Files
tycho-protocol-sdk/substreams/ethereum-balancer-v2/src/abi/managed_pool_factory.rs
Zizou eea8b27112 fix(balancer): miscellaneous improvements before resync (#104)
* fix(balancer): ignore self balance change

Euler pool emit a balance change for the pool itself. We don't want to have it because it's an unknown token from Tycho's perspective.

example: https://etherscan.io/tx/0x4a9ea683052afefdae3d189862868c3a7dc8f431d1d9828b6bfd9451a8816426#eventlog#338

* refactor(balancer): rename balancer module to balancer-v2

* ci: make clippy happy

---------

Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
2024-10-31 15:12:37 +02:00

1569 lines
61 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 Create {
pub params: (String, String, Vec<Vec<u8>>),
pub settings_params: (
Vec<Vec<u8>>,
Vec<substreams::scalar::BigInt>,
substreams::scalar::BigInt,
bool,
bool,
substreams::scalar::BigInt,
substreams::scalar::BigInt,
),
pub owner: Vec<u8>,
pub salt: [u8; 32usize],
}
impl Create {
const METHOD_ID: [u8; 4] = [115u8, 4u8, 184u8, 185u8];
pub fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result<Self, String> {
let maybe_data = call.input.get(4..);
if maybe_data.is_none() {
return Err("no data to decode".to_string());
}
let mut values = ethabi::decode(
&[
ethabi::ParamType::Tuple(vec![
ethabi::ParamType::String,
ethabi::ParamType::String,
ethabi::ParamType::Array(Box::new(ethabi::ParamType::Address)),
]),
ethabi::ParamType::Tuple(vec![
ethabi::ParamType::Array(Box::new(ethabi::ParamType::Address)),
ethabi::ParamType::Array(Box::new(ethabi::ParamType::Uint(256usize))),
ethabi::ParamType::Uint(256usize),
ethabi::ParamType::Bool,
ethabi::ParamType::Bool,
ethabi::ParamType::Uint(256usize),
ethabi::ParamType::Uint(256usize),
]),
ethabi::ParamType::Address,
ethabi::ParamType::FixedBytes(32usize),
],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
params: {
let tuple_elements = values
.pop()
.expect(INTERNAL_ERR)
.into_tuple()
.expect(INTERNAL_ERR);
(
tuple_elements[0usize]
.clone()
.into_string()
.expect(INTERNAL_ERR),
tuple_elements[1usize]
.clone()
.into_string()
.expect(INTERNAL_ERR),
tuple_elements[2usize]
.clone()
.into_array()
.expect(INTERNAL_ERR)
.into_iter()
.map(|inner| {
inner
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec()
})
.collect(),
)
},
settings_params: {
let tuple_elements = values
.pop()
.expect(INTERNAL_ERR)
.into_tuple()
.expect(INTERNAL_ERR);
(
tuple_elements[0usize]
.clone()
.into_array()
.expect(INTERNAL_ERR)
.into_iter()
.map(|inner| {
inner
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec()
})
.collect(),
tuple_elements[1usize]
.clone()
.into_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)
})
.collect(),
{
let mut v = [0 as u8; 32];
tuple_elements[2usize]
.clone()
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
tuple_elements[3usize]
.clone()
.into_bool()
.expect(INTERNAL_ERR),
tuple_elements[4usize]
.clone()
.into_bool()
.expect(INTERNAL_ERR),
{
let mut v = [0 as u8; 32];
tuple_elements[5usize]
.clone()
.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];
tuple_elements[6usize]
.clone()
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
)
},
owner: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
salt: {
let mut result = [0u8; 32];
let v = values
.pop()
.expect(INTERNAL_ERR)
.into_fixed_bytes()
.expect(INTERNAL_ERR);
result.copy_from_slice(&v);
result
},
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(&[
ethabi::Token::Tuple(vec![
ethabi::Token::String(self.params.0.clone()),
ethabi::Token::String(self.params.1.clone()),
{
let v = self
.params
.2
.iter()
.map(|inner| {
ethabi::Token::Address(ethabi::Address::from_slice(&inner))
})
.collect();
ethabi::Token::Array(v)
},
]),
ethabi::Token::Tuple(vec![
{
let v = self
.settings_params
.0
.iter()
.map(|inner| {
ethabi::Token::Address(ethabi::Address::from_slice(&inner))
})
.collect();
ethabi::Token::Array(v)
},
{
let v = self
.settings_params
.1
.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::Array(v)
},
ethabi::Token::Uint(ethabi::Uint::from_big_endian(
match self
.settings_params
.2
.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.settings_params.3.clone()),
ethabi::Token::Bool(self.settings_params.4.clone()),
ethabi::Token::Uint(ethabi::Uint::from_big_endian(
match self
.settings_params
.5
.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
.settings_params
.6
.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.owner)),
ethabi::Token::FixedBytes(self.salt.as_ref().to_vec()),
]);
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 Create {
const NAME: &'static str = "create";
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 Create {
fn output(data: &[u8]) -> Result<Vec<u8>, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct Disable {}
impl Disable {
const METHOD_ID: [u8; 4] = [47u8, 39u8, 112u8, 219u8];
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 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 Disable {
const NAME: &'static str = "disable";
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 GetActionId {
pub selector: [u8; 4usize],
}
impl GetActionId {
const METHOD_ID: [u8; 4] = [133u8, 28u8, 27u8, 179u8];
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::FixedBytes(4usize)], maybe_data.unwrap())
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
selector: {
let mut result = [0u8; 4];
let v = values
.pop()
.expect(INTERNAL_ERR)
.into_fixed_bytes()
.expect(INTERNAL_ERR);
result.copy_from_slice(&v);
result
},
})
}
pub fn encode(&self) -> Vec<u8> {
let data =
ethabi::encode(&[ethabi::Token::FixedBytes(self.selector.as_ref().to_vec())]);
let mut encoded = Vec::with_capacity(4 + data.len());
encoded.extend(Self::METHOD_ID);
encoded.extend(data);
encoded
}
pub fn output_call(
call: &substreams_ethereum::pb::eth::v2::Call,
) -> Result<[u8; 32usize], String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<[u8; 32usize], String> {
let mut values =
ethabi::decode(&[ethabi::ParamType::FixedBytes(32usize)], data.as_ref())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok({
let mut result = [0u8; 32];
let v = values
.pop()
.expect("one output data should have existed")
.into_fixed_bytes()
.expect(INTERNAL_ERR);
result.copy_from_slice(&v);
result
})
}
pub fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool {
match call.input.get(0..4) {
Some(signature) => Self::METHOD_ID == signature,
None => false,
}
}
pub fn call(&self, address: Vec<u8>) -> Option<[u8; 32usize]> {
use substreams_ethereum::pb::eth::rpc;
let rpc_calls = rpc::RpcCalls {
calls: vec![rpc::RpcCall { to_addr: address, data: self.encode() }],
};
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
let response = responses
.get(0)
.expect("one response should have existed");
if response.failed {
return None;
}
match Self::output(response.raw.as_ref()) {
Ok(data) => Some(data),
Err(err) => {
use substreams_ethereum::Function;
substreams::log::info!(
"Call output for function `{}` failed to decode with error: {}",
Self::NAME,
err
);
None
}
}
}
}
impl substreams_ethereum::Function for GetActionId {
const NAME: &'static str = "getActionId";
fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool {
Self::match_call(call)
}
fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result<Self, String> {
Self::decode(call)
}
fn encode(&self) -> Vec<u8> {
self.encode()
}
}
impl substreams_ethereum::rpc::RPCDecodable<[u8; 32usize]> for GetActionId {
fn output(data: &[u8]) -> Result<[u8; 32usize], String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetAuthorizer {}
impl GetAuthorizer {
const METHOD_ID: [u8; 4] = [170u8, 171u8, 173u8, 197u8];
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 GetAuthorizer {
const NAME: &'static str = "getAuthorizer";
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 GetAuthorizer {
fn output(data: &[u8]) -> Result<Vec<u8>, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetCreationCode {}
impl GetCreationCode {
const METHOD_ID: [u8; 4] = [0u8, 193u8, 148u8, 219u8];
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::Bytes], data.as_ref())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok(values
.pop()
.expect("one output data should have existed")
.into_bytes()
.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>> {
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 GetCreationCode {
const NAME: &'static str = "getCreationCode";
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 GetCreationCode {
fn output(data: &[u8]) -> Result<Vec<u8>, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetCreationCodeContracts {}
impl GetCreationCodeContracts {
const METHOD_ID: [u8; 4] = [23u8, 68u8, 129u8, 250u8];
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>, Vec<u8>), String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<(Vec<u8>, Vec<u8>), String> {
let mut values = ethabi::decode(
&[ethabi::ParamType::Address, ethabi::ParamType::Address],
data.as_ref(),
)
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
values.reverse();
Ok((
values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
values
.pop()
.expect(INTERNAL_ERR)
.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>, 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 GetCreationCodeContracts {
const NAME: &'static str = "getCreationCodeContracts";
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>, Vec<u8>)> for GetCreationCodeContracts {
fn output(data: &[u8]) -> Result<(Vec<u8>, Vec<u8>), String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetPauseConfiguration {}
impl GetPauseConfiguration {
const METHOD_ID: [u8; 4] = [45u8, 164u8, 124u8, 64u8];
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, substreams::scalar::BigInt), String> {
Self::output(call.return_data.as_ref())
}
pub fn output(
data: &[u8],
) -> Result<(substreams::scalar::BigInt, substreams::scalar::BigInt), String> {
let mut values = ethabi::decode(
&[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)
},
))
}
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)> {
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 GetPauseConfiguration {
const NAME: &'static str = "getPauseConfiguration";
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,
)> for GetPauseConfiguration
{
fn output(
data: &[u8],
) -> Result<(substreams::scalar::BigInt, substreams::scalar::BigInt), String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetPoolVersion {}
impl GetPoolVersion {
const METHOD_ID: [u8; 4] = [63u8, 129u8, 155u8, 111u8];
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<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 GetPoolVersion {
const NAME: &'static str = "getPoolVersion";
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 GetPoolVersion {
fn output(data: &[u8]) -> Result<String, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetProtocolFeePercentagesProvider {}
impl GetProtocolFeePercentagesProvider {
const METHOD_ID: [u8; 4] = [115u8, 146u8, 56u8, 214u8];
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 GetProtocolFeePercentagesProvider {
const NAME: &'static str = "getProtocolFeePercentagesProvider";
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 GetProtocolFeePercentagesProvider {
fn output(data: &[u8]) -> Result<Vec<u8>, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetRecoveryModeHelper {}
impl GetRecoveryModeHelper {
const METHOD_ID: [u8; 4] = [138u8, 71u8, 174u8, 59u8];
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 GetRecoveryModeHelper {
const NAME: &'static str = "getRecoveryModeHelper";
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 GetRecoveryModeHelper {
fn output(data: &[u8]) -> Result<Vec<u8>, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetVault {}
impl GetVault {
const METHOD_ID: [u8; 4] = [141u8, 146u8, 138u8, 248u8];
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 GetVault {
const NAME: &'static str = "getVault";
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 GetVault {
fn output(data: &[u8]) -> Result<Vec<u8>, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetWeightedMath {}
impl GetWeightedMath {
const METHOD_ID: [u8; 4] = [80u8, 143u8, 14u8, 174u8];
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 GetWeightedMath {
const NAME: &'static str = "getWeightedMath";
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 GetWeightedMath {
fn output(data: &[u8]) -> Result<Vec<u8>, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct IsDisabled {}
impl IsDisabled {
const METHOD_ID: [u8; 4] = [108u8, 87u8, 245u8, 169u8];
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<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 IsDisabled {
const NAME: &'static str = "isDisabled";
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 IsDisabled {
fn output(data: &[u8]) -> Result<bool, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct IsPoolFromFactory {
pub pool: Vec<u8>,
}
impl IsPoolFromFactory {
const METHOD_ID: [u8; 4] = [102u8, 52u8, 183u8, 83u8];
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 IsPoolFromFactory {
const NAME: &'static str = "isPoolFromFactory";
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 IsPoolFromFactory {
fn output(data: &[u8]) -> Result<bool, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct Version {}
impl Version {
const METHOD_ID: [u8; 4] = [84u8, 253u8, 77u8, 80u8];
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<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 Version {
const NAME: &'static str = "version";
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 Version {
fn output(data: &[u8]) -> Result<String, String> {
Self::output(data)
}
}
}
/// Contract's events.
#[allow(dead_code, unused_imports, unused_variables)]
pub mod events {
use super::INTERNAL_ERR;
#[derive(Debug, Clone, PartialEq)]
pub struct FactoryDisabled {}
impl FactoryDisabled {
const TOPIC_ID: [u8; 32] = [
67u8, 42u8, 203u8, 253u8, 102u8, 45u8, 187u8, 93u8, 139u8, 55u8, 131u8, 132u8, 166u8,
113u8, 89u8, 180u8, 124u8, 169u8, 208u8, 241u8, 183u8, 159u8, 151u8, 207u8, 100u8,
207u8, 133u8, 133u8, 250u8, 54u8, 45u8, 80u8,
];
pub fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
if log.topics.len() != 1usize {
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 {})
}
}
impl substreams_ethereum::Event for FactoryDisabled {
const NAME: &'static str = "FactoryDisabled";
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 PoolCreated {
pub pool: Vec<u8>,
}
impl PoolCreated {
const TOPIC_ID: [u8; 32] = [
131u8, 164u8, 143u8, 188u8, 252u8, 153u8, 19u8, 53u8, 49u8, 78u8, 116u8, 208u8, 73u8,
106u8, 171u8, 106u8, 25u8, 135u8, 233u8, 146u8, 221u8, 200u8, 93u8, 221u8, 188u8,
196u8, 214u8, 221u8, 110u8, 242u8, 233u8, 252u8,
];
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 PoolCreated {
const NAME: &'static str = "PoolCreated";
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)
}
}
}