Files
tycho-protocol-sdk/substreams/ethereum-curve/src/abi/meta_registry.rs
2024-07-25 14:11:29 +01:00

7130 lines
282 KiB
Rust

const INTERNAL_ERR: &'static str = "`ethabi_derive` internal error";
/// Contract's functions.
#[allow(dead_code, unused_imports, unused_variables)]
pub mod functions {
use super::INTERNAL_ERR;
#[derive(Debug, Clone, PartialEq)]
pub struct AddRegistryHandler {
pub registry_handler: Vec<u8>,
}
impl AddRegistryHandler {
const METHOD_ID: [u8; 4] = [34u8, 245u8, 149u8, 200u8];
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())
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
registry_handler: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(&[ethabi::Token::Address(ethabi::Address::from_slice(
&self.registry_handler,
))]);
let mut encoded = Vec::with_capacity(4 + data.len());
encoded.extend(Self::METHOD_ID);
encoded.extend(data);
encoded
}
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,
}
}
}
impl substreams_ethereum::Function for AddRegistryHandler {
const NAME: &'static str = "add_registry_handler";
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()
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct AddressProvider {}
impl AddressProvider {
const METHOD_ID: [u8; 4] = [206u8, 80u8, 194u8, 231u8];
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<Vec<u8>, String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
let mut values = ethabi::decode(&[ethabi::ParamType::Address], data.as_ref())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok(values
.pop()
.expect("one output data should have existed")
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec())
}
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<Vec<u8>> {
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 AddressProvider {
const NAME: &'static str = "address_provider";
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<Vec<u8>> for AddressProvider {
fn output(data: &[u8]) -> Result<Vec<u8>, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct FindPoolForCoins1 {
pub from: Vec<u8>,
pub to: Vec<u8>,
}
impl FindPoolForCoins1 {
const METHOD_ID: [u8; 4] = [168u8, 125u8, 240u8, 108u8];
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, ethabi::ParamType::Address],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
from: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
to: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(&[
ethabi::Token::Address(ethabi::Address::from_slice(&self.from)),
ethabi::Token::Address(ethabi::Address::from_slice(&self.to)),
]);
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<Vec<u8>, String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
let mut values = ethabi::decode(&[ethabi::ParamType::Address], data.as_ref())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok(values
.pop()
.expect("one output data should have existed")
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec())
}
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<Vec<u8>> {
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 FindPoolForCoins1 {
const NAME: &'static str = "find_pool_for_coins1";
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<Vec<u8>> for FindPoolForCoins1 {
fn output(data: &[u8]) -> Result<Vec<u8>, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct FindPoolForCoins2 {
pub from: Vec<u8>,
pub to: Vec<u8>,
pub i: substreams::scalar::BigInt,
}
impl FindPoolForCoins2 {
const METHOD_ID: [u8; 4] = [105u8, 130u8, 235u8, 11u8];
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,
ethabi::ParamType::Address,
ethabi::ParamType::Uint(256usize),
],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
from: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
to: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
i: {
let mut v = [0 as u8; 32];
values
.pop()
.expect(INTERNAL_ERR)
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
})
}
pub fn encode(&self) -> Vec<u8> {
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(
match self.i.clone().to_bytes_be() {
(num_bigint::Sign::Plus, bytes) => bytes,
(num_bigint::Sign::NoSign, bytes) => bytes,
(num_bigint::Sign::Minus, _) => {
panic!("negative numbers are not supported")
}
}
.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<Vec<u8>, String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
let mut values = ethabi::decode(&[ethabi::ParamType::Address], data.as_ref())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok(values
.pop()
.expect("one output data should have existed")
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec())
}
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<Vec<u8>> {
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 FindPoolForCoins2 {
const NAME: &'static str = "find_pool_for_coins2";
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<Vec<u8>> for FindPoolForCoins2 {
fn output(data: &[u8]) -> Result<Vec<u8>, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct FindPoolsForCoins {
pub from: Vec<u8>,
pub to: Vec<u8>,
}
impl FindPoolsForCoins {
const METHOD_ID: [u8; 4] = [160u8, 100u8, 7u8, 43u8];
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, ethabi::ParamType::Address],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
from: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
to: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(&[
ethabi::Token::Address(ethabi::Address::from_slice(&self.from)),
ethabi::Token::Address(ethabi::Address::from_slice(&self.to)),
]);
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<Vec<Vec<u8>>, String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<Vec<Vec<u8>>, String> {
let mut values = ethabi::decode(
&[ethabi::ParamType::Array(Box::new(ethabi::ParamType::Address))],
data.as_ref(),
)
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok(values
.pop()
.expect("one output data should have existed")
.into_array()
.expect(INTERNAL_ERR)
.into_iter()
.map(|inner| {
inner
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec()
})
.collect())
}
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<Vec<Vec<u8>>> {
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 FindPoolsForCoins {
const NAME: &'static str = "find_pools_for_coins";
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<Vec<Vec<u8>>> for FindPoolsForCoins {
fn output(data: &[u8]) -> Result<Vec<Vec<u8>>, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetAdminBalances1 {
pub pool: Vec<u8>,
}
impl GetAdminBalances1 {
const METHOD_ID: [u8; 4] = [193u8, 30u8, 69u8, 184u8];
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())
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
})
}
pub fn encode(&self) -> Vec<u8> {
let data =
ethabi::encode(&[ethabi::Token::Address(ethabi::Address::from_slice(&self.pool))]);
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<[substreams::scalar::BigInt; 8usize], String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<[substreams::scalar::BigInt; 8usize], String> {
let mut values = ethabi::decode(
&[ethabi::ParamType::FixedArray(
Box::new(ethabi::ParamType::Uint(256usize)),
8usize,
)],
data.as_ref(),
)
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok({
let mut iter = values
.pop()
.expect("one output data should have existed")
.into_fixed_array()
.expect(INTERNAL_ERR)
.into_iter()
.map(|inner| {
let mut v = [0 as u8; 32];
inner
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
});
[
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
]
})
}
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<[substreams::scalar::BigInt; 8usize]> {
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 GetAdminBalances1 {
const NAME: &'static str = "get_admin_balances1";
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<[substreams::scalar::BigInt; 8usize]>
for GetAdminBalances1
{
fn output(data: &[u8]) -> Result<[substreams::scalar::BigInt; 8usize], String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetAdminBalances2 {
pub pool: Vec<u8>,
pub handler_id: substreams::scalar::BigInt,
}
impl GetAdminBalances2 {
const METHOD_ID: [u8; 4] = [192u8, 191u8, 76u8, 191u8];
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, ethabi::ParamType::Uint(256usize)],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
handler_id: {
let mut v = [0 as u8; 32];
values
.pop()
.expect(INTERNAL_ERR)
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(&[
ethabi::Token::Address(ethabi::Address::from_slice(&self.pool)),
ethabi::Token::Uint(ethabi::Uint::from_big_endian(
match self.handler_id.clone().to_bytes_be() {
(num_bigint::Sign::Plus, bytes) => bytes,
(num_bigint::Sign::NoSign, bytes) => bytes,
(num_bigint::Sign::Minus, _) => {
panic!("negative numbers are not supported")
}
}
.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<[substreams::scalar::BigInt; 8usize], String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<[substreams::scalar::BigInt; 8usize], String> {
let mut values = ethabi::decode(
&[ethabi::ParamType::FixedArray(
Box::new(ethabi::ParamType::Uint(256usize)),
8usize,
)],
data.as_ref(),
)
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok({
let mut iter = values
.pop()
.expect("one output data should have existed")
.into_fixed_array()
.expect(INTERNAL_ERR)
.into_iter()
.map(|inner| {
let mut v = [0 as u8; 32];
inner
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
});
[
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
]
})
}
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<[substreams::scalar::BigInt; 8usize]> {
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 GetAdminBalances2 {
const NAME: &'static str = "get_admin_balances2";
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<[substreams::scalar::BigInt; 8usize]>
for GetAdminBalances2
{
fn output(data: &[u8]) -> Result<[substreams::scalar::BigInt; 8usize], String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetBalances1 {
pub pool: Vec<u8>,
}
impl GetBalances1 {
const METHOD_ID: [u8; 4] = [146u8, 227u8, 204u8, 45u8];
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())
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
})
}
pub fn encode(&self) -> Vec<u8> {
let data =
ethabi::encode(&[ethabi::Token::Address(ethabi::Address::from_slice(&self.pool))]);
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<[substreams::scalar::BigInt; 8usize], String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<[substreams::scalar::BigInt; 8usize], String> {
let mut values = ethabi::decode(
&[ethabi::ParamType::FixedArray(
Box::new(ethabi::ParamType::Uint(256usize)),
8usize,
)],
data.as_ref(),
)
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok({
let mut iter = values
.pop()
.expect("one output data should have existed")
.into_fixed_array()
.expect(INTERNAL_ERR)
.into_iter()
.map(|inner| {
let mut v = [0 as u8; 32];
inner
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
});
[
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
]
})
}
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<[substreams::scalar::BigInt; 8usize]> {
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 GetBalances1 {
const NAME: &'static str = "get_balances1";
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<[substreams::scalar::BigInt; 8usize]> for GetBalances1 {
fn output(data: &[u8]) -> Result<[substreams::scalar::BigInt; 8usize], String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetBalances2 {
pub pool: Vec<u8>,
pub handler_id: substreams::scalar::BigInt,
}
impl GetBalances2 {
const METHOD_ID: [u8; 4] = [170u8, 133u8, 22u8, 156u8];
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, ethabi::ParamType::Uint(256usize)],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
handler_id: {
let mut v = [0 as u8; 32];
values
.pop()
.expect(INTERNAL_ERR)
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(&[
ethabi::Token::Address(ethabi::Address::from_slice(&self.pool)),
ethabi::Token::Uint(ethabi::Uint::from_big_endian(
match self.handler_id.clone().to_bytes_be() {
(num_bigint::Sign::Plus, bytes) => bytes,
(num_bigint::Sign::NoSign, bytes) => bytes,
(num_bigint::Sign::Minus, _) => {
panic!("negative numbers are not supported")
}
}
.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<[substreams::scalar::BigInt; 8usize], String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<[substreams::scalar::BigInt; 8usize], String> {
let mut values = ethabi::decode(
&[ethabi::ParamType::FixedArray(
Box::new(ethabi::ParamType::Uint(256usize)),
8usize,
)],
data.as_ref(),
)
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok({
let mut iter = values
.pop()
.expect("one output data should have existed")
.into_fixed_array()
.expect(INTERNAL_ERR)
.into_iter()
.map(|inner| {
let mut v = [0 as u8; 32];
inner
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
});
[
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
]
})
}
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<[substreams::scalar::BigInt; 8usize]> {
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 GetBalances2 {
const NAME: &'static str = "get_balances2";
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<[substreams::scalar::BigInt; 8usize]> for GetBalances2 {
fn output(data: &[u8]) -> Result<[substreams::scalar::BigInt; 8usize], String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetBasePool1 {
pub pool: Vec<u8>,
}
impl GetBasePool1 {
const METHOD_ID: [u8; 4] = [111u8, 32u8, 214u8, 221u8];
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())
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
})
}
pub fn encode(&self) -> Vec<u8> {
let data =
ethabi::encode(&[ethabi::Token::Address(ethabi::Address::from_slice(&self.pool))]);
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<Vec<u8>, String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
let mut values = ethabi::decode(&[ethabi::ParamType::Address], data.as_ref())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok(values
.pop()
.expect("one output data should have existed")
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec())
}
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<Vec<u8>> {
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 GetBasePool1 {
const NAME: &'static str = "get_base_pool1";
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<Vec<u8>> for GetBasePool1 {
fn output(data: &[u8]) -> Result<Vec<u8>, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetBasePool2 {
pub pool: Vec<u8>,
pub handler_id: substreams::scalar::BigInt,
}
impl GetBasePool2 {
const METHOD_ID: [u8; 4] = [165u8, 78u8, 58u8, 222u8];
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, ethabi::ParamType::Uint(256usize)],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
handler_id: {
let mut v = [0 as u8; 32];
values
.pop()
.expect(INTERNAL_ERR)
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(&[
ethabi::Token::Address(ethabi::Address::from_slice(&self.pool)),
ethabi::Token::Uint(ethabi::Uint::from_big_endian(
match self.handler_id.clone().to_bytes_be() {
(num_bigint::Sign::Plus, bytes) => bytes,
(num_bigint::Sign::NoSign, bytes) => bytes,
(num_bigint::Sign::Minus, _) => {
panic!("negative numbers are not supported")
}
}
.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<Vec<u8>, String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
let mut values = ethabi::decode(&[ethabi::ParamType::Address], data.as_ref())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok(values
.pop()
.expect("one output data should have existed")
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec())
}
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<Vec<u8>> {
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 GetBasePool2 {
const NAME: &'static str = "get_base_pool2";
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<Vec<u8>> for GetBasePool2 {
fn output(data: &[u8]) -> Result<Vec<u8>, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetBaseRegistry {
pub registry_handler: Vec<u8>,
}
impl GetBaseRegistry {
const METHOD_ID: [u8; 4] = [132u8, 225u8, 113u8, 13u8];
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())
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
registry_handler: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(&[ethabi::Token::Address(ethabi::Address::from_slice(
&self.registry_handler,
))]);
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<Vec<u8>, String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
let mut values = ethabi::decode(&[ethabi::ParamType::Address], data.as_ref())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok(values
.pop()
.expect("one output data should have existed")
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec())
}
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<Vec<u8>> {
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 GetBaseRegistry {
const NAME: &'static str = "get_base_registry";
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<Vec<u8>> for GetBaseRegistry {
fn output(data: &[u8]) -> Result<Vec<u8>, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetCoinIndices1 {
pub pool: Vec<u8>,
pub from: Vec<u8>,
pub to: Vec<u8>,
}
impl GetCoinIndices1 {
const METHOD_ID: [u8; 4] = [235u8, 133u8, 34u8, 109u8];
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,
ethabi::ParamType::Address,
ethabi::ParamType::Address,
],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
from: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
to: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(&[
ethabi::Token::Address(ethabi::Address::from_slice(&self.pool)),
ethabi::Token::Address(ethabi::Address::from_slice(&self.from)),
ethabi::Token::Address(ethabi::Address::from_slice(&self.to)),
]);
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<(substreams::scalar::BigInt, substreams::scalar::BigInt, bool), String>
{
Self::output(call.return_data.as_ref())
}
pub fn output(
data: &[u8],
) -> Result<(substreams::scalar::BigInt, substreams::scalar::BigInt, bool), String>
{
let mut values = ethabi::decode(
&[
ethabi::ParamType::Int(128usize),
ethabi::ParamType::Int(128usize),
ethabi::ParamType::Bool,
],
data.as_ref(),
)
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
values.reverse();
Ok((
{
let mut v = [0 as u8; 32];
values
.pop()
.expect(INTERNAL_ERR)
.into_int()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_signed_bytes_be(&v)
},
{
let mut v = [0 as u8; 32];
values
.pop()
.expect(INTERNAL_ERR)
.into_int()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_signed_bytes_be(&v)
},
values
.pop()
.expect(INTERNAL_ERR)
.into_bool()
.expect(INTERNAL_ERR),
))
}
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<(substreams::scalar::BigInt, substreams::scalar::BigInt, bool)> {
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 GetCoinIndices1 {
const NAME: &'static str = "get_coin_indices1";
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<(
substreams::scalar::BigInt,
substreams::scalar::BigInt,
bool,
)> for GetCoinIndices1
{
fn output(
data: &[u8],
) -> Result<(substreams::scalar::BigInt, substreams::scalar::BigInt, bool), String>
{
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetCoinIndices2 {
pub pool: Vec<u8>,
pub from: Vec<u8>,
pub to: Vec<u8>,
pub handler_id: substreams::scalar::BigInt,
}
impl GetCoinIndices2 {
const METHOD_ID: [u8; 4] = [99u8, 251u8, 61u8, 219u8];
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,
ethabi::ParamType::Address,
ethabi::ParamType::Address,
ethabi::ParamType::Uint(256usize),
],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
from: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
to: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
handler_id: {
let mut v = [0 as u8; 32];
values
.pop()
.expect(INTERNAL_ERR)
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(&[
ethabi::Token::Address(ethabi::Address::from_slice(&self.pool)),
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(
match self.handler_id.clone().to_bytes_be() {
(num_bigint::Sign::Plus, bytes) => bytes,
(num_bigint::Sign::NoSign, bytes) => bytes,
(num_bigint::Sign::Minus, _) => {
panic!("negative numbers are not supported")
}
}
.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<(substreams::scalar::BigInt, substreams::scalar::BigInt, bool), String>
{
Self::output(call.return_data.as_ref())
}
pub fn output(
data: &[u8],
) -> Result<(substreams::scalar::BigInt, substreams::scalar::BigInt, bool), String>
{
let mut values = ethabi::decode(
&[
ethabi::ParamType::Int(128usize),
ethabi::ParamType::Int(128usize),
ethabi::ParamType::Bool,
],
data.as_ref(),
)
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
values.reverse();
Ok((
{
let mut v = [0 as u8; 32];
values
.pop()
.expect(INTERNAL_ERR)
.into_int()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_signed_bytes_be(&v)
},
{
let mut v = [0 as u8; 32];
values
.pop()
.expect(INTERNAL_ERR)
.into_int()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_signed_bytes_be(&v)
},
values
.pop()
.expect(INTERNAL_ERR)
.into_bool()
.expect(INTERNAL_ERR),
))
}
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<(substreams::scalar::BigInt, substreams::scalar::BigInt, bool)> {
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 GetCoinIndices2 {
const NAME: &'static str = "get_coin_indices2";
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<(
substreams::scalar::BigInt,
substreams::scalar::BigInt,
bool,
)> for GetCoinIndices2
{
fn output(
data: &[u8],
) -> Result<(substreams::scalar::BigInt, substreams::scalar::BigInt, bool), String>
{
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetCoins1 {
pub pool: Vec<u8>,
}
impl GetCoins1 {
const METHOD_ID: [u8; 4] = [154u8, 201u8, 13u8, 61u8];
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())
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
})
}
pub fn encode(&self) -> Vec<u8> {
let data =
ethabi::encode(&[ethabi::Token::Address(ethabi::Address::from_slice(&self.pool))]);
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<[Vec<u8>; 8usize], String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<[Vec<u8>; 8usize], String> {
let mut values = ethabi::decode(
&[ethabi::ParamType::FixedArray(Box::new(ethabi::ParamType::Address), 8usize)],
data.as_ref(),
)
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok({
let mut iter = values
.pop()
.expect("one output data should have existed")
.into_fixed_array()
.expect(INTERNAL_ERR)
.into_iter()
.map(|inner| {
inner
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec()
});
[
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
]
})
}
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<[Vec<u8>; 8usize]> {
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 GetCoins1 {
const NAME: &'static str = "get_coins1";
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<[Vec<u8>; 8usize]> for GetCoins1 {
fn output(data: &[u8]) -> Result<[Vec<u8>; 8usize], String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetCoins2 {
pub pool: Vec<u8>,
pub handler_id: substreams::scalar::BigInt,
}
impl GetCoins2 {
const METHOD_ID: [u8; 4] = [110u8, 190u8, 81u8, 252u8];
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, ethabi::ParamType::Uint(256usize)],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
handler_id: {
let mut v = [0 as u8; 32];
values
.pop()
.expect(INTERNAL_ERR)
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(&[
ethabi::Token::Address(ethabi::Address::from_slice(&self.pool)),
ethabi::Token::Uint(ethabi::Uint::from_big_endian(
match self.handler_id.clone().to_bytes_be() {
(num_bigint::Sign::Plus, bytes) => bytes,
(num_bigint::Sign::NoSign, bytes) => bytes,
(num_bigint::Sign::Minus, _) => {
panic!("negative numbers are not supported")
}
}
.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<[Vec<u8>; 8usize], String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<[Vec<u8>; 8usize], String> {
let mut values = ethabi::decode(
&[ethabi::ParamType::FixedArray(Box::new(ethabi::ParamType::Address), 8usize)],
data.as_ref(),
)
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok({
let mut iter = values
.pop()
.expect("one output data should have existed")
.into_fixed_array()
.expect(INTERNAL_ERR)
.into_iter()
.map(|inner| {
inner
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec()
});
[
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
]
})
}
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<[Vec<u8>; 8usize]> {
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 GetCoins2 {
const NAME: &'static str = "get_coins2";
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<[Vec<u8>; 8usize]> for GetCoins2 {
fn output(data: &[u8]) -> Result<[Vec<u8>; 8usize], String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetDecimals1 {
pub pool: Vec<u8>,
}
impl GetDecimals1 {
const METHOD_ID: [u8; 4] = [82u8, 181u8, 21u8, 85u8];
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())
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
})
}
pub fn encode(&self) -> Vec<u8> {
let data =
ethabi::encode(&[ethabi::Token::Address(ethabi::Address::from_slice(&self.pool))]);
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<[substreams::scalar::BigInt; 8usize], String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<[substreams::scalar::BigInt; 8usize], String> {
let mut values = ethabi::decode(
&[ethabi::ParamType::FixedArray(
Box::new(ethabi::ParamType::Uint(256usize)),
8usize,
)],
data.as_ref(),
)
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok({
let mut iter = values
.pop()
.expect("one output data should have existed")
.into_fixed_array()
.expect(INTERNAL_ERR)
.into_iter()
.map(|inner| {
let mut v = [0 as u8; 32];
inner
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
});
[
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
]
})
}
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<[substreams::scalar::BigInt; 8usize]> {
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 GetDecimals1 {
const NAME: &'static str = "get_decimals1";
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<[substreams::scalar::BigInt; 8usize]> for GetDecimals1 {
fn output(data: &[u8]) -> Result<[substreams::scalar::BigInt; 8usize], String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetDecimals2 {
pub pool: Vec<u8>,
pub handler_id: substreams::scalar::BigInt,
}
impl GetDecimals2 {
const METHOD_ID: [u8; 4] = [64u8, 63u8, 80u8, 47u8];
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, ethabi::ParamType::Uint(256usize)],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
handler_id: {
let mut v = [0 as u8; 32];
values
.pop()
.expect(INTERNAL_ERR)
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(&[
ethabi::Token::Address(ethabi::Address::from_slice(&self.pool)),
ethabi::Token::Uint(ethabi::Uint::from_big_endian(
match self.handler_id.clone().to_bytes_be() {
(num_bigint::Sign::Plus, bytes) => bytes,
(num_bigint::Sign::NoSign, bytes) => bytes,
(num_bigint::Sign::Minus, _) => {
panic!("negative numbers are not supported")
}
}
.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<[substreams::scalar::BigInt; 8usize], String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<[substreams::scalar::BigInt; 8usize], String> {
let mut values = ethabi::decode(
&[ethabi::ParamType::FixedArray(
Box::new(ethabi::ParamType::Uint(256usize)),
8usize,
)],
data.as_ref(),
)
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok({
let mut iter = values
.pop()
.expect("one output data should have existed")
.into_fixed_array()
.expect(INTERNAL_ERR)
.into_iter()
.map(|inner| {
let mut v = [0 as u8; 32];
inner
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
});
[
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
]
})
}
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<[substreams::scalar::BigInt; 8usize]> {
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 GetDecimals2 {
const NAME: &'static str = "get_decimals2";
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<[substreams::scalar::BigInt; 8usize]> for GetDecimals2 {
fn output(data: &[u8]) -> Result<[substreams::scalar::BigInt; 8usize], String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetFees1 {
pub pool: Vec<u8>,
}
impl GetFees1 {
const METHOD_ID: [u8; 4] = [124u8, 219u8, 114u8, 176u8];
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())
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
})
}
pub fn encode(&self) -> Vec<u8> {
let data =
ethabi::encode(&[ethabi::Token::Address(ethabi::Address::from_slice(&self.pool))]);
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<[substreams::scalar::BigInt; 10usize], String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<[substreams::scalar::BigInt; 10usize], String> {
let mut values = ethabi::decode(
&[ethabi::ParamType::FixedArray(
Box::new(ethabi::ParamType::Uint(256usize)),
10usize,
)],
data.as_ref(),
)
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok({
let mut iter = values
.pop()
.expect("one output data should have existed")
.into_fixed_array()
.expect(INTERNAL_ERR)
.into_iter()
.map(|inner| {
let mut v = [0 as u8; 32];
inner
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
});
[
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
]
})
}
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<[substreams::scalar::BigInt; 10usize]> {
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 GetFees1 {
const NAME: &'static str = "get_fees1";
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<[substreams::scalar::BigInt; 10usize]> for GetFees1 {
fn output(data: &[u8]) -> Result<[substreams::scalar::BigInt; 10usize], String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetFees2 {
pub pool: Vec<u8>,
pub handler_id: substreams::scalar::BigInt,
}
impl GetFees2 {
const METHOD_ID: [u8; 4] = [14u8, 213u8, 164u8, 39u8];
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, ethabi::ParamType::Uint(256usize)],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
handler_id: {
let mut v = [0 as u8; 32];
values
.pop()
.expect(INTERNAL_ERR)
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(&[
ethabi::Token::Address(ethabi::Address::from_slice(&self.pool)),
ethabi::Token::Uint(ethabi::Uint::from_big_endian(
match self.handler_id.clone().to_bytes_be() {
(num_bigint::Sign::Plus, bytes) => bytes,
(num_bigint::Sign::NoSign, bytes) => bytes,
(num_bigint::Sign::Minus, _) => {
panic!("negative numbers are not supported")
}
}
.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<[substreams::scalar::BigInt; 10usize], String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<[substreams::scalar::BigInt; 10usize], String> {
let mut values = ethabi::decode(
&[ethabi::ParamType::FixedArray(
Box::new(ethabi::ParamType::Uint(256usize)),
10usize,
)],
data.as_ref(),
)
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok({
let mut iter = values
.pop()
.expect("one output data should have existed")
.into_fixed_array()
.expect(INTERNAL_ERR)
.into_iter()
.map(|inner| {
let mut v = [0 as u8; 32];
inner
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
});
[
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
]
})
}
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<[substreams::scalar::BigInt; 10usize]> {
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 GetFees2 {
const NAME: &'static str = "get_fees2";
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<[substreams::scalar::BigInt; 10usize]> for GetFees2 {
fn output(data: &[u8]) -> Result<[substreams::scalar::BigInt; 10usize], String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetGauge1 {
pub pool: Vec<u8>,
}
impl GetGauge1 {
const METHOD_ID: [u8; 4] = [218u8, 242u8, 151u8, 185u8];
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())
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
})
}
pub fn encode(&self) -> Vec<u8> {
let data =
ethabi::encode(&[ethabi::Token::Address(ethabi::Address::from_slice(&self.pool))]);
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<Vec<u8>, String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
let mut values = ethabi::decode(&[ethabi::ParamType::Address], data.as_ref())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok(values
.pop()
.expect("one output data should have existed")
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec())
}
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<Vec<u8>> {
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 GetGauge1 {
const NAME: &'static str = "get_gauge1";
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<Vec<u8>> for GetGauge1 {
fn output(data: &[u8]) -> Result<Vec<u8>, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetGauge2 {
pub pool: Vec<u8>,
pub gauge_idx: substreams::scalar::BigInt,
}
impl GetGauge2 {
const METHOD_ID: [u8; 4] = [228u8, 8u8, 18u8, 32u8];
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, ethabi::ParamType::Uint(256usize)],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
gauge_idx: {
let mut v = [0 as u8; 32];
values
.pop()
.expect(INTERNAL_ERR)
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(&[
ethabi::Token::Address(ethabi::Address::from_slice(&self.pool)),
ethabi::Token::Uint(ethabi::Uint::from_big_endian(
match self.gauge_idx.clone().to_bytes_be() {
(num_bigint::Sign::Plus, bytes) => bytes,
(num_bigint::Sign::NoSign, bytes) => bytes,
(num_bigint::Sign::Minus, _) => {
panic!("negative numbers are not supported")
}
}
.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<Vec<u8>, String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
let mut values = ethabi::decode(&[ethabi::ParamType::Address], data.as_ref())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok(values
.pop()
.expect("one output data should have existed")
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec())
}
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<Vec<u8>> {
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 GetGauge2 {
const NAME: &'static str = "get_gauge2";
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<Vec<u8>> for GetGauge2 {
fn output(data: &[u8]) -> Result<Vec<u8>, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetGauge3 {
pub pool: Vec<u8>,
pub gauge_idx: substreams::scalar::BigInt,
pub handler_id: substreams::scalar::BigInt,
}
impl GetGauge3 {
const METHOD_ID: [u8; 4] = [119u8, 63u8, 183u8, 227u8];
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,
ethabi::ParamType::Uint(256usize),
ethabi::ParamType::Uint(256usize),
],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
gauge_idx: {
let mut v = [0 as u8; 32];
values
.pop()
.expect(INTERNAL_ERR)
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
handler_id: {
let mut v = [0 as u8; 32];
values
.pop()
.expect(INTERNAL_ERR)
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(&[
ethabi::Token::Address(ethabi::Address::from_slice(&self.pool)),
ethabi::Token::Uint(ethabi::Uint::from_big_endian(
match self.gauge_idx.clone().to_bytes_be() {
(num_bigint::Sign::Plus, bytes) => bytes,
(num_bigint::Sign::NoSign, bytes) => bytes,
(num_bigint::Sign::Minus, _) => {
panic!("negative numbers are not supported")
}
}
.as_slice(),
)),
ethabi::Token::Uint(ethabi::Uint::from_big_endian(
match self.handler_id.clone().to_bytes_be() {
(num_bigint::Sign::Plus, bytes) => bytes,
(num_bigint::Sign::NoSign, bytes) => bytes,
(num_bigint::Sign::Minus, _) => {
panic!("negative numbers are not supported")
}
}
.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<Vec<u8>, String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
let mut values = ethabi::decode(&[ethabi::ParamType::Address], data.as_ref())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok(values
.pop()
.expect("one output data should have existed")
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec())
}
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<Vec<u8>> {
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 GetGauge3 {
const NAME: &'static str = "get_gauge3";
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<Vec<u8>> for GetGauge3 {
fn output(data: &[u8]) -> Result<Vec<u8>, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetGaugeType1 {
pub pool: Vec<u8>,
}
impl GetGaugeType1 {
const METHOD_ID: [u8; 4] = [37u8, 250u8, 93u8, 19u8];
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())
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
})
}
pub fn encode(&self) -> Vec<u8> {
let data =
ethabi::encode(&[ethabi::Token::Address(ethabi::Address::from_slice(&self.pool))]);
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<substreams::scalar::BigInt, String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
let mut values = ethabi::decode(&[ethabi::ParamType::Int(128usize)], data.as_ref())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok({
let mut v = [0 as u8; 32];
values
.pop()
.expect("one output data should have existed")
.into_int()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_signed_bytes_be(&v)
})
}
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<substreams::scalar::BigInt> {
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 GetGaugeType1 {
const NAME: &'static str = "get_gauge_type1";
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<substreams::scalar::BigInt> for GetGaugeType1 {
fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetGaugeType2 {
pub pool: Vec<u8>,
pub gauge_idx: substreams::scalar::BigInt,
}
impl GetGaugeType2 {
const METHOD_ID: [u8; 4] = [124u8, 81u8, 219u8, 85u8];
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, ethabi::ParamType::Uint(256usize)],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
gauge_idx: {
let mut v = [0 as u8; 32];
values
.pop()
.expect(INTERNAL_ERR)
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(&[
ethabi::Token::Address(ethabi::Address::from_slice(&self.pool)),
ethabi::Token::Uint(ethabi::Uint::from_big_endian(
match self.gauge_idx.clone().to_bytes_be() {
(num_bigint::Sign::Plus, bytes) => bytes,
(num_bigint::Sign::NoSign, bytes) => bytes,
(num_bigint::Sign::Minus, _) => {
panic!("negative numbers are not supported")
}
}
.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<substreams::scalar::BigInt, String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
let mut values = ethabi::decode(&[ethabi::ParamType::Int(128usize)], data.as_ref())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok({
let mut v = [0 as u8; 32];
values
.pop()
.expect("one output data should have existed")
.into_int()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_signed_bytes_be(&v)
})
}
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<substreams::scalar::BigInt> {
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 GetGaugeType2 {
const NAME: &'static str = "get_gauge_type2";
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<substreams::scalar::BigInt> for GetGaugeType2 {
fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetGaugeType3 {
pub pool: Vec<u8>,
pub gauge_idx: substreams::scalar::BigInt,
pub handler_id: substreams::scalar::BigInt,
}
impl GetGaugeType3 {
const METHOD_ID: [u8; 4] = [248u8, 182u8, 97u8, 226u8];
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,
ethabi::ParamType::Uint(256usize),
ethabi::ParamType::Uint(256usize),
],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
gauge_idx: {
let mut v = [0 as u8; 32];
values
.pop()
.expect(INTERNAL_ERR)
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
handler_id: {
let mut v = [0 as u8; 32];
values
.pop()
.expect(INTERNAL_ERR)
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(&[
ethabi::Token::Address(ethabi::Address::from_slice(&self.pool)),
ethabi::Token::Uint(ethabi::Uint::from_big_endian(
match self.gauge_idx.clone().to_bytes_be() {
(num_bigint::Sign::Plus, bytes) => bytes,
(num_bigint::Sign::NoSign, bytes) => bytes,
(num_bigint::Sign::Minus, _) => {
panic!("negative numbers are not supported")
}
}
.as_slice(),
)),
ethabi::Token::Uint(ethabi::Uint::from_big_endian(
match self.handler_id.clone().to_bytes_be() {
(num_bigint::Sign::Plus, bytes) => bytes,
(num_bigint::Sign::NoSign, bytes) => bytes,
(num_bigint::Sign::Minus, _) => {
panic!("negative numbers are not supported")
}
}
.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<substreams::scalar::BigInt, String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
let mut values = ethabi::decode(&[ethabi::ParamType::Int(128usize)], data.as_ref())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok({
let mut v = [0 as u8; 32];
values
.pop()
.expect("one output data should have existed")
.into_int()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_signed_bytes_be(&v)
})
}
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<substreams::scalar::BigInt> {
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 GetGaugeType3 {
const NAME: &'static str = "get_gauge_type3";
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<substreams::scalar::BigInt> for GetGaugeType3 {
fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetLpToken1 {
pub pool: Vec<u8>,
}
impl GetLpToken1 {
const METHOD_ID: [u8; 4] = [55u8, 149u8, 16u8, 73u8];
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())
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
})
}
pub fn encode(&self) -> Vec<u8> {
let data =
ethabi::encode(&[ethabi::Token::Address(ethabi::Address::from_slice(&self.pool))]);
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<Vec<u8>, String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
let mut values = ethabi::decode(&[ethabi::ParamType::Address], data.as_ref())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok(values
.pop()
.expect("one output data should have existed")
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec())
}
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<Vec<u8>> {
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 GetLpToken1 {
const NAME: &'static str = "get_lp_token1";
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<Vec<u8>> for GetLpToken1 {
fn output(data: &[u8]) -> Result<Vec<u8>, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetLpToken2 {
pub pool: Vec<u8>,
pub handler_id: substreams::scalar::BigInt,
}
impl GetLpToken2 {
const METHOD_ID: [u8; 4] = [8u8, 129u8, 113u8, 95u8];
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, ethabi::ParamType::Uint(256usize)],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
handler_id: {
let mut v = [0 as u8; 32];
values
.pop()
.expect(INTERNAL_ERR)
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(&[
ethabi::Token::Address(ethabi::Address::from_slice(&self.pool)),
ethabi::Token::Uint(ethabi::Uint::from_big_endian(
match self.handler_id.clone().to_bytes_be() {
(num_bigint::Sign::Plus, bytes) => bytes,
(num_bigint::Sign::NoSign, bytes) => bytes,
(num_bigint::Sign::Minus, _) => {
panic!("negative numbers are not supported")
}
}
.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<Vec<u8>, String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
let mut values = ethabi::decode(&[ethabi::ParamType::Address], data.as_ref())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok(values
.pop()
.expect("one output data should have existed")
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec())
}
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<Vec<u8>> {
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 GetLpToken2 {
const NAME: &'static str = "get_lp_token2";
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<Vec<u8>> for GetLpToken2 {
fn output(data: &[u8]) -> Result<Vec<u8>, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetNCoins1 {
pub pool: Vec<u8>,
}
impl GetNCoins1 {
const METHOD_ID: [u8; 4] = [148u8, 4u8, 148u8, 241u8];
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())
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
})
}
pub fn encode(&self) -> Vec<u8> {
let data =
ethabi::encode(&[ethabi::Token::Address(ethabi::Address::from_slice(&self.pool))]);
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<substreams::scalar::BigInt, String> {
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())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok({
let mut v = [0 as u8; 32];
values
.pop()
.expect("one output data should have existed")
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
})
}
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<substreams::scalar::BigInt> {
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 GetNCoins1 {
const NAME: &'static str = "get_n_coins1";
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<substreams::scalar::BigInt> for GetNCoins1 {
fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetNCoins2 {
pub pool: Vec<u8>,
pub handler_id: substreams::scalar::BigInt,
}
impl GetNCoins2 {
const METHOD_ID: [u8; 4] = [17u8, 216u8, 18u8, 121u8];
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, ethabi::ParamType::Uint(256usize)],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
handler_id: {
let mut v = [0 as u8; 32];
values
.pop()
.expect(INTERNAL_ERR)
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(&[
ethabi::Token::Address(ethabi::Address::from_slice(&self.pool)),
ethabi::Token::Uint(ethabi::Uint::from_big_endian(
match self.handler_id.clone().to_bytes_be() {
(num_bigint::Sign::Plus, bytes) => bytes,
(num_bigint::Sign::NoSign, bytes) => bytes,
(num_bigint::Sign::Minus, _) => {
panic!("negative numbers are not supported")
}
}
.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<substreams::scalar::BigInt, String> {
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())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok({
let mut v = [0 as u8; 32];
values
.pop()
.expect("one output data should have existed")
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
})
}
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<substreams::scalar::BigInt> {
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 GetNCoins2 {
const NAME: &'static str = "get_n_coins2";
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<substreams::scalar::BigInt> for GetNCoins2 {
fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetNUnderlyingCoins1 {
pub pool: Vec<u8>,
}
impl GetNUnderlyingCoins1 {
const METHOD_ID: [u8; 4] = [10u8, 112u8, 12u8, 8u8];
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())
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
})
}
pub fn encode(&self) -> Vec<u8> {
let data =
ethabi::encode(&[ethabi::Token::Address(ethabi::Address::from_slice(&self.pool))]);
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<substreams::scalar::BigInt, String> {
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())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok({
let mut v = [0 as u8; 32];
values
.pop()
.expect("one output data should have existed")
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
})
}
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<substreams::scalar::BigInt> {
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 GetNUnderlyingCoins1 {
const NAME: &'static str = "get_n_underlying_coins1";
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<substreams::scalar::BigInt> for GetNUnderlyingCoins1 {
fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetNUnderlyingCoins2 {
pub pool: Vec<u8>,
pub handler_id: substreams::scalar::BigInt,
}
impl GetNUnderlyingCoins2 {
const METHOD_ID: [u8; 4] = [222u8, 205u8, 246u8, 143u8];
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, ethabi::ParamType::Uint(256usize)],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
handler_id: {
let mut v = [0 as u8; 32];
values
.pop()
.expect(INTERNAL_ERR)
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(&[
ethabi::Token::Address(ethabi::Address::from_slice(&self.pool)),
ethabi::Token::Uint(ethabi::Uint::from_big_endian(
match self.handler_id.clone().to_bytes_be() {
(num_bigint::Sign::Plus, bytes) => bytes,
(num_bigint::Sign::NoSign, bytes) => bytes,
(num_bigint::Sign::Minus, _) => {
panic!("negative numbers are not supported")
}
}
.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<substreams::scalar::BigInt, String> {
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())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok({
let mut v = [0 as u8; 32];
values
.pop()
.expect("one output data should have existed")
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
})
}
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<substreams::scalar::BigInt> {
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 GetNUnderlyingCoins2 {
const NAME: &'static str = "get_n_underlying_coins2";
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<substreams::scalar::BigInt> for GetNUnderlyingCoins2 {
fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetPoolAssetType1 {
pub pool: Vec<u8>,
}
impl GetPoolAssetType1 {
const METHOD_ID: [u8; 4] = [102u8, 211u8, 150u8, 108u8];
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())
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
})
}
pub fn encode(&self) -> Vec<u8> {
let data =
ethabi::encode(&[ethabi::Token::Address(ethabi::Address::from_slice(&self.pool))]);
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<substreams::scalar::BigInt, String> {
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())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok({
let mut v = [0 as u8; 32];
values
.pop()
.expect("one output data should have existed")
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
})
}
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<substreams::scalar::BigInt> {
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 GetPoolAssetType1 {
const NAME: &'static str = "get_pool_asset_type1";
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<substreams::scalar::BigInt> for GetPoolAssetType1 {
fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetPoolAssetType2 {
pub pool: Vec<u8>,
pub handler_id: substreams::scalar::BigInt,
}
impl GetPoolAssetType2 {
const METHOD_ID: [u8; 4] = [144u8, 209u8, 221u8, 45u8];
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, ethabi::ParamType::Uint(256usize)],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
handler_id: {
let mut v = [0 as u8; 32];
values
.pop()
.expect(INTERNAL_ERR)
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(&[
ethabi::Token::Address(ethabi::Address::from_slice(&self.pool)),
ethabi::Token::Uint(ethabi::Uint::from_big_endian(
match self.handler_id.clone().to_bytes_be() {
(num_bigint::Sign::Plus, bytes) => bytes,
(num_bigint::Sign::NoSign, bytes) => bytes,
(num_bigint::Sign::Minus, _) => {
panic!("negative numbers are not supported")
}
}
.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<substreams::scalar::BigInt, String> {
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())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok({
let mut v = [0 as u8; 32];
values
.pop()
.expect("one output data should have existed")
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
})
}
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<substreams::scalar::BigInt> {
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 GetPoolAssetType2 {
const NAME: &'static str = "get_pool_asset_type2";
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<substreams::scalar::BigInt> for GetPoolAssetType2 {
fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetPoolFromLpToken1 {
pub token: Vec<u8>,
}
impl GetPoolFromLpToken1 {
const METHOD_ID: [u8; 4] = [189u8, 244u8, 117u8, 195u8];
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())
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
token: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
})
}
pub fn encode(&self) -> Vec<u8> {
let data =
ethabi::encode(&[ethabi::Token::Address(ethabi::Address::from_slice(&self.token))]);
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<Vec<u8>, String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
let mut values = ethabi::decode(&[ethabi::ParamType::Address], data.as_ref())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok(values
.pop()
.expect("one output data should have existed")
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec())
}
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<Vec<u8>> {
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 GetPoolFromLpToken1 {
const NAME: &'static str = "get_pool_from_lp_token1";
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<Vec<u8>> for GetPoolFromLpToken1 {
fn output(data: &[u8]) -> Result<Vec<u8>, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetPoolFromLpToken2 {
pub token: Vec<u8>,
pub handler_id: substreams::scalar::BigInt,
}
impl GetPoolFromLpToken2 {
const METHOD_ID: [u8; 4] = [54u8, 103u8, 139u8, 128u8];
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, ethabi::ParamType::Uint(256usize)],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
token: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
handler_id: {
let mut v = [0 as u8; 32];
values
.pop()
.expect(INTERNAL_ERR)
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(&[
ethabi::Token::Address(ethabi::Address::from_slice(&self.token)),
ethabi::Token::Uint(ethabi::Uint::from_big_endian(
match self.handler_id.clone().to_bytes_be() {
(num_bigint::Sign::Plus, bytes) => bytes,
(num_bigint::Sign::NoSign, bytes) => bytes,
(num_bigint::Sign::Minus, _) => {
panic!("negative numbers are not supported")
}
}
.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<Vec<u8>, String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
let mut values = ethabi::decode(&[ethabi::ParamType::Address], data.as_ref())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok(values
.pop()
.expect("one output data should have existed")
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec())
}
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<Vec<u8>> {
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 GetPoolFromLpToken2 {
const NAME: &'static str = "get_pool_from_lp_token2";
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<Vec<u8>> for GetPoolFromLpToken2 {
fn output(data: &[u8]) -> Result<Vec<u8>, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetPoolName1 {
pub pool: Vec<u8>,
}
impl GetPoolName1 {
const METHOD_ID: [u8; 4] = [92u8, 145u8, 23u8, 65u8];
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())
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
})
}
pub fn encode(&self) -> Vec<u8> {
let data =
ethabi::encode(&[ethabi::Token::Address(ethabi::Address::from_slice(&self.pool))]);
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<String, String> {
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())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok(values
.pop()
.expect("one output data should have existed")
.into_string()
.expect(INTERNAL_ERR))
}
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<String> {
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 GetPoolName1 {
const NAME: &'static str = "get_pool_name1";
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<String> for GetPoolName1 {
fn output(data: &[u8]) -> Result<String, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetPoolName2 {
pub pool: Vec<u8>,
pub handler_id: substreams::scalar::BigInt,
}
impl GetPoolName2 {
const METHOD_ID: [u8; 4] = [146u8, 35u8, 79u8, 69u8];
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, ethabi::ParamType::Uint(256usize)],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
handler_id: {
let mut v = [0 as u8; 32];
values
.pop()
.expect(INTERNAL_ERR)
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(&[
ethabi::Token::Address(ethabi::Address::from_slice(&self.pool)),
ethabi::Token::Uint(ethabi::Uint::from_big_endian(
match self.handler_id.clone().to_bytes_be() {
(num_bigint::Sign::Plus, bytes) => bytes,
(num_bigint::Sign::NoSign, bytes) => bytes,
(num_bigint::Sign::Minus, _) => {
panic!("negative numbers are not supported")
}
}
.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<String, String> {
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())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok(values
.pop()
.expect("one output data should have existed")
.into_string()
.expect(INTERNAL_ERR))
}
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<String> {
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 GetPoolName2 {
const NAME: &'static str = "get_pool_name2";
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<String> for GetPoolName2 {
fn output(data: &[u8]) -> Result<String, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetPoolParams1 {
pub pool: Vec<u8>,
}
impl GetPoolParams1 {
const METHOD_ID: [u8; 4] = [104u8, 133u8, 50u8, 170u8];
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())
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
})
}
pub fn encode(&self) -> Vec<u8> {
let data =
ethabi::encode(&[ethabi::Token::Address(ethabi::Address::from_slice(&self.pool))]);
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<[substreams::scalar::BigInt; 20usize], String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<[substreams::scalar::BigInt; 20usize], String> {
let mut values = ethabi::decode(
&[ethabi::ParamType::FixedArray(
Box::new(ethabi::ParamType::Uint(256usize)),
20usize,
)],
data.as_ref(),
)
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok({
let mut iter = values
.pop()
.expect("one output data should have existed")
.into_fixed_array()
.expect(INTERNAL_ERR)
.into_iter()
.map(|inner| {
let mut v = [0 as u8; 32];
inner
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
});
[
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
]
})
}
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<[substreams::scalar::BigInt; 20usize]> {
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 GetPoolParams1 {
const NAME: &'static str = "get_pool_params1";
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<[substreams::scalar::BigInt; 20usize]>
for GetPoolParams1
{
fn output(data: &[u8]) -> Result<[substreams::scalar::BigInt; 20usize], String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetPoolParams2 {
pub pool: Vec<u8>,
pub handler_id: substreams::scalar::BigInt,
}
impl GetPoolParams2 {
const METHOD_ID: [u8; 4] = [122u8, 101u8, 210u8, 221u8];
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, ethabi::ParamType::Uint(256usize)],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
handler_id: {
let mut v = [0 as u8; 32];
values
.pop()
.expect(INTERNAL_ERR)
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(&[
ethabi::Token::Address(ethabi::Address::from_slice(&self.pool)),
ethabi::Token::Uint(ethabi::Uint::from_big_endian(
match self.handler_id.clone().to_bytes_be() {
(num_bigint::Sign::Plus, bytes) => bytes,
(num_bigint::Sign::NoSign, bytes) => bytes,
(num_bigint::Sign::Minus, _) => {
panic!("negative numbers are not supported")
}
}
.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<[substreams::scalar::BigInt; 20usize], String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<[substreams::scalar::BigInt; 20usize], String> {
let mut values = ethabi::decode(
&[ethabi::ParamType::FixedArray(
Box::new(ethabi::ParamType::Uint(256usize)),
20usize,
)],
data.as_ref(),
)
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok({
let mut iter = values
.pop()
.expect("one output data should have existed")
.into_fixed_array()
.expect(INTERNAL_ERR)
.into_iter()
.map(|inner| {
let mut v = [0 as u8; 32];
inner
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
});
[
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
]
})
}
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<[substreams::scalar::BigInt; 20usize]> {
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 GetPoolParams2 {
const NAME: &'static str = "get_pool_params2";
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<[substreams::scalar::BigInt; 20usize]>
for GetPoolParams2
{
fn output(data: &[u8]) -> Result<[substreams::scalar::BigInt; 20usize], String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetRegistry {
pub arg0: substreams::scalar::BigInt,
}
impl GetRegistry {
const METHOD_ID: [u8; 4] = [145u8, 61u8, 155u8, 77u8];
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::Uint(256usize)], maybe_data.unwrap())
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
arg0: {
let mut v = [0 as u8; 32];
values
.pop()
.expect(INTERNAL_ERR)
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(&[ethabi::Token::Uint(ethabi::Uint::from_big_endian(
match self.arg0.clone().to_bytes_be() {
(num_bigint::Sign::Plus, bytes) => bytes,
(num_bigint::Sign::NoSign, bytes) => bytes,
(num_bigint::Sign::Minus, _) => {
panic!("negative numbers are not supported")
}
}
.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<Vec<u8>, String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
let mut values = ethabi::decode(&[ethabi::ParamType::Address], data.as_ref())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok(values
.pop()
.expect("one output data should have existed")
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec())
}
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<Vec<u8>> {
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 GetRegistry {
const NAME: &'static str = "get_registry";
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<Vec<u8>> for GetRegistry {
fn output(data: &[u8]) -> Result<Vec<u8>, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetRegistryHandlersFromPool {
pub pool: Vec<u8>,
}
impl GetRegistryHandlersFromPool {
const METHOD_ID: [u8; 4] = [48u8, 141u8, 27u8, 109u8];
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())
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
})
}
pub fn encode(&self) -> Vec<u8> {
let data =
ethabi::encode(&[ethabi::Token::Address(ethabi::Address::from_slice(&self.pool))]);
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<[Vec<u8>; 10usize], String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<[Vec<u8>; 10usize], String> {
let mut values = ethabi::decode(
&[ethabi::ParamType::FixedArray(Box::new(ethabi::ParamType::Address), 10usize)],
data.as_ref(),
)
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok({
let mut iter = values
.pop()
.expect("one output data should have existed")
.into_fixed_array()
.expect(INTERNAL_ERR)
.into_iter()
.map(|inner| {
inner
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec()
});
[
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
]
})
}
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<[Vec<u8>; 10usize]> {
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 GetRegistryHandlersFromPool {
const NAME: &'static str = "get_registry_handlers_from_pool";
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<[Vec<u8>; 10usize]> for GetRegistryHandlersFromPool {
fn output(data: &[u8]) -> Result<[Vec<u8>; 10usize], String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetUnderlyingBalances1 {
pub pool: Vec<u8>,
}
impl GetUnderlyingBalances1 {
const METHOD_ID: [u8; 4] = [89u8, 244u8, 243u8, 81u8];
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())
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
})
}
pub fn encode(&self) -> Vec<u8> {
let data =
ethabi::encode(&[ethabi::Token::Address(ethabi::Address::from_slice(&self.pool))]);
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<[substreams::scalar::BigInt; 8usize], String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<[substreams::scalar::BigInt; 8usize], String> {
let mut values = ethabi::decode(
&[ethabi::ParamType::FixedArray(
Box::new(ethabi::ParamType::Uint(256usize)),
8usize,
)],
data.as_ref(),
)
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok({
let mut iter = values
.pop()
.expect("one output data should have existed")
.into_fixed_array()
.expect(INTERNAL_ERR)
.into_iter()
.map(|inner| {
let mut v = [0 as u8; 32];
inner
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
});
[
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
]
})
}
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<[substreams::scalar::BigInt; 8usize]> {
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 GetUnderlyingBalances1 {
const NAME: &'static str = "get_underlying_balances1";
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<[substreams::scalar::BigInt; 8usize]>
for GetUnderlyingBalances1
{
fn output(data: &[u8]) -> Result<[substreams::scalar::BigInt; 8usize], String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetUnderlyingBalances2 {
pub pool: Vec<u8>,
pub handler_id: substreams::scalar::BigInt,
}
impl GetUnderlyingBalances2 {
const METHOD_ID: [u8; 4] = [135u8, 97u8, 18u8, 230u8];
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, ethabi::ParamType::Uint(256usize)],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
handler_id: {
let mut v = [0 as u8; 32];
values
.pop()
.expect(INTERNAL_ERR)
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(&[
ethabi::Token::Address(ethabi::Address::from_slice(&self.pool)),
ethabi::Token::Uint(ethabi::Uint::from_big_endian(
match self.handler_id.clone().to_bytes_be() {
(num_bigint::Sign::Plus, bytes) => bytes,
(num_bigint::Sign::NoSign, bytes) => bytes,
(num_bigint::Sign::Minus, _) => {
panic!("negative numbers are not supported")
}
}
.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<[substreams::scalar::BigInt; 8usize], String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<[substreams::scalar::BigInt; 8usize], String> {
let mut values = ethabi::decode(
&[ethabi::ParamType::FixedArray(
Box::new(ethabi::ParamType::Uint(256usize)),
8usize,
)],
data.as_ref(),
)
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok({
let mut iter = values
.pop()
.expect("one output data should have existed")
.into_fixed_array()
.expect(INTERNAL_ERR)
.into_iter()
.map(|inner| {
let mut v = [0 as u8; 32];
inner
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
});
[
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
]
})
}
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<[substreams::scalar::BigInt; 8usize]> {
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 GetUnderlyingBalances2 {
const NAME: &'static str = "get_underlying_balances2";
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<[substreams::scalar::BigInt; 8usize]>
for GetUnderlyingBalances2
{
fn output(data: &[u8]) -> Result<[substreams::scalar::BigInt; 8usize], String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetUnderlyingCoins1 {
pub pool: Vec<u8>,
}
impl GetUnderlyingCoins1 {
const METHOD_ID: [u8; 4] = [167u8, 117u8, 118u8, 239u8];
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())
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
})
}
pub fn encode(&self) -> Vec<u8> {
let data =
ethabi::encode(&[ethabi::Token::Address(ethabi::Address::from_slice(&self.pool))]);
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<[Vec<u8>; 8usize], String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<[Vec<u8>; 8usize], String> {
let mut values = ethabi::decode(
&[ethabi::ParamType::FixedArray(Box::new(ethabi::ParamType::Address), 8usize)],
data.as_ref(),
)
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok({
let mut iter = values
.pop()
.expect("one output data should have existed")
.into_fixed_array()
.expect(INTERNAL_ERR)
.into_iter()
.map(|inner| {
inner
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec()
});
[
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
]
})
}
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<[Vec<u8>; 8usize]> {
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 GetUnderlyingCoins1 {
const NAME: &'static str = "get_underlying_coins1";
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<[Vec<u8>; 8usize]> for GetUnderlyingCoins1 {
fn output(data: &[u8]) -> Result<[Vec<u8>; 8usize], String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetUnderlyingCoins2 {
pub pool: Vec<u8>,
pub handler_id: substreams::scalar::BigInt,
}
impl GetUnderlyingCoins2 {
const METHOD_ID: [u8; 4] = [47u8, 201u8, 11u8, 207u8];
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, ethabi::ParamType::Uint(256usize)],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
handler_id: {
let mut v = [0 as u8; 32];
values
.pop()
.expect(INTERNAL_ERR)
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(&[
ethabi::Token::Address(ethabi::Address::from_slice(&self.pool)),
ethabi::Token::Uint(ethabi::Uint::from_big_endian(
match self.handler_id.clone().to_bytes_be() {
(num_bigint::Sign::Plus, bytes) => bytes,
(num_bigint::Sign::NoSign, bytes) => bytes,
(num_bigint::Sign::Minus, _) => {
panic!("negative numbers are not supported")
}
}
.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<[Vec<u8>; 8usize], String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<[Vec<u8>; 8usize], String> {
let mut values = ethabi::decode(
&[ethabi::ParamType::FixedArray(Box::new(ethabi::ParamType::Address), 8usize)],
data.as_ref(),
)
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok({
let mut iter = values
.pop()
.expect("one output data should have existed")
.into_fixed_array()
.expect(INTERNAL_ERR)
.into_iter()
.map(|inner| {
inner
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec()
});
[
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
]
})
}
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<[Vec<u8>; 8usize]> {
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 GetUnderlyingCoins2 {
const NAME: &'static str = "get_underlying_coins2";
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<[Vec<u8>; 8usize]> for GetUnderlyingCoins2 {
fn output(data: &[u8]) -> Result<[Vec<u8>; 8usize], String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetUnderlyingDecimals1 {
pub pool: Vec<u8>,
}
impl GetUnderlyingDecimals1 {
const METHOD_ID: [u8; 4] = [76u8, 176u8, 136u8, 241u8];
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())
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
})
}
pub fn encode(&self) -> Vec<u8> {
let data =
ethabi::encode(&[ethabi::Token::Address(ethabi::Address::from_slice(&self.pool))]);
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<[substreams::scalar::BigInt; 8usize], String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<[substreams::scalar::BigInt; 8usize], String> {
let mut values = ethabi::decode(
&[ethabi::ParamType::FixedArray(
Box::new(ethabi::ParamType::Uint(256usize)),
8usize,
)],
data.as_ref(),
)
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok({
let mut iter = values
.pop()
.expect("one output data should have existed")
.into_fixed_array()
.expect(INTERNAL_ERR)
.into_iter()
.map(|inner| {
let mut v = [0 as u8; 32];
inner
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
});
[
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
]
})
}
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<[substreams::scalar::BigInt; 8usize]> {
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 GetUnderlyingDecimals1 {
const NAME: &'static str = "get_underlying_decimals1";
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<[substreams::scalar::BigInt; 8usize]>
for GetUnderlyingDecimals1
{
fn output(data: &[u8]) -> Result<[substreams::scalar::BigInt; 8usize], String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetUnderlyingDecimals2 {
pub pool: Vec<u8>,
pub handler_id: substreams::scalar::BigInt,
}
impl GetUnderlyingDecimals2 {
const METHOD_ID: [u8; 4] = [98u8, 45u8, 100u8, 244u8];
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, ethabi::ParamType::Uint(256usize)],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
handler_id: {
let mut v = [0 as u8; 32];
values
.pop()
.expect(INTERNAL_ERR)
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(&[
ethabi::Token::Address(ethabi::Address::from_slice(&self.pool)),
ethabi::Token::Uint(ethabi::Uint::from_big_endian(
match self.handler_id.clone().to_bytes_be() {
(num_bigint::Sign::Plus, bytes) => bytes,
(num_bigint::Sign::NoSign, bytes) => bytes,
(num_bigint::Sign::Minus, _) => {
panic!("negative numbers are not supported")
}
}
.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<[substreams::scalar::BigInt; 8usize], String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<[substreams::scalar::BigInt; 8usize], String> {
let mut values = ethabi::decode(
&[ethabi::ParamType::FixedArray(
Box::new(ethabi::ParamType::Uint(256usize)),
8usize,
)],
data.as_ref(),
)
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok({
let mut iter = values
.pop()
.expect("one output data should have existed")
.into_fixed_array()
.expect(INTERNAL_ERR)
.into_iter()
.map(|inner| {
let mut v = [0 as u8; 32];
inner
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
});
[
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
]
})
}
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<[substreams::scalar::BigInt; 8usize]> {
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 GetUnderlyingDecimals2 {
const NAME: &'static str = "get_underlying_decimals2";
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<[substreams::scalar::BigInt; 8usize]>
for GetUnderlyingDecimals2
{
fn output(data: &[u8]) -> Result<[substreams::scalar::BigInt; 8usize], String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetVirtualPriceFromLpToken1 {
pub token: Vec<u8>,
}
impl GetVirtualPriceFromLpToken1 {
const METHOD_ID: [u8; 4] = [197u8, 183u8, 7u8, 74u8];
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())
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
token: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
})
}
pub fn encode(&self) -> Vec<u8> {
let data =
ethabi::encode(&[ethabi::Token::Address(ethabi::Address::from_slice(&self.token))]);
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<substreams::scalar::BigInt, String> {
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())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok({
let mut v = [0 as u8; 32];
values
.pop()
.expect("one output data should have existed")
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
})
}
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<substreams::scalar::BigInt> {
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 GetVirtualPriceFromLpToken1 {
const NAME: &'static str = "get_virtual_price_from_lp_token1";
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<substreams::scalar::BigInt>
for GetVirtualPriceFromLpToken1
{
fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetVirtualPriceFromLpToken2 {
pub token: Vec<u8>,
pub handler_id: substreams::scalar::BigInt,
}
impl GetVirtualPriceFromLpToken2 {
const METHOD_ID: [u8; 4] = [68u8, 96u8, 246u8, 111u8];
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, ethabi::ParamType::Uint(256usize)],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
token: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
handler_id: {
let mut v = [0 as u8; 32];
values
.pop()
.expect(INTERNAL_ERR)
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(&[
ethabi::Token::Address(ethabi::Address::from_slice(&self.token)),
ethabi::Token::Uint(ethabi::Uint::from_big_endian(
match self.handler_id.clone().to_bytes_be() {
(num_bigint::Sign::Plus, bytes) => bytes,
(num_bigint::Sign::NoSign, bytes) => bytes,
(num_bigint::Sign::Minus, _) => {
panic!("negative numbers are not supported")
}
}
.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<substreams::scalar::BigInt, String> {
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())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok({
let mut v = [0 as u8; 32];
values
.pop()
.expect("one output data should have existed")
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
})
}
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<substreams::scalar::BigInt> {
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 GetVirtualPriceFromLpToken2 {
const NAME: &'static str = "get_virtual_price_from_lp_token2";
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<substreams::scalar::BigInt>
for GetVirtualPriceFromLpToken2
{
fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct IsMeta1 {
pub pool: Vec<u8>,
}
impl IsMeta1 {
const METHOD_ID: [u8; 4] = [228u8, 211u8, 50u8, 169u8];
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())
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
})
}
pub fn encode(&self) -> Vec<u8> {
let data =
ethabi::encode(&[ethabi::Token::Address(ethabi::Address::from_slice(&self.pool))]);
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> {
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())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok(values
.pop()
.expect("one output data should have existed")
.into_bool()
.expect(INTERNAL_ERR))
}
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<bool> {
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 IsMeta1 {
const NAME: &'static str = "is_meta1";
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<bool> for IsMeta1 {
fn output(data: &[u8]) -> Result<bool, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct IsMeta2 {
pub pool: Vec<u8>,
pub handler_id: substreams::scalar::BigInt,
}
impl IsMeta2 {
const METHOD_ID: [u8; 4] = [166u8, 68u8, 133u8, 161u8];
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, ethabi::ParamType::Uint(256usize)],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
handler_id: {
let mut v = [0 as u8; 32];
values
.pop()
.expect(INTERNAL_ERR)
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(&[
ethabi::Token::Address(ethabi::Address::from_slice(&self.pool)),
ethabi::Token::Uint(ethabi::Uint::from_big_endian(
match self.handler_id.clone().to_bytes_be() {
(num_bigint::Sign::Plus, bytes) => bytes,
(num_bigint::Sign::NoSign, bytes) => bytes,
(num_bigint::Sign::Minus, _) => {
panic!("negative numbers are not supported")
}
}
.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> {
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())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok(values
.pop()
.expect("one output data should have existed")
.into_bool()
.expect(INTERNAL_ERR))
}
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<bool> {
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 IsMeta2 {
const NAME: &'static str = "is_meta2";
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<bool> for IsMeta2 {
fn output(data: &[u8]) -> Result<bool, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct IsRegistered1 {
pub pool: Vec<u8>,
}
impl IsRegistered1 {
const METHOD_ID: [u8; 4] = [97u8, 158u8, 168u8, 6u8];
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())
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
})
}
pub fn encode(&self) -> Vec<u8> {
let data =
ethabi::encode(&[ethabi::Token::Address(ethabi::Address::from_slice(&self.pool))]);
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> {
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())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok(values
.pop()
.expect("one output data should have existed")
.into_bool()
.expect(INTERNAL_ERR))
}
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<bool> {
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 IsRegistered1 {
const NAME: &'static str = "is_registered1";
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<bool> for IsRegistered1 {
fn output(data: &[u8]) -> Result<bool, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct IsRegistered2 {
pub pool: Vec<u8>,
pub handler_id: substreams::scalar::BigInt,
}
impl IsRegistered2 {
const METHOD_ID: [u8; 4] = [201u8, 196u8, 243u8, 236u8];
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, ethabi::ParamType::Uint(256usize)],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
handler_id: {
let mut v = [0 as u8; 32];
values
.pop()
.expect(INTERNAL_ERR)
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(&[
ethabi::Token::Address(ethabi::Address::from_slice(&self.pool)),
ethabi::Token::Uint(ethabi::Uint::from_big_endian(
match self.handler_id.clone().to_bytes_be() {
(num_bigint::Sign::Plus, bytes) => bytes,
(num_bigint::Sign::NoSign, bytes) => bytes,
(num_bigint::Sign::Minus, _) => {
panic!("negative numbers are not supported")
}
}
.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> {
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())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok(values
.pop()
.expect("one output data should have existed")
.into_bool()
.expect(INTERNAL_ERR))
}
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<bool> {
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 IsRegistered2 {
const NAME: &'static str = "is_registered2";
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<bool> for IsRegistered2 {
fn output(data: &[u8]) -> Result<bool, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct Owner {}
impl Owner {
const METHOD_ID: [u8; 4] = [141u8, 165u8, 203u8, 91u8];
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<Vec<u8>, String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
let mut values = ethabi::decode(&[ethabi::ParamType::Address], data.as_ref())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok(values
.pop()
.expect("one output data should have existed")
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec())
}
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<Vec<u8>> {
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 Owner {
const NAME: &'static str = "owner";
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<Vec<u8>> for Owner {
fn output(data: &[u8]) -> Result<Vec<u8>, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct PoolCount {}
impl PoolCount {
const METHOD_ID: [u8; 4] = [149u8, 106u8, 174u8, 58u8];
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<substreams::scalar::BigInt, String> {
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())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok({
let mut v = [0 as u8; 32];
values
.pop()
.expect("one output data should have existed")
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
})
}
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<substreams::scalar::BigInt> {
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 PoolCount {
const NAME: &'static str = "pool_count";
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<substreams::scalar::BigInt> for PoolCount {
fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct PoolList {
pub index: substreams::scalar::BigInt,
}
impl PoolList {
const METHOD_ID: [u8; 4] = [58u8, 29u8, 93u8, 142u8];
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::Uint(256usize)], maybe_data.unwrap())
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
index: {
let mut v = [0 as u8; 32];
values
.pop()
.expect(INTERNAL_ERR)
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(&[ethabi::Token::Uint(ethabi::Uint::from_big_endian(
match self.index.clone().to_bytes_be() {
(num_bigint::Sign::Plus, bytes) => bytes,
(num_bigint::Sign::NoSign, bytes) => bytes,
(num_bigint::Sign::Minus, _) => {
panic!("negative numbers are not supported")
}
}
.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<Vec<u8>, String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<Vec<u8>, String> {
let mut values = ethabi::decode(&[ethabi::ParamType::Address], data.as_ref())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok(values
.pop()
.expect("one output data should have existed")
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec())
}
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<Vec<u8>> {
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 PoolList {
const NAME: &'static str = "pool_list";
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<Vec<u8>> for PoolList {
fn output(data: &[u8]) -> Result<Vec<u8>, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct RegistryLength {}
impl RegistryLength {
const METHOD_ID: [u8; 4] = [8u8, 50u8, 151u8, 210u8];
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<substreams::scalar::BigInt, String> {
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())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok({
let mut v = [0 as u8; 32];
values
.pop()
.expect("one output data should have existed")
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
})
}
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<substreams::scalar::BigInt> {
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 RegistryLength {
const NAME: &'static str = "registry_length";
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<substreams::scalar::BigInt> for RegistryLength {
fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct UpdateRegistryHandler {
pub index: substreams::scalar::BigInt,
pub registry_handler: Vec<u8>,
}
impl UpdateRegistryHandler {
const METHOD_ID: [u8; 4] = [13u8, 189u8, 201u8, 255u8];
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::Uint(256usize), ethabi::ParamType::Address],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
index: {
let mut v = [0 as u8; 32];
values
.pop()
.expect(INTERNAL_ERR)
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
registry_handler: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(&[
ethabi::Token::Uint(ethabi::Uint::from_big_endian(
match self.index.clone().to_bytes_be() {
(num_bigint::Sign::Plus, bytes) => bytes,
(num_bigint::Sign::NoSign, bytes) => bytes,
(num_bigint::Sign::Minus, _) => {
panic!("negative numbers are not supported")
}
}
.as_slice(),
)),
ethabi::Token::Address(ethabi::Address::from_slice(&self.registry_handler)),
]);
let mut encoded = Vec::with_capacity(4 + data.len());
encoded.extend(Self::METHOD_ID);
encoded.extend(data);
encoded
}
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,
}
}
}
impl substreams_ethereum::Function for UpdateRegistryHandler {
const NAME: &'static str = "update_registry_handler";
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()
}
}
}
/// Contract's events.
#[allow(dead_code, unused_imports, unused_variables)]
pub mod events {
use super::INTERNAL_ERR;
#[derive(Debug, Clone, PartialEq)]
pub struct CommitNewAdmin {
pub deadline: substreams::scalar::BigInt,
pub admin: Vec<u8>,
}
impl CommitNewAdmin {
const TOPIC_ID: [u8; 32] = [
24u8, 26u8, 163u8, 170u8, 23u8, 212u8, 203u8, 249u8, 146u8, 101u8, 221u8, 68u8, 67u8,
235u8, 160u8, 9u8, 67u8, 61u8, 60u8, 222u8, 121u8, 214u8, 1u8, 100u8, 253u8, 225u8,
209u8, 161u8, 146u8, 190u8, 185u8, 53u8,
];
pub fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
if log.topics.len() != 3usize {
return false;
}
if log.data.len() != 0usize {
return false;
}
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> {
Ok(Self {
deadline: {
let mut v = [0 as u8; 32];
ethabi::decode(
&[ethabi::ParamType::Uint(256usize)],
log.topics[1usize].as_ref(),
)
.map_err(|e| {
format!(
"unable to decode param 'deadline' from topic of type 'uint256': {:?}",
e
)
})?
.pop()
.expect(INTERNAL_ERR)
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
admin: ethabi::decode(&[ethabi::ParamType::Address], log.topics[2usize].as_ref())
.map_err(|e| {
format!(
"unable to decode param 'admin' from topic of type 'address': {:?}",
e
)
})?
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
})
}
}
impl substreams_ethereum::Event for CommitNewAdmin {
const NAME: &'static str = "CommitNewAdmin";
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> {
Self::decode(log)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct NewAdmin {
pub admin: Vec<u8>,
}
impl NewAdmin {
const TOPIC_ID: [u8; 32] = [
113u8, 97u8, 64u8, 113u8, 184u8, 141u8, 238u8, 94u8, 11u8, 42u8, 229u8, 120u8, 169u8,
221u8, 123u8, 46u8, 187u8, 233u8, 174u8, 131u8, 43u8, 164u8, 25u8, 220u8, 2u8, 66u8,
205u8, 6u8, 90u8, 41u8, 11u8, 108u8,
];
pub fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
if log.topics.len() != 2usize {
return false;
}
if log.data.len() != 0usize {
return false;
}
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> {
Ok(Self {
admin: ethabi::decode(&[ethabi::ParamType::Address], log.topics[1usize].as_ref())
.map_err(|e| {
format!(
"unable to decode param 'admin' from topic of type 'address': {:?}",
e
)
})?
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
})
}
}
impl substreams_ethereum::Event for NewAdmin {
const NAME: &'static str = "NewAdmin";
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> {
Self::decode(log)
}
}
}