const INTERNAL_ERR: &'static str = "`ethabi_derive` internal error"; /// Contract's functions. #[allow(dead_code, unused_imports, unused_variables)] pub mod functions { use super::INTERNAL_ERR; #[derive(Debug, Clone, PartialEq)] pub struct Create { pub name: String, pub symbol: String, pub main_token: Vec, pub wrapped_token: Vec, pub upper_target: substreams::scalar::BigInt, pub swap_fee_percentage: substreams::scalar::BigInt, pub owner: Vec, pub protocol_id: substreams::scalar::BigInt, pub salt: [u8; 32usize], } impl Create { const METHOD_ID: [u8; 4] = [118u8, 137u8, 91u8, 231u8]; 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::String, ethabi::ParamType::String, ethabi::ParamType::Address, ethabi::ParamType::Address, ethabi::ParamType::Uint(256usize), ethabi::ParamType::Uint(256usize), ethabi::ParamType::Address, ethabi::ParamType::Uint(256usize), ethabi::ParamType::FixedBytes(32usize), ], maybe_data.unwrap(), ) .map_err(|e| format!("unable to decode call.input: {:?}", e))?; values.reverse(); Ok(Self { name: values .pop() .expect(INTERNAL_ERR) .into_string() .expect(INTERNAL_ERR), symbol: values .pop() .expect(INTERNAL_ERR) .into_string() .expect(INTERNAL_ERR), main_token: values .pop() .expect(INTERNAL_ERR) .into_address() .expect(INTERNAL_ERR) .as_bytes() .to_vec(), wrapped_token: values .pop() .expect(INTERNAL_ERR) .into_address() .expect(INTERNAL_ERR) .as_bytes() .to_vec(), upper_target: { 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) }, owner: values .pop() .expect(INTERNAL_ERR) .into_address() .expect(INTERNAL_ERR) .as_bytes() .to_vec(), protocol_id: { let mut v = [0 as u8; 32]; values .pop() .expect(INTERNAL_ERR) .into_uint() .expect(INTERNAL_ERR) .to_big_endian(v.as_mut_slice()); substreams::scalar::BigInt::from_unsigned_bytes_be(&v) }, salt: { let mut result = [0u8; 32]; let v = values .pop() .expect(INTERNAL_ERR) .into_fixed_bytes() .expect(INTERNAL_ERR); result.copy_from_slice(&v); result }, }) } pub fn encode(&self) -> Vec { let data = ethabi::encode(&[ ethabi::Token::String(self.name.clone()), ethabi::Token::String(self.symbol.clone()), ethabi::Token::Address(ethabi::Address::from_slice(&self.main_token)), ethabi::Token::Address(ethabi::Address::from_slice(&self.wrapped_token)), ethabi::Token::Uint(ethabi::Uint::from_big_endian( match self.upper_target.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 .swap_fee_percentage .clone() .to_bytes_be() { (num_bigint::Sign::Plus, bytes) => bytes, (num_bigint::Sign::NoSign, bytes) => bytes, (num_bigint::Sign::Minus, _) => { panic!("negative numbers are not supported") } } .as_slice(), )), ethabi::Token::Address(ethabi::Address::from_slice(&self.owner)), ethabi::Token::Uint(ethabi::Uint::from_big_endian( match self.protocol_id.clone().to_bytes_be() { (num_bigint::Sign::Plus, bytes) => bytes, (num_bigint::Sign::NoSign, bytes) => bytes, (num_bigint::Sign::Minus, _) => { panic!("negative numbers are not supported") } } .as_slice(), )), ethabi::Token::FixedBytes(self.salt.as_ref().to_vec()), ]); let mut encoded = Vec::with_capacity(4 + data.len()); encoded.extend(Self::METHOD_ID); encoded.extend(data); encoded } pub fn output_call( call: &substreams_ethereum::pb::eth::v2::Call, ) -> Result, 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 Create { const NAME: &'static str = "create"; fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool { Self::match_call(call) } fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result { Self::decode(call) } fn encode(&self) -> Vec { self.encode() } } impl substreams_ethereum::rpc::RPCDecodable> for Create { fn output(data: &[u8]) -> Result, String> { Self::output(data) } } #[derive(Debug, Clone, PartialEq)] pub struct Disable {} impl Disable { const METHOD_ID: [u8; 4] = [47u8, 39u8, 112u8, 219u8]; pub fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result { 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 match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool { match call.input.get(0..4) { Some(signature) => Self::METHOD_ID == signature, None => false, } } } impl substreams_ethereum::Function for Disable { const NAME: &'static str = "disable"; fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool { Self::match_call(call) } fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result { Self::decode(call) } fn encode(&self) -> Vec { self.encode() } } #[derive(Debug, Clone, PartialEq)] pub struct GetActionId { pub selector: [u8; 4usize], } impl GetActionId { const METHOD_ID: [u8; 4] = [133u8, 28u8, 27u8, 179u8]; pub fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result { let maybe_data = call.input.get(4..); if maybe_data.is_none() { return Err("no data to decode".to_string()); } let mut values = ethabi::decode(&[ethabi::ParamType::FixedBytes(4usize)], maybe_data.unwrap()) .map_err(|e| format!("unable to decode call.input: {:?}", e))?; values.reverse(); Ok(Self { selector: { let mut result = [0u8; 4]; let v = values .pop() .expect(INTERNAL_ERR) .into_fixed_bytes() .expect(INTERNAL_ERR); result.copy_from_slice(&v); result }, }) } pub fn encode(&self) -> Vec { let data = ethabi::encode(&[ethabi::Token::FixedBytes(self.selector.as_ref().to_vec())]); let mut encoded = Vec::with_capacity(4 + data.len()); encoded.extend(Self::METHOD_ID); encoded.extend(data); encoded } pub fn output_call( call: &substreams_ethereum::pb::eth::v2::Call, ) -> Result<[u8; 32usize], String> { Self::output(call.return_data.as_ref()) } pub fn output(data: &[u8]) -> Result<[u8; 32usize], String> { let mut values = ethabi::decode(&[ethabi::ParamType::FixedBytes(32usize)], data.as_ref()) .map_err(|e| format!("unable to decode output data: {:?}", e))?; Ok({ let mut result = [0u8; 32]; let v = values .pop() .expect("one output data should have existed") .into_fixed_bytes() .expect(INTERNAL_ERR); result.copy_from_slice(&v); result }) } pub fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool { match call.input.get(0..4) { Some(signature) => Self::METHOD_ID == signature, None => false, } } pub fn call(&self, address: Vec) -> Option<[u8; 32usize]> { use substreams_ethereum::pb::eth::rpc; let rpc_calls = rpc::RpcCalls { calls: vec![rpc::RpcCall { to_addr: address, data: self.encode() }], }; let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses; let response = responses .get(0) .expect("one response should have existed"); if response.failed { return None; } match Self::output(response.raw.as_ref()) { Ok(data) => Some(data), Err(err) => { use substreams_ethereum::Function; substreams::log::info!( "Call output for function `{}` failed to decode with error: {}", Self::NAME, err ); None } } } } impl substreams_ethereum::Function for GetActionId { const NAME: &'static str = "getActionId"; fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool { Self::match_call(call) } fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result { Self::decode(call) } fn encode(&self) -> Vec { self.encode() } } impl substreams_ethereum::rpc::RPCDecodable<[u8; 32usize]> for GetActionId { fn output(data: &[u8]) -> Result<[u8; 32usize], String> { Self::output(data) } } #[derive(Debug, Clone, PartialEq)] pub struct GetAuthorizer {} impl GetAuthorizer { const METHOD_ID: [u8; 4] = [170u8, 171u8, 173u8, 197u8]; pub fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result { 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 GetAuthorizer { const NAME: &'static str = "getAuthorizer"; fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool { Self::match_call(call) } fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result { Self::decode(call) } fn encode(&self) -> Vec { self.encode() } } impl substreams_ethereum::rpc::RPCDecodable> for GetAuthorizer { fn output(data: &[u8]) -> Result, String> { Self::output(data) } } #[derive(Debug, Clone, PartialEq)] pub struct GetCreationCode {} impl GetCreationCode { const METHOD_ID: [u8; 4] = [0u8, 193u8, 148u8, 219u8]; pub fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result { 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::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 GetCreationCode { const NAME: &'static str = "getCreationCode"; fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool { Self::match_call(call) } fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result { Self::decode(call) } fn encode(&self) -> Vec { self.encode() } } impl substreams_ethereum::rpc::RPCDecodable> for GetCreationCode { fn output(data: &[u8]) -> Result, String> { Self::output(data) } } #[derive(Debug, Clone, PartialEq)] pub struct GetCreationCodeContracts {} impl GetCreationCodeContracts { const METHOD_ID: [u8; 4] = [23u8, 68u8, 129u8, 250u8]; pub fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result { 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<(Vec, Vec), String> { Self::output(call.return_data.as_ref()) } pub fn output(data: &[u8]) -> Result<(Vec, Vec), String> { let mut values = ethabi::decode( &[ethabi::ParamType::Address, ethabi::ParamType::Address], data.as_ref(), ) .map_err(|e| format!("unable to decode output data: {:?}", e))?; values.reverse(); Ok(( values .pop() .expect(INTERNAL_ERR) .into_address() .expect(INTERNAL_ERR) .as_bytes() .to_vec(), values .pop() .expect(INTERNAL_ERR) .into_address() .expect(INTERNAL_ERR) .as_bytes() .to_vec(), )) } pub fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool { match call.input.get(0..4) { Some(signature) => Self::METHOD_ID == signature, None => false, } } pub fn call(&self, address: Vec) -> Option<(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 GetCreationCodeContracts { const NAME: &'static str = "getCreationCodeContracts"; fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool { Self::match_call(call) } fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result { Self::decode(call) } fn encode(&self) -> Vec { self.encode() } } impl substreams_ethereum::rpc::RPCDecodable<(Vec, Vec)> for GetCreationCodeContracts { fn output(data: &[u8]) -> Result<(Vec, Vec), String> { Self::output(data) } } #[derive(Debug, Clone, PartialEq)] pub struct GetLastCreatedPool {} impl GetLastCreatedPool { const METHOD_ID: [u8; 4] = [94u8, 211u8, 18u8, 130u8]; 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 GetLastCreatedPool { const NAME: &'static str = "getLastCreatedPool"; 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 GetLastCreatedPool { fn output(data: &[u8]) -> Result, String> { Self::output(data) } } #[derive(Debug, Clone, PartialEq)] pub struct GetPauseConfiguration {} impl GetPauseConfiguration { const METHOD_ID: [u8; 4] = [45u8, 164u8, 124u8, 64u8]; pub fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result { 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<(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 GetPauseConfiguration { const NAME: &'static str = "getPauseConfiguration"; fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool { Self::match_call(call) } fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result { Self::decode(call) } fn encode(&self) -> Vec { self.encode() } } impl substreams_ethereum::rpc::RPCDecodable<( substreams::scalar::BigInt, substreams::scalar::BigInt, )> for GetPauseConfiguration { fn output( data: &[u8], ) -> Result<(substreams::scalar::BigInt, substreams::scalar::BigInt), String> { Self::output(data) } } #[derive(Debug, Clone, PartialEq)] pub struct GetPoolVersion {} impl GetPoolVersion { const METHOD_ID: [u8; 4] = [63u8, 129u8, 155u8, 111u8]; pub fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result { 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::String], data.as_ref()) .map_err(|e| format!("unable to decode output data: {:?}", e))?; Ok(values .pop() .expect("one output data should have existed") .into_string() .expect(INTERNAL_ERR)) } pub fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool { match call.input.get(0..4) { Some(signature) => Self::METHOD_ID == signature, None => false, } } pub fn call(&self, address: Vec) -> 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 GetPoolVersion { const NAME: &'static str = "getPoolVersion"; fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool { Self::match_call(call) } fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result { Self::decode(call) } fn encode(&self) -> Vec { self.encode() } } impl substreams_ethereum::rpc::RPCDecodable for GetPoolVersion { fn output(data: &[u8]) -> Result { Self::output(data) } } #[derive(Debug, Clone, PartialEq)] pub struct GetProtocolFeePercentagesProvider {} impl GetProtocolFeePercentagesProvider { const METHOD_ID: [u8; 4] = [115u8, 146u8, 56u8, 214u8]; pub fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result { 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 GetProtocolFeePercentagesProvider { const NAME: &'static str = "getProtocolFeePercentagesProvider"; fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool { Self::match_call(call) } fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result { Self::decode(call) } fn encode(&self) -> Vec { self.encode() } } impl substreams_ethereum::rpc::RPCDecodable> for GetProtocolFeePercentagesProvider { fn output(data: &[u8]) -> Result, String> { Self::output(data) } } #[derive(Debug, Clone, PartialEq)] pub struct GetVault {} impl GetVault { const METHOD_ID: [u8; 4] = [141u8, 146u8, 138u8, 248u8]; pub fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result { 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 GetVault { const NAME: &'static str = "getVault"; fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool { Self::match_call(call) } fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result { Self::decode(call) } fn encode(&self) -> Vec { self.encode() } } impl substreams_ethereum::rpc::RPCDecodable> for GetVault { fn output(data: &[u8]) -> Result, String> { Self::output(data) } } #[derive(Debug, Clone, PartialEq)] pub struct IsDisabled {} impl IsDisabled { const METHOD_ID: [u8; 4] = [108u8, 87u8, 245u8, 169u8]; pub fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result { 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 IsDisabled { const NAME: &'static str = "isDisabled"; fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool { Self::match_call(call) } fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result { Self::decode(call) } fn encode(&self) -> Vec { self.encode() } } impl substreams_ethereum::rpc::RPCDecodable for IsDisabled { fn output(data: &[u8]) -> Result { Self::output(data) } } #[derive(Debug, Clone, PartialEq)] pub struct IsPoolFromFactory { pub pool: Vec, } impl IsPoolFromFactory { const METHOD_ID: [u8; 4] = [102u8, 52u8, 183u8, 83u8]; 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], maybe_data.unwrap()) .map_err(|e| format!("unable to decode call.input: {:?}", e))?; values.reverse(); Ok(Self { pool: values .pop() .expect(INTERNAL_ERR) .into_address() .expect(INTERNAL_ERR) .as_bytes() .to_vec(), }) } pub fn encode(&self) -> Vec { let data = ethabi::encode(&[ethabi::Token::Address(ethabi::Address::from_slice(&self.pool))]); let mut encoded = Vec::with_capacity(4 + data.len()); encoded.extend(Self::METHOD_ID); encoded.extend(data); encoded } pub fn output_call(call: &substreams_ethereum::pb::eth::v2::Call) -> Result { 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 IsPoolFromFactory { const NAME: &'static str = "isPoolFromFactory"; fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool { Self::match_call(call) } fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result { Self::decode(call) } fn encode(&self) -> Vec { self.encode() } } impl substreams_ethereum::rpc::RPCDecodable for IsPoolFromFactory { fn output(data: &[u8]) -> Result { Self::output(data) } } #[derive(Debug, Clone, PartialEq)] pub struct Version {} impl Version { const METHOD_ID: [u8; 4] = [84u8, 253u8, 77u8, 80u8]; pub fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result { 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::String], data.as_ref()) .map_err(|e| format!("unable to decode output data: {:?}", e))?; Ok(values .pop() .expect("one output data should have existed") .into_string() .expect(INTERNAL_ERR)) } pub fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool { match call.input.get(0..4) { Some(signature) => Self::METHOD_ID == signature, None => false, } } pub fn call(&self, address: Vec) -> 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 Version { const NAME: &'static str = "version"; fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool { Self::match_call(call) } fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result { Self::decode(call) } fn encode(&self) -> Vec { self.encode() } } impl substreams_ethereum::rpc::RPCDecodable for Version { fn output(data: &[u8]) -> Result { 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 Erc4626LinearPoolCreated { pub pool: Vec, pub protocol_id: substreams::scalar::BigInt, } impl Erc4626LinearPoolCreated { const TOPIC_ID: [u8; 32] = [ 69u8, 221u8, 97u8, 93u8, 46u8, 215u8, 153u8, 79u8, 152u8, 254u8, 200u8, 55u8, 178u8, 208u8, 146u8, 175u8, 147u8, 60u8, 101u8, 32u8, 184u8, 113u8, 124u8, 58u8, 100u8, 49u8, 121u8, 97u8, 202u8, 165u8, 50u8, 234u8, ]; pub fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool { if log.topics.len() != 3usize { return false; } if log.data.len() != 0usize { return false; } return log .topics .get(0) .expect("bounds already checked") .as_ref() == Self::TOPIC_ID; } pub fn decode(log: &substreams_ethereum::pb::eth::v2::Log) -> Result { 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(), protocol_id: { let mut v = [0 as u8; 32]; ethabi::decode( &[ethabi::ParamType::Uint(256usize)], log.topics[2usize].as_ref(), ) .map_err(|e| { format!( "unable to decode param 'protocol_id' from topic of type 'uint256': {:?}", e ) })? .pop() .expect(INTERNAL_ERR) .into_uint() .expect(INTERNAL_ERR) .to_big_endian(v.as_mut_slice()); substreams::scalar::BigInt::from_unsigned_bytes_be(&v) }, }) } } impl substreams_ethereum::Event for Erc4626LinearPoolCreated { const NAME: &'static str = "Erc4626LinearPoolCreated"; 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 FactoryDisabled {} impl FactoryDisabled { const TOPIC_ID: [u8; 32] = [ 67u8, 42u8, 203u8, 253u8, 102u8, 45u8, 187u8, 93u8, 139u8, 55u8, 131u8, 132u8, 166u8, 113u8, 89u8, 180u8, 124u8, 169u8, 208u8, 241u8, 183u8, 159u8, 151u8, 207u8, 100u8, 207u8, 133u8, 133u8, 250u8, 54u8, 45u8, 80u8, ]; pub fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool { if log.topics.len() != 1usize { return false; } if log.data.len() != 0usize { return false; } return log .topics .get(0) .expect("bounds already checked") .as_ref() == Self::TOPIC_ID; } pub fn decode(log: &substreams_ethereum::pb::eth::v2::Log) -> Result { Ok(Self {}) } } impl substreams_ethereum::Event for FactoryDisabled { const NAME: &'static str = "FactoryDisabled"; fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool { Self::match_log(log) } fn decode(log: &substreams_ethereum::pb::eth::v2::Log) -> Result { Self::decode(log) } } #[derive(Debug, Clone, PartialEq)] pub struct PoolCreated { pub pool: Vec, } impl PoolCreated { const TOPIC_ID: [u8; 32] = [ 131u8, 164u8, 143u8, 188u8, 252u8, 153u8, 19u8, 53u8, 49u8, 78u8, 116u8, 208u8, 73u8, 106u8, 171u8, 106u8, 25u8, 135u8, 233u8, 146u8, 221u8, 200u8, 93u8, 221u8, 188u8, 196u8, 214u8, 221u8, 110u8, 242u8, 233u8, 252u8, ]; pub fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool { if log.topics.len() != 2usize { return false; } if log.data.len() != 0usize { return false; } return log .topics .get(0) .expect("bounds already checked") .as_ref() == Self::TOPIC_ID; } pub fn decode(log: &substreams_ethereum::pb::eth::v2::Log) -> Result { Ok(Self { pool: ethabi::decode(&[ethabi::ParamType::Address], log.topics[1usize].as_ref()) .map_err(|e| { format!( "unable to decode param 'pool' from topic of type 'address': {:?}", e ) })? .pop() .expect(INTERNAL_ERR) .into_address() .expect(INTERNAL_ERR) .as_bytes() .to_vec(), }) } } impl substreams_ethereum::Event for PoolCreated { const NAME: &'static str = "PoolCreated"; fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool { Self::match_log(log) } fn decode(log: &substreams_ethereum::pb::eth::v2::Log) -> Result { Self::decode(log) } } }