Files
tycho-protocol-sdk/substreams/ethereum-curve/src/abi/main_registry.rs
0xMochan cad782f467 curve
2024-03-01 14:41:00 -05:00

5802 lines
240 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 AddMetapool1 {
pub pool: Vec<u8>,
pub n_coins: substreams::scalar::BigInt,
pub lp_token: Vec<u8>,
pub decimals: substreams::scalar::BigInt,
pub name: String,
}
impl AddMetapool1 {
const METHOD_ID: [u8; 4] = [206u8, 111u8, 148u8, 225u8];
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::Address,
ethabi::ParamType::Uint(256usize),
ethabi::ParamType::String,
],
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(),
n_coins: {
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)
},
lp_token: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
decimals: {
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)
},
name: values
.pop()
.expect(INTERNAL_ERR)
.into_string()
.expect(INTERNAL_ERR),
})
}
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.n_coins.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.lp_token),
),
ethabi::Token::Uint(
ethabi::Uint::from_big_endian(
match self.decimals.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::String(self.name.clone()),
],
);
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 AddMetapool1 {
const NAME: &'static str = "add_metapool1";
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 AddMetapool2 {
pub pool: Vec<u8>,
pub n_coins: substreams::scalar::BigInt,
pub lp_token: Vec<u8>,
pub decimals: substreams::scalar::BigInt,
pub name: String,
pub base_pool: Vec<u8>,
}
impl AddMetapool2 {
const METHOD_ID: [u8; 4] = [210u8, 160u8, 107u8, 175u8];
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::Address,
ethabi::ParamType::Uint(256usize),
ethabi::ParamType::String,
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(),
n_coins: {
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)
},
lp_token: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
decimals: {
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)
},
name: values
.pop()
.expect(INTERNAL_ERR)
.into_string()
.expect(INTERNAL_ERR),
base_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)),
ethabi::Token::Uint(
ethabi::Uint::from_big_endian(
match self.n_coins.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.lp_token),
),
ethabi::Token::Uint(
ethabi::Uint::from_big_endian(
match self.decimals.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::String(self.name.clone()),
ethabi::Token::Address(
ethabi::Address::from_slice(&self.base_pool),
),
],
);
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 AddMetapool2 {
const NAME: &'static str = "add_metapool2";
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 AddPool {
pub pool: Vec<u8>,
pub n_coins: substreams::scalar::BigInt,
pub lp_token: Vec<u8>,
pub rate_info: [u8; 32usize],
pub decimals: substreams::scalar::BigInt,
pub underlying_decimals: substreams::scalar::BigInt,
pub has_initial_a: bool,
pub is_v1: bool,
pub name: String,
}
impl AddPool {
const METHOD_ID: [u8; 4] = [153u8, 32u8, 154u8, 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),
ethabi::ParamType::Address,
ethabi::ParamType::FixedBytes(32usize),
ethabi::ParamType::Uint(256usize),
ethabi::ParamType::Uint(256usize),
ethabi::ParamType::Bool,
ethabi::ParamType::Bool,
ethabi::ParamType::String,
],
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(),
n_coins: {
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)
},
lp_token: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
rate_info: {
let mut result = [0u8; 32];
let v = values
.pop()
.expect(INTERNAL_ERR)
.into_fixed_bytes()
.expect(INTERNAL_ERR);
result.copy_from_slice(&v);
result
},
decimals: {
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)
},
underlying_decimals: {
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)
},
has_initial_a: values
.pop()
.expect(INTERNAL_ERR)
.into_bool()
.expect(INTERNAL_ERR),
is_v1: values
.pop()
.expect(INTERNAL_ERR)
.into_bool()
.expect(INTERNAL_ERR),
name: values
.pop()
.expect(INTERNAL_ERR)
.into_string()
.expect(INTERNAL_ERR),
})
}
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.n_coins.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.lp_token),
),
ethabi::Token::FixedBytes(self.rate_info.as_ref().to_vec()),
ethabi::Token::Uint(
ethabi::Uint::from_big_endian(
match self.decimals.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.underlying_decimals.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::Bool(self.has_initial_a.clone()),
ethabi::Token::Bool(self.is_v1.clone()),
ethabi::Token::String(self.name.clone()),
],
);
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 AddPool {
const NAME: &'static str = "add_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()
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct AddPoolWithoutUnderlying {
pub pool: Vec<u8>,
pub n_coins: substreams::scalar::BigInt,
pub lp_token: Vec<u8>,
pub rate_info: [u8; 32usize],
pub decimals: substreams::scalar::BigInt,
pub use_rates: substreams::scalar::BigInt,
pub has_initial_a: bool,
pub is_v1: bool,
pub name: String,
}
impl AddPoolWithoutUnderlying {
const METHOD_ID: [u8; 4] = [220u8, 238u8, 134u8, 163u8];
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::Address,
ethabi::ParamType::FixedBytes(32usize),
ethabi::ParamType::Uint(256usize),
ethabi::ParamType::Uint(256usize),
ethabi::ParamType::Bool,
ethabi::ParamType::Bool,
ethabi::ParamType::String,
],
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(),
n_coins: {
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)
},
lp_token: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
rate_info: {
let mut result = [0u8; 32];
let v = values
.pop()
.expect(INTERNAL_ERR)
.into_fixed_bytes()
.expect(INTERNAL_ERR);
result.copy_from_slice(&v);
result
},
decimals: {
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)
},
use_rates: {
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)
},
has_initial_a: values
.pop()
.expect(INTERNAL_ERR)
.into_bool()
.expect(INTERNAL_ERR),
is_v1: values
.pop()
.expect(INTERNAL_ERR)
.into_bool()
.expect(INTERNAL_ERR),
name: values
.pop()
.expect(INTERNAL_ERR)
.into_string()
.expect(INTERNAL_ERR),
})
}
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.n_coins.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.lp_token),
),
ethabi::Token::FixedBytes(self.rate_info.as_ref().to_vec()),
ethabi::Token::Uint(
ethabi::Uint::from_big_endian(
match self.decimals.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.use_rates.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::Bool(self.has_initial_a.clone()),
ethabi::Token::Bool(self.is_v1.clone()),
ethabi::Token::String(self.name.clone()),
],
);
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 AddPoolWithoutUnderlying {
const NAME: &'static str = "add_pool_without_underlying";
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 BatchSetPoolAssetType {
pub pools: [Vec<u8>; 32usize],
pub asset_types: [substreams::scalar::BigInt; 32usize],
}
impl BatchSetPoolAssetType {
const METHOD_ID: [u8; 4] = [117u8, 66u8, 240u8, 120u8];
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::FixedArray(
Box::new(ethabi::ParamType::Address),
32usize,
),
ethabi::ParamType::FixedArray(
Box::new(ethabi::ParamType::Uint(256usize)),
32usize,
),
],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
pools: {
let mut iter = values
.pop()
.expect(INTERNAL_ERR)
.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),
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),
iter.next().expect(INTERNAL_ERR),
iter.next().expect(INTERNAL_ERR),
]
},
asset_types: {
let mut iter = values
.pop()
.expect(INTERNAL_ERR)
.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),
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 encode(&self) -> Vec<u8> {
let data = ethabi::encode(
&[
{
let v = self
.pools
.iter()
.map(|inner| ethabi::Token::Address(
ethabi::Address::from_slice(&inner),
))
.collect();
ethabi::Token::FixedArray(v)
},
{
let v = self
.asset_types
.iter()
.map(|inner| ethabi::Token::Uint(
ethabi::Uint::from_big_endian(
match inner.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(),
),
))
.collect();
ethabi::Token::FixedArray(v)
},
],
);
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 BatchSetPoolAssetType {
const NAME: &'static str = "batch_set_pool_asset_type";
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 CoinCount {}
impl CoinCount {
const METHOD_ID: [u8; 4] = [80u8, 117u8, 119u8, 15u8];
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 CoinCount {
const NAME: &'static str = "coin_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 CoinCount {
fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct EstimateGasUsed {
pub pool: Vec<u8>,
pub from: Vec<u8>,
pub to: Vec<u8>,
}
impl EstimateGasUsed {
const METHOD_ID: [u8; 4] = [176u8, 187u8, 54u8, 91u8];
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, 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 EstimateGasUsed {
const NAME: &'static str = "estimate_gas_used";
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 EstimateGasUsed {
fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, 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 GaugeController {}
impl GaugeController {
const METHOD_ID: [u8; 4] = [216u8, 185u8, 160u8, 24u8];
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 GaugeController {
const NAME: &'static str = "gauge_controller";
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 GaugeController {
fn output(data: &[u8]) -> Result<Vec<u8>, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetA {
pub pool: Vec<u8>,
}
impl GetA {
const METHOD_ID: [u8; 4] = [85u8, 179u8, 11u8, 25u8];
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 GetA {
const NAME: &'static str = "get_A";
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 GetA {
fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetAdminBalances {
pub pool: Vec<u8>,
}
impl GetAdminBalances {
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 GetAdminBalances {
const NAME: &'static str = "get_admin_balances";
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 GetAdminBalances {
fn output(
data: &[u8],
) -> Result<[substreams::scalar::BigInt; 8usize], String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetBalances {
pub pool: Vec<u8>,
}
impl GetBalances {
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 GetBalances {
const NAME: &'static str = "get_balances";
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 GetBalances {
fn output(
data: &[u8],
) -> Result<[substreams::scalar::BigInt; 8usize], String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetCoin {
pub arg0: substreams::scalar::BigInt,
}
impl GetCoin {
const METHOD_ID: [u8; 4] = [69u8, 240u8, 219u8, 36u8];
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 GetCoin {
const NAME: &'static str = "get_coin";
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 GetCoin {
fn output(data: &[u8]) -> Result<Vec<u8>, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetCoinIndices {
pub pool: Vec<u8>,
pub from: Vec<u8>,
pub to: Vec<u8>,
}
impl GetCoinIndices {
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 GetCoinIndices {
const NAME: &'static str = "get_coin_indices";
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 GetCoinIndices {
fn output(
data: &[u8],
) -> Result<
(substreams::scalar::BigInt, substreams::scalar::BigInt, bool),
String,
> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetCoinSwapComplement {
pub coin: Vec<u8>,
pub index: substreams::scalar::BigInt,
}
impl GetCoinSwapComplement {
const METHOD_ID: [u8; 4] = [93u8, 33u8, 25u8, 130u8];
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 {
coin: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
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::Address(ethabi::Address::from_slice(&self.coin)),
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 GetCoinSwapComplement {
const NAME: &'static str = "get_coin_swap_complement";
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 GetCoinSwapComplement {
fn output(data: &[u8]) -> Result<Vec<u8>, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetCoinSwapCount {
pub coin: Vec<u8>,
}
impl GetCoinSwapCount {
const METHOD_ID: [u8; 4] = [152u8, 174u8, 222u8, 22u8];
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 {
coin: 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.coin))],
);
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 GetCoinSwapCount {
const NAME: &'static str = "get_coin_swap_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 GetCoinSwapCount {
fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetCoins {
pub pool: Vec<u8>,
}
impl GetCoins {
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 GetCoins {
const NAME: &'static str = "get_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<u8>; 8usize]> for GetCoins {
fn output(data: &[u8]) -> Result<[Vec<u8>; 8usize], String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetDecimals {
pub pool: Vec<u8>,
}
impl GetDecimals {
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 GetDecimals {
const NAME: &'static str = "get_decimals";
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 GetDecimals {
fn output(
data: &[u8],
) -> Result<[substreams::scalar::BigInt; 8usize], String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetFees {
pub pool: Vec<u8>,
}
impl GetFees {
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; 2usize], String> {
Self::output(call.return_data.as_ref())
}
pub fn output(
data: &[u8],
) -> Result<[substreams::scalar::BigInt; 2usize], String> {
let mut values = ethabi::decode(
&[
ethabi::ParamType::FixedArray(
Box::new(ethabi::ParamType::Uint(256usize)),
2usize,
),
],
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)]
})
}
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; 2usize]> {
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 GetFees {
const NAME: &'static str = "get_fees";
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; 2usize]>
for GetFees {
fn output(
data: &[u8],
) -> Result<[substreams::scalar::BigInt; 2usize], String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetGauges {
pub pool: Vec<u8>,
}
impl GetGauges {
const METHOD_ID: [u8; 4] = [86u8, 5u8, 159u8, 251u8];
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], [substreams::scalar::BigInt; 10usize]),
String,
> {
Self::output(call.return_data.as_ref())
}
pub fn output(
data: &[u8],
) -> Result<
([Vec<u8>; 10usize], [substreams::scalar::BigInt; 10usize]),
String,
> {
let mut values = ethabi::decode(
&[
ethabi::ParamType::FixedArray(
Box::new(ethabi::ParamType::Address),
10usize,
),
ethabi::ParamType::FixedArray(
Box::new(ethabi::ParamType::Int(128usize)),
10usize,
),
],
data.as_ref(),
)
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
values.reverse();
Ok((
{
let mut iter = values
.pop()
.expect(INTERNAL_ERR)
.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),
]
},
{
let mut iter = values
.pop()
.expect(INTERNAL_ERR)
.into_fixed_array()
.expect(INTERNAL_ERR)
.into_iter()
.map(|inner| {
let mut v = [0 as u8; 32];
inner
.into_int()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_signed_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<([Vec<u8>; 10usize], [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 GetGauges {
const NAME: &'static str = "get_gauges";
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], [substreams::scalar::BigInt; 10usize]),
> for GetGauges {
fn output(
data: &[u8],
) -> Result<
([Vec<u8>; 10usize], [substreams::scalar::BigInt; 10usize]),
String,
> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetLpToken {
pub arg0: Vec<u8>,
}
impl GetLpToken {
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 {
arg0: 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.arg0))],
);
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 GetLpToken {
const NAME: &'static str = "get_lp_token";
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 GetLpToken {
fn output(data: &[u8]) -> Result<Vec<u8>, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetNCoins {
pub pool: Vec<u8>,
}
impl GetNCoins {
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; 2usize], String> {
Self::output(call.return_data.as_ref())
}
pub fn output(
data: &[u8],
) -> Result<[substreams::scalar::BigInt; 2usize], String> {
let mut values = ethabi::decode(
&[
ethabi::ParamType::FixedArray(
Box::new(ethabi::ParamType::Uint(256usize)),
2usize,
),
],
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)]
})
}
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; 2usize]> {
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 GetNCoins {
const NAME: &'static str = "get_n_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<[substreams::scalar::BigInt; 2usize]>
for GetNCoins {
fn output(
data: &[u8],
) -> Result<[substreams::scalar::BigInt; 2usize], String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetParameters {
pub pool: Vec<u8>,
}
impl GetParameters {
const METHOD_ID: [u8; 4] = [31u8, 128u8, 169u8, 87u8];
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,
substreams::scalar::BigInt,
substreams::scalar::BigInt,
substreams::scalar::BigInt,
substreams::scalar::BigInt,
substreams::scalar::BigInt,
Vec<u8>,
substreams::scalar::BigInt,
substreams::scalar::BigInt,
substreams::scalar::BigInt,
),
String,
> {
Self::output(call.return_data.as_ref())
}
pub fn output(
data: &[u8],
) -> Result<
(
substreams::scalar::BigInt,
substreams::scalar::BigInt,
substreams::scalar::BigInt,
substreams::scalar::BigInt,
substreams::scalar::BigInt,
substreams::scalar::BigInt,
Vec<u8>,
substreams::scalar::BigInt,
substreams::scalar::BigInt,
substreams::scalar::BigInt,
),
String,
> {
let mut values = ethabi::decode(
&[
ethabi::ParamType::Uint(256usize),
ethabi::ParamType::Uint(256usize),
ethabi::ParamType::Uint(256usize),
ethabi::ParamType::Uint(256usize),
ethabi::ParamType::Uint(256usize),
ethabi::ParamType::Uint(256usize),
ethabi::ParamType::Address,
ethabi::ParamType::Uint(256usize),
ethabi::ParamType::Uint(256usize),
ethabi::ParamType::Uint(256usize),
],
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_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
{
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)
},
{
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)
},
{
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)
},
{
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)
},
{
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)
},
values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
{
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)
},
{
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)
},
{
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 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,
substreams::scalar::BigInt,
substreams::scalar::BigInt,
substreams::scalar::BigInt,
substreams::scalar::BigInt,
Vec<u8>,
substreams::scalar::BigInt,
substreams::scalar::BigInt,
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 GetParameters {
const NAME: &'static str = "get_parameters";
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,
substreams::scalar::BigInt,
substreams::scalar::BigInt,
substreams::scalar::BigInt,
substreams::scalar::BigInt,
Vec<u8>,
substreams::scalar::BigInt,
substreams::scalar::BigInt,
substreams::scalar::BigInt,
),
> for GetParameters {
fn output(
data: &[u8],
) -> Result<
(
substreams::scalar::BigInt,
substreams::scalar::BigInt,
substreams::scalar::BigInt,
substreams::scalar::BigInt,
substreams::scalar::BigInt,
substreams::scalar::BigInt,
Vec<u8>,
substreams::scalar::BigInt,
substreams::scalar::BigInt,
substreams::scalar::BigInt,
),
String,
> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetPoolAssetType {
pub pool: Vec<u8>,
}
impl GetPoolAssetType {
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 GetPoolAssetType {
const NAME: &'static str = "get_pool_asset_type";
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 GetPoolAssetType {
fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetPoolFromLpToken {
pub arg0: Vec<u8>,
}
impl GetPoolFromLpToken {
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 {
arg0: 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.arg0))],
);
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 GetPoolFromLpToken {
const NAME: &'static str = "get_pool_from_lp_token";
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 GetPoolFromLpToken {
fn output(data: &[u8]) -> Result<Vec<u8>, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetPoolName {
pub pool: Vec<u8>,
}
impl GetPoolName {
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 GetPoolName {
const NAME: &'static str = "get_pool_name";
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 GetPoolName {
fn output(data: &[u8]) -> Result<String, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetRates {
pub pool: Vec<u8>,
}
impl GetRates {
const METHOD_ID: [u8; 4] = [206u8, 153u8, 228u8, 90u8];
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 GetRates {
const NAME: &'static str = "get_rates";
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 GetRates {
fn output(
data: &[u8],
) -> Result<[substreams::scalar::BigInt; 8usize], String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetUnderlyingBalances {
pub pool: Vec<u8>,
}
impl GetUnderlyingBalances {
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 GetUnderlyingBalances {
const NAME: &'static str = "get_underlying_balances";
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 GetUnderlyingBalances {
fn output(
data: &[u8],
) -> Result<[substreams::scalar::BigInt; 8usize], String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetUnderlyingCoins {
pub pool: Vec<u8>,
}
impl GetUnderlyingCoins {
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 GetUnderlyingCoins {
const NAME: &'static str = "get_underlying_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<u8>; 8usize]>
for GetUnderlyingCoins {
fn output(data: &[u8]) -> Result<[Vec<u8>; 8usize], String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetUnderlyingDecimals {
pub pool: Vec<u8>,
}
impl GetUnderlyingDecimals {
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 GetUnderlyingDecimals {
const NAME: &'static str = "get_underlying_decimals";
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 GetUnderlyingDecimals {
fn output(
data: &[u8],
) -> Result<[substreams::scalar::BigInt; 8usize], String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetVirtualPriceFromLpToken {
pub token: Vec<u8>,
}
impl GetVirtualPriceFromLpToken {
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 GetVirtualPriceFromLpToken {
const NAME: &'static str = "get_virtual_price_from_lp_token";
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 GetVirtualPriceFromLpToken {
fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct IsMeta {
pub pool: Vec<u8>,
}
impl IsMeta {
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 IsMeta {
const NAME: &'static str = "is_meta";
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 IsMeta {
fn output(data: &[u8]) -> Result<bool, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct LastUpdated {}
impl LastUpdated {
const METHOD_ID: [u8; 4] = [104u8, 144u8, 9u8, 97u8];
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 LastUpdated {
const NAME: &'static str = "last_updated";
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 LastUpdated {
fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, 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 arg0: 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 {
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 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 RemovePool {
pub pool: Vec<u8>,
}
impl RemovePool {
const METHOD_ID: [u8; 4] = [71u8, 73u8, 50u8, 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 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 RemovePool {
const NAME: &'static str = "remove_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()
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct SetCoinGasEstimates {
pub addr: [Vec<u8>; 10usize],
pub amount: [substreams::scalar::BigInt; 10usize],
}
impl SetCoinGasEstimates {
const METHOD_ID: [u8; 4] = [35u8, 127u8, 137u8, 242u8];
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::FixedArray(
Box::new(ethabi::ParamType::Address),
10usize,
),
ethabi::ParamType::FixedArray(
Box::new(ethabi::ParamType::Uint(256usize)),
10usize,
),
],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
addr: {
let mut iter = values
.pop()
.expect(INTERNAL_ERR)
.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),
]
},
amount: {
let mut iter = values
.pop()
.expect(INTERNAL_ERR)
.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 encode(&self) -> Vec<u8> {
let data = ethabi::encode(
&[
{
let v = self
.addr
.iter()
.map(|inner| ethabi::Token::Address(
ethabi::Address::from_slice(&inner),
))
.collect();
ethabi::Token::FixedArray(v)
},
{
let v = self
.amount
.iter()
.map(|inner| ethabi::Token::Uint(
ethabi::Uint::from_big_endian(
match inner.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(),
),
))
.collect();
ethabi::Token::FixedArray(v)
},
],
);
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 SetCoinGasEstimates {
const NAME: &'static str = "set_coin_gas_estimates";
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 SetGasEstimateContract {
pub pool: Vec<u8>,
pub estimator: Vec<u8>,
}
impl SetGasEstimateContract {
const METHOD_ID: [u8; 4] = [202u8, 153u8, 27u8, 20u8];
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 {
pool: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
estimator: 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.estimator),
),
],
);
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 SetGasEstimateContract {
const NAME: &'static str = "set_gas_estimate_contract";
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 SetLiquidityGauges {
pub pool: Vec<u8>,
pub liquidity_gauges: [Vec<u8>; 10usize],
}
impl SetLiquidityGauges {
const METHOD_ID: [u8; 4] = [239u8, 107u8, 151u8, 136u8];
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::FixedArray(
Box::new(ethabi::ParamType::Address),
10usize,
),
],
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(),
liquidity_gauges: {
let mut iter = values
.pop()
.expect(INTERNAL_ERR)
.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 encode(&self) -> Vec<u8> {
let data = ethabi::encode(
&[
ethabi::Token::Address(ethabi::Address::from_slice(&self.pool)),
{
let v = self
.liquidity_gauges
.iter()
.map(|inner| ethabi::Token::Address(
ethabi::Address::from_slice(&inner),
))
.collect();
ethabi::Token::FixedArray(v)
},
],
);
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 SetLiquidityGauges {
const NAME: &'static str = "set_liquidity_gauges";
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 SetPoolAssetType {
pub pool: Vec<u8>,
pub asset_type: substreams::scalar::BigInt,
}
impl SetPoolAssetType {
const METHOD_ID: [u8; 4] = [9u8, 231u8, 103u8, 116u8];
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(),
asset_type: {
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.asset_type.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 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 SetPoolAssetType {
const NAME: &'static str = "set_pool_asset_type";
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 SetPoolGasEstimates {
pub addr: [Vec<u8>; 5usize],
pub amount: [[substreams::scalar::BigInt; 2usize]; 5usize],
}
impl SetPoolGasEstimates {
const METHOD_ID: [u8; 4] = [7u8, 51u8, 182u8, 122u8];
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::FixedArray(
Box::new(ethabi::ParamType::Address),
5usize,
),
ethabi::ParamType::FixedArray(
Box::new(
ethabi::ParamType::FixedArray(
Box::new(ethabi::ParamType::Uint(256usize)),
2usize,
),
),
5usize,
),
],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
addr: {
let mut iter = values
.pop()
.expect(INTERNAL_ERR)
.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),
]
},
amount: {
let mut iter = values
.pop()
.expect(INTERNAL_ERR)
.into_fixed_array()
.expect(INTERNAL_ERR)
.into_iter()
.map(|inner| {
let mut iter = inner
.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),
]
},
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(
&[
{
let v = self
.addr
.iter()
.map(|inner| ethabi::Token::Address(
ethabi::Address::from_slice(&inner),
))
.collect();
ethabi::Token::FixedArray(v)
},
{
let v = self
.amount
.iter()
.map(|inner| {
let v = inner
.iter()
.map(|inner| ethabi::Token::Uint(
ethabi::Uint::from_big_endian(
match inner.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(),
),
))
.collect();
ethabi::Token::FixedArray(v)
})
.collect();
ethabi::Token::FixedArray(v)
},
],
);
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 SetPoolGasEstimates {
const NAME: &'static str = "set_pool_gas_estimates";
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 PoolAdded {
pub pool: Vec<u8>,
pub rate_method_id: Vec<u8>,
}
impl PoolAdded {
const TOPIC_ID: [u8; 32] = [
228u8,
133u8,
193u8,
100u8,
121u8,
171u8,
112u8,
146u8,
192u8,
179u8,
252u8,
70u8,
73u8,
132u8,
60u8,
6u8,
190u8,
127u8,
7u8,
33u8,
148u8,
103u8,
82u8,
97u8,
89u8,
12u8,
132u8,
71u8,
58u8,
176u8,
174u8,
169u8,
];
pub fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
if log.topics.len() != 2usize {
return false;
}
if log.data.len() < 64usize {
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> {
let mut values = ethabi::decode(
&[ethabi::ParamType::Bytes],
log.data.as_ref(),
)
.map_err(|e| format!("unable to decode log.data: {:?}", e))?;
values.reverse();
Ok(Self {
pool: ethabi::decode(
&[ethabi::ParamType::Address],
log.topics[1usize].as_ref(),
)
.map_err(|e| {
format!(
"unable to decode param 'pool' from topic of type 'address': {:?}",
e
)
})?
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
rate_method_id: values
.pop()
.expect(INTERNAL_ERR)
.into_bytes()
.expect(INTERNAL_ERR),
})
}
}
impl substreams_ethereum::Event for PoolAdded {
const NAME: &'static str = "PoolAdded";
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 PoolRemoved {
pub pool: Vec<u8>,
}
impl PoolRemoved {
const TOPIC_ID: [u8; 32] = [
65u8,
6u8,
223u8,
218u8,
165u8,
119u8,
87u8,
61u8,
181u8,
28u8,
12u8,
169u8,
63u8,
118u8,
109u8,
190u8,
223u8,
160u8,
117u8,
143u8,
170u8,
46u8,
127u8,
91u8,
205u8,
183u8,
193u8,
66u8,
190u8,
128u8,
60u8,
63u8,
];
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 {
pool: ethabi::decode(
&[ethabi::ParamType::Address],
log.topics[1usize].as_ref(),
)
.map_err(|e| {
format!(
"unable to decode param 'pool' from topic of type 'address': {:?}",
e
)
})?
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
})
}
}
impl substreams_ethereum::Event for PoolRemoved {
const NAME: &'static str = "PoolRemoved";
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)
}
}
}