fmt(substreams): update auto generated files (#150)
Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -4,96 +4,6 @@
|
|||||||
pub mod functions {
|
pub mod functions {
|
||||||
use super::INTERNAL_ERR;
|
use super::INTERNAL_ERR;
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
pub struct DomainSeparator {}
|
|
||||||
impl DomainSeparator {
|
|
||||||
const METHOD_ID: [u8; 4] = [54u8, 68u8, 229u8, 21u8];
|
|
||||||
pub fn decode(
|
|
||||||
call: &substreams_ethereum::pb::eth::v2::Call,
|
|
||||||
) -> Result<Self, String> {
|
|
||||||
Ok(Self {})
|
|
||||||
}
|
|
||||||
pub fn encode(&self) -> Vec<u8> {
|
|
||||||
let data = ethabi::encode(&[]);
|
|
||||||
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<[u8; 32usize], String> {
|
|
||||||
Self::output(call.return_data.as_ref())
|
|
||||||
}
|
|
||||||
pub fn output(data: &[u8]) -> Result<[u8; 32usize], String> {
|
|
||||||
let mut values = ethabi::decode(
|
|
||||||
&[ethabi::ParamType::FixedBytes(32usize)],
|
|
||||||
data.as_ref(),
|
|
||||||
)
|
|
||||||
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
|
||||||
Ok({
|
|
||||||
let mut result = [0u8; 32];
|
|
||||||
let v = values
|
|
||||||
.pop()
|
|
||||||
.expect("one output data should have existed")
|
|
||||||
.into_fixed_bytes()
|
|
||||||
.expect(INTERNAL_ERR);
|
|
||||||
result.copy_from_slice(&v);
|
|
||||||
result
|
|
||||||
})
|
|
||||||
}
|
|
||||||
pub fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool {
|
|
||||||
match call.input.get(0..4) {
|
|
||||||
Some(signature) => Self::METHOD_ID == signature,
|
|
||||||
None => false,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pub fn call(&self, address: Vec<u8>) -> Option<[u8; 32usize]> {
|
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
|
||||||
let rpc_calls = rpc::RpcCalls {
|
|
||||||
calls: vec![
|
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
|
||||||
let response = responses
|
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
match Self::output(response.raw.as_ref()) {
|
|
||||||
Ok(data) => Some(data),
|
|
||||||
Err(err) => {
|
|
||||||
use substreams_ethereum::Function;
|
|
||||||
substreams::log::info!(
|
|
||||||
"Call output for function `{}` failed to decode with error: {}",
|
|
||||||
Self::NAME, err
|
|
||||||
);
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl substreams_ethereum::Function for DomainSeparator {
|
|
||||||
const NAME: &'static str = "DOMAIN_SEPARATOR";
|
|
||||||
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> {
|
|
||||||
Self::decode(call)
|
|
||||||
}
|
|
||||||
fn encode(&self) -> Vec<u8> {
|
|
||||||
self.encode()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl substreams_ethereum::rpc::RPCDecodable<[u8; 32usize]> for DomainSeparator {
|
|
||||||
fn output(data: &[u8]) -> Result<[u8; 32usize], String> {
|
|
||||||
Self::output(data)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
|
||||||
pub struct Allowance {
|
pub struct Allowance {
|
||||||
pub param0: Vec<u8>,
|
pub param0: Vec<u8>,
|
||||||
pub param1: Vec<u8>,
|
pub param1: Vec<u8>,
|
||||||
@@ -133,9 +43,7 @@
|
|||||||
pub fn encode(&self) -> Vec<u8> {
|
pub fn encode(&self) -> Vec<u8> {
|
||||||
let data = ethabi::encode(
|
let data = ethabi::encode(
|
||||||
&[
|
&[
|
||||||
ethabi::Token::Address(
|
ethabi::Token::Address(ethabi::Address::from_slice(&self.param0)),
|
||||||
ethabi::Address::from_slice(&self.param0),
|
|
||||||
),
|
|
||||||
ethabi::Token::Address(ethabi::Address::from_slice(&self.param1)),
|
ethabi::Token::Address(ethabi::Address::from_slice(&self.param1)),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@@ -175,14 +83,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -262,9 +166,7 @@
|
|||||||
pub fn encode(&self) -> Vec<u8> {
|
pub fn encode(&self) -> Vec<u8> {
|
||||||
let data = ethabi::encode(
|
let data = ethabi::encode(
|
||||||
&[
|
&[
|
||||||
ethabi::Token::Address(
|
ethabi::Token::Address(ethabi::Address::from_slice(&self.spender)),
|
||||||
ethabi::Address::from_slice(&self.spender),
|
|
||||||
),
|
|
||||||
ethabi::Token::Uint(
|
ethabi::Token::Uint(
|
||||||
ethabi::Uint::from_big_endian(
|
ethabi::Uint::from_big_endian(
|
||||||
match self.amount.clone().to_bytes_be() {
|
match self.amount.clone().to_bytes_be() {
|
||||||
@@ -290,10 +192,7 @@
|
|||||||
Self::output(call.return_data.as_ref())
|
Self::output(call.return_data.as_ref())
|
||||||
}
|
}
|
||||||
pub fn output(data: &[u8]) -> Result<bool, String> {
|
pub fn output(data: &[u8]) -> Result<bool, String> {
|
||||||
let mut values = ethabi::decode(
|
let mut values = ethabi::decode(&[ethabi::ParamType::Bool], data.as_ref())
|
||||||
&[ethabi::ParamType::Bool],
|
|
||||||
data.as_ref(),
|
|
||||||
)
|
|
||||||
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
||||||
Ok(
|
Ok(
|
||||||
values
|
values
|
||||||
@@ -312,14 +211,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<bool> {
|
pub fn call(&self, address: Vec<u8>) -> Option<bool> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -377,10 +272,7 @@
|
|||||||
Self::output(call.return_data.as_ref())
|
Self::output(call.return_data.as_ref())
|
||||||
}
|
}
|
||||||
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
|
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
|
||||||
let mut values = ethabi::decode(
|
let mut values = ethabi::decode(&[ethabi::ParamType::Address], data.as_ref())
|
||||||
&[ethabi::ParamType::Address],
|
|
||||||
data.as_ref(),
|
|
||||||
)
|
|
||||||
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
||||||
Ok(
|
Ok(
|
||||||
values
|
values
|
||||||
@@ -401,14 +293,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<Vec<u8>> {
|
pub fn call(&self, address: Vec<u8>) -> Option<Vec<u8>> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -513,14 +401,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -642,14 +526,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -771,14 +651,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -862,14 +738,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -961,9 +833,7 @@
|
|||||||
.as_slice(),
|
.as_slice(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
ethabi::Token::Address(
|
ethabi::Token::Address(ethabi::Address::from_slice(&self.receiver)),
|
||||||
ethabi::Address::from_slice(&self.receiver),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
let mut encoded = Vec::with_capacity(4 + data.len());
|
let mut encoded = Vec::with_capacity(4 + data.len());
|
||||||
@@ -1002,14 +872,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -1040,8 +906,7 @@
|
|||||||
self.encode()
|
self.encode()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl substreams_ethereum::rpc::RPCDecodable<substreams::scalar::BigInt>
|
impl substreams_ethereum::rpc::RPCDecodable<substreams::scalar::BigInt> for Deposit {
|
||||||
for Deposit {
|
|
||||||
fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
|
fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
|
||||||
Self::output(data)
|
Self::output(data)
|
||||||
}
|
}
|
||||||
@@ -1159,9 +1024,7 @@
|
|||||||
.as_slice(),
|
.as_slice(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
ethabi::Token::Address(
|
ethabi::Token::Address(ethabi::Address::from_slice(&self.receiver)),
|
||||||
ethabi::Address::from_slice(&self.receiver),
|
|
||||||
),
|
|
||||||
ethabi::Token::Uint(
|
ethabi::Token::Uint(
|
||||||
ethabi::Uint::from_big_endian(
|
ethabi::Uint::from_big_endian(
|
||||||
match self.deadline.clone().to_bytes_be() {
|
match self.deadline.clone().to_bytes_be() {
|
||||||
@@ -1227,14 +1090,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -1272,6 +1131,92 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
|
pub struct DomainSeparator {}
|
||||||
|
impl DomainSeparator {
|
||||||
|
const METHOD_ID: [u8; 4] = [54u8, 68u8, 229u8, 21u8];
|
||||||
|
pub fn decode(
|
||||||
|
call: &substreams_ethereum::pb::eth::v2::Call,
|
||||||
|
) -> Result<Self, String> {
|
||||||
|
Ok(Self {})
|
||||||
|
}
|
||||||
|
pub fn encode(&self) -> Vec<u8> {
|
||||||
|
let data = ethabi::encode(&[]);
|
||||||
|
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<[u8; 32usize], String> {
|
||||||
|
Self::output(call.return_data.as_ref())
|
||||||
|
}
|
||||||
|
pub fn output(data: &[u8]) -> Result<[u8; 32usize], String> {
|
||||||
|
let mut values = ethabi::decode(
|
||||||
|
&[ethabi::ParamType::FixedBytes(32usize)],
|
||||||
|
data.as_ref(),
|
||||||
|
)
|
||||||
|
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
||||||
|
Ok({
|
||||||
|
let mut result = [0u8; 32];
|
||||||
|
let v = values
|
||||||
|
.pop()
|
||||||
|
.expect("one output data should have existed")
|
||||||
|
.into_fixed_bytes()
|
||||||
|
.expect(INTERNAL_ERR);
|
||||||
|
result.copy_from_slice(&v);
|
||||||
|
result
|
||||||
|
})
|
||||||
|
}
|
||||||
|
pub fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool {
|
||||||
|
match call.input.get(0..4) {
|
||||||
|
Some(signature) => Self::METHOD_ID == signature,
|
||||||
|
None => false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pub fn call(&self, address: Vec<u8>) -> Option<[u8; 32usize]> {
|
||||||
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
|
let rpc_calls = rpc::RpcCalls {
|
||||||
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
|
};
|
||||||
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
|
if response.failed {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
match Self::output(response.raw.as_ref()) {
|
||||||
|
Ok(data) => Some(data),
|
||||||
|
Err(err) => {
|
||||||
|
use substreams_ethereum::Function;
|
||||||
|
substreams::log::info!(
|
||||||
|
"Call output for function `{}` failed to decode with error: {}",
|
||||||
|
Self::NAME, err
|
||||||
|
);
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl substreams_ethereum::Function for DomainSeparator {
|
||||||
|
const NAME: &'static str = "DOMAIN_SEPARATOR";
|
||||||
|
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> {
|
||||||
|
Self::decode(call)
|
||||||
|
}
|
||||||
|
fn encode(&self) -> Vec<u8> {
|
||||||
|
self.encode()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl substreams_ethereum::rpc::RPCDecodable<[u8; 32usize]> for DomainSeparator {
|
||||||
|
fn output(data: &[u8]) -> Result<[u8; 32usize], String> {
|
||||||
|
Self::output(data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
pub struct LastRewardAmount {}
|
pub struct LastRewardAmount {}
|
||||||
impl LastRewardAmount {
|
impl LastRewardAmount {
|
||||||
const METHOD_ID: [u8; 4] = [186u8, 254u8, 220u8, 170u8];
|
const METHOD_ID: [u8; 4] = [186u8, 254u8, 220u8, 170u8];
|
||||||
@@ -1318,14 +1263,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -1409,14 +1350,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -1522,14 +1459,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -1635,14 +1568,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -1673,8 +1602,7 @@
|
|||||||
self.encode()
|
self.encode()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl substreams_ethereum::rpc::RPCDecodable<substreams::scalar::BigInt>
|
impl substreams_ethereum::rpc::RPCDecodable<substreams::scalar::BigInt> for MaxMint {
|
||||||
for MaxMint {
|
|
||||||
fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
|
fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
|
||||||
Self::output(data)
|
Self::output(data)
|
||||||
}
|
}
|
||||||
@@ -1748,14 +1676,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -1861,14 +1785,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -1960,9 +1880,7 @@
|
|||||||
.as_slice(),
|
.as_slice(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
ethabi::Token::Address(
|
ethabi::Token::Address(ethabi::Address::from_slice(&self.receiver)),
|
||||||
ethabi::Address::from_slice(&self.receiver),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
let mut encoded = Vec::with_capacity(4 + data.len());
|
let mut encoded = Vec::with_capacity(4 + data.len());
|
||||||
@@ -2001,14 +1919,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -2039,8 +1953,7 @@
|
|||||||
self.encode()
|
self.encode()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl substreams_ethereum::rpc::RPCDecodable<substreams::scalar::BigInt>
|
impl substreams_ethereum::rpc::RPCDecodable<substreams::scalar::BigInt> for Mint {
|
||||||
for Mint {
|
|
||||||
fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
|
fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
|
||||||
Self::output(data)
|
Self::output(data)
|
||||||
}
|
}
|
||||||
@@ -2067,10 +1980,7 @@
|
|||||||
Self::output(call.return_data.as_ref())
|
Self::output(call.return_data.as_ref())
|
||||||
}
|
}
|
||||||
pub fn output(data: &[u8]) -> Result<String, String> {
|
pub fn output(data: &[u8]) -> Result<String, String> {
|
||||||
let mut values = ethabi::decode(
|
let mut values = ethabi::decode(&[ethabi::ParamType::String], data.as_ref())
|
||||||
&[ethabi::ParamType::String],
|
|
||||||
data.as_ref(),
|
|
||||||
)
|
|
||||||
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
||||||
Ok(
|
Ok(
|
||||||
values
|
values
|
||||||
@@ -2089,14 +1999,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<String> {
|
pub fn call(&self, address: Vec<u8>) -> Option<String> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -2201,14 +2107,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -2239,8 +2141,7 @@
|
|||||||
self.encode()
|
self.encode()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl substreams_ethereum::rpc::RPCDecodable<substreams::scalar::BigInt>
|
impl substreams_ethereum::rpc::RPCDecodable<substreams::scalar::BigInt> for Nonces {
|
||||||
for Nonces {
|
|
||||||
fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
|
fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
|
||||||
Self::output(data)
|
Self::output(data)
|
||||||
}
|
}
|
||||||
@@ -2349,9 +2250,7 @@
|
|||||||
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.owner)),
|
||||||
ethabi::Token::Address(
|
ethabi::Token::Address(ethabi::Address::from_slice(&self.spender)),
|
||||||
ethabi::Address::from_slice(&self.spender),
|
|
||||||
),
|
|
||||||
ethabi::Token::Uint(
|
ethabi::Token::Uint(
|
||||||
ethabi::Uint::from_big_endian(
|
ethabi::Uint::from_big_endian(
|
||||||
match self.value.clone().to_bytes_be() {
|
match self.value.clone().to_bytes_be() {
|
||||||
@@ -2503,14 +2402,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -2632,14 +2527,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -2761,14 +2652,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -2890,14 +2777,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -2981,14 +2864,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -3092,9 +2971,7 @@
|
|||||||
.as_slice(),
|
.as_slice(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
ethabi::Token::Address(
|
ethabi::Token::Address(ethabi::Address::from_slice(&self.receiver)),
|
||||||
ethabi::Address::from_slice(&self.receiver),
|
|
||||||
),
|
|
||||||
ethabi::Token::Address(ethabi::Address::from_slice(&self.owner)),
|
ethabi::Token::Address(ethabi::Address::from_slice(&self.owner)),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@@ -3134,14 +3011,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -3172,8 +3045,7 @@
|
|||||||
self.encode()
|
self.encode()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl substreams_ethereum::rpc::RPCDecodable<substreams::scalar::BigInt>
|
impl substreams_ethereum::rpc::RPCDecodable<substreams::scalar::BigInt> for Redeem {
|
||||||
for Redeem {
|
|
||||||
fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
|
fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
|
||||||
Self::output(data)
|
Self::output(data)
|
||||||
}
|
}
|
||||||
@@ -3225,14 +3097,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -3316,14 +3184,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -3382,10 +3246,7 @@
|
|||||||
Self::output(call.return_data.as_ref())
|
Self::output(call.return_data.as_ref())
|
||||||
}
|
}
|
||||||
pub fn output(data: &[u8]) -> Result<String, String> {
|
pub fn output(data: &[u8]) -> Result<String, String> {
|
||||||
let mut values = ethabi::decode(
|
let mut values = ethabi::decode(&[ethabi::ParamType::String], data.as_ref())
|
||||||
&[ethabi::ParamType::String],
|
|
||||||
data.as_ref(),
|
|
||||||
)
|
|
||||||
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
||||||
Ok(
|
Ok(
|
||||||
values
|
values
|
||||||
@@ -3404,14 +3265,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<String> {
|
pub fn call(&self, address: Vec<u8>) -> Option<String> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -3531,14 +3388,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -3622,14 +3475,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -3735,10 +3584,7 @@
|
|||||||
Self::output(call.return_data.as_ref())
|
Self::output(call.return_data.as_ref())
|
||||||
}
|
}
|
||||||
pub fn output(data: &[u8]) -> Result<bool, String> {
|
pub fn output(data: &[u8]) -> Result<bool, String> {
|
||||||
let mut values = ethabi::decode(
|
let mut values = ethabi::decode(&[ethabi::ParamType::Bool], data.as_ref())
|
||||||
&[ethabi::ParamType::Bool],
|
|
||||||
data.as_ref(),
|
|
||||||
)
|
|
||||||
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
||||||
Ok(
|
Ok(
|
||||||
values
|
values
|
||||||
@@ -3757,14 +3603,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<bool> {
|
pub fn call(&self, address: Vec<u8>) -> Option<bool> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -3882,10 +3724,7 @@
|
|||||||
Self::output(call.return_data.as_ref())
|
Self::output(call.return_data.as_ref())
|
||||||
}
|
}
|
||||||
pub fn output(data: &[u8]) -> Result<bool, String> {
|
pub fn output(data: &[u8]) -> Result<bool, String> {
|
||||||
let mut values = ethabi::decode(
|
let mut values = ethabi::decode(&[ethabi::ParamType::Bool], data.as_ref())
|
||||||
&[ethabi::ParamType::Bool],
|
|
||||||
data.as_ref(),
|
|
||||||
)
|
|
||||||
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
||||||
Ok(
|
Ok(
|
||||||
values
|
values
|
||||||
@@ -3904,14 +3743,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<bool> {
|
pub fn call(&self, address: Vec<u8>) -> Option<bool> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -4014,9 +3849,7 @@
|
|||||||
.as_slice(),
|
.as_slice(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
ethabi::Token::Address(
|
ethabi::Token::Address(ethabi::Address::from_slice(&self.receiver)),
|
||||||
ethabi::Address::from_slice(&self.receiver),
|
|
||||||
),
|
|
||||||
ethabi::Token::Address(ethabi::Address::from_slice(&self.owner)),
|
ethabi::Token::Address(ethabi::Address::from_slice(&self.owner)),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@@ -4056,14 +3889,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -4216,9 +4045,7 @@
|
|||||||
fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
|
fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
|
||||||
Self::match_log(log)
|
Self::match_log(log)
|
||||||
}
|
}
|
||||||
fn decode(
|
fn decode(log: &substreams_ethereum::pb::eth::v2::Log) -> Result<Self, String> {
|
||||||
log: &substreams_ethereum::pb::eth::v2::Log,
|
|
||||||
) -> Result<Self, String> {
|
|
||||||
Self::decode(log)
|
Self::decode(log)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4347,9 +4174,7 @@
|
|||||||
fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
|
fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
|
||||||
Self::match_log(log)
|
Self::match_log(log)
|
||||||
}
|
}
|
||||||
fn decode(
|
fn decode(log: &substreams_ethereum::pb::eth::v2::Log) -> Result<Self, String> {
|
||||||
log: &substreams_ethereum::pb::eth::v2::Log,
|
|
||||||
) -> Result<Self, String> {
|
|
||||||
Self::decode(log)
|
Self::decode(log)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4450,9 +4275,7 @@
|
|||||||
fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
|
fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
|
||||||
Self::match_log(log)
|
Self::match_log(log)
|
||||||
}
|
}
|
||||||
fn decode(
|
fn decode(log: &substreams_ethereum::pb::eth::v2::Log) -> Result<Self, String> {
|
||||||
log: &substreams_ethereum::pb::eth::v2::Log,
|
|
||||||
) -> Result<Self, String> {
|
|
||||||
Self::decode(log)
|
Self::decode(log)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4567,9 +4390,7 @@
|
|||||||
fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
|
fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
|
||||||
Self::match_log(log)
|
Self::match_log(log)
|
||||||
}
|
}
|
||||||
fn decode(
|
fn decode(log: &substreams_ethereum::pb::eth::v2::Log) -> Result<Self, String> {
|
||||||
log: &substreams_ethereum::pb::eth::v2::Log,
|
|
||||||
) -> Result<Self, String> {
|
|
||||||
Self::decode(log)
|
Self::decode(log)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4715,9 +4536,7 @@
|
|||||||
fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
|
fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
|
||||||
Self::match_log(log)
|
Self::match_log(log)
|
||||||
}
|
}
|
||||||
fn decode(
|
fn decode(log: &substreams_ethereum::pb::eth::v2::Log) -> Result<Self, String> {
|
||||||
log: &substreams_ethereum::pb::eth::v2::Log,
|
|
||||||
) -> Result<Self, String> {
|
|
||||||
Self::decode(log)
|
Self::decode(log)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,10 +63,7 @@
|
|||||||
Self::output(call.return_data.as_ref())
|
Self::output(call.return_data.as_ref())
|
||||||
}
|
}
|
||||||
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
|
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
|
||||||
let mut values = ethabi::decode(
|
let mut values = ethabi::decode(&[ethabi::ParamType::Address], data.as_ref())
|
||||||
&[ethabi::ParamType::Address],
|
|
||||||
data.as_ref(),
|
|
||||||
)
|
|
||||||
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
||||||
Ok(
|
Ok(
|
||||||
values
|
values
|
||||||
@@ -87,14 +84,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<Vec<u8>> {
|
pub fn call(&self, address: Vec<u8>) -> Option<Vec<u8>> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -177,14 +170,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -261,12 +250,8 @@
|
|||||||
pub fn encode(&self) -> Vec<u8> {
|
pub fn encode(&self) -> Vec<u8> {
|
||||||
let data = ethabi::encode(
|
let data = ethabi::encode(
|
||||||
&[
|
&[
|
||||||
ethabi::Token::Address(
|
ethabi::Token::Address(ethabi::Address::from_slice(&self.token_a)),
|
||||||
ethabi::Address::from_slice(&self.token_a),
|
ethabi::Token::Address(ethabi::Address::from_slice(&self.token_b)),
|
||||||
),
|
|
||||||
ethabi::Token::Address(
|
|
||||||
ethabi::Address::from_slice(&self.token_b),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
let mut encoded = Vec::with_capacity(4 + data.len());
|
let mut encoded = Vec::with_capacity(4 + data.len());
|
||||||
@@ -280,10 +265,7 @@
|
|||||||
Self::output(call.return_data.as_ref())
|
Self::output(call.return_data.as_ref())
|
||||||
}
|
}
|
||||||
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
|
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
|
||||||
let mut values = ethabi::decode(
|
let mut values = ethabi::decode(&[ethabi::ParamType::Address], data.as_ref())
|
||||||
&[ethabi::ParamType::Address],
|
|
||||||
data.as_ref(),
|
|
||||||
)
|
|
||||||
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
||||||
Ok(
|
Ok(
|
||||||
values
|
values
|
||||||
@@ -304,14 +286,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<Vec<u8>> {
|
pub fn call(&self, address: Vec<u8>) -> Option<Vec<u8>> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -369,10 +347,7 @@
|
|||||||
Self::output(call.return_data.as_ref())
|
Self::output(call.return_data.as_ref())
|
||||||
}
|
}
|
||||||
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
|
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
|
||||||
let mut values = ethabi::decode(
|
let mut values = ethabi::decode(&[ethabi::ParamType::Address], data.as_ref())
|
||||||
&[ethabi::ParamType::Address],
|
|
||||||
data.as_ref(),
|
|
||||||
)
|
|
||||||
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
||||||
Ok(
|
Ok(
|
||||||
values
|
values
|
||||||
@@ -393,14 +368,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<Vec<u8>> {
|
pub fn call(&self, address: Vec<u8>) -> Option<Vec<u8>> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -458,10 +429,7 @@
|
|||||||
Self::output(call.return_data.as_ref())
|
Self::output(call.return_data.as_ref())
|
||||||
}
|
}
|
||||||
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
|
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
|
||||||
let mut values = ethabi::decode(
|
let mut values = ethabi::decode(&[ethabi::ParamType::Address], data.as_ref())
|
||||||
&[ethabi::ParamType::Address],
|
|
||||||
data.as_ref(),
|
|
||||||
)
|
|
||||||
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
||||||
Ok(
|
Ok(
|
||||||
values
|
values
|
||||||
@@ -482,14 +450,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<Vec<u8>> {
|
pub fn call(&self, address: Vec<u8>) -> Option<Vec<u8>> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -565,9 +529,7 @@
|
|||||||
pub fn encode(&self) -> Vec<u8> {
|
pub fn encode(&self) -> Vec<u8> {
|
||||||
let data = ethabi::encode(
|
let data = ethabi::encode(
|
||||||
&[
|
&[
|
||||||
ethabi::Token::Address(
|
ethabi::Token::Address(ethabi::Address::from_slice(&self.param0)),
|
||||||
ethabi::Address::from_slice(&self.param0),
|
|
||||||
),
|
|
||||||
ethabi::Token::Address(ethabi::Address::from_slice(&self.param1)),
|
ethabi::Token::Address(ethabi::Address::from_slice(&self.param1)),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@@ -582,10 +544,7 @@
|
|||||||
Self::output(call.return_data.as_ref())
|
Self::output(call.return_data.as_ref())
|
||||||
}
|
}
|
||||||
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
|
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
|
||||||
let mut values = ethabi::decode(
|
let mut values = ethabi::decode(&[ethabi::ParamType::Address], data.as_ref())
|
||||||
&[ethabi::ParamType::Address],
|
|
||||||
data.as_ref(),
|
|
||||||
)
|
|
||||||
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
||||||
Ok(
|
Ok(
|
||||||
values
|
values
|
||||||
@@ -606,14 +565,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<Vec<u8>> {
|
pub fn call(&self, address: Vec<u8>) -> Option<Vec<u8>> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -895,9 +850,7 @@
|
|||||||
fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
|
fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
|
||||||
Self::match_log(log)
|
Self::match_log(log)
|
||||||
}
|
}
|
||||||
fn decode(
|
fn decode(log: &substreams_ethereum::pb::eth::v2::Log) -> Result<Self, String> {
|
||||||
log: &substreams_ethereum::pb::eth::v2::Log,
|
|
||||||
) -> Result<Self, String> {
|
|
||||||
Self::decode(log)
|
Self::decode(log)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -58,12 +58,8 @@
|
|||||||
pub fn encode(&self) -> Vec<u8> {
|
pub fn encode(&self) -> Vec<u8> {
|
||||||
let data = ethabi::encode(
|
let data = ethabi::encode(
|
||||||
&[
|
&[
|
||||||
ethabi::Token::Address(
|
ethabi::Token::Address(ethabi::Address::from_slice(&self.token_a)),
|
||||||
ethabi::Address::from_slice(&self.token_a),
|
ethabi::Token::Address(ethabi::Address::from_slice(&self.token_b)),
|
||||||
),
|
|
||||||
ethabi::Token::Address(
|
|
||||||
ethabi::Address::from_slice(&self.token_b),
|
|
||||||
),
|
|
||||||
ethabi::Token::Uint(
|
ethabi::Token::Uint(
|
||||||
ethabi::Uint::from_big_endian(
|
ethabi::Uint::from_big_endian(
|
||||||
match self.fee.clone().to_bytes_be() {
|
match self.fee.clone().to_bytes_be() {
|
||||||
@@ -89,10 +85,7 @@
|
|||||||
Self::output(call.return_data.as_ref())
|
Self::output(call.return_data.as_ref())
|
||||||
}
|
}
|
||||||
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
|
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
|
||||||
let mut values = ethabi::decode(
|
let mut values = ethabi::decode(&[ethabi::ParamType::Address], data.as_ref())
|
||||||
&[ethabi::ParamType::Address],
|
|
||||||
data.as_ref(),
|
|
||||||
)
|
|
||||||
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
||||||
Ok(
|
Ok(
|
||||||
values
|
values
|
||||||
@@ -113,14 +106,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<Vec<u8>> {
|
pub fn call(&self, address: Vec<u8>) -> Option<Vec<u8>> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -171,10 +160,7 @@
|
|||||||
return Err("no data to decode".to_string());
|
return Err("no data to decode".to_string());
|
||||||
}
|
}
|
||||||
let mut values = ethabi::decode(
|
let mut values = ethabi::decode(
|
||||||
&[
|
&[ethabi::ParamType::Uint(24usize), ethabi::ParamType::Int(24usize)],
|
||||||
ethabi::ParamType::Uint(24usize),
|
|
||||||
ethabi::ParamType::Int(24usize),
|
|
||||||
],
|
|
||||||
maybe_data.unwrap(),
|
maybe_data.unwrap(),
|
||||||
)
|
)
|
||||||
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
|
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
|
||||||
@@ -221,15 +207,14 @@
|
|||||||
let non_full_signed_bytes = self
|
let non_full_signed_bytes = self
|
||||||
.tick_spacing
|
.tick_spacing
|
||||||
.to_signed_bytes_be();
|
.to_signed_bytes_be();
|
||||||
let full_signed_bytes_init = if non_full_signed_bytes[0]
|
let full_signed_bytes_init = if non_full_signed_bytes[0] & 0x80
|
||||||
& 0x80 == 0x80
|
== 0x80
|
||||||
{
|
{
|
||||||
0xff
|
0xff
|
||||||
} else {
|
} else {
|
||||||
0x00
|
0x00
|
||||||
};
|
};
|
||||||
let mut full_signed_bytes = [full_signed_bytes_init
|
let mut full_signed_bytes = [full_signed_bytes_init as u8; 32];
|
||||||
as u8; 32];
|
|
||||||
non_full_signed_bytes
|
non_full_signed_bytes
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.rev()
|
.rev()
|
||||||
@@ -352,14 +337,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -451,12 +432,8 @@
|
|||||||
pub fn encode(&self) -> Vec<u8> {
|
pub fn encode(&self) -> Vec<u8> {
|
||||||
let data = ethabi::encode(
|
let data = ethabi::encode(
|
||||||
&[
|
&[
|
||||||
ethabi::Token::Address(
|
ethabi::Token::Address(ethabi::Address::from_slice(&self.token_a)),
|
||||||
ethabi::Address::from_slice(&self.token_a),
|
ethabi::Token::Address(ethabi::Address::from_slice(&self.token_b)),
|
||||||
),
|
|
||||||
ethabi::Token::Address(
|
|
||||||
ethabi::Address::from_slice(&self.token_b),
|
|
||||||
),
|
|
||||||
ethabi::Token::Uint(
|
ethabi::Token::Uint(
|
||||||
ethabi::Uint::from_big_endian(
|
ethabi::Uint::from_big_endian(
|
||||||
match self.fee.clone().to_bytes_be() {
|
match self.fee.clone().to_bytes_be() {
|
||||||
@@ -482,10 +459,7 @@
|
|||||||
Self::output(call.return_data.as_ref())
|
Self::output(call.return_data.as_ref())
|
||||||
}
|
}
|
||||||
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
|
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
|
||||||
let mut values = ethabi::decode(
|
let mut values = ethabi::decode(&[ethabi::ParamType::Address], data.as_ref())
|
||||||
&[ethabi::ParamType::Address],
|
|
||||||
data.as_ref(),
|
|
||||||
)
|
|
||||||
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
||||||
Ok(
|
Ok(
|
||||||
values
|
values
|
||||||
@@ -506,14 +480,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<Vec<u8>> {
|
pub fn call(&self, address: Vec<u8>) -> Option<Vec<u8>> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -571,10 +541,7 @@
|
|||||||
Self::output(call.return_data.as_ref())
|
Self::output(call.return_data.as_ref())
|
||||||
}
|
}
|
||||||
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
|
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
|
||||||
let mut values = ethabi::decode(
|
let mut values = ethabi::decode(&[ethabi::ParamType::Address], data.as_ref())
|
||||||
&[ethabi::ParamType::Address],
|
|
||||||
data.as_ref(),
|
|
||||||
)
|
|
||||||
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
||||||
Ok(
|
Ok(
|
||||||
values
|
values
|
||||||
@@ -595,14 +562,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<Vec<u8>> {
|
pub fn call(&self, address: Vec<u8>) -> Option<Vec<u8>> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -786,9 +749,7 @@
|
|||||||
fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
|
fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
|
||||||
Self::match_log(log)
|
Self::match_log(log)
|
||||||
}
|
}
|
||||||
fn decode(
|
fn decode(log: &substreams_ethereum::pb::eth::v2::Log) -> Result<Self, String> {
|
||||||
log: &substreams_ethereum::pb::eth::v2::Log,
|
|
||||||
) -> Result<Self, String> {
|
|
||||||
Self::decode(log)
|
Self::decode(log)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -886,9 +847,7 @@
|
|||||||
fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
|
fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
|
||||||
Self::match_log(log)
|
Self::match_log(log)
|
||||||
}
|
}
|
||||||
fn decode(
|
fn decode(log: &substreams_ethereum::pb::eth::v2::Log) -> Result<Self, String> {
|
||||||
log: &substreams_ethereum::pb::eth::v2::Log,
|
|
||||||
) -> Result<Self, String> {
|
|
||||||
Self::decode(log)
|
Self::decode(log)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1031,9 +990,7 @@
|
|||||||
fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
|
fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
|
||||||
Self::match_log(log)
|
Self::match_log(log)
|
||||||
}
|
}
|
||||||
fn decode(
|
fn decode(log: &substreams_ethereum::pb::eth::v2::Log) -> Result<Self, String> {
|
||||||
log: &substreams_ethereum::pb::eth::v2::Log,
|
|
||||||
) -> Result<Self, String> {
|
|
||||||
Self::decode(log)
|
Self::decode(log)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -58,12 +58,8 @@
|
|||||||
pub fn encode(&self) -> Vec<u8> {
|
pub fn encode(&self) -> Vec<u8> {
|
||||||
let data = ethabi::encode(
|
let data = ethabi::encode(
|
||||||
&[
|
&[
|
||||||
ethabi::Token::Address(
|
ethabi::Token::Address(ethabi::Address::from_slice(&self.token_a)),
|
||||||
ethabi::Address::from_slice(&self.token_a),
|
ethabi::Token::Address(ethabi::Address::from_slice(&self.token_b)),
|
||||||
),
|
|
||||||
ethabi::Token::Address(
|
|
||||||
ethabi::Address::from_slice(&self.token_b),
|
|
||||||
),
|
|
||||||
ethabi::Token::Uint(
|
ethabi::Token::Uint(
|
||||||
ethabi::Uint::from_big_endian(
|
ethabi::Uint::from_big_endian(
|
||||||
match self.fee.clone().to_bytes_be() {
|
match self.fee.clone().to_bytes_be() {
|
||||||
@@ -89,10 +85,7 @@
|
|||||||
Self::output(call.return_data.as_ref())
|
Self::output(call.return_data.as_ref())
|
||||||
}
|
}
|
||||||
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
|
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
|
||||||
let mut values = ethabi::decode(
|
let mut values = ethabi::decode(&[ethabi::ParamType::Address], data.as_ref())
|
||||||
&[ethabi::ParamType::Address],
|
|
||||||
data.as_ref(),
|
|
||||||
)
|
|
||||||
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
||||||
Ok(
|
Ok(
|
||||||
values
|
values
|
||||||
@@ -113,14 +106,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<Vec<u8>> {
|
pub fn call(&self, address: Vec<u8>) -> Option<Vec<u8>> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -171,10 +160,7 @@
|
|||||||
return Err("no data to decode".to_string());
|
return Err("no data to decode".to_string());
|
||||||
}
|
}
|
||||||
let mut values = ethabi::decode(
|
let mut values = ethabi::decode(
|
||||||
&[
|
&[ethabi::ParamType::Uint(24usize), ethabi::ParamType::Int(24usize)],
|
||||||
ethabi::ParamType::Uint(24usize),
|
|
||||||
ethabi::ParamType::Int(24usize),
|
|
||||||
],
|
|
||||||
maybe_data.unwrap(),
|
maybe_data.unwrap(),
|
||||||
)
|
)
|
||||||
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
|
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
|
||||||
@@ -221,15 +207,14 @@
|
|||||||
let non_full_signed_bytes = self
|
let non_full_signed_bytes = self
|
||||||
.tick_spacing
|
.tick_spacing
|
||||||
.to_signed_bytes_be();
|
.to_signed_bytes_be();
|
||||||
let full_signed_bytes_init = if non_full_signed_bytes[0]
|
let full_signed_bytes_init = if non_full_signed_bytes[0] & 0x80
|
||||||
& 0x80 == 0x80
|
== 0x80
|
||||||
{
|
{
|
||||||
0xff
|
0xff
|
||||||
} else {
|
} else {
|
||||||
0x00
|
0x00
|
||||||
};
|
};
|
||||||
let mut full_signed_bytes = [full_signed_bytes_init
|
let mut full_signed_bytes = [full_signed_bytes_init as u8; 32];
|
||||||
as u8; 32];
|
|
||||||
non_full_signed_bytes
|
non_full_signed_bytes
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.rev()
|
.rev()
|
||||||
@@ -352,14 +337,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -451,12 +432,8 @@
|
|||||||
pub fn encode(&self) -> Vec<u8> {
|
pub fn encode(&self) -> Vec<u8> {
|
||||||
let data = ethabi::encode(
|
let data = ethabi::encode(
|
||||||
&[
|
&[
|
||||||
ethabi::Token::Address(
|
ethabi::Token::Address(ethabi::Address::from_slice(&self.token_a)),
|
||||||
ethabi::Address::from_slice(&self.token_a),
|
ethabi::Token::Address(ethabi::Address::from_slice(&self.token_b)),
|
||||||
),
|
|
||||||
ethabi::Token::Address(
|
|
||||||
ethabi::Address::from_slice(&self.token_b),
|
|
||||||
),
|
|
||||||
ethabi::Token::Uint(
|
ethabi::Token::Uint(
|
||||||
ethabi::Uint::from_big_endian(
|
ethabi::Uint::from_big_endian(
|
||||||
match self.fee.clone().to_bytes_be() {
|
match self.fee.clone().to_bytes_be() {
|
||||||
@@ -482,10 +459,7 @@
|
|||||||
Self::output(call.return_data.as_ref())
|
Self::output(call.return_data.as_ref())
|
||||||
}
|
}
|
||||||
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
|
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
|
||||||
let mut values = ethabi::decode(
|
let mut values = ethabi::decode(&[ethabi::ParamType::Address], data.as_ref())
|
||||||
&[ethabi::ParamType::Address],
|
|
||||||
data.as_ref(),
|
|
||||||
)
|
|
||||||
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
||||||
Ok(
|
Ok(
|
||||||
values
|
values
|
||||||
@@ -506,14 +480,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<Vec<u8>> {
|
pub fn call(&self, address: Vec<u8>) -> Option<Vec<u8>> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -571,10 +541,7 @@
|
|||||||
Self::output(call.return_data.as_ref())
|
Self::output(call.return_data.as_ref())
|
||||||
}
|
}
|
||||||
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
|
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
|
||||||
let mut values = ethabi::decode(
|
let mut values = ethabi::decode(&[ethabi::ParamType::Address], data.as_ref())
|
||||||
&[ethabi::ParamType::Address],
|
|
||||||
data.as_ref(),
|
|
||||||
)
|
|
||||||
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
||||||
Ok(
|
Ok(
|
||||||
values
|
values
|
||||||
@@ -595,14 +562,10 @@
|
|||||||
pub fn call(&self, address: Vec<u8>) -> Option<Vec<u8>> {
|
pub fn call(&self, address: Vec<u8>) -> Option<Vec<u8>> {
|
||||||
use substreams_ethereum::pb::eth::rpc;
|
use substreams_ethereum::pb::eth::rpc;
|
||||||
let rpc_calls = rpc::RpcCalls {
|
let rpc_calls = rpc::RpcCalls {
|
||||||
calls: vec![
|
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
|
||||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||||
let response = responses
|
let response = responses.get(0).expect("one response should have existed");
|
||||||
.get(0)
|
|
||||||
.expect("one response should have existed");
|
|
||||||
if response.failed {
|
if response.failed {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@@ -786,9 +749,7 @@
|
|||||||
fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
|
fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
|
||||||
Self::match_log(log)
|
Self::match_log(log)
|
||||||
}
|
}
|
||||||
fn decode(
|
fn decode(log: &substreams_ethereum::pb::eth::v2::Log) -> Result<Self, String> {
|
||||||
log: &substreams_ethereum::pb::eth::v2::Log,
|
|
||||||
) -> Result<Self, String> {
|
|
||||||
Self::decode(log)
|
Self::decode(log)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -886,9 +847,7 @@
|
|||||||
fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
|
fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
|
||||||
Self::match_log(log)
|
Self::match_log(log)
|
||||||
}
|
}
|
||||||
fn decode(
|
fn decode(log: &substreams_ethereum::pb::eth::v2::Log) -> Result<Self, String> {
|
||||||
log: &substreams_ethereum::pb::eth::v2::Log,
|
|
||||||
) -> Result<Self, String> {
|
|
||||||
Self::decode(log)
|
Self::decode(log)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1031,9 +990,7 @@
|
|||||||
fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
|
fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
|
||||||
Self::match_log(log)
|
Self::match_log(log)
|
||||||
}
|
}
|
||||||
fn decode(
|
fn decode(log: &substreams_ethereum::pb::eth::v2::Log) -> Result<Self, String> {
|
||||||
log: &substreams_ethereum::pb::eth::v2::Log,
|
|
||||||
) -> Result<Self, String> {
|
|
||||||
Self::decode(log)
|
Self::decode(log)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user