Files
tycho-protocol-sdk/substreams/ethereum-balancer-v3/src/abi/vault_contract.rs
mrBovo fc0fb1e540 BalancerV3: SwapAdapter and Substreams (#126)
* feat: add balancer swapAdapter and Substreams

* fix: undo tycho-substreams logs, ignore abi on rustmft

* ci: prevent warnings from failing CI

* ci: skip size check on CI

* chore: forge fmt

* feat: vault balance from storage

Vault contract tokenBalance message are set according to the vault
storage changes in the `_reserveOf` storage variable VaultStorage.sol
contract
This was the culprit that caused the failure in simulation since
balancer enforces the invariant that `token.balanceOf(vault_addr) == _reservesOf[token]`

* ci: warnings

* fix: avoid duplicated balance changes

* fix: order by ordinal

* chore: format

* feat: extract new contracts before extracting balance changes

* feat: skip unnecessary steps if no balance change is found

* refactor: filter out account balances for tokens that aren't part of any protocol components.

On the indexer side, when we receive an account balance, we need to know about the token. This commit ensure that the token was introduced before we emit any account balance with it.

* refactor: don't index liquidity buffers.

Liquidity buffers rely on rate providers. Therefore we need DCI (feature to be able to index previously created contract) to deal with them.

* refactor: cleanup tests and add docstrings

* chore: lock tycho-substreams version

* ci: set Foundry workflow to use stable foundry

* feat(DCI): Add DCI Entrypoints to BalancerV3 components (#218)

* refactor: fix typo in weighted_pool_factory_contract name

* feat: add rate_providers static attributes

* feat: add DCI entrypoints to BalancerV3 components

* fix: set default trade price to Fraction(0, 1)

* feat: remove buffers as components

Buffers are to be used internally by Boosted pools (stable/weighted pools that use ERC4626 tokens). They are not to be treated as a separate swap component.

* test: update test blocks

Extend tests some tests block range to ensure liquidity was added to the pool and can be simulated on

* feat: remove buffers as components

Remove balance updates for buffer components

* feat: listen for pool pause/unpause events

* chore: formating

* fix: encoding call data

* test: update Balancer V3 tests to use DCI

* test: set indexer log level to info

* docs: add comment on support of boosted pools

* feat: update balancer v3 package version

---------

Co-authored-by: Thales <thales@datarevenue.com>
Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
Co-authored-by: Louise Poole <louise@datarevenue.com>
Co-authored-by: Louise Poole <louisecarmenpoole@gmail.com>
2025-06-26 12:19:39 +02:00

4856 lines
171 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 AddLiquidity {
pub params: (
Vec<u8>,
Vec<u8>,
Vec<substreams::scalar::BigInt>,
substreams::scalar::BigInt,
substreams::scalar::BigInt,
Vec<u8>,
),
}
impl AddLiquidity {
const METHOD_ID: [u8; 4] = [74u8, 242u8, 158u8, 196u8];
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::Address, ethabi::ParamType::Address,
ethabi::ParamType::Array(Box::new(ethabi::ParamType::Uint(256usize))),
ethabi::ParamType::Uint(256usize),
ethabi::ParamType::Uint(8usize), ethabi::ParamType::Bytes
],
),
],
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_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
tuple_elements[1usize]
.clone()
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
tuple_elements[2usize]
.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[3usize]
.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[4usize]
.clone()
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
tuple_elements[5usize].clone().into_bytes().expect(INTERNAL_ERR),
)
},
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(
&[
ethabi::Token::Tuple(
vec![
ethabi::Token::Address(ethabi::Address::from_slice(& self
.params.0)),
ethabi::Token::Address(ethabi::Address::from_slice(& self
.params.1)), { let v = self.params.2.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
.params.3.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
.params.4.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::Bytes(self.params.5.clone())
],
),
],
);
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<substreams::scalar::BigInt>, substreams::scalar::BigInt, Vec<u8>),
String,
> {
Self::output(call.return_data.as_ref())
}
pub fn output(
data: &[u8],
) -> Result<
(Vec<substreams::scalar::BigInt>, substreams::scalar::BigInt, Vec<u8>),
String,
> {
let mut values = ethabi::decode(
&[
ethabi::ParamType::Array(
Box::new(ethabi::ParamType::Uint(256usize)),
),
ethabi::ParamType::Uint(256usize),
ethabi::ParamType::Bytes,
],
data.as_ref(),
)
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
values.reverse();
Ok((
values
.pop()
.expect(INTERNAL_ERR)
.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];
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_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<substreams::scalar::BigInt>, substreams::scalar::BigInt, 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 AddLiquidity {
const NAME: &'static str = "addLiquidity";
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<substreams::scalar::BigInt>, substreams::scalar::BigInt, Vec<u8>),
> for AddLiquidity {
fn output(
data: &[u8],
) -> Result<
(Vec<substreams::scalar::BigInt>, substreams::scalar::BigInt, Vec<u8>),
String,
> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct Erc4626BufferWrapOrUnwrap {
pub params: (
substreams::scalar::BigInt,
substreams::scalar::BigInt,
Vec<u8>,
substreams::scalar::BigInt,
substreams::scalar::BigInt,
),
}
impl Erc4626BufferWrapOrUnwrap {
const METHOD_ID: [u8; 4] = [67u8, 88u8, 59u8, 229u8];
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::Uint(8usize),
ethabi::ParamType::Uint(8usize), ethabi::ParamType::Address,
ethabi::ParamType::Uint(256usize),
ethabi::ParamType::Uint(256usize)
],
),
],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
params: {
let tuple_elements = values
.pop()
.expect(INTERNAL_ERR)
.into_tuple()
.expect(INTERNAL_ERR);
(
{
let mut v = [0 as u8; 32];
tuple_elements[0usize]
.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[1usize]
.clone()
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
tuple_elements[2usize]
.clone()
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
{
let mut v = [0 as u8; 32];
tuple_elements[3usize]
.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[4usize]
.clone()
.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::Tuple(
vec![
ethabi::Token::Uint(ethabi::Uint::from_big_endian(match self
.params.0.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
.params.1.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
.params.2)),
ethabi::Token::Uint(ethabi::Uint::from_big_endian(match self
.params.3.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
.params.4.clone().to_bytes_be() { (num_bigint::Sign::Plus,
bytes) => bytes, (num_bigint::Sign::NoSign, bytes) => bytes,
(num_bigint::Sign::Minus, _) => {
panic!("negative numbers are not supported") }, }
.as_slice(),),)
],
),
],
);
let mut encoded = Vec::with_capacity(4 + data.len());
encoded.extend(Self::METHOD_ID);
encoded.extend(data);
encoded
}
pub fn output_call(
call: &substreams_ethereum::pb::eth::v2::Call,
) -> Result<
(
substreams::scalar::BigInt,
substreams::scalar::BigInt,
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,
),
String,
> {
let mut values = ethabi::decode(
&[
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)
},
))
}
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,
),
> {
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 Erc4626BufferWrapOrUnwrap {
const NAME: &'static str = "erc4626BufferWrapOrUnwrap";
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,
),
> for Erc4626BufferWrapOrUnwrap {
fn output(
data: &[u8],
) -> Result<
(
substreams::scalar::BigInt,
substreams::scalar::BigInt,
substreams::scalar::BigInt,
),
String,
> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetPoolTokenCountAndIndexOfToken {
pub pool: Vec<u8>,
pub token: Vec<u8>,
}
impl GetPoolTokenCountAndIndexOfToken {
const METHOD_ID: [u8; 4] = [201u8, 193u8, 102u8, 27u8];
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(),
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.pool)),
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, 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 GetPoolTokenCountAndIndexOfToken {
const NAME: &'static str = "getPoolTokenCountAndIndexOfToken";
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 GetPoolTokenCountAndIndexOfToken {
fn output(
data: &[u8],
) -> Result<(substreams::scalar::BigInt, substreams::scalar::BigInt), String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct GetVaultExtension {}
impl GetVaultExtension {
const METHOD_ID: [u8; 4] = [185u8, 168u8, 239u8, 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>, 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 GetVaultExtension {
const NAME: &'static str = "getVaultExtension";
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 GetVaultExtension {
fn output(data: &[u8]) -> Result<Vec<u8>, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct ReentrancyGuardEntered {}
impl ReentrancyGuardEntered {
const METHOD_ID: [u8; 4] = [210u8, 199u8, 37u8, 224u8];
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 ReentrancyGuardEntered {
const NAME: &'static str = "reentrancyGuardEntered";
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 ReentrancyGuardEntered {
fn output(data: &[u8]) -> Result<bool, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct RemoveLiquidity {
pub params: (
Vec<u8>,
Vec<u8>,
substreams::scalar::BigInt,
Vec<substreams::scalar::BigInt>,
substreams::scalar::BigInt,
Vec<u8>,
),
}
impl RemoveLiquidity {
const METHOD_ID: [u8; 4] = [33u8, 69u8, 120u8, 151u8];
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::Address, ethabi::ParamType::Address,
ethabi::ParamType::Uint(256usize),
ethabi::ParamType::Array(Box::new(ethabi::ParamType::Uint(256usize))),
ethabi::ParamType::Uint(8usize), ethabi::ParamType::Bytes
],
),
],
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_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
tuple_elements[1usize]
.clone()
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
{
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_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[4usize]
.clone()
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
tuple_elements[5usize].clone().into_bytes().expect(INTERNAL_ERR),
)
},
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(
&[
ethabi::Token::Tuple(
vec![
ethabi::Token::Address(ethabi::Address::from_slice(& self
.params.0)),
ethabi::Token::Address(ethabi::Address::from_slice(& self
.params.1)),
ethabi::Token::Uint(ethabi::Uint::from_big_endian(match self
.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(),),), { let v = self.params.3.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
.params.4.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::Bytes(self.params.5.clone())
],
),
],
);
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, Vec<substreams::scalar::BigInt>, Vec<u8>),
String,
> {
Self::output(call.return_data.as_ref())
}
pub fn output(
data: &[u8],
) -> Result<
(substreams::scalar::BigInt, Vec<substreams::scalar::BigInt>, Vec<u8>),
String,
> {
let mut values = ethabi::decode(
&[
ethabi::ParamType::Uint(256usize),
ethabi::ParamType::Array(
Box::new(ethabi::ParamType::Uint(256usize)),
),
ethabi::ParamType::Bytes,
],
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)
},
values
.pop()
.expect(INTERNAL_ERR)
.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(),
values.pop().expect(INTERNAL_ERR).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<
(substreams::scalar::BigInt, Vec<substreams::scalar::BigInt>, 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 RemoveLiquidity {
const NAME: &'static str = "removeLiquidity";
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, Vec<substreams::scalar::BigInt>, Vec<u8>),
> for RemoveLiquidity {
fn output(
data: &[u8],
) -> Result<
(substreams::scalar::BigInt, Vec<substreams::scalar::BigInt>, Vec<u8>),
String,
> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct SendTo {
pub token: Vec<u8>,
pub to: Vec<u8>,
pub amount: substreams::scalar::BigInt,
}
impl SendTo {
const METHOD_ID: [u8; 4] = [174u8, 99u8, 147u8, 41u8];
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 {
token: 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(),
amount: {
let mut v = [0 as u8; 32];
values
.pop()
.expect(INTERNAL_ERR)
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(
&[
ethabi::Token::Address(ethabi::Address::from_slice(&self.token)),
ethabi::Token::Address(ethabi::Address::from_slice(&self.to)),
ethabi::Token::Uint(
ethabi::Uint::from_big_endian(
match self.amount.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 SendTo {
const NAME: &'static str = "sendTo";
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 Settle {
pub token: Vec<u8>,
pub amount_hint: substreams::scalar::BigInt,
}
impl Settle {
const METHOD_ID: [u8; 4] = [21u8, 175u8, 212u8, 9u8];
pub fn decode(
call: &substreams_ethereum::pb::eth::v2::Call,
) -> Result<Self, String> {
let maybe_data = call.input.get(4..);
if maybe_data.is_none() {
return Err("no data to decode".to_string());
}
let mut values = ethabi::decode(
&[ethabi::ParamType::Address, ethabi::ParamType::Uint(256usize)],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
token: values
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
amount_hint: {
let mut v = [0 as u8; 32];
values
.pop()
.expect(INTERNAL_ERR)
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(
&[
ethabi::Token::Address(ethabi::Address::from_slice(&self.token)),
ethabi::Token::Uint(
ethabi::Uint::from_big_endian(
match self.amount_hint.clone().to_bytes_be() {
(num_bigint::Sign::Plus, bytes) => bytes,
(num_bigint::Sign::NoSign, bytes) => bytes,
(num_bigint::Sign::Minus, _) => {
panic!("negative numbers are not supported")
}
}
.as_slice(),
),
),
],
);
let mut encoded = Vec::with_capacity(4 + data.len());
encoded.extend(Self::METHOD_ID);
encoded.extend(data);
encoded
}
pub fn output_call(
call: &substreams_ethereum::pb::eth::v2::Call,
) -> Result<substreams::scalar::BigInt, String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
let mut values = ethabi::decode(
&[ethabi::ParamType::Uint(256usize)],
data.as_ref(),
)
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok({
let mut v = [0 as u8; 32];
values
.pop()
.expect("one output data should have existed")
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
})
}
pub fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool {
match call.input.get(0..4) {
Some(signature) => Self::METHOD_ID == signature,
None => false,
}
}
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
use substreams_ethereum::pb::eth::rpc;
let rpc_calls = rpc::RpcCalls {
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
};
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
let response = responses.get(0).expect("one response should have existed");
if response.failed {
return None;
}
match Self::output(response.raw.as_ref()) {
Ok(data) => Some(data),
Err(err) => {
use substreams_ethereum::Function;
substreams::log::info!(
"Call output for function `{}` failed to decode with error: {}",
Self::NAME, err
);
None
}
}
}
}
impl substreams_ethereum::Function for Settle {
const NAME: &'static str = "settle";
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 Settle {
fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct Swap {
pub vault_swap_params: (
substreams::scalar::BigInt,
Vec<u8>,
Vec<u8>,
Vec<u8>,
substreams::scalar::BigInt,
substreams::scalar::BigInt,
Vec<u8>,
),
}
impl Swap {
const METHOD_ID: [u8; 4] = [43u8, 251u8, 120u8, 12u8];
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::Uint(8usize), ethabi::ParamType::Address,
ethabi::ParamType::Address, ethabi::ParamType::Address,
ethabi::ParamType::Uint(256usize),
ethabi::ParamType::Uint(256usize), ethabi::ParamType::Bytes
],
),
],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
vault_swap_params: {
let tuple_elements = values
.pop()
.expect(INTERNAL_ERR)
.into_tuple()
.expect(INTERNAL_ERR);
(
{
let mut v = [0 as u8; 32];
tuple_elements[0usize]
.clone()
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
tuple_elements[1usize]
.clone()
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
tuple_elements[2usize]
.clone()
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
tuple_elements[3usize]
.clone()
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
{
let mut v = [0 as u8; 32];
tuple_elements[4usize]
.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[5usize]
.clone()
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
tuple_elements[6usize].clone().into_bytes().expect(INTERNAL_ERR),
)
},
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(
&[
ethabi::Token::Tuple(
vec![
ethabi::Token::Uint(ethabi::Uint::from_big_endian(match self
.vault_swap_params.0.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
.vault_swap_params.1)),
ethabi::Token::Address(ethabi::Address::from_slice(& self
.vault_swap_params.2)),
ethabi::Token::Address(ethabi::Address::from_slice(& self
.vault_swap_params.3)),
ethabi::Token::Uint(ethabi::Uint::from_big_endian(match self
.vault_swap_params.4.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
.vault_swap_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::Bytes(self.vault_swap_params
.6.clone())
],
),
],
);
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,
),
String,
> {
Self::output(call.return_data.as_ref())
}
pub fn output(
data: &[u8],
) -> Result<
(
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),
],
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)
},
))
}
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,
),
> {
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 Swap {
const NAME: &'static str = "swap";
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,
),
> for Swap {
fn output(
data: &[u8],
) -> Result<
(
substreams::scalar::BigInt,
substreams::scalar::BigInt,
substreams::scalar::BigInt,
),
String,
> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct Transfer {
pub owner: Vec<u8>,
pub to: Vec<u8>,
pub amount: substreams::scalar::BigInt,
}
impl Transfer {
const METHOD_ID: [u8; 4] = [190u8, 171u8, 172u8, 200u8];
pub fn decode(
call: &substreams_ethereum::pb::eth::v2::Call,
) -> Result<Self, String> {
let maybe_data = call.input.get(4..);
if maybe_data.is_none() {
return Err("no data to decode".to_string());
}
let mut values = ethabi::decode(
&[
ethabi::ParamType::Address,
ethabi::ParamType::Address,
ethabi::ParamType::Uint(256usize),
],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
owner: 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(),
amount: {
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.owner)),
ethabi::Token::Address(ethabi::Address::from_slice(&self.to)),
ethabi::Token::Uint(
ethabi::Uint::from_big_endian(
match self.amount.clone().to_bytes_be() {
(num_bigint::Sign::Plus, bytes) => bytes,
(num_bigint::Sign::NoSign, bytes) => bytes,
(num_bigint::Sign::Minus, _) => {
panic!("negative numbers are not supported")
}
}
.as_slice(),
),
),
],
);
let mut encoded = Vec::with_capacity(4 + data.len());
encoded.extend(Self::METHOD_ID);
encoded.extend(data);
encoded
}
pub fn output_call(
call: &substreams_ethereum::pb::eth::v2::Call,
) -> Result<bool, String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<bool, String> {
let mut values = ethabi::decode(&[ethabi::ParamType::Bool], data.as_ref())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok(
values
.pop()
.expect("one output data should have existed")
.into_bool()
.expect(INTERNAL_ERR),
)
}
pub fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool {
match call.input.get(0..4) {
Some(signature) => Self::METHOD_ID == signature,
None => false,
}
}
pub fn call(&self, address: Vec<u8>) -> Option<bool> {
use substreams_ethereum::pb::eth::rpc;
let rpc_calls = rpc::RpcCalls {
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
};
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
let response = responses.get(0).expect("one response should have existed");
if response.failed {
return None;
}
match Self::output(response.raw.as_ref()) {
Ok(data) => Some(data),
Err(err) => {
use substreams_ethereum::Function;
substreams::log::info!(
"Call output for function `{}` failed to decode with error: {}",
Self::NAME, err
);
None
}
}
}
}
impl substreams_ethereum::Function for Transfer {
const NAME: &'static str = "transfer";
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 Transfer {
fn output(data: &[u8]) -> Result<bool, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct TransferFrom {
pub spender: Vec<u8>,
pub from: Vec<u8>,
pub to: Vec<u8>,
pub amount: substreams::scalar::BigInt,
}
impl TransferFrom {
const METHOD_ID: [u8; 4] = [21u8, 218u8, 203u8, 234u8];
pub fn decode(
call: &substreams_ethereum::pb::eth::v2::Call,
) -> Result<Self, String> {
let maybe_data = call.input.get(4..);
if maybe_data.is_none() {
return Err("no data to decode".to_string());
}
let mut values = ethabi::decode(
&[
ethabi::ParamType::Address,
ethabi::ParamType::Address,
ethabi::ParamType::Address,
ethabi::ParamType::Uint(256usize),
],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
spender: 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(),
amount: {
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.spender)),
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.amount.clone().to_bytes_be() {
(num_bigint::Sign::Plus, bytes) => bytes,
(num_bigint::Sign::NoSign, bytes) => bytes,
(num_bigint::Sign::Minus, _) => {
panic!("negative numbers are not supported")
}
}
.as_slice(),
),
),
],
);
let mut encoded = Vec::with_capacity(4 + data.len());
encoded.extend(Self::METHOD_ID);
encoded.extend(data);
encoded
}
pub fn output_call(
call: &substreams_ethereum::pb::eth::v2::Call,
) -> Result<bool, String> {
Self::output(call.return_data.as_ref())
}
pub fn output(data: &[u8]) -> Result<bool, String> {
let mut values = ethabi::decode(&[ethabi::ParamType::Bool], data.as_ref())
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
Ok(
values
.pop()
.expect("one output data should have existed")
.into_bool()
.expect(INTERNAL_ERR),
)
}
pub fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool {
match call.input.get(0..4) {
Some(signature) => Self::METHOD_ID == signature,
None => false,
}
}
pub fn call(&self, address: Vec<u8>) -> Option<bool> {
use substreams_ethereum::pb::eth::rpc;
let rpc_calls = rpc::RpcCalls {
calls: vec![rpc::RpcCall { to_addr : address, data : self.encode(), }],
};
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
let response = responses.get(0).expect("one response should have existed");
if response.failed {
return None;
}
match Self::output(response.raw.as_ref()) {
Ok(data) => Some(data),
Err(err) => {
use substreams_ethereum::Function;
substreams::log::info!(
"Call output for function `{}` failed to decode with error: {}",
Self::NAME, err
);
None
}
}
}
}
impl substreams_ethereum::Function for TransferFrom {
const NAME: &'static str = "transferFrom";
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 TransferFrom {
fn output(data: &[u8]) -> Result<bool, String> {
Self::output(data)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct Unlock {
pub data: Vec<u8>,
}
impl Unlock {
const METHOD_ID: [u8; 4] = [72u8, 200u8, 148u8, 145u8];
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::Bytes],
maybe_data.unwrap(),
)
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
values.reverse();
Ok(Self {
data: values.pop().expect(INTERNAL_ERR).into_bytes().expect(INTERNAL_ERR),
})
}
pub fn encode(&self) -> Vec<u8> {
let data = ethabi::encode(&[ethabi::Token::Bytes(self.data.clone())]);
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 Unlock {
const NAME: &'static str = "unlock";
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 Unlock {
fn output(data: &[u8]) -> Result<Vec<u8>, 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 AggregateSwapFeePercentageChanged {
pub pool: Vec<u8>,
pub aggregate_swap_fee_percentage: substreams::scalar::BigInt,
}
impl AggregateSwapFeePercentageChanged {
const TOPIC_ID: [u8; 32] = [
228u8,
211u8,
113u8,
9u8,
123u8,
238u8,
164u8,
36u8,
83u8,
163u8,
116u8,
6u8,
226u8,
174u8,
244u8,
192u8,
79u8,
60u8,
84u8,
143u8,
132u8,
172u8,
80u8,
231u8,
37u8,
120u8,
102u8,
44u8,
13u8,
205u8,
115u8,
84u8,
];
pub fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
if log.topics.len() != 2usize {
return false;
}
if log.data.len() != 32usize {
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::Uint(256usize)],
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(),
aggregate_swap_fee_percentage: {
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)
},
})
}
}
impl substreams_ethereum::Event for AggregateSwapFeePercentageChanged {
const NAME: &'static str = "AggregateSwapFeePercentageChanged";
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 AggregateYieldFeePercentageChanged {
pub pool: Vec<u8>,
pub aggregate_yield_fee_percentage: substreams::scalar::BigInt,
}
impl AggregateYieldFeePercentageChanged {
const TOPIC_ID: [u8; 32] = [
96u8,
110u8,
185u8,
125u8,
131u8,
22u8,
75u8,
214u8,
178u8,
0u8,
214u8,
56u8,
205u8,
73u8,
193u8,
76u8,
101u8,
217u8,
77u8,
79u8,
44u8,
103u8,
76u8,
253u8,
133u8,
226u8,
78u8,
14u8,
32u8,
44u8,
60u8,
165u8,
];
pub fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
if log.topics.len() != 2usize {
return false;
}
if log.data.len() != 32usize {
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::Uint(256usize)],
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(),
aggregate_yield_fee_percentage: {
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)
},
})
}
}
impl substreams_ethereum::Event for AggregateYieldFeePercentageChanged {
const NAME: &'static str = "AggregateYieldFeePercentageChanged";
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 Approval {
pub pool: Vec<u8>,
pub owner: Vec<u8>,
pub spender: Vec<u8>,
pub value: substreams::scalar::BigInt,
}
impl Approval {
const TOPIC_ID: [u8; 32] = [
160u8,
23u8,
83u8,
96u8,
161u8,
91u8,
202u8,
50u8,
139u8,
175u8,
126u8,
168u8,
92u8,
123u8,
120u8,
77u8,
88u8,
178u8,
34u8,
165u8,
13u8,
12u8,
231u8,
96u8,
177u8,
13u8,
186u8,
51u8,
109u8,
34u8,
106u8,
97u8,
];
pub fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
if log.topics.len() != 4usize {
return false;
}
if log.data.len() != 32usize {
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::Uint(256usize)],
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(),
owner: ethabi::decode(
&[ethabi::ParamType::Address],
log.topics[2usize].as_ref(),
)
.map_err(|e| {
format!(
"unable to decode param 'owner' from topic of type 'address': {:?}",
e
)
})?
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
spender: ethabi::decode(
&[ethabi::ParamType::Address],
log.topics[3usize].as_ref(),
)
.map_err(|e| {
format!(
"unable to decode param 'spender' from topic of type 'address': {:?}",
e
)
})?
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
value: {
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)
},
})
}
}
impl substreams_ethereum::Event for Approval {
const NAME: &'static str = "Approval";
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 AuthorizerChanged {
pub new_authorizer: Vec<u8>,
}
impl AuthorizerChanged {
const TOPIC_ID: [u8; 32] = [
148u8,
185u8,
121u8,
182u8,
131u8,
26u8,
81u8,
41u8,
62u8,
38u8,
65u8,
66u8,
111u8,
151u8,
116u8,
127u8,
238u8,
212u8,
111u8,
23u8,
119u8,
159u8,
237u8,
156u8,
209u8,
141u8,
30u8,
206u8,
252u8,
254u8,
146u8,
239u8,
];
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 {
new_authorizer: ethabi::decode(
&[ethabi::ParamType::Address],
log.topics[1usize].as_ref(),
)
.map_err(|e| {
format!(
"unable to decode param 'new_authorizer' from topic of type 'address': {:?}",
e
)
})?
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
})
}
}
impl substreams_ethereum::Event for AuthorizerChanged {
const NAME: &'static str = "AuthorizerChanged";
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 BufferSharesBurned {
pub wrapped_token: Vec<u8>,
pub from: Vec<u8>,
pub burned_shares: substreams::scalar::BigInt,
}
impl BufferSharesBurned {
const TOPIC_ID: [u8; 32] = [
78u8,
9u8,
247u8,
247u8,
252u8,
55u8,
206u8,
40u8,
151u8,
128u8,
14u8,
44u8,
42u8,
144u8,
153u8,
86u8,
94u8,
219u8,
10u8,
19u8,
61u8,
25u8,
216u8,
74u8,
104u8,
113u8,
179u8,
83u8,
10u8,
248u8,
132u8,
107u8,
];
pub fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
if log.topics.len() != 3usize {
return false;
}
if log.data.len() != 32usize {
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::Uint(256usize)],
log.data.as_ref(),
)
.map_err(|e| format!("unable to decode log.data: {:?}", e))?;
values.reverse();
Ok(Self {
wrapped_token: ethabi::decode(
&[ethabi::ParamType::Address],
log.topics[1usize].as_ref(),
)
.map_err(|e| {
format!(
"unable to decode param 'wrapped_token' from topic of type 'address': {:?}",
e
)
})?
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
from: ethabi::decode(
&[ethabi::ParamType::Address],
log.topics[2usize].as_ref(),
)
.map_err(|e| {
format!(
"unable to decode param 'from' from topic of type 'address': {:?}",
e
)
})?
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
burned_shares: {
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)
},
})
}
}
impl substreams_ethereum::Event for BufferSharesBurned {
const NAME: &'static str = "BufferSharesBurned";
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 BufferSharesMinted {
pub wrapped_token: Vec<u8>,
pub to: Vec<u8>,
pub issued_shares: substreams::scalar::BigInt,
}
impl BufferSharesMinted {
const TOPIC_ID: [u8; 32] = [
214u8,
111u8,
3u8,
29u8,
51u8,
56u8,
28u8,
100u8,
8u8,
240u8,
179u8,
44u8,
136u8,
68u8,
97u8,
229u8,
222u8,
61u8,
248u8,
128u8,
131u8,
153u8,
182u8,
243u8,
163u8,
216u8,
107u8,
19u8,
104u8,
248u8,
236u8,
52u8,
];
pub fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
if log.topics.len() != 3usize {
return false;
}
if log.data.len() != 32usize {
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::Uint(256usize)],
log.data.as_ref(),
)
.map_err(|e| format!("unable to decode log.data: {:?}", e))?;
values.reverse();
Ok(Self {
wrapped_token: ethabi::decode(
&[ethabi::ParamType::Address],
log.topics[1usize].as_ref(),
)
.map_err(|e| {
format!(
"unable to decode param 'wrapped_token' from topic of type 'address': {:?}",
e
)
})?
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
to: ethabi::decode(
&[ethabi::ParamType::Address],
log.topics[2usize].as_ref(),
)
.map_err(|e| {
format!(
"unable to decode param 'to' from topic of type 'address': {:?}",
e
)
})?
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
issued_shares: {
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)
},
})
}
}
impl substreams_ethereum::Event for BufferSharesMinted {
const NAME: &'static str = "BufferSharesMinted";
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 LiquidityAdded {
pub pool: Vec<u8>,
pub liquidity_provider: Vec<u8>,
pub kind: substreams::scalar::BigInt,
pub total_supply: substreams::scalar::BigInt,
pub amounts_added_raw: Vec<substreams::scalar::BigInt>,
pub swap_fee_amounts_raw: Vec<substreams::scalar::BigInt>,
}
impl LiquidityAdded {
const TOPIC_ID: [u8; 32] = [
162u8,
106u8,
82u8,
216u8,
213u8,
55u8,
2u8,
187u8,
167u8,
241u8,
55u8,
144u8,
123u8,
142u8,
31u8,
153u8,
255u8,
135u8,
246u8,
212u8,
80u8,
20u8,
66u8,
112u8,
202u8,
37u8,
231u8,
36u8,
129u8,
204u8,
168u8,
113u8,
];
pub fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
if log.topics.len() != 4usize {
return false;
}
if log.data.len() < 160usize {
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::Uint(256usize),
ethabi::ParamType::Array(
Box::new(ethabi::ParamType::Uint(256usize)),
),
ethabi::ParamType::Array(
Box::new(ethabi::ParamType::Uint(256usize)),
),
],
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(),
liquidity_provider: ethabi::decode(
&[ethabi::ParamType::Address],
log.topics[2usize].as_ref(),
)
.map_err(|e| {
format!(
"unable to decode param 'liquidity_provider' from topic of type 'address': {:?}",
e
)
})?
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
kind: {
let mut v = [0 as u8; 32];
ethabi::decode(
&[ethabi::ParamType::Uint(8usize)],
log.topics[3usize].as_ref(),
)
.map_err(|e| {
format!(
"unable to decode param 'kind' from topic of type 'uint8': {:?}",
e
)
})?
.pop()
.expect(INTERNAL_ERR)
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
total_supply: {
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)
},
amounts_added_raw: values
.pop()
.expect(INTERNAL_ERR)
.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(),
swap_fee_amounts_raw: values
.pop()
.expect(INTERNAL_ERR)
.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(),
})
}
}
impl substreams_ethereum::Event for LiquidityAdded {
const NAME: &'static str = "LiquidityAdded";
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 LiquidityAddedToBuffer {
pub wrapped_token: Vec<u8>,
pub amount_underlying: substreams::scalar::BigInt,
pub amount_wrapped: substreams::scalar::BigInt,
pub buffer_balances: [u8; 32usize],
}
impl LiquidityAddedToBuffer {
const TOPIC_ID: [u8; 32] = [
117u8,
196u8,
220u8,
95u8,
35u8,
100u8,
14u8,
235u8,
167u8,
212u8,
4u8,
217u8,
22u8,
95u8,
81u8,
95u8,
195u8,
217u8,
226u8,
58u8,
92u8,
139u8,
110u8,
45u8,
9u8,
180u8,
185u8,
218u8,
86u8,
255u8,
0u8,
169u8,
];
pub fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
if log.topics.len() != 2usize {
return false;
}
if log.data.len() != 96usize {
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::Uint(256usize),
ethabi::ParamType::Uint(256usize),
ethabi::ParamType::FixedBytes(32usize),
],
log.data.as_ref(),
)
.map_err(|e| format!("unable to decode log.data: {:?}", e))?;
values.reverse();
Ok(Self {
wrapped_token: ethabi::decode(
&[ethabi::ParamType::Address],
log.topics[1usize].as_ref(),
)
.map_err(|e| {
format!(
"unable to decode param 'wrapped_token' from topic of type 'address': {:?}",
e
)
})?
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
amount_underlying: {
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)
},
amount_wrapped: {
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)
},
buffer_balances: {
let mut result = [0u8; 32];
let v = values
.pop()
.expect(INTERNAL_ERR)
.into_fixed_bytes()
.expect(INTERNAL_ERR);
result.copy_from_slice(&v);
result
},
})
}
}
impl substreams_ethereum::Event for LiquidityAddedToBuffer {
const NAME: &'static str = "LiquidityAddedToBuffer";
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 LiquidityRemoved {
pub pool: Vec<u8>,
pub liquidity_provider: Vec<u8>,
pub kind: substreams::scalar::BigInt,
pub total_supply: substreams::scalar::BigInt,
pub amounts_removed_raw: Vec<substreams::scalar::BigInt>,
pub swap_fee_amounts_raw: Vec<substreams::scalar::BigInt>,
}
impl LiquidityRemoved {
const TOPIC_ID: [u8; 32] = [
251u8,
229u8,
176u8,
215u8,
159u8,
185u8,
79u8,
30u8,
129u8,
192u8,
169u8,
43u8,
248u8,
106u8,
233u8,
211u8,
161u8,
158u8,
157u8,
27u8,
246u8,
32u8,
44u8,
13u8,
62u8,
117u8,
18u8,
15u8,
101u8,
213u8,
216u8,
165u8,
];
pub fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
if log.topics.len() != 4usize {
return false;
}
if log.data.len() < 160usize {
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::Uint(256usize),
ethabi::ParamType::Array(
Box::new(ethabi::ParamType::Uint(256usize)),
),
ethabi::ParamType::Array(
Box::new(ethabi::ParamType::Uint(256usize)),
),
],
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(),
liquidity_provider: ethabi::decode(
&[ethabi::ParamType::Address],
log.topics[2usize].as_ref(),
)
.map_err(|e| {
format!(
"unable to decode param 'liquidity_provider' from topic of type 'address': {:?}",
e
)
})?
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
kind: {
let mut v = [0 as u8; 32];
ethabi::decode(
&[ethabi::ParamType::Uint(8usize)],
log.topics[3usize].as_ref(),
)
.map_err(|e| {
format!(
"unable to decode param 'kind' from topic of type 'uint8': {:?}",
e
)
})?
.pop()
.expect(INTERNAL_ERR)
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
total_supply: {
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)
},
amounts_removed_raw: values
.pop()
.expect(INTERNAL_ERR)
.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(),
swap_fee_amounts_raw: values
.pop()
.expect(INTERNAL_ERR)
.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(),
})
}
}
impl substreams_ethereum::Event for LiquidityRemoved {
const NAME: &'static str = "LiquidityRemoved";
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 LiquidityRemovedFromBuffer {
pub wrapped_token: Vec<u8>,
pub amount_underlying: substreams::scalar::BigInt,
pub amount_wrapped: substreams::scalar::BigInt,
pub buffer_balances: [u8; 32usize],
}
impl LiquidityRemovedFromBuffer {
const TOPIC_ID: [u8; 32] = [
68u8,
217u8,
123u8,
54u8,
233u8,
155u8,
89u8,
11u8,
61u8,
40u8,
117u8,
170u8,
211u8,
177u8,
103u8,
177u8,
215u8,
251u8,
30u8,
6u8,
63u8,
63u8,
19u8,
37u8,
161u8,
238u8,
172u8,
118u8,
202u8,
238u8,
81u8,
19u8,
];
pub fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
if log.topics.len() != 2usize {
return false;
}
if log.data.len() != 96usize {
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::Uint(256usize),
ethabi::ParamType::Uint(256usize),
ethabi::ParamType::FixedBytes(32usize),
],
log.data.as_ref(),
)
.map_err(|e| format!("unable to decode log.data: {:?}", e))?;
values.reverse();
Ok(Self {
wrapped_token: ethabi::decode(
&[ethabi::ParamType::Address],
log.topics[1usize].as_ref(),
)
.map_err(|e| {
format!(
"unable to decode param 'wrapped_token' from topic of type 'address': {:?}",
e
)
})?
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
amount_underlying: {
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)
},
amount_wrapped: {
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)
},
buffer_balances: {
let mut result = [0u8; 32];
let v = values
.pop()
.expect(INTERNAL_ERR)
.into_fixed_bytes()
.expect(INTERNAL_ERR);
result.copy_from_slice(&v);
result
},
})
}
}
impl substreams_ethereum::Event for LiquidityRemovedFromBuffer {
const NAME: &'static str = "LiquidityRemovedFromBuffer";
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 PoolInitialized {
pub pool: Vec<u8>,
}
impl PoolInitialized {
const TOPIC_ID: [u8; 32] = [
202u8,
216u8,
201u8,
211u8,
37u8,
7u8,
57u8,
59u8,
101u8,
8u8,
202u8,
74u8,
136u8,
139u8,
129u8,
151u8,
153u8,
25u8,
180u8,
119u8,
81u8,
5u8,
133u8,
189u8,
232u8,
72u8,
143u8,
21u8,
48u8,
114u8,
214u8,
243u8,
];
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 PoolInitialized {
const NAME: &'static str = "PoolInitialized";
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 PoolPausedStateChanged {
pub pool: Vec<u8>,
pub paused: bool,
}
impl PoolPausedStateChanged {
const TOPIC_ID: [u8; 32] = [
87u8,
226u8,
4u8,
72u8,
2u8,
130u8,
151u8,
25u8,
1u8,
34u8,
87u8,
27u8,
231u8,
203u8,
108u8,
27u8,
30u8,
248u8,
87u8,
48u8,
198u8,
115u8,
247u8,
199u8,
47u8,
83u8,
60u8,
134u8,
98u8,
65u8,
154u8,
167u8,
];
pub fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
if log.topics.len() != 2usize {
return false;
}
if log.data.len() != 32usize {
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::Bool],
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(),
paused: values
.pop()
.expect(INTERNAL_ERR)
.into_bool()
.expect(INTERNAL_ERR),
})
}
}
impl substreams_ethereum::Event for PoolPausedStateChanged {
const NAME: &'static str = "PoolPausedStateChanged";
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 PoolRecoveryModeStateChanged {
pub pool: Vec<u8>,
pub recovery_mode: bool,
}
impl PoolRecoveryModeStateChanged {
const TOPIC_ID: [u8; 32] = [
194u8,
53u8,
76u8,
194u8,
247u8,
142u8,
165u8,
119u8,
119u8,
229u8,
93u8,
221u8,
67u8,
167u8,
242u8,
43u8,
17u8,
44u8,
233u8,
136u8,
104u8,
89u8,
104u8,
128u8,
237u8,
174u8,
178u8,
43u8,
79u8,
156u8,
115u8,
169u8,
];
pub fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
if log.topics.len() != 2usize {
return false;
}
if log.data.len() != 32usize {
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::Bool],
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(),
recovery_mode: values
.pop()
.expect(INTERNAL_ERR)
.into_bool()
.expect(INTERNAL_ERR),
})
}
}
impl substreams_ethereum::Event for PoolRecoveryModeStateChanged {
const NAME: &'static str = "PoolRecoveryModeStateChanged";
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 PoolRegistered {
pub pool: Vec<u8>,
pub factory: Vec<u8>,
pub token_config: Vec<(Vec<u8>, substreams::scalar::BigInt, Vec<u8>, bool)>,
pub swap_fee_percentage: substreams::scalar::BigInt,
pub pause_window_end_time: substreams::scalar::BigInt,
pub role_accounts: (Vec<u8>, Vec<u8>, Vec<u8>),
pub hooks_config: (
bool,
bool,
bool,
bool,
bool,
bool,
bool,
bool,
bool,
bool,
Vec<u8>,
),
pub liquidity_management: (bool, bool, bool, bool),
}
impl PoolRegistered {
const TOPIC_ID: [u8; 32] = [
188u8,
21u8,
97u8,
238u8,
171u8,
159u8,
64u8,
150u8,
46u8,
47u8,
184u8,
39u8,
167u8,
255u8,
156u8,
124u8,
219u8,
71u8,
169u8,
215u8,
200u8,
76u8,
174u8,
239u8,
164u8,
237u8,
144u8,
224u8,
67u8,
132u8,
45u8,
173u8,
];
pub fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
if log.topics.len() != 3usize {
return false;
}
if log.data.len() < 704usize {
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::Array(
Box::new(
ethabi::ParamType::Tuple(
vec![
ethabi::ParamType::Address, ethabi::ParamType::Uint(8usize),
ethabi::ParamType::Address, ethabi::ParamType::Bool
],
),
),
),
ethabi::ParamType::Uint(256usize),
ethabi::ParamType::Uint(32usize),
ethabi::ParamType::Tuple(
vec![
ethabi::ParamType::Address, ethabi::ParamType::Address,
ethabi::ParamType::Address
],
),
ethabi::ParamType::Tuple(
vec![
ethabi::ParamType::Bool, ethabi::ParamType::Bool,
ethabi::ParamType::Bool, ethabi::ParamType::Bool,
ethabi::ParamType::Bool, ethabi::ParamType::Bool,
ethabi::ParamType::Bool, ethabi::ParamType::Bool,
ethabi::ParamType::Bool, ethabi::ParamType::Bool,
ethabi::ParamType::Address
],
),
ethabi::ParamType::Tuple(
vec![
ethabi::ParamType::Bool, ethabi::ParamType::Bool,
ethabi::ParamType::Bool, ethabi::ParamType::Bool
],
),
],
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(),
factory: ethabi::decode(
&[ethabi::ParamType::Address],
log.topics[2usize].as_ref(),
)
.map_err(|e| {
format!(
"unable to decode param 'factory' from topic of type 'address': {:?}",
e
)
})?
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
token_config: values
.pop()
.expect(INTERNAL_ERR)
.into_array()
.expect(INTERNAL_ERR)
.into_iter()
.map(|inner| {
let tuple_elements = inner.into_tuple().expect(INTERNAL_ERR);
(
tuple_elements[0usize]
.clone()
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
{
let mut v = [0 as u8; 32];
tuple_elements[1usize]
.clone()
.into_uint()
.expect(INTERNAL_ERR)
.to_big_endian(v.as_mut_slice());
substreams::scalar::BigInt::from_unsigned_bytes_be(&v)
},
tuple_elements[2usize]
.clone()
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
tuple_elements[3usize]
.clone()
.into_bool()
.expect(INTERNAL_ERR),
)
})
.collect(),
swap_fee_percentage: {
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)
},
pause_window_end_time: {
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)
},
role_accounts: {
let tuple_elements = values
.pop()
.expect(INTERNAL_ERR)
.into_tuple()
.expect(INTERNAL_ERR);
(
tuple_elements[0usize]
.clone()
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
tuple_elements[1usize]
.clone()
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
tuple_elements[2usize]
.clone()
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
)
},
hooks_config: {
let tuple_elements = values
.pop()
.expect(INTERNAL_ERR)
.into_tuple()
.expect(INTERNAL_ERR);
(
tuple_elements[0usize].clone().into_bool().expect(INTERNAL_ERR),
tuple_elements[1usize].clone().into_bool().expect(INTERNAL_ERR),
tuple_elements[2usize].clone().into_bool().expect(INTERNAL_ERR),
tuple_elements[3usize].clone().into_bool().expect(INTERNAL_ERR),
tuple_elements[4usize].clone().into_bool().expect(INTERNAL_ERR),
tuple_elements[5usize].clone().into_bool().expect(INTERNAL_ERR),
tuple_elements[6usize].clone().into_bool().expect(INTERNAL_ERR),
tuple_elements[7usize].clone().into_bool().expect(INTERNAL_ERR),
tuple_elements[8usize].clone().into_bool().expect(INTERNAL_ERR),
tuple_elements[9usize].clone().into_bool().expect(INTERNAL_ERR),
tuple_elements[10usize]
.clone()
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
)
},
liquidity_management: {
let tuple_elements = values
.pop()
.expect(INTERNAL_ERR)
.into_tuple()
.expect(INTERNAL_ERR);
(
tuple_elements[0usize].clone().into_bool().expect(INTERNAL_ERR),
tuple_elements[1usize].clone().into_bool().expect(INTERNAL_ERR),
tuple_elements[2usize].clone().into_bool().expect(INTERNAL_ERR),
tuple_elements[3usize].clone().into_bool().expect(INTERNAL_ERR),
)
},
})
}
}
impl substreams_ethereum::Event for PoolRegistered {
const NAME: &'static str = "PoolRegistered";
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 ProtocolFeeControllerChanged {
pub new_protocol_fee_controller: Vec<u8>,
}
impl ProtocolFeeControllerChanged {
const TOPIC_ID: [u8; 32] = [
40u8,
10u8,
96u8,
177u8,
230u8,
60u8,
23u8,
116u8,
211u8,
151u8,
211u8,
92u8,
206u8,
128u8,
235u8,
128u8,
229u8,
20u8,
8u8,
234u8,
215u8,
85u8,
251u8,
68u8,
110u8,
111u8,
116u8,
76u8,
233u8,
142u8,
93u8,
240u8,
];
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 {
new_protocol_fee_controller: ethabi::decode(
&[ethabi::ParamType::Address],
log.topics[1usize].as_ref(),
)
.map_err(|e| {
format!(
"unable to decode param 'new_protocol_fee_controller' from topic of type 'address': {:?}",
e
)
})?
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
})
}
}
impl substreams_ethereum::Event for ProtocolFeeControllerChanged {
const NAME: &'static str = "ProtocolFeeControllerChanged";
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 Swap {
pub pool: Vec<u8>,
pub token_in: Vec<u8>,
pub token_out: Vec<u8>,
pub amount_in: substreams::scalar::BigInt,
pub amount_out: substreams::scalar::BigInt,
pub swap_fee_percentage: substreams::scalar::BigInt,
pub swap_fee_amount: substreams::scalar::BigInt,
}
impl Swap {
const TOPIC_ID: [u8; 32] = [
8u8,
116u8,
178u8,
213u8,
69u8,
203u8,
39u8,
28u8,
219u8,
218u8,
78u8,
9u8,
48u8,
32u8,
196u8,
82u8,
50u8,
139u8,
36u8,
175u8,
18u8,
56u8,
46u8,
214u8,
44u8,
77u8,
0u8,
245u8,
194u8,
103u8,
9u8,
219u8,
];
pub fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
if log.topics.len() != 4usize {
return false;
}
if log.data.len() != 128usize {
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::Uint(256usize),
ethabi::ParamType::Uint(256usize),
ethabi::ParamType::Uint(256usize),
ethabi::ParamType::Uint(256usize),
],
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(),
token_in: ethabi::decode(
&[ethabi::ParamType::Address],
log.topics[2usize].as_ref(),
)
.map_err(|e| {
format!(
"unable to decode param 'token_in' from topic of type 'address': {:?}",
e
)
})?
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
token_out: ethabi::decode(
&[ethabi::ParamType::Address],
log.topics[3usize].as_ref(),
)
.map_err(|e| {
format!(
"unable to decode param 'token_out' from topic of type 'address': {:?}",
e
)
})?
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
amount_in: {
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)
},
amount_out: {
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)
},
swap_fee_percentage: {
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)
},
swap_fee_amount: {
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)
},
})
}
}
impl substreams_ethereum::Event for Swap {
const NAME: &'static str = "Swap";
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 SwapFeePercentageChanged {
pub pool: Vec<u8>,
pub swap_fee_percentage: substreams::scalar::BigInt,
}
impl SwapFeePercentageChanged {
const TOPIC_ID: [u8; 32] = [
137u8,
212u8,
21u8,
34u8,
52u8,
47u8,
171u8,
172u8,
20u8,
113u8,
202u8,
96u8,
115u8,
165u8,
98u8,
62u8,
92u8,
175u8,
54u8,
123u8,
3u8,
202u8,
110u8,
154u8,
0u8,
20u8,
120u8,
208u8,
207u8,
139u8,
228u8,
161u8,
];
pub fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
if log.topics.len() != 2usize {
return false;
}
if log.data.len() != 32usize {
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::Uint(256usize)],
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(),
swap_fee_percentage: {
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)
},
})
}
}
impl substreams_ethereum::Event for SwapFeePercentageChanged {
const NAME: &'static str = "SwapFeePercentageChanged";
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 Transfer {
pub pool: Vec<u8>,
pub from: Vec<u8>,
pub to: Vec<u8>,
pub value: substreams::scalar::BigInt,
}
impl Transfer {
const TOPIC_ID: [u8; 32] = [
209u8,
57u8,
139u8,
238u8,
25u8,
49u8,
61u8,
107u8,
246u8,
114u8,
204u8,
177u8,
22u8,
229u8,
31u8,
74u8,
26u8,
148u8,
126u8,
145u8,
199u8,
87u8,
144u8,
127u8,
81u8,
251u8,
181u8,
181u8,
229u8,
108u8,
105u8,
143u8,
];
pub fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
if log.topics.len() != 4usize {
return false;
}
if log.data.len() != 32usize {
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::Uint(256usize)],
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(),
from: ethabi::decode(
&[ethabi::ParamType::Address],
log.topics[2usize].as_ref(),
)
.map_err(|e| {
format!(
"unable to decode param 'from' from topic of type 'address': {:?}",
e
)
})?
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
to: ethabi::decode(
&[ethabi::ParamType::Address],
log.topics[3usize].as_ref(),
)
.map_err(|e| {
format!(
"unable to decode param 'to' from topic of type 'address': {:?}",
e
)
})?
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
value: {
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)
},
})
}
}
impl substreams_ethereum::Event for Transfer {
const NAME: &'static str = "Transfer";
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 Unwrap {
pub wrapped_token: Vec<u8>,
pub burned_shares: substreams::scalar::BigInt,
pub withdrawn_underlying: substreams::scalar::BigInt,
pub buffer_balances: [u8; 32usize],
}
impl Unwrap {
const TOPIC_ID: [u8; 32] = [
238u8,
183u8,
64u8,
201u8,
11u8,
242u8,
177u8,
140u8,
149u8,
50u8,
235u8,
125u8,
71u8,
49u8,
55u8,
118u8,
112u8,
54u8,
216u8,
147u8,
223u8,
243u8,
224u8,
9u8,
243u8,
39u8,
24u8,
248u8,
33u8,
178u8,
164u8,
192u8,
];
pub fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
if log.topics.len() != 2usize {
return false;
}
if log.data.len() != 96usize {
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::Uint(256usize),
ethabi::ParamType::Uint(256usize),
ethabi::ParamType::FixedBytes(32usize),
],
log.data.as_ref(),
)
.map_err(|e| format!("unable to decode log.data: {:?}", e))?;
values.reverse();
Ok(Self {
wrapped_token: ethabi::decode(
&[ethabi::ParamType::Address],
log.topics[1usize].as_ref(),
)
.map_err(|e| {
format!(
"unable to decode param 'wrapped_token' from topic of type 'address': {:?}",
e
)
})?
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
burned_shares: {
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)
},
withdrawn_underlying: {
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)
},
buffer_balances: {
let mut result = [0u8; 32];
let v = values
.pop()
.expect(INTERNAL_ERR)
.into_fixed_bytes()
.expect(INTERNAL_ERR);
result.copy_from_slice(&v);
result
},
})
}
}
impl substreams_ethereum::Event for Unwrap {
const NAME: &'static str = "Unwrap";
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 VaultAuxiliary {
pub pool: Vec<u8>,
pub event_key: [u8; 32usize],
pub event_data: Vec<u8>,
}
impl VaultAuxiliary {
const TOPIC_ID: [u8; 32] = [
75u8,
196u8,
65u8,
46u8,
33u8,
1u8,
21u8,
69u8,
105u8,
3u8,
198u8,
91u8,
82u8,
119u8,
210u8,
153u8,
165u8,
5u8,
231u8,
159u8,
46u8,
184u8,
82u8,
185u8,
43u8,
28u8,
165u8,
45u8,
133u8,
133u8,
100u8,
40u8,
];
pub fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
if log.topics.len() != 3usize {
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(),
event_key: {
let mut result = [0u8; 32];
let v = ethabi::decode(
&[ethabi::ParamType::FixedBytes(32usize)],
log.topics[2usize].as_ref(),
)
.map_err(|e| {
format!(
"unable to decode param 'event_key' from topic of type 'bytes32': {:?}",
e
)
})?
.pop()
.expect(INTERNAL_ERR)
.into_fixed_bytes()
.expect(INTERNAL_ERR);
result.copy_from_slice(&v);
result
},
event_data: values
.pop()
.expect(INTERNAL_ERR)
.into_bytes()
.expect(INTERNAL_ERR),
})
}
}
impl substreams_ethereum::Event for VaultAuxiliary {
const NAME: &'static str = "VaultAuxiliary";
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 VaultBuffersPausedStateChanged {
pub paused: bool,
}
impl VaultBuffersPausedStateChanged {
const TOPIC_ID: [u8; 32] = [
48u8,
12u8,
124u8,
166u8,
25u8,
235u8,
132u8,
99u8,
134u8,
170u8,
10u8,
110u8,
89u8,
22u8,
172u8,
42u8,
65u8,
64u8,
100u8,
72u8,
176u8,
162u8,
233u8,
155u8,
169u8,
204u8,
175u8,
235u8,
137u8,
144u8,
21u8,
165u8,
];
pub fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
if log.topics.len() != 1usize {
return false;
}
if log.data.len() != 32usize {
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::Bool],
log.data.as_ref(),
)
.map_err(|e| format!("unable to decode log.data: {:?}", e))?;
values.reverse();
Ok(Self {
paused: values
.pop()
.expect(INTERNAL_ERR)
.into_bool()
.expect(INTERNAL_ERR),
})
}
}
impl substreams_ethereum::Event for VaultBuffersPausedStateChanged {
const NAME: &'static str = "VaultBuffersPausedStateChanged";
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 VaultPausedStateChanged {
pub paused: bool,
}
impl VaultPausedStateChanged {
const TOPIC_ID: [u8; 32] = [
224u8,
98u8,
159u8,
230u8,
86u8,
228u8,
90u8,
215u8,
253u8,
99u8,
162u8,
75u8,
137u8,
157u8,
163u8,
104u8,
105u8,
0u8,
36u8,
192u8,
112u8,
67u8,
184u8,
142u8,
87u8,
174u8,
229u8,
9u8,
91u8,
29u8,
61u8,
2u8,
];
pub fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
if log.topics.len() != 1usize {
return false;
}
if log.data.len() != 32usize {
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::Bool],
log.data.as_ref(),
)
.map_err(|e| format!("unable to decode log.data: {:?}", e))?;
values.reverse();
Ok(Self {
paused: values
.pop()
.expect(INTERNAL_ERR)
.into_bool()
.expect(INTERNAL_ERR),
})
}
}
impl substreams_ethereum::Event for VaultPausedStateChanged {
const NAME: &'static str = "VaultPausedStateChanged";
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 VaultQueriesDisabled {}
impl VaultQueriesDisabled {
const TOPIC_ID: [u8; 32] = [
189u8,
32u8,
64u8,
144u8,
253u8,
56u8,
127u8,
8u8,
227u8,
7u8,
101u8,
40u8,
191u8,
9u8,
180u8,
252u8,
153u8,
216u8,
16u8,
13u8,
116u8,
158u8,
172u8,
233u8,
108u8,
6u8,
0u8,
45u8,
63u8,
237u8,
198u8,
37u8,
];
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 VaultQueriesDisabled {
const NAME: &'static str = "VaultQueriesDisabled";
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 VaultQueriesEnabled {}
impl VaultQueriesEnabled {
const TOPIC_ID: [u8; 32] = [
145u8,
215u8,
71u8,
136u8,
53u8,
242u8,
181u8,
173u8,
195u8,
21u8,
245u8,
170u8,
217u8,
32u8,
244u8,
167u8,
240u8,
160u8,
47u8,
127u8,
221u8,
243u8,
4u8,
45u8,
23u8,
178u8,
200u8,
1u8,
104u8,
234u8,
23u8,
245u8,
];
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 VaultQueriesEnabled {
const NAME: &'static str = "VaultQueriesEnabled";
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 Wrap {
pub wrapped_token: Vec<u8>,
pub deposited_underlying: substreams::scalar::BigInt,
pub minted_shares: substreams::scalar::BigInt,
pub buffer_balances: [u8; 32usize],
}
impl Wrap {
const TOPIC_ID: [u8; 32] = [
55u8,
113u8,
209u8,
60u8,
103u8,
1u8,
30u8,
49u8,
225u8,
32u8,
49u8,
197u8,
75u8,
181u8,
155u8,
11u8,
245u8,
68u8,
168u8,
11u8,
129u8,
210u8,
128u8,
163u8,
113u8,
30u8,
23u8,
42u8,
168u8,
183u8,
244u8,
123u8,
];
pub fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
if log.topics.len() != 2usize {
return false;
}
if log.data.len() != 96usize {
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::Uint(256usize),
ethabi::ParamType::Uint(256usize),
ethabi::ParamType::FixedBytes(32usize),
],
log.data.as_ref(),
)
.map_err(|e| format!("unable to decode log.data: {:?}", e))?;
values.reverse();
Ok(Self {
wrapped_token: ethabi::decode(
&[ethabi::ParamType::Address],
log.topics[1usize].as_ref(),
)
.map_err(|e| {
format!(
"unable to decode param 'wrapped_token' from topic of type 'address': {:?}",
e
)
})?
.pop()
.expect(INTERNAL_ERR)
.into_address()
.expect(INTERNAL_ERR)
.as_bytes()
.to_vec(),
deposited_underlying: {
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)
},
minted_shares: {
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)
},
buffer_balances: {
let mut result = [0u8; 32];
let v = values
.pop()
.expect(INTERNAL_ERR)
.into_fixed_bytes()
.expect(INTERNAL_ERR);
result.copy_from_slice(&v);
result
},
})
}
}
impl substreams_ethereum::Event for Wrap {
const NAME: &'static str = "Wrap";
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)
}
}
}