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, Vec, Vec, substreams::scalar::BigInt, substreams::scalar::BigInt, Vec, ), } impl AddLiquidity { const METHOD_ID: [u8; 4] = [74u8, 242u8, 158u8, 196u8]; pub fn decode( call: &substreams_ethereum::pb::eth::v2::Call, ) -> Result { 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 { 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, Vec), String, > { Self::output(call.return_data.as_ref()) } pub fn output( data: &[u8], ) -> Result< (Vec, substreams::scalar::BigInt, Vec), 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, ) -> Option< (Vec, substreams::scalar::BigInt, Vec), > { 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::decode(call) } fn encode(&self) -> Vec { self.encode() } } impl substreams_ethereum::rpc::RPCDecodable< (Vec, substreams::scalar::BigInt, Vec), > for AddLiquidity { fn output( data: &[u8], ) -> Result< (Vec, substreams::scalar::BigInt, Vec), String, > { Self::output(data) } } #[derive(Debug, Clone, PartialEq)] pub struct Erc4626BufferWrapOrUnwrap { pub params: ( substreams::scalar::BigInt, substreams::scalar::BigInt, Vec, 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 { 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 { 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, ) -> 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::decode(call) } fn encode(&self) -> Vec { 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, pub token: Vec, } impl GetPoolTokenCountAndIndexOfToken { const METHOD_ID: [u8; 4] = [201u8, 193u8, 102u8, 27u8]; pub fn decode( call: &substreams_ethereum::pb::eth::v2::Call, ) -> Result { 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 { 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, ) -> 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::decode(call) } fn encode(&self) -> Vec { 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 { Ok(Self {}) } pub fn encode(&self) -> Vec { let data = ethabi::encode(&[]); let mut encoded = Vec::with_capacity(4 + data.len()); encoded.extend(Self::METHOD_ID); encoded.extend(data); encoded } pub fn output_call( call: &substreams_ethereum::pb::eth::v2::Call, ) -> Result, String> { Self::output(call.return_data.as_ref()) } pub fn output(data: &[u8]) -> Result, 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) -> Option> { 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::decode(call) } fn encode(&self) -> Vec { self.encode() } } impl substreams_ethereum::rpc::RPCDecodable> for GetVaultExtension { fn output(data: &[u8]) -> Result, 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 { Ok(Self {}) } pub fn encode(&self) -> Vec { 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 { Self::output(call.return_data.as_ref()) } pub fn output(data: &[u8]) -> Result { 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) -> Option { 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::decode(call) } fn encode(&self) -> Vec { self.encode() } } impl substreams_ethereum::rpc::RPCDecodable for ReentrancyGuardEntered { fn output(data: &[u8]) -> Result { Self::output(data) } } #[derive(Debug, Clone, PartialEq)] pub struct RemoveLiquidity { pub params: ( Vec, Vec, substreams::scalar::BigInt, Vec, substreams::scalar::BigInt, Vec, ), } impl RemoveLiquidity { const METHOD_ID: [u8; 4] = [33u8, 69u8, 120u8, 151u8]; pub fn decode( call: &substreams_ethereum::pb::eth::v2::Call, ) -> Result { 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 { 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, Vec), String, > { Self::output(call.return_data.as_ref()) } pub fn output( data: &[u8], ) -> Result< (substreams::scalar::BigInt, Vec, Vec), 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, ) -> Option< (substreams::scalar::BigInt, Vec, Vec), > { 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::decode(call) } fn encode(&self) -> Vec { self.encode() } } impl substreams_ethereum::rpc::RPCDecodable< (substreams::scalar::BigInt, Vec, Vec), > for RemoveLiquidity { fn output( data: &[u8], ) -> Result< (substreams::scalar::BigInt, Vec, Vec), String, > { Self::output(data) } } #[derive(Debug, Clone, PartialEq)] pub struct SendTo { pub token: Vec, pub to: Vec, 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 { 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 { 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::decode(call) } fn encode(&self) -> Vec { self.encode() } } #[derive(Debug, Clone, PartialEq)] pub struct Settle { pub token: Vec, 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 { 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 { 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 { Self::output(call.return_data.as_ref()) } pub fn output(data: &[u8]) -> Result { 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) -> Option { 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::decode(call) } fn encode(&self) -> Vec { self.encode() } } impl substreams_ethereum::rpc::RPCDecodable for Settle { fn output(data: &[u8]) -> Result { Self::output(data) } } #[derive(Debug, Clone, PartialEq)] pub struct Swap { pub vault_swap_params: ( substreams::scalar::BigInt, Vec, Vec, Vec, substreams::scalar::BigInt, substreams::scalar::BigInt, Vec, ), } impl Swap { const METHOD_ID: [u8; 4] = [43u8, 251u8, 120u8, 12u8]; pub fn decode( call: &substreams_ethereum::pb::eth::v2::Call, ) -> Result { 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 { 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, ) -> 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::decode(call) } fn encode(&self) -> Vec { 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, pub to: Vec, 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 { 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 { 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 { Self::output(call.return_data.as_ref()) } pub fn output(data: &[u8]) -> Result { 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) -> Option { 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::decode(call) } fn encode(&self) -> Vec { self.encode() } } impl substreams_ethereum::rpc::RPCDecodable for Transfer { fn output(data: &[u8]) -> Result { Self::output(data) } } #[derive(Debug, Clone, PartialEq)] pub struct TransferFrom { pub spender: Vec, pub from: Vec, pub to: Vec, 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 { 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 { 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 { Self::output(call.return_data.as_ref()) } pub fn output(data: &[u8]) -> Result { 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) -> Option { 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::decode(call) } fn encode(&self) -> Vec { self.encode() } } impl substreams_ethereum::rpc::RPCDecodable for TransferFrom { fn output(data: &[u8]) -> Result { Self::output(data) } } #[derive(Debug, Clone, PartialEq)] pub struct Unlock { pub data: Vec, } impl Unlock { const METHOD_ID: [u8; 4] = [72u8, 200u8, 148u8, 145u8]; pub fn decode( call: &substreams_ethereum::pb::eth::v2::Call, ) -> Result { 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 { 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, String> { Self::output(call.return_data.as_ref()) } pub fn output(data: &[u8]) -> Result, 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) -> Option> { 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::decode(call) } fn encode(&self) -> Vec { self.encode() } } impl substreams_ethereum::rpc::RPCDecodable> for Unlock { fn output(data: &[u8]) -> Result, 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, 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 { 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::decode(log) } } #[derive(Debug, Clone, PartialEq)] pub struct AggregateYieldFeePercentageChanged { pub pool: Vec, 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 { 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::decode(log) } } #[derive(Debug, Clone, PartialEq)] pub struct Approval { pub pool: Vec, pub owner: Vec, pub spender: Vec, 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 { 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::decode(log) } } #[derive(Debug, Clone, PartialEq)] pub struct AuthorizerChanged { pub new_authorizer: Vec, } 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 { 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::decode(log) } } #[derive(Debug, Clone, PartialEq)] pub struct BufferSharesBurned { pub wrapped_token: Vec, pub from: Vec, 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 { 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::decode(log) } } #[derive(Debug, Clone, PartialEq)] pub struct BufferSharesMinted { pub wrapped_token: Vec, pub to: Vec, 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 { 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::decode(log) } } #[derive(Debug, Clone, PartialEq)] pub struct LiquidityAdded { pub pool: Vec, pub liquidity_provider: Vec, pub kind: substreams::scalar::BigInt, pub total_supply: substreams::scalar::BigInt, pub amounts_added_raw: Vec, pub swap_fee_amounts_raw: Vec, } 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 { 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::decode(log) } } #[derive(Debug, Clone, PartialEq)] pub struct LiquidityAddedToBuffer { pub wrapped_token: Vec, 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 { 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::decode(log) } } #[derive(Debug, Clone, PartialEq)] pub struct LiquidityRemoved { pub pool: Vec, pub liquidity_provider: Vec, pub kind: substreams::scalar::BigInt, pub total_supply: substreams::scalar::BigInt, pub amounts_removed_raw: Vec, pub swap_fee_amounts_raw: Vec, } 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 { 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::decode(log) } } #[derive(Debug, Clone, PartialEq)] pub struct LiquidityRemovedFromBuffer { pub wrapped_token: Vec, 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 { 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::decode(log) } } #[derive(Debug, Clone, PartialEq)] pub struct PoolInitialized { pub pool: Vec, } 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 { 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::decode(log) } } #[derive(Debug, Clone, PartialEq)] pub struct PoolPausedStateChanged { pub pool: Vec, 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 { 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::decode(log) } } #[derive(Debug, Clone, PartialEq)] pub struct PoolRecoveryModeStateChanged { pub pool: Vec, 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 { 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::decode(log) } } #[derive(Debug, Clone, PartialEq)] pub struct PoolRegistered { pub pool: Vec, pub factory: Vec, pub token_config: Vec<(Vec, substreams::scalar::BigInt, Vec, bool)>, pub swap_fee_percentage: substreams::scalar::BigInt, pub pause_window_end_time: substreams::scalar::BigInt, pub role_accounts: (Vec, Vec, Vec), pub hooks_config: ( bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, Vec, ), 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 { 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::decode(log) } } #[derive(Debug, Clone, PartialEq)] pub struct ProtocolFeeControllerChanged { pub new_protocol_fee_controller: Vec, } 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 { 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::decode(log) } } #[derive(Debug, Clone, PartialEq)] pub struct Swap { pub pool: Vec, pub token_in: Vec, pub token_out: Vec, 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 { 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::decode(log) } } #[derive(Debug, Clone, PartialEq)] pub struct SwapFeePercentageChanged { pub pool: Vec, 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 { 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::decode(log) } } #[derive(Debug, Clone, PartialEq)] pub struct Transfer { pub pool: Vec, pub from: Vec, pub to: Vec, 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 { 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::decode(log) } } #[derive(Debug, Clone, PartialEq)] pub struct Unwrap { pub wrapped_token: Vec, 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 { 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::decode(log) } } #[derive(Debug, Clone, PartialEq)] pub struct VaultAuxiliary { pub pool: Vec, pub event_key: [u8; 32usize], pub event_data: Vec, } 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 { 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::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 { 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::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 { 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::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 { 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::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 { 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::decode(log) } } #[derive(Debug, Clone, PartialEq)] pub struct Wrap { pub wrapped_token: Vec, 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 { 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::decode(log) } } }