From ad8763b5d184233d1b82fc645c0903c6fec801b3 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Mon, 10 Jul 2023 16:39:43 -0700 Subject: [PATCH] add them --- payment-contracts/src/contracts/ierc20.rs | 667 +++++++ payment-contracts/src/contracts/mod.rs | 9 + .../src/contracts/payment_factory.rs | 1596 +++++++++++++++++ .../src/contracts/payment_proxy.rs | 98 + .../src/contracts/payment_sweeper.rs | 256 +++ 5 files changed, 2626 insertions(+) create mode 100644 payment-contracts/src/contracts/ierc20.rs create mode 100644 payment-contracts/src/contracts/mod.rs create mode 100644 payment-contracts/src/contracts/payment_factory.rs create mode 100644 payment-contracts/src/contracts/payment_proxy.rs create mode 100644 payment-contracts/src/contracts/payment_sweeper.rs diff --git a/payment-contracts/src/contracts/ierc20.rs b/payment-contracts/src/contracts/ierc20.rs new file mode 100644 index 00000000..2fcb627c --- /dev/null +++ b/payment-contracts/src/contracts/ierc20.rs @@ -0,0 +1,667 @@ +pub use ierc20::*; +/// This module was auto-generated with ethers-rs Abigen. +/// More information at: +#[allow( + clippy::enum_variant_names, + clippy::too_many_arguments, + clippy::upper_case_acronyms, + clippy::type_complexity, + dead_code, + non_camel_case_types, +)] +pub mod ierc20 { + #[rustfmt::skip] + const __ABI: &str = "[\n {\n \"name\": \"Transfer\",\n \"inputs\": [\n {\n \"name\": \"_from\",\n \"type\": \"address\",\n \"indexed\": true\n },\n {\n \"name\": \"_to\",\n \"type\": \"address\",\n \"indexed\": true\n },\n {\n \"name\": \"_value\",\n \"type\": \"uint256\",\n \"indexed\": false\n }\n ],\n \"anonymous\": false,\n \"type\": \"event\"\n },\n {\n \"name\": \"Approval\",\n \"inputs\": [\n {\n \"name\": \"_owner\",\n \"type\": \"address\",\n \"indexed\": true\n },\n {\n \"name\": \"_spender\",\n \"type\": \"address\",\n \"indexed\": true\n },\n {\n \"name\": \"_value\",\n \"type\": \"uint256\",\n \"indexed\": false\n }\n ],\n \"anonymous\": false,\n \"type\": \"event\"\n },\n {\n \"stateMutability\": \"nonpayable\",\n \"type\": \"constructor\",\n \"inputs\": [\n {\n \"name\": \"_name\",\n \"type\": \"string\"\n },\n {\n \"name\": \"_symbol\",\n \"type\": \"string\"\n },\n {\n \"name\": \"_decimals\",\n \"type\": \"uint256\"\n }\n ],\n \"outputs\": []\n },\n {\n \"stateMutability\": \"nonpayable\",\n \"type\": \"function\",\n \"name\": \"transfer\",\n \"inputs\": [\n {\n \"name\": \"_to\",\n \"type\": \"address\"\n },\n {\n \"name\": \"_value\",\n \"type\": \"uint256\"\n }\n ],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"bool\"\n }\n ],\n \"gas\": 79588\n },\n {\n \"stateMutability\": \"nonpayable\",\n \"type\": \"function\",\n \"name\": \"transferFrom\",\n \"inputs\": [\n {\n \"name\": \"_from\",\n \"type\": \"address\"\n },\n {\n \"name\": \"_to\",\n \"type\": \"address\"\n },\n {\n \"name\": \"_value\",\n \"type\": \"uint256\"\n }\n ],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"bool\"\n }\n ],\n \"gas\": 119640\n },\n {\n \"stateMutability\": \"nonpayable\",\n \"type\": \"function\",\n \"name\": \"approve\",\n \"inputs\": [\n {\n \"name\": \"_spender\",\n \"type\": \"address\"\n },\n {\n \"name\": \"_value\",\n \"type\": \"uint256\"\n }\n ],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"bool\"\n }\n ],\n \"gas\": 37791\n },\n {\n \"stateMutability\": \"nonpayable\",\n \"type\": \"function\",\n \"name\": \"_mint_for_testing\",\n \"inputs\": [\n {\n \"name\": \"_target\",\n \"type\": \"address\"\n },\n {\n \"name\": \"_value\",\n \"type\": \"uint256\"\n }\n ],\n \"outputs\": [],\n \"gas\": 77251\n },\n {\n \"stateMutability\": \"view\",\n \"type\": \"function\",\n \"name\": \"name\",\n \"inputs\": [],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"string\"\n }\n ],\n \"gas\": 12810\n },\n {\n \"stateMutability\": \"view\",\n \"type\": \"function\",\n \"name\": \"symbol\",\n \"inputs\": [],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"string\"\n }\n ],\n \"gas\": 10563\n },\n {\n \"stateMutability\": \"view\",\n \"type\": \"function\",\n \"name\": \"decimals\",\n \"inputs\": [],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"uint256\"\n }\n ],\n \"gas\": 2568\n },\n {\n \"stateMutability\": \"view\",\n \"type\": \"function\",\n \"name\": \"balanceOf\",\n \"inputs\": [\n {\n \"name\": \"arg0\",\n \"type\": \"address\"\n }\n ],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"uint256\"\n }\n ],\n \"gas\": 2813\n },\n {\n \"stateMutability\": \"view\",\n \"type\": \"function\",\n \"name\": \"allowance\",\n \"inputs\": [\n {\n \"name\": \"arg0\",\n \"type\": \"address\"\n },\n {\n \"name\": \"arg1\",\n \"type\": \"address\"\n }\n ],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"uint256\"\n }\n ],\n \"gas\": 3058\n },\n {\n \"stateMutability\": \"view\",\n \"type\": \"function\",\n \"name\": \"totalSupply\",\n \"inputs\": [],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"uint256\"\n }\n ],\n \"gas\": 2658\n }\n]"; + ///The parsed JSON ABI of the contract. + pub static IERC20_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> = ::ethers::contract::Lazy::new(|| + ::ethers::core::utils::__serde_json::from_str(__ABI).expect("ABI is always valid")); + pub struct IERC20(::ethers::contract::Contract); + impl ::core::clone::Clone for IERC20 { + fn clone(&self) -> Self { + Self(::core::clone::Clone::clone(&self.0)) + } + } + impl ::core::ops::Deref for IERC20 { + type Target = ::ethers::contract::Contract; + fn deref(&self) -> &Self::Target { + &self.0 + } + } + impl ::core::ops::DerefMut for IERC20 { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } + } + impl ::core::fmt::Debug for IERC20 { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_tuple(stringify!(IERC20)).field(&self.address()).finish() + } + } + impl IERC20 { + /// Creates a new contract instance with the specified `ethers` client at + /// `address`. The contract derefs to a `ethers::Contract` object. + pub fn new>( + address: T, + client: ::std::sync::Arc, + ) -> Self { + Self( + ::ethers::contract::Contract::new( + address.into(), + IERC20_ABI.clone(), + client, + ), + ) + } + ///Calls the contract's `_mint_for_testing` (0xf8c14102) function + pub fn mint_for_testing( + &self, + target: ::ethers::core::types::Address, + value: ::ethers::core::types::U256, + ) -> ::ethers::contract::builders::ContractCall { + self.0 + .method_hash([248, 193, 65, 2], (target, value)) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `allowance` (0xdd62ed3e) function + pub fn allowance( + &self, + arg_0: ::ethers::core::types::Address, + arg_1: ::ethers::core::types::Address, + ) -> ::ethers::contract::builders::ContractCall { + self.0 + .method_hash([221, 98, 237, 62], (arg_0, arg_1)) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `approve` (0x095ea7b3) function + pub fn approve( + &self, + spender: ::ethers::core::types::Address, + value: ::ethers::core::types::U256, + ) -> ::ethers::contract::builders::ContractCall { + self.0 + .method_hash([9, 94, 167, 179], (spender, value)) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `balanceOf` (0x70a08231) function + pub fn balance_of( + &self, + arg_0: ::ethers::core::types::Address, + ) -> ::ethers::contract::builders::ContractCall { + self.0 + .method_hash([112, 160, 130, 49], arg_0) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `decimals` (0x313ce567) function + pub fn decimals( + &self, + ) -> ::ethers::contract::builders::ContractCall { + self.0 + .method_hash([49, 60, 229, 103], ()) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `name` (0x06fdde03) function + pub fn name( + &self, + ) -> ::ethers::contract::builders::ContractCall { + self.0 + .method_hash([6, 253, 222, 3], ()) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `symbol` (0x95d89b41) function + pub fn symbol( + &self, + ) -> ::ethers::contract::builders::ContractCall { + self.0 + .method_hash([149, 216, 155, 65], ()) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `totalSupply` (0x18160ddd) function + pub fn total_supply( + &self, + ) -> ::ethers::contract::builders::ContractCall { + self.0 + .method_hash([24, 22, 13, 221], ()) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `transfer` (0xa9059cbb) function + pub fn transfer( + &self, + to: ::ethers::core::types::Address, + value: ::ethers::core::types::U256, + ) -> ::ethers::contract::builders::ContractCall { + self.0 + .method_hash([169, 5, 156, 187], (to, value)) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `transferFrom` (0x23b872dd) function + pub fn transfer_from( + &self, + from: ::ethers::core::types::Address, + to: ::ethers::core::types::Address, + value: ::ethers::core::types::U256, + ) -> ::ethers::contract::builders::ContractCall { + self.0 + .method_hash([35, 184, 114, 221], (from, to, value)) + .expect("method not found (this should never happen)") + } + ///Gets the contract's `Approval` event + pub fn approval_filter( + &self, + ) -> ::ethers::contract::builders::Event< + ::std::sync::Arc, + M, + ApprovalFilter, + > { + self.0.event() + } + ///Gets the contract's `Transfer` event + pub fn transfer_filter( + &self, + ) -> ::ethers::contract::builders::Event< + ::std::sync::Arc, + M, + TransferFilter, + > { + self.0.event() + } + /// Returns an `Event` builder for all the events of this contract. + pub fn events( + &self, + ) -> ::ethers::contract::builders::Event<::std::sync::Arc, M, IERC20Events> { + self.0.event_with_filter(::core::default::Default::default()) + } + } + impl From<::ethers::contract::Contract> + for IERC20 { + fn from(contract: ::ethers::contract::Contract) -> Self { + Self::new(contract.address(), contract.client()) + } + } + #[derive( + Clone, + ::ethers::contract::EthEvent, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethevent(name = "Approval", abi = "Approval(address,address,uint256)")] + pub struct ApprovalFilter { + #[ethevent(indexed)] + pub owner: ::ethers::core::types::Address, + #[ethevent(indexed)] + pub spender: ::ethers::core::types::Address, + pub value: ::ethers::core::types::U256, + } + #[derive( + Clone, + ::ethers::contract::EthEvent, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethevent(name = "Transfer", abi = "Transfer(address,address,uint256)")] + pub struct TransferFilter { + #[ethevent(indexed)] + pub from: ::ethers::core::types::Address, + #[ethevent(indexed)] + pub to: ::ethers::core::types::Address, + pub value: ::ethers::core::types::U256, + } + ///Container type for all of the contract's events + #[derive(Clone, ::ethers::contract::EthAbiType, Debug, PartialEq, Eq, Hash)] + pub enum IERC20Events { + ApprovalFilter(ApprovalFilter), + TransferFilter(TransferFilter), + } + impl ::ethers::contract::EthLogDecode for IERC20Events { + fn decode_log( + log: &::ethers::core::abi::RawLog, + ) -> ::core::result::Result { + if let Ok(decoded) = ApprovalFilter::decode_log(log) { + return Ok(IERC20Events::ApprovalFilter(decoded)); + } + if let Ok(decoded) = TransferFilter::decode_log(log) { + return Ok(IERC20Events::TransferFilter(decoded)); + } + Err(::ethers::core::abi::Error::InvalidData) + } + } + impl ::core::fmt::Display for IERC20Events { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + Self::ApprovalFilter(element) => ::core::fmt::Display::fmt(element, f), + Self::TransferFilter(element) => ::core::fmt::Display::fmt(element, f), + } + } + } + impl ::core::convert::From for IERC20Events { + fn from(value: ApprovalFilter) -> Self { + Self::ApprovalFilter(value) + } + } + impl ::core::convert::From for IERC20Events { + fn from(value: TransferFilter) -> Self { + Self::TransferFilter(value) + } + } + ///Container type for all input parameters for the `_mint_for_testing` function with signature `_mint_for_testing(address,uint256)` and selector `0xf8c14102` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "_mint_for_testing", abi = "_mint_for_testing(address,uint256)")] + pub struct MintForTestingCall { + pub target: ::ethers::core::types::Address, + pub value: ::ethers::core::types::U256, + } + ///Container type for all input parameters for the `allowance` function with signature `allowance(address,address)` and selector `0xdd62ed3e` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "allowance", abi = "allowance(address,address)")] + pub struct AllowanceCall { + pub arg_0: ::ethers::core::types::Address, + pub arg_1: ::ethers::core::types::Address, + } + ///Container type for all input parameters for the `approve` function with signature `approve(address,uint256)` and selector `0x095ea7b3` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "approve", abi = "approve(address,uint256)")] + pub struct ApproveCall { + pub spender: ::ethers::core::types::Address, + pub value: ::ethers::core::types::U256, + } + ///Container type for all input parameters for the `balanceOf` function with signature `balanceOf(address)` and selector `0x70a08231` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "balanceOf", abi = "balanceOf(address)")] + pub struct BalanceOfCall { + pub arg_0: ::ethers::core::types::Address, + } + ///Container type for all input parameters for the `decimals` function with signature `decimals()` and selector `0x313ce567` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "decimals", abi = "decimals()")] + pub struct DecimalsCall; + ///Container type for all input parameters for the `name` function with signature `name()` and selector `0x06fdde03` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "name", abi = "name()")] + pub struct NameCall; + ///Container type for all input parameters for the `symbol` function with signature `symbol()` and selector `0x95d89b41` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "symbol", abi = "symbol()")] + pub struct SymbolCall; + ///Container type for all input parameters for the `totalSupply` function with signature `totalSupply()` and selector `0x18160ddd` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "totalSupply", abi = "totalSupply()")] + pub struct TotalSupplyCall; + ///Container type for all input parameters for the `transfer` function with signature `transfer(address,uint256)` and selector `0xa9059cbb` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "transfer", abi = "transfer(address,uint256)")] + pub struct TransferCall { + pub to: ::ethers::core::types::Address, + pub value: ::ethers::core::types::U256, + } + ///Container type for all input parameters for the `transferFrom` function with signature `transferFrom(address,address,uint256)` and selector `0x23b872dd` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "transferFrom", abi = "transferFrom(address,address,uint256)")] + pub struct TransferFromCall { + pub from: ::ethers::core::types::Address, + pub to: ::ethers::core::types::Address, + pub value: ::ethers::core::types::U256, + } + ///Container type for all of the contract's call + #[derive(Clone, ::ethers::contract::EthAbiType, Debug, PartialEq, Eq, Hash)] + pub enum IERC20Calls { + MintForTesting(MintForTestingCall), + Allowance(AllowanceCall), + Approve(ApproveCall), + BalanceOf(BalanceOfCall), + Decimals(DecimalsCall), + Name(NameCall), + Symbol(SymbolCall), + TotalSupply(TotalSupplyCall), + Transfer(TransferCall), + TransferFrom(TransferFromCall), + } + impl ::ethers::core::abi::AbiDecode for IERC20Calls { + fn decode( + data: impl AsRef<[u8]>, + ) -> ::core::result::Result { + let data = data.as_ref(); + if let Ok(decoded) + = ::decode(data) { + return Ok(Self::MintForTesting(decoded)); + } + if let Ok(decoded) + = ::decode(data) { + return Ok(Self::Allowance(decoded)); + } + if let Ok(decoded) + = ::decode(data) { + return Ok(Self::Approve(decoded)); + } + if let Ok(decoded) + = ::decode(data) { + return Ok(Self::BalanceOf(decoded)); + } + if let Ok(decoded) + = ::decode(data) { + return Ok(Self::Decimals(decoded)); + } + if let Ok(decoded) + = ::decode(data) { + return Ok(Self::Name(decoded)); + } + if let Ok(decoded) + = ::decode(data) { + return Ok(Self::Symbol(decoded)); + } + if let Ok(decoded) + = ::decode(data) { + return Ok(Self::TotalSupply(decoded)); + } + if let Ok(decoded) + = ::decode(data) { + return Ok(Self::Transfer(decoded)); + } + if let Ok(decoded) + = ::decode(data) { + return Ok(Self::TransferFrom(decoded)); + } + Err(::ethers::core::abi::Error::InvalidData.into()) + } + } + impl ::ethers::core::abi::AbiEncode for IERC20Calls { + fn encode(self) -> Vec { + match self { + Self::MintForTesting(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + Self::Allowance(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + Self::Approve(element) => ::ethers::core::abi::AbiEncode::encode(element), + Self::BalanceOf(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + Self::Decimals(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + Self::Name(element) => ::ethers::core::abi::AbiEncode::encode(element), + Self::Symbol(element) => ::ethers::core::abi::AbiEncode::encode(element), + Self::TotalSupply(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + Self::Transfer(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + Self::TransferFrom(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + } + } + } + impl ::core::fmt::Display for IERC20Calls { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + Self::MintForTesting(element) => ::core::fmt::Display::fmt(element, f), + Self::Allowance(element) => ::core::fmt::Display::fmt(element, f), + Self::Approve(element) => ::core::fmt::Display::fmt(element, f), + Self::BalanceOf(element) => ::core::fmt::Display::fmt(element, f), + Self::Decimals(element) => ::core::fmt::Display::fmt(element, f), + Self::Name(element) => ::core::fmt::Display::fmt(element, f), + Self::Symbol(element) => ::core::fmt::Display::fmt(element, f), + Self::TotalSupply(element) => ::core::fmt::Display::fmt(element, f), + Self::Transfer(element) => ::core::fmt::Display::fmt(element, f), + Self::TransferFrom(element) => ::core::fmt::Display::fmt(element, f), + } + } + } + impl ::core::convert::From for IERC20Calls { + fn from(value: MintForTestingCall) -> Self { + Self::MintForTesting(value) + } + } + impl ::core::convert::From for IERC20Calls { + fn from(value: AllowanceCall) -> Self { + Self::Allowance(value) + } + } + impl ::core::convert::From for IERC20Calls { + fn from(value: ApproveCall) -> Self { + Self::Approve(value) + } + } + impl ::core::convert::From for IERC20Calls { + fn from(value: BalanceOfCall) -> Self { + Self::BalanceOf(value) + } + } + impl ::core::convert::From for IERC20Calls { + fn from(value: DecimalsCall) -> Self { + Self::Decimals(value) + } + } + impl ::core::convert::From for IERC20Calls { + fn from(value: NameCall) -> Self { + Self::Name(value) + } + } + impl ::core::convert::From for IERC20Calls { + fn from(value: SymbolCall) -> Self { + Self::Symbol(value) + } + } + impl ::core::convert::From for IERC20Calls { + fn from(value: TotalSupplyCall) -> Self { + Self::TotalSupply(value) + } + } + impl ::core::convert::From for IERC20Calls { + fn from(value: TransferCall) -> Self { + Self::Transfer(value) + } + } + impl ::core::convert::From for IERC20Calls { + fn from(value: TransferFromCall) -> Self { + Self::TransferFrom(value) + } + } + ///Container type for all return fields from the `allowance` function with signature `allowance(address,address)` and selector `0xdd62ed3e` + #[derive( + Clone, + ::ethers::contract::EthAbiType, + ::ethers::contract::EthAbiCodec, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + pub struct AllowanceReturn(pub ::ethers::core::types::U256); + ///Container type for all return fields from the `approve` function with signature `approve(address,uint256)` and selector `0x095ea7b3` + #[derive( + Clone, + ::ethers::contract::EthAbiType, + ::ethers::contract::EthAbiCodec, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + pub struct ApproveReturn(pub bool); + ///Container type for all return fields from the `balanceOf` function with signature `balanceOf(address)` and selector `0x70a08231` + #[derive( + Clone, + ::ethers::contract::EthAbiType, + ::ethers::contract::EthAbiCodec, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + pub struct BalanceOfReturn(pub ::ethers::core::types::U256); + ///Container type for all return fields from the `decimals` function with signature `decimals()` and selector `0x313ce567` + #[derive( + Clone, + ::ethers::contract::EthAbiType, + ::ethers::contract::EthAbiCodec, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + pub struct DecimalsReturn(pub ::ethers::core::types::U256); + ///Container type for all return fields from the `name` function with signature `name()` and selector `0x06fdde03` + #[derive( + Clone, + ::ethers::contract::EthAbiType, + ::ethers::contract::EthAbiCodec, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + pub struct NameReturn(pub ::std::string::String); + ///Container type for all return fields from the `symbol` function with signature `symbol()` and selector `0x95d89b41` + #[derive( + Clone, + ::ethers::contract::EthAbiType, + ::ethers::contract::EthAbiCodec, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + pub struct SymbolReturn(pub ::std::string::String); + ///Container type for all return fields from the `totalSupply` function with signature `totalSupply()` and selector `0x18160ddd` + #[derive( + Clone, + ::ethers::contract::EthAbiType, + ::ethers::contract::EthAbiCodec, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + pub struct TotalSupplyReturn(pub ::ethers::core::types::U256); + ///Container type for all return fields from the `transfer` function with signature `transfer(address,uint256)` and selector `0xa9059cbb` + #[derive( + Clone, + ::ethers::contract::EthAbiType, + ::ethers::contract::EthAbiCodec, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + pub struct TransferReturn(pub bool); + ///Container type for all return fields from the `transferFrom` function with signature `transferFrom(address,address,uint256)` and selector `0x23b872dd` + #[derive( + Clone, + ::ethers::contract::EthAbiType, + ::ethers::contract::EthAbiCodec, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + pub struct TransferFromReturn(pub bool); +} diff --git a/payment-contracts/src/contracts/mod.rs b/payment-contracts/src/contracts/mod.rs new file mode 100644 index 00000000..b6a35935 --- /dev/null +++ b/payment-contracts/src/contracts/mod.rs @@ -0,0 +1,9 @@ +#![allow(clippy::all)] +//! This module contains abigen! generated bindings for solidity contracts. +//! This is autogenerated code. +//! Do not manually edit these files. +//! These files may be overwritten by the codegen system at any time. +pub mod ierc20; +pub mod payment_factory; +pub mod payment_proxy; +pub mod payment_sweeper; diff --git a/payment-contracts/src/contracts/payment_factory.rs b/payment-contracts/src/contracts/payment_factory.rs new file mode 100644 index 00000000..7e4927c5 --- /dev/null +++ b/payment-contracts/src/contracts/payment_factory.rs @@ -0,0 +1,1596 @@ +pub use payment_factory::*; +/// This module was auto-generated with ethers-rs Abigen. +/// More information at: +#[allow( + clippy::enum_variant_names, + clippy::too_many_arguments, + clippy::upper_case_acronyms, + clippy::type_complexity, + dead_code, + non_camel_case_types, +)] +pub mod payment_factory { + #[rustfmt::skip] + const __ABI: &str = "[\n {\n \"name\": \"NewPaymentAddress\",\n \"inputs\": [\n {\n \"name\": \"account\",\n \"type\": \"address\",\n \"indexed\": false\n },\n {\n \"name\": \"payment_address\",\n \"type\": \"address\",\n \"indexed\": false\n }\n ],\n \"anonymous\": false,\n \"type\": \"event\"\n },\n {\n \"name\": \"PaymentReceived\",\n \"inputs\": [\n {\n \"name\": \"account\",\n \"type\": \"address\",\n \"indexed\": false\n },\n {\n \"name\": \"token\",\n \"type\": \"address\",\n \"indexed\": false\n },\n {\n \"name\": \"amount\",\n \"type\": \"uint256\",\n \"indexed\": false\n }\n ],\n \"anonymous\": false,\n \"type\": \"event\"\n },\n {\n \"name\": \"NewOwnerCommitted\",\n \"inputs\": [\n {\n \"name\": \"owner\",\n \"type\": \"address\",\n \"indexed\": false\n },\n {\n \"name\": \"new_owner\",\n \"type\": \"address\",\n \"indexed\": false\n },\n {\n \"name\": \"finalize_time\",\n \"type\": \"uint256\",\n \"indexed\": false\n }\n ],\n \"anonymous\": false,\n \"type\": \"event\"\n },\n {\n \"name\": \"NewOwnerAccepted\",\n \"inputs\": [\n {\n \"name\": \"old_owner\",\n \"type\": \"address\",\n \"indexed\": false\n },\n {\n \"name\": \"owner\",\n \"type\": \"address\",\n \"indexed\": false\n }\n ],\n \"anonymous\": false,\n \"type\": \"event\"\n },\n {\n \"name\": \"NewSweeperCommitted\",\n \"inputs\": [\n {\n \"name\": \"sweeper\",\n \"type\": \"address\",\n \"indexed\": false\n },\n {\n \"name\": \"new_sweeper\",\n \"type\": \"address\",\n \"indexed\": false\n },\n {\n \"name\": \"finalize_time\",\n \"type\": \"uint256\",\n \"indexed\": false\n }\n ],\n \"anonymous\": false,\n \"type\": \"event\"\n },\n {\n \"name\": \"NewSweeperSet\",\n \"inputs\": [\n {\n \"name\": \"old_sweeper\",\n \"type\": \"address\",\n \"indexed\": false\n },\n {\n \"name\": \"sweeper\",\n \"type\": \"address\",\n \"indexed\": false\n }\n ],\n \"anonymous\": false,\n \"type\": \"event\"\n },\n {\n \"name\": \"NewReceiverCommitted\",\n \"inputs\": [\n {\n \"name\": \"receiver\",\n \"type\": \"address\",\n \"indexed\": false\n },\n {\n \"name\": \"new_receiver\",\n \"type\": \"address\",\n \"indexed\": false\n },\n {\n \"name\": \"finalize_time\",\n \"type\": \"uint256\",\n \"indexed\": false\n }\n ],\n \"anonymous\": false,\n \"type\": \"event\"\n },\n {\n \"name\": \"NewReceiverSet\",\n \"inputs\": [\n {\n \"name\": \"old_receiver\",\n \"type\": \"address\",\n \"indexed\": false\n },\n {\n \"name\": \"receiver\",\n \"type\": \"address\",\n \"indexed\": false\n }\n ],\n \"anonymous\": false,\n \"type\": \"event\"\n },\n {\n \"stateMutability\": \"nonpayable\",\n \"type\": \"constructor\",\n \"inputs\": [\n {\n \"name\": \"_owner\",\n \"type\": \"address\"\n },\n {\n \"name\": \"_receiver\",\n \"type\": \"address\"\n },\n {\n \"name\": \"_sweeper\",\n \"type\": \"address\"\n },\n {\n \"name\": \"_proxy\",\n \"type\": \"address\"\n }\n ],\n \"outputs\": []\n },\n {\n \"stateMutability\": \"view\",\n \"type\": \"function\",\n \"name\": \"get_approved_tokens\",\n \"inputs\": [],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"address[]\"\n }\n ]\n },\n {\n \"stateMutability\": \"nonpayable\",\n \"type\": \"function\",\n \"name\": \"payment_received\",\n \"inputs\": [\n {\n \"name\": \"_token\",\n \"type\": \"address\"\n },\n {\n \"name\": \"_amount\",\n \"type\": \"uint256\"\n }\n ],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"bool\"\n }\n ]\n },\n {\n \"stateMutability\": \"nonpayable\",\n \"type\": \"function\",\n \"name\": \"create_payment_address\",\n \"inputs\": [],\n \"outputs\": []\n },\n {\n \"stateMutability\": \"nonpayable\",\n \"type\": \"function\",\n \"name\": \"create_payment_address\",\n \"inputs\": [\n {\n \"name\": \"_account\",\n \"type\": \"address\"\n }\n ],\n \"outputs\": []\n },\n {\n \"stateMutability\": \"nonpayable\",\n \"type\": \"function\",\n \"name\": \"set_token_approvals\",\n \"inputs\": [\n {\n \"name\": \"_tokens\",\n \"type\": \"address[]\"\n },\n {\n \"name\": \"_approved\",\n \"type\": \"bool\"\n }\n ],\n \"outputs\": []\n },\n {\n \"stateMutability\": \"nonpayable\",\n \"type\": \"function\",\n \"name\": \"commit_new_sweeper_implementation\",\n \"inputs\": [\n {\n \"name\": \"_sweeper\",\n \"type\": \"address\"\n }\n ],\n \"outputs\": []\n },\n {\n \"stateMutability\": \"nonpayable\",\n \"type\": \"function\",\n \"name\": \"finalize_new_sweeper_implementation\",\n \"inputs\": [],\n \"outputs\": []\n },\n {\n \"stateMutability\": \"nonpayable\",\n \"type\": \"function\",\n \"name\": \"commit_new_receiver\",\n \"inputs\": [\n {\n \"name\": \"_receiver\",\n \"type\": \"address\"\n }\n ],\n \"outputs\": []\n },\n {\n \"stateMutability\": \"nonpayable\",\n \"type\": \"function\",\n \"name\": \"finalize_new_receiver\",\n \"inputs\": [],\n \"outputs\": []\n },\n {\n \"stateMutability\": \"nonpayable\",\n \"type\": \"function\",\n \"name\": \"commit_transfer_ownership\",\n \"inputs\": [\n {\n \"name\": \"_new_owner\",\n \"type\": \"address\"\n }\n ],\n \"outputs\": []\n },\n {\n \"stateMutability\": \"nonpayable\",\n \"type\": \"function\",\n \"name\": \"accept_transfer_ownership\",\n \"inputs\": [],\n \"outputs\": []\n },\n {\n \"stateMutability\": \"view\",\n \"type\": \"function\",\n \"name\": \"PROXY_IMPLEMENTATION\",\n \"inputs\": [],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"address\"\n }\n ]\n },\n {\n \"stateMutability\": \"view\",\n \"type\": \"function\",\n \"name\": \"sweeper_implementation\",\n \"inputs\": [],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"address\"\n }\n ]\n },\n {\n \"stateMutability\": \"view\",\n \"type\": \"function\",\n \"name\": \"future_sweeper_implementation\",\n \"inputs\": [],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"address\"\n }\n ]\n },\n {\n \"stateMutability\": \"view\",\n \"type\": \"function\",\n \"name\": \"owner\",\n \"inputs\": [],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"address\"\n }\n ]\n },\n {\n \"stateMutability\": \"view\",\n \"type\": \"function\",\n \"name\": \"future_owner\",\n \"inputs\": [],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"address\"\n }\n ]\n },\n {\n \"stateMutability\": \"view\",\n \"type\": \"function\",\n \"name\": \"receiver\",\n \"inputs\": [],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"address\"\n }\n ]\n },\n {\n \"stateMutability\": \"view\",\n \"type\": \"function\",\n \"name\": \"future_receiver\",\n \"inputs\": [],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"address\"\n }\n ]\n },\n {\n \"stateMutability\": \"view\",\n \"type\": \"function\",\n \"name\": \"transfer_ownership_timestamp\",\n \"inputs\": [],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"uint256\"\n }\n ]\n },\n {\n \"stateMutability\": \"view\",\n \"type\": \"function\",\n \"name\": \"new_sweeper_timestamp\",\n \"inputs\": [],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"uint256\"\n }\n ]\n },\n {\n \"stateMutability\": \"view\",\n \"type\": \"function\",\n \"name\": \"new_receiver_timestamp\",\n \"inputs\": [],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"uint256\"\n }\n ]\n },\n {\n \"stateMutability\": \"view\",\n \"type\": \"function\",\n \"name\": \"is_approved_token\",\n \"inputs\": [\n {\n \"name\": \"arg0\",\n \"type\": \"address\"\n }\n ],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"bool\"\n }\n ]\n },\n {\n \"stateMutability\": \"view\",\n \"type\": \"function\",\n \"name\": \"account_to_payment_address\",\n \"inputs\": [\n {\n \"name\": \"arg0\",\n \"type\": \"address\"\n }\n ],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"address\"\n }\n ]\n },\n {\n \"stateMutability\": \"view\",\n \"type\": \"function\",\n \"name\": \"payment_address_to_account\",\n \"inputs\": [\n {\n \"name\": \"arg0\",\n \"type\": \"address\"\n }\n ],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"address\"\n }\n ]\n }\n]"; + ///The parsed JSON ABI of the contract. + pub static PAYMENTFACTORY_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> = ::ethers::contract::Lazy::new(|| + ::ethers::core::utils::__serde_json::from_str(__ABI).expect("ABI is always valid")); + pub struct PaymentFactory(::ethers::contract::Contract); + impl ::core::clone::Clone for PaymentFactory { + fn clone(&self) -> Self { + Self(::core::clone::Clone::clone(&self.0)) + } + } + impl ::core::ops::Deref for PaymentFactory { + type Target = ::ethers::contract::Contract; + fn deref(&self) -> &Self::Target { + &self.0 + } + } + impl ::core::ops::DerefMut for PaymentFactory { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } + } + impl ::core::fmt::Debug for PaymentFactory { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_tuple(stringify!(PaymentFactory)).field(&self.address()).finish() + } + } + impl PaymentFactory { + /// Creates a new contract instance with the specified `ethers` client at + /// `address`. The contract derefs to a `ethers::Contract` object. + pub fn new>( + address: T, + client: ::std::sync::Arc, + ) -> Self { + Self( + ::ethers::contract::Contract::new( + address.into(), + PAYMENTFACTORY_ABI.clone(), + client, + ), + ) + } + ///Calls the contract's `PROXY_IMPLEMENTATION` (0x5c7a7d99) function + pub fn proxy_implementation( + &self, + ) -> ::ethers::contract::builders::ContractCall< + M, + ::ethers::core::types::Address, + > { + self.0 + .method_hash([92, 122, 125, 153], ()) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `accept_transfer_ownership` (0xe5ea47b8) function + pub fn accept_transfer_ownership( + &self, + ) -> ::ethers::contract::builders::ContractCall { + self.0 + .method_hash([229, 234, 71, 184], ()) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `account_to_payment_address` (0x0b810230) function + pub fn account_to_payment_address( + &self, + arg_0: ::ethers::core::types::Address, + ) -> ::ethers::contract::builders::ContractCall< + M, + ::ethers::core::types::Address, + > { + self.0 + .method_hash([11, 129, 2, 48], arg_0) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `commit_new_receiver` (0x561a4147) function + pub fn commit_new_receiver( + &self, + receiver: ::ethers::core::types::Address, + ) -> ::ethers::contract::builders::ContractCall { + self.0 + .method_hash([86, 26, 65, 71], receiver) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `commit_new_sweeper_implementation` (0xafcbdc11) function + pub fn commit_new_sweeper_implementation( + &self, + sweeper: ::ethers::core::types::Address, + ) -> ::ethers::contract::builders::ContractCall { + self.0 + .method_hash([175, 203, 220, 17], sweeper) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `commit_transfer_ownership` (0x6b441a40) function + pub fn commit_transfer_ownership( + &self, + new_owner: ::ethers::core::types::Address, + ) -> ::ethers::contract::builders::ContractCall { + self.0 + .method_hash([107, 68, 26, 64], new_owner) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `create_payment_address` (0x6248d5c6) function + pub fn create_payment_address( + &self, + ) -> ::ethers::contract::builders::ContractCall { + self.0 + .method_hash([98, 72, 213, 198], ()) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `create_payment_address` (0x998faa1e) function + pub fn create_payment_address_with_account( + &self, + account: ::ethers::core::types::Address, + ) -> ::ethers::contract::builders::ContractCall { + self.0 + .method_hash([153, 143, 170, 30], account) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `finalize_new_receiver` (0x73d02b33) function + pub fn finalize_new_receiver( + &self, + ) -> ::ethers::contract::builders::ContractCall { + self.0 + .method_hash([115, 208, 43, 51], ()) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `finalize_new_sweeper_implementation` (0x41acefbb) function + pub fn finalize_new_sweeper_implementation( + &self, + ) -> ::ethers::contract::builders::ContractCall { + self.0 + .method_hash([65, 172, 239, 187], ()) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `future_owner` (0x1ec0cdc1) function + pub fn future_owner( + &self, + ) -> ::ethers::contract::builders::ContractCall< + M, + ::ethers::core::types::Address, + > { + self.0 + .method_hash([30, 192, 205, 193], ()) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `future_receiver` (0x3bea9ddd) function + pub fn future_receiver( + &self, + ) -> ::ethers::contract::builders::ContractCall< + M, + ::ethers::core::types::Address, + > { + self.0 + .method_hash([59, 234, 157, 221], ()) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `future_sweeper_implementation` (0x4333d02b) function + pub fn future_sweeper_implementation( + &self, + ) -> ::ethers::contract::builders::ContractCall< + M, + ::ethers::core::types::Address, + > { + self.0 + .method_hash([67, 51, 208, 43], ()) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `get_approved_tokens` (0x79aaf078) function + pub fn get_approved_tokens( + &self, + ) -> ::ethers::contract::builders::ContractCall< + M, + ::std::vec::Vec<::ethers::core::types::Address>, + > { + self.0 + .method_hash([121, 170, 240, 120], ()) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `is_approved_token` (0x363b5b3e) function + pub fn is_approved_token( + &self, + arg_0: ::ethers::core::types::Address, + ) -> ::ethers::contract::builders::ContractCall { + self.0 + .method_hash([54, 59, 91, 62], arg_0) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `new_receiver_timestamp` (0xf85c2e83) function + pub fn new_receiver_timestamp( + &self, + ) -> ::ethers::contract::builders::ContractCall { + self.0 + .method_hash([248, 92, 46, 131], ()) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `new_sweeper_timestamp` (0x05daefa8) function + pub fn new_sweeper_timestamp( + &self, + ) -> ::ethers::contract::builders::ContractCall { + self.0 + .method_hash([5, 218, 239, 168], ()) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `owner` (0x8da5cb5b) function + pub fn owner( + &self, + ) -> ::ethers::contract::builders::ContractCall< + M, + ::ethers::core::types::Address, + > { + self.0 + .method_hash([141, 165, 203, 91], ()) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `payment_address_to_account` (0xe0934982) function + pub fn payment_address_to_account( + &self, + arg_0: ::ethers::core::types::Address, + ) -> ::ethers::contract::builders::ContractCall< + M, + ::ethers::core::types::Address, + > { + self.0 + .method_hash([224, 147, 73, 130], arg_0) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `payment_received` (0x7414b098) function + pub fn payment_received( + &self, + token: ::ethers::core::types::Address, + amount: ::ethers::core::types::U256, + ) -> ::ethers::contract::builders::ContractCall { + self.0 + .method_hash([116, 20, 176, 152], (token, amount)) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `receiver` (0xf7260d3e) function + pub fn receiver( + &self, + ) -> ::ethers::contract::builders::ContractCall< + M, + ::ethers::core::types::Address, + > { + self.0 + .method_hash([247, 38, 13, 62], ()) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `set_token_approvals` (0x50054612) function + pub fn set_token_approvals( + &self, + tokens: ::std::vec::Vec<::ethers::core::types::Address>, + approved: bool, + ) -> ::ethers::contract::builders::ContractCall { + self.0 + .method_hash([80, 5, 70, 18], (tokens, approved)) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `sweeper_implementation` (0x791cc746) function + pub fn sweeper_implementation( + &self, + ) -> ::ethers::contract::builders::ContractCall< + M, + ::ethers::core::types::Address, + > { + self.0 + .method_hash([121, 28, 199, 70], ()) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `transfer_ownership_timestamp` (0x4598cb25) function + pub fn transfer_ownership_timestamp( + &self, + ) -> ::ethers::contract::builders::ContractCall { + self.0 + .method_hash([69, 152, 203, 37], ()) + .expect("method not found (this should never happen)") + } + ///Gets the contract's `NewOwnerAccepted` event + pub fn new_owner_accepted_filter( + &self, + ) -> ::ethers::contract::builders::Event< + ::std::sync::Arc, + M, + NewOwnerAcceptedFilter, + > { + self.0.event() + } + ///Gets the contract's `NewOwnerCommitted` event + pub fn new_owner_committed_filter( + &self, + ) -> ::ethers::contract::builders::Event< + ::std::sync::Arc, + M, + NewOwnerCommittedFilter, + > { + self.0.event() + } + ///Gets the contract's `NewPaymentAddress` event + pub fn new_payment_address_filter( + &self, + ) -> ::ethers::contract::builders::Event< + ::std::sync::Arc, + M, + NewPaymentAddressFilter, + > { + self.0.event() + } + ///Gets the contract's `NewReceiverCommitted` event + pub fn new_receiver_committed_filter( + &self, + ) -> ::ethers::contract::builders::Event< + ::std::sync::Arc, + M, + NewReceiverCommittedFilter, + > { + self.0.event() + } + ///Gets the contract's `NewReceiverSet` event + pub fn new_receiver_set_filter( + &self, + ) -> ::ethers::contract::builders::Event< + ::std::sync::Arc, + M, + NewReceiverSetFilter, + > { + self.0.event() + } + ///Gets the contract's `NewSweeperCommitted` event + pub fn new_sweeper_committed_filter( + &self, + ) -> ::ethers::contract::builders::Event< + ::std::sync::Arc, + M, + NewSweeperCommittedFilter, + > { + self.0.event() + } + ///Gets the contract's `NewSweeperSet` event + pub fn new_sweeper_set_filter( + &self, + ) -> ::ethers::contract::builders::Event< + ::std::sync::Arc, + M, + NewSweeperSetFilter, + > { + self.0.event() + } + ///Gets the contract's `PaymentReceived` event + pub fn payment_received_filter( + &self, + ) -> ::ethers::contract::builders::Event< + ::std::sync::Arc, + M, + PaymentReceivedFilter, + > { + self.0.event() + } + /// Returns an `Event` builder for all the events of this contract. + pub fn events( + &self, + ) -> ::ethers::contract::builders::Event< + ::std::sync::Arc, + M, + PaymentFactoryEvents, + > { + self.0.event_with_filter(::core::default::Default::default()) + } + } + impl From<::ethers::contract::Contract> + for PaymentFactory { + fn from(contract: ::ethers::contract::Contract) -> Self { + Self::new(contract.address(), contract.client()) + } + } + #[derive( + Clone, + ::ethers::contract::EthEvent, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethevent(name = "NewOwnerAccepted", abi = "NewOwnerAccepted(address,address)")] + pub struct NewOwnerAcceptedFilter { + pub old_owner: ::ethers::core::types::Address, + pub owner: ::ethers::core::types::Address, + } + #[derive( + Clone, + ::ethers::contract::EthEvent, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethevent( + name = "NewOwnerCommitted", + abi = "NewOwnerCommitted(address,address,uint256)" + )] + pub struct NewOwnerCommittedFilter { + pub owner: ::ethers::core::types::Address, + pub new_owner: ::ethers::core::types::Address, + pub finalize_time: ::ethers::core::types::U256, + } + #[derive( + Clone, + ::ethers::contract::EthEvent, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethevent(name = "NewPaymentAddress", abi = "NewPaymentAddress(address,address)")] + pub struct NewPaymentAddressFilter { + pub account: ::ethers::core::types::Address, + pub payment_address: ::ethers::core::types::Address, + } + #[derive( + Clone, + ::ethers::contract::EthEvent, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethevent( + name = "NewReceiverCommitted", + abi = "NewReceiverCommitted(address,address,uint256)" + )] + pub struct NewReceiverCommittedFilter { + pub receiver: ::ethers::core::types::Address, + pub new_receiver: ::ethers::core::types::Address, + pub finalize_time: ::ethers::core::types::U256, + } + #[derive( + Clone, + ::ethers::contract::EthEvent, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethevent(name = "NewReceiverSet", abi = "NewReceiverSet(address,address)")] + pub struct NewReceiverSetFilter { + pub old_receiver: ::ethers::core::types::Address, + pub receiver: ::ethers::core::types::Address, + } + #[derive( + Clone, + ::ethers::contract::EthEvent, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethevent( + name = "NewSweeperCommitted", + abi = "NewSweeperCommitted(address,address,uint256)" + )] + pub struct NewSweeperCommittedFilter { + pub sweeper: ::ethers::core::types::Address, + pub new_sweeper: ::ethers::core::types::Address, + pub finalize_time: ::ethers::core::types::U256, + } + #[derive( + Clone, + ::ethers::contract::EthEvent, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethevent(name = "NewSweeperSet", abi = "NewSweeperSet(address,address)")] + pub struct NewSweeperSetFilter { + pub old_sweeper: ::ethers::core::types::Address, + pub sweeper: ::ethers::core::types::Address, + } + #[derive( + Clone, + ::ethers::contract::EthEvent, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethevent( + name = "PaymentReceived", + abi = "PaymentReceived(address,address,uint256)" + )] + pub struct PaymentReceivedFilter { + pub account: ::ethers::core::types::Address, + pub token: ::ethers::core::types::Address, + pub amount: ::ethers::core::types::U256, + } + ///Container type for all of the contract's events + #[derive(Clone, ::ethers::contract::EthAbiType, Debug, PartialEq, Eq, Hash)] + pub enum PaymentFactoryEvents { + NewOwnerAcceptedFilter(NewOwnerAcceptedFilter), + NewOwnerCommittedFilter(NewOwnerCommittedFilter), + NewPaymentAddressFilter(NewPaymentAddressFilter), + NewReceiverCommittedFilter(NewReceiverCommittedFilter), + NewReceiverSetFilter(NewReceiverSetFilter), + NewSweeperCommittedFilter(NewSweeperCommittedFilter), + NewSweeperSetFilter(NewSweeperSetFilter), + PaymentReceivedFilter(PaymentReceivedFilter), + } + impl ::ethers::contract::EthLogDecode for PaymentFactoryEvents { + fn decode_log( + log: &::ethers::core::abi::RawLog, + ) -> ::core::result::Result { + if let Ok(decoded) = NewOwnerAcceptedFilter::decode_log(log) { + return Ok(PaymentFactoryEvents::NewOwnerAcceptedFilter(decoded)); + } + if let Ok(decoded) = NewOwnerCommittedFilter::decode_log(log) { + return Ok(PaymentFactoryEvents::NewOwnerCommittedFilter(decoded)); + } + if let Ok(decoded) = NewPaymentAddressFilter::decode_log(log) { + return Ok(PaymentFactoryEvents::NewPaymentAddressFilter(decoded)); + } + if let Ok(decoded) = NewReceiverCommittedFilter::decode_log(log) { + return Ok(PaymentFactoryEvents::NewReceiverCommittedFilter(decoded)); + } + if let Ok(decoded) = NewReceiverSetFilter::decode_log(log) { + return Ok(PaymentFactoryEvents::NewReceiverSetFilter(decoded)); + } + if let Ok(decoded) = NewSweeperCommittedFilter::decode_log(log) { + return Ok(PaymentFactoryEvents::NewSweeperCommittedFilter(decoded)); + } + if let Ok(decoded) = NewSweeperSetFilter::decode_log(log) { + return Ok(PaymentFactoryEvents::NewSweeperSetFilter(decoded)); + } + if let Ok(decoded) = PaymentReceivedFilter::decode_log(log) { + return Ok(PaymentFactoryEvents::PaymentReceivedFilter(decoded)); + } + Err(::ethers::core::abi::Error::InvalidData) + } + } + impl ::core::fmt::Display for PaymentFactoryEvents { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + Self::NewOwnerAcceptedFilter(element) => { + ::core::fmt::Display::fmt(element, f) + } + Self::NewOwnerCommittedFilter(element) => { + ::core::fmt::Display::fmt(element, f) + } + Self::NewPaymentAddressFilter(element) => { + ::core::fmt::Display::fmt(element, f) + } + Self::NewReceiverCommittedFilter(element) => { + ::core::fmt::Display::fmt(element, f) + } + Self::NewReceiverSetFilter(element) => { + ::core::fmt::Display::fmt(element, f) + } + Self::NewSweeperCommittedFilter(element) => { + ::core::fmt::Display::fmt(element, f) + } + Self::NewSweeperSetFilter(element) => { + ::core::fmt::Display::fmt(element, f) + } + Self::PaymentReceivedFilter(element) => { + ::core::fmt::Display::fmt(element, f) + } + } + } + } + impl ::core::convert::From for PaymentFactoryEvents { + fn from(value: NewOwnerAcceptedFilter) -> Self { + Self::NewOwnerAcceptedFilter(value) + } + } + impl ::core::convert::From for PaymentFactoryEvents { + fn from(value: NewOwnerCommittedFilter) -> Self { + Self::NewOwnerCommittedFilter(value) + } + } + impl ::core::convert::From for PaymentFactoryEvents { + fn from(value: NewPaymentAddressFilter) -> Self { + Self::NewPaymentAddressFilter(value) + } + } + impl ::core::convert::From for PaymentFactoryEvents { + fn from(value: NewReceiverCommittedFilter) -> Self { + Self::NewReceiverCommittedFilter(value) + } + } + impl ::core::convert::From for PaymentFactoryEvents { + fn from(value: NewReceiverSetFilter) -> Self { + Self::NewReceiverSetFilter(value) + } + } + impl ::core::convert::From for PaymentFactoryEvents { + fn from(value: NewSweeperCommittedFilter) -> Self { + Self::NewSweeperCommittedFilter(value) + } + } + impl ::core::convert::From for PaymentFactoryEvents { + fn from(value: NewSweeperSetFilter) -> Self { + Self::NewSweeperSetFilter(value) + } + } + impl ::core::convert::From for PaymentFactoryEvents { + fn from(value: PaymentReceivedFilter) -> Self { + Self::PaymentReceivedFilter(value) + } + } + ///Container type for all input parameters for the `PROXY_IMPLEMENTATION` function with signature `PROXY_IMPLEMENTATION()` and selector `0x5c7a7d99` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "PROXY_IMPLEMENTATION", abi = "PROXY_IMPLEMENTATION()")] + pub struct ProxyImplementationCall; + ///Container type for all input parameters for the `accept_transfer_ownership` function with signature `accept_transfer_ownership()` and selector `0xe5ea47b8` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "accept_transfer_ownership", abi = "accept_transfer_ownership()")] + pub struct AcceptTransferOwnershipCall; + ///Container type for all input parameters for the `account_to_payment_address` function with signature `account_to_payment_address(address)` and selector `0x0b810230` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall( + name = "account_to_payment_address", + abi = "account_to_payment_address(address)" + )] + pub struct AccountToPaymentAddressCall { + pub arg_0: ::ethers::core::types::Address, + } + ///Container type for all input parameters for the `commit_new_receiver` function with signature `commit_new_receiver(address)` and selector `0x561a4147` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "commit_new_receiver", abi = "commit_new_receiver(address)")] + pub struct CommitNewReceiverCall { + pub receiver: ::ethers::core::types::Address, + } + ///Container type for all input parameters for the `commit_new_sweeper_implementation` function with signature `commit_new_sweeper_implementation(address)` and selector `0xafcbdc11` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall( + name = "commit_new_sweeper_implementation", + abi = "commit_new_sweeper_implementation(address)" + )] + pub struct CommitNewSweeperImplementationCall { + pub sweeper: ::ethers::core::types::Address, + } + ///Container type for all input parameters for the `commit_transfer_ownership` function with signature `commit_transfer_ownership(address)` and selector `0x6b441a40` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall( + name = "commit_transfer_ownership", + abi = "commit_transfer_ownership(address)" + )] + pub struct CommitTransferOwnershipCall { + pub new_owner: ::ethers::core::types::Address, + } + ///Container type for all input parameters for the `create_payment_address` function with signature `create_payment_address()` and selector `0x6248d5c6` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "create_payment_address", abi = "create_payment_address()")] + pub struct CreatePaymentAddressCall; + ///Container type for all input parameters for the `create_payment_address` function with signature `create_payment_address(address)` and selector `0x998faa1e` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "create_payment_address", abi = "create_payment_address(address)")] + pub struct CreatePaymentAddressWithAccountCall { + pub account: ::ethers::core::types::Address, + } + ///Container type for all input parameters for the `finalize_new_receiver` function with signature `finalize_new_receiver()` and selector `0x73d02b33` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "finalize_new_receiver", abi = "finalize_new_receiver()")] + pub struct FinalizeNewReceiverCall; + ///Container type for all input parameters for the `finalize_new_sweeper_implementation` function with signature `finalize_new_sweeper_implementation()` and selector `0x41acefbb` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall( + name = "finalize_new_sweeper_implementation", + abi = "finalize_new_sweeper_implementation()" + )] + pub struct FinalizeNewSweeperImplementationCall; + ///Container type for all input parameters for the `future_owner` function with signature `future_owner()` and selector `0x1ec0cdc1` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "future_owner", abi = "future_owner()")] + pub struct FutureOwnerCall; + ///Container type for all input parameters for the `future_receiver` function with signature `future_receiver()` and selector `0x3bea9ddd` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "future_receiver", abi = "future_receiver()")] + pub struct FutureReceiverCall; + ///Container type for all input parameters for the `future_sweeper_implementation` function with signature `future_sweeper_implementation()` and selector `0x4333d02b` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall( + name = "future_sweeper_implementation", + abi = "future_sweeper_implementation()" + )] + pub struct FutureSweeperImplementationCall; + ///Container type for all input parameters for the `get_approved_tokens` function with signature `get_approved_tokens()` and selector `0x79aaf078` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "get_approved_tokens", abi = "get_approved_tokens()")] + pub struct GetApprovedTokensCall; + ///Container type for all input parameters for the `is_approved_token` function with signature `is_approved_token(address)` and selector `0x363b5b3e` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "is_approved_token", abi = "is_approved_token(address)")] + pub struct IsApprovedTokenCall { + pub arg_0: ::ethers::core::types::Address, + } + ///Container type for all input parameters for the `new_receiver_timestamp` function with signature `new_receiver_timestamp()` and selector `0xf85c2e83` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "new_receiver_timestamp", abi = "new_receiver_timestamp()")] + pub struct NewReceiverTimestampCall; + ///Container type for all input parameters for the `new_sweeper_timestamp` function with signature `new_sweeper_timestamp()` and selector `0x05daefa8` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "new_sweeper_timestamp", abi = "new_sweeper_timestamp()")] + pub struct NewSweeperTimestampCall; + ///Container type for all input parameters for the `owner` function with signature `owner()` and selector `0x8da5cb5b` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "owner", abi = "owner()")] + pub struct OwnerCall; + ///Container type for all input parameters for the `payment_address_to_account` function with signature `payment_address_to_account(address)` and selector `0xe0934982` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall( + name = "payment_address_to_account", + abi = "payment_address_to_account(address)" + )] + pub struct PaymentAddressToAccountCall { + pub arg_0: ::ethers::core::types::Address, + } + ///Container type for all input parameters for the `payment_received` function with signature `payment_received(address,uint256)` and selector `0x7414b098` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "payment_received", abi = "payment_received(address,uint256)")] + pub struct PaymentReceivedCall { + pub token: ::ethers::core::types::Address, + pub amount: ::ethers::core::types::U256, + } + ///Container type for all input parameters for the `receiver` function with signature `receiver()` and selector `0xf7260d3e` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "receiver", abi = "receiver()")] + pub struct ReceiverCall; + ///Container type for all input parameters for the `set_token_approvals` function with signature `set_token_approvals(address[],bool)` and selector `0x50054612` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "set_token_approvals", abi = "set_token_approvals(address[],bool)")] + pub struct SetTokenApprovalsCall { + pub tokens: ::std::vec::Vec<::ethers::core::types::Address>, + pub approved: bool, + } + ///Container type for all input parameters for the `sweeper_implementation` function with signature `sweeper_implementation()` and selector `0x791cc746` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "sweeper_implementation", abi = "sweeper_implementation()")] + pub struct SweeperImplementationCall; + ///Container type for all input parameters for the `transfer_ownership_timestamp` function with signature `transfer_ownership_timestamp()` and selector `0x4598cb25` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall( + name = "transfer_ownership_timestamp", + abi = "transfer_ownership_timestamp()" + )] + pub struct TransferOwnershipTimestampCall; + ///Container type for all of the contract's call + #[derive(Clone, ::ethers::contract::EthAbiType, Debug, PartialEq, Eq, Hash)] + pub enum PaymentFactoryCalls { + ProxyImplementation(ProxyImplementationCall), + AcceptTransferOwnership(AcceptTransferOwnershipCall), + AccountToPaymentAddress(AccountToPaymentAddressCall), + CommitNewReceiver(CommitNewReceiverCall), + CommitNewSweeperImplementation(CommitNewSweeperImplementationCall), + CommitTransferOwnership(CommitTransferOwnershipCall), + CreatePaymentAddress(CreatePaymentAddressCall), + CreatePaymentAddressWithAccount(CreatePaymentAddressWithAccountCall), + FinalizeNewReceiver(FinalizeNewReceiverCall), + FinalizeNewSweeperImplementation(FinalizeNewSweeperImplementationCall), + FutureOwner(FutureOwnerCall), + FutureReceiver(FutureReceiverCall), + FutureSweeperImplementation(FutureSweeperImplementationCall), + GetApprovedTokens(GetApprovedTokensCall), + IsApprovedToken(IsApprovedTokenCall), + NewReceiverTimestamp(NewReceiverTimestampCall), + NewSweeperTimestamp(NewSweeperTimestampCall), + Owner(OwnerCall), + PaymentAddressToAccount(PaymentAddressToAccountCall), + PaymentReceived(PaymentReceivedCall), + Receiver(ReceiverCall), + SetTokenApprovals(SetTokenApprovalsCall), + SweeperImplementation(SweeperImplementationCall), + TransferOwnershipTimestamp(TransferOwnershipTimestampCall), + } + impl ::ethers::core::abi::AbiDecode for PaymentFactoryCalls { + fn decode( + data: impl AsRef<[u8]>, + ) -> ::core::result::Result { + let data = data.as_ref(); + if let Ok(decoded) + = ::decode( + data, + ) { + return Ok(Self::ProxyImplementation(decoded)); + } + if let Ok(decoded) + = ::decode( + data, + ) { + return Ok(Self::AcceptTransferOwnership(decoded)); + } + if let Ok(decoded) + = ::decode( + data, + ) { + return Ok(Self::AccountToPaymentAddress(decoded)); + } + if let Ok(decoded) + = ::decode( + data, + ) { + return Ok(Self::CommitNewReceiver(decoded)); + } + if let Ok(decoded) + = ::decode( + data, + ) { + return Ok(Self::CommitNewSweeperImplementation(decoded)); + } + if let Ok(decoded) + = ::decode( + data, + ) { + return Ok(Self::CommitTransferOwnership(decoded)); + } + if let Ok(decoded) + = ::decode( + data, + ) { + return Ok(Self::CreatePaymentAddress(decoded)); + } + if let Ok(decoded) + = ::decode( + data, + ) { + return Ok(Self::CreatePaymentAddressWithAccount(decoded)); + } + if let Ok(decoded) + = ::decode( + data, + ) { + return Ok(Self::FinalizeNewReceiver(decoded)); + } + if let Ok(decoded) + = ::decode( + data, + ) { + return Ok(Self::FinalizeNewSweeperImplementation(decoded)); + } + if let Ok(decoded) + = ::decode(data) { + return Ok(Self::FutureOwner(decoded)); + } + if let Ok(decoded) + = ::decode(data) { + return Ok(Self::FutureReceiver(decoded)); + } + if let Ok(decoded) + = ::decode( + data, + ) { + return Ok(Self::FutureSweeperImplementation(decoded)); + } + if let Ok(decoded) + = ::decode( + data, + ) { + return Ok(Self::GetApprovedTokens(decoded)); + } + if let Ok(decoded) + = ::decode(data) { + return Ok(Self::IsApprovedToken(decoded)); + } + if let Ok(decoded) + = ::decode( + data, + ) { + return Ok(Self::NewReceiverTimestamp(decoded)); + } + if let Ok(decoded) + = ::decode( + data, + ) { + return Ok(Self::NewSweeperTimestamp(decoded)); + } + if let Ok(decoded) + = ::decode(data) { + return Ok(Self::Owner(decoded)); + } + if let Ok(decoded) + = ::decode( + data, + ) { + return Ok(Self::PaymentAddressToAccount(decoded)); + } + if let Ok(decoded) + = ::decode(data) { + return Ok(Self::PaymentReceived(decoded)); + } + if let Ok(decoded) + = ::decode(data) { + return Ok(Self::Receiver(decoded)); + } + if let Ok(decoded) + = ::decode( + data, + ) { + return Ok(Self::SetTokenApprovals(decoded)); + } + if let Ok(decoded) + = ::decode( + data, + ) { + return Ok(Self::SweeperImplementation(decoded)); + } + if let Ok(decoded) + = ::decode( + data, + ) { + return Ok(Self::TransferOwnershipTimestamp(decoded)); + } + Err(::ethers::core::abi::Error::InvalidData.into()) + } + } + impl ::ethers::core::abi::AbiEncode for PaymentFactoryCalls { + fn encode(self) -> Vec { + match self { + Self::ProxyImplementation(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + Self::AcceptTransferOwnership(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + Self::AccountToPaymentAddress(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + Self::CommitNewReceiver(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + Self::CommitNewSweeperImplementation(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + Self::CommitTransferOwnership(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + Self::CreatePaymentAddress(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + Self::CreatePaymentAddressWithAccount(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + Self::FinalizeNewReceiver(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + Self::FinalizeNewSweeperImplementation(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + Self::FutureOwner(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + Self::FutureReceiver(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + Self::FutureSweeperImplementation(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + Self::GetApprovedTokens(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + Self::IsApprovedToken(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + Self::NewReceiverTimestamp(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + Self::NewSweeperTimestamp(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + Self::Owner(element) => ::ethers::core::abi::AbiEncode::encode(element), + Self::PaymentAddressToAccount(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + Self::PaymentReceived(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + Self::Receiver(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + Self::SetTokenApprovals(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + Self::SweeperImplementation(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + Self::TransferOwnershipTimestamp(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + } + } + } + impl ::core::fmt::Display for PaymentFactoryCalls { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + Self::ProxyImplementation(element) => { + ::core::fmt::Display::fmt(element, f) + } + Self::AcceptTransferOwnership(element) => { + ::core::fmt::Display::fmt(element, f) + } + Self::AccountToPaymentAddress(element) => { + ::core::fmt::Display::fmt(element, f) + } + Self::CommitNewReceiver(element) => ::core::fmt::Display::fmt(element, f), + Self::CommitNewSweeperImplementation(element) => { + ::core::fmt::Display::fmt(element, f) + } + Self::CommitTransferOwnership(element) => { + ::core::fmt::Display::fmt(element, f) + } + Self::CreatePaymentAddress(element) => { + ::core::fmt::Display::fmt(element, f) + } + Self::CreatePaymentAddressWithAccount(element) => { + ::core::fmt::Display::fmt(element, f) + } + Self::FinalizeNewReceiver(element) => { + ::core::fmt::Display::fmt(element, f) + } + Self::FinalizeNewSweeperImplementation(element) => { + ::core::fmt::Display::fmt(element, f) + } + Self::FutureOwner(element) => ::core::fmt::Display::fmt(element, f), + Self::FutureReceiver(element) => ::core::fmt::Display::fmt(element, f), + Self::FutureSweeperImplementation(element) => { + ::core::fmt::Display::fmt(element, f) + } + Self::GetApprovedTokens(element) => ::core::fmt::Display::fmt(element, f), + Self::IsApprovedToken(element) => ::core::fmt::Display::fmt(element, f), + Self::NewReceiverTimestamp(element) => { + ::core::fmt::Display::fmt(element, f) + } + Self::NewSweeperTimestamp(element) => { + ::core::fmt::Display::fmt(element, f) + } + Self::Owner(element) => ::core::fmt::Display::fmt(element, f), + Self::PaymentAddressToAccount(element) => { + ::core::fmt::Display::fmt(element, f) + } + Self::PaymentReceived(element) => ::core::fmt::Display::fmt(element, f), + Self::Receiver(element) => ::core::fmt::Display::fmt(element, f), + Self::SetTokenApprovals(element) => ::core::fmt::Display::fmt(element, f), + Self::SweeperImplementation(element) => { + ::core::fmt::Display::fmt(element, f) + } + Self::TransferOwnershipTimestamp(element) => { + ::core::fmt::Display::fmt(element, f) + } + } + } + } + impl ::core::convert::From for PaymentFactoryCalls { + fn from(value: ProxyImplementationCall) -> Self { + Self::ProxyImplementation(value) + } + } + impl ::core::convert::From for PaymentFactoryCalls { + fn from(value: AcceptTransferOwnershipCall) -> Self { + Self::AcceptTransferOwnership(value) + } + } + impl ::core::convert::From for PaymentFactoryCalls { + fn from(value: AccountToPaymentAddressCall) -> Self { + Self::AccountToPaymentAddress(value) + } + } + impl ::core::convert::From for PaymentFactoryCalls { + fn from(value: CommitNewReceiverCall) -> Self { + Self::CommitNewReceiver(value) + } + } + impl ::core::convert::From + for PaymentFactoryCalls { + fn from(value: CommitNewSweeperImplementationCall) -> Self { + Self::CommitNewSweeperImplementation(value) + } + } + impl ::core::convert::From for PaymentFactoryCalls { + fn from(value: CommitTransferOwnershipCall) -> Self { + Self::CommitTransferOwnership(value) + } + } + impl ::core::convert::From for PaymentFactoryCalls { + fn from(value: CreatePaymentAddressCall) -> Self { + Self::CreatePaymentAddress(value) + } + } + impl ::core::convert::From + for PaymentFactoryCalls { + fn from(value: CreatePaymentAddressWithAccountCall) -> Self { + Self::CreatePaymentAddressWithAccount(value) + } + } + impl ::core::convert::From for PaymentFactoryCalls { + fn from(value: FinalizeNewReceiverCall) -> Self { + Self::FinalizeNewReceiver(value) + } + } + impl ::core::convert::From + for PaymentFactoryCalls { + fn from(value: FinalizeNewSweeperImplementationCall) -> Self { + Self::FinalizeNewSweeperImplementation(value) + } + } + impl ::core::convert::From for PaymentFactoryCalls { + fn from(value: FutureOwnerCall) -> Self { + Self::FutureOwner(value) + } + } + impl ::core::convert::From for PaymentFactoryCalls { + fn from(value: FutureReceiverCall) -> Self { + Self::FutureReceiver(value) + } + } + impl ::core::convert::From for PaymentFactoryCalls { + fn from(value: FutureSweeperImplementationCall) -> Self { + Self::FutureSweeperImplementation(value) + } + } + impl ::core::convert::From for PaymentFactoryCalls { + fn from(value: GetApprovedTokensCall) -> Self { + Self::GetApprovedTokens(value) + } + } + impl ::core::convert::From for PaymentFactoryCalls { + fn from(value: IsApprovedTokenCall) -> Self { + Self::IsApprovedToken(value) + } + } + impl ::core::convert::From for PaymentFactoryCalls { + fn from(value: NewReceiverTimestampCall) -> Self { + Self::NewReceiverTimestamp(value) + } + } + impl ::core::convert::From for PaymentFactoryCalls { + fn from(value: NewSweeperTimestampCall) -> Self { + Self::NewSweeperTimestamp(value) + } + } + impl ::core::convert::From for PaymentFactoryCalls { + fn from(value: OwnerCall) -> Self { + Self::Owner(value) + } + } + impl ::core::convert::From for PaymentFactoryCalls { + fn from(value: PaymentAddressToAccountCall) -> Self { + Self::PaymentAddressToAccount(value) + } + } + impl ::core::convert::From for PaymentFactoryCalls { + fn from(value: PaymentReceivedCall) -> Self { + Self::PaymentReceived(value) + } + } + impl ::core::convert::From for PaymentFactoryCalls { + fn from(value: ReceiverCall) -> Self { + Self::Receiver(value) + } + } + impl ::core::convert::From for PaymentFactoryCalls { + fn from(value: SetTokenApprovalsCall) -> Self { + Self::SetTokenApprovals(value) + } + } + impl ::core::convert::From for PaymentFactoryCalls { + fn from(value: SweeperImplementationCall) -> Self { + Self::SweeperImplementation(value) + } + } + impl ::core::convert::From for PaymentFactoryCalls { + fn from(value: TransferOwnershipTimestampCall) -> Self { + Self::TransferOwnershipTimestamp(value) + } + } + ///Container type for all return fields from the `PROXY_IMPLEMENTATION` function with signature `PROXY_IMPLEMENTATION()` and selector `0x5c7a7d99` + #[derive( + Clone, + ::ethers::contract::EthAbiType, + ::ethers::contract::EthAbiCodec, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + pub struct ProxyImplementationReturn(pub ::ethers::core::types::Address); + ///Container type for all return fields from the `account_to_payment_address` function with signature `account_to_payment_address(address)` and selector `0x0b810230` + #[derive( + Clone, + ::ethers::contract::EthAbiType, + ::ethers::contract::EthAbiCodec, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + pub struct AccountToPaymentAddressReturn(pub ::ethers::core::types::Address); + ///Container type for all return fields from the `future_owner` function with signature `future_owner()` and selector `0x1ec0cdc1` + #[derive( + Clone, + ::ethers::contract::EthAbiType, + ::ethers::contract::EthAbiCodec, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + pub struct FutureOwnerReturn(pub ::ethers::core::types::Address); + ///Container type for all return fields from the `future_receiver` function with signature `future_receiver()` and selector `0x3bea9ddd` + #[derive( + Clone, + ::ethers::contract::EthAbiType, + ::ethers::contract::EthAbiCodec, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + pub struct FutureReceiverReturn(pub ::ethers::core::types::Address); + ///Container type for all return fields from the `future_sweeper_implementation` function with signature `future_sweeper_implementation()` and selector `0x4333d02b` + #[derive( + Clone, + ::ethers::contract::EthAbiType, + ::ethers::contract::EthAbiCodec, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + pub struct FutureSweeperImplementationReturn(pub ::ethers::core::types::Address); + ///Container type for all return fields from the `get_approved_tokens` function with signature `get_approved_tokens()` and selector `0x79aaf078` + #[derive( + Clone, + ::ethers::contract::EthAbiType, + ::ethers::contract::EthAbiCodec, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + pub struct GetApprovedTokensReturn( + pub ::std::vec::Vec<::ethers::core::types::Address>, + ); + ///Container type for all return fields from the `is_approved_token` function with signature `is_approved_token(address)` and selector `0x363b5b3e` + #[derive( + Clone, + ::ethers::contract::EthAbiType, + ::ethers::contract::EthAbiCodec, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + pub struct IsApprovedTokenReturn(pub bool); + ///Container type for all return fields from the `new_receiver_timestamp` function with signature `new_receiver_timestamp()` and selector `0xf85c2e83` + #[derive( + Clone, + ::ethers::contract::EthAbiType, + ::ethers::contract::EthAbiCodec, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + pub struct NewReceiverTimestampReturn(pub ::ethers::core::types::U256); + ///Container type for all return fields from the `new_sweeper_timestamp` function with signature `new_sweeper_timestamp()` and selector `0x05daefa8` + #[derive( + Clone, + ::ethers::contract::EthAbiType, + ::ethers::contract::EthAbiCodec, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + pub struct NewSweeperTimestampReturn(pub ::ethers::core::types::U256); + ///Container type for all return fields from the `owner` function with signature `owner()` and selector `0x8da5cb5b` + #[derive( + Clone, + ::ethers::contract::EthAbiType, + ::ethers::contract::EthAbiCodec, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + pub struct OwnerReturn(pub ::ethers::core::types::Address); + ///Container type for all return fields from the `payment_address_to_account` function with signature `payment_address_to_account(address)` and selector `0xe0934982` + #[derive( + Clone, + ::ethers::contract::EthAbiType, + ::ethers::contract::EthAbiCodec, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + pub struct PaymentAddressToAccountReturn(pub ::ethers::core::types::Address); + ///Container type for all return fields from the `payment_received` function with signature `payment_received(address,uint256)` and selector `0x7414b098` + #[derive( + Clone, + ::ethers::contract::EthAbiType, + ::ethers::contract::EthAbiCodec, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + pub struct PaymentReceivedReturn(pub bool); + ///Container type for all return fields from the `receiver` function with signature `receiver()` and selector `0xf7260d3e` + #[derive( + Clone, + ::ethers::contract::EthAbiType, + ::ethers::contract::EthAbiCodec, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + pub struct ReceiverReturn(pub ::ethers::core::types::Address); + ///Container type for all return fields from the `sweeper_implementation` function with signature `sweeper_implementation()` and selector `0x791cc746` + #[derive( + Clone, + ::ethers::contract::EthAbiType, + ::ethers::contract::EthAbiCodec, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + pub struct SweeperImplementationReturn(pub ::ethers::core::types::Address); + ///Container type for all return fields from the `transfer_ownership_timestamp` function with signature `transfer_ownership_timestamp()` and selector `0x4598cb25` + #[derive( + Clone, + ::ethers::contract::EthAbiType, + ::ethers::contract::EthAbiCodec, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + pub struct TransferOwnershipTimestampReturn(pub ::ethers::core::types::U256); +} diff --git a/payment-contracts/src/contracts/payment_proxy.rs b/payment-contracts/src/contracts/payment_proxy.rs new file mode 100644 index 00000000..b14765af --- /dev/null +++ b/payment-contracts/src/contracts/payment_proxy.rs @@ -0,0 +1,98 @@ +pub use payment_proxy::*; +/// This module was auto-generated with ethers-rs Abigen. +/// More information at: +#[allow( + clippy::enum_variant_names, + clippy::too_many_arguments, + clippy::upper_case_acronyms, + clippy::type_complexity, + dead_code, + non_camel_case_types, +)] +pub mod payment_proxy { + #[rustfmt::skip] + const __ABI: &str = "[\n {\n \"stateMutability\": \"nonpayable\",\n \"type\": \"constructor\",\n \"inputs\": [\n {\n \"name\": \"_factory\",\n \"type\": \"address\"\n }\n ],\n \"outputs\": []\n },\n {\n \"stateMutability\": \"nonpayable\",\n \"type\": \"fallback\"\n },\n {\n \"stateMutability\": \"view\",\n \"type\": \"function\",\n \"name\": \"implementation\",\n \"inputs\": [],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"address\"\n }\n ]\n }\n]"; + ///The parsed JSON ABI of the contract. + pub static PAYMENTPROXY_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> = ::ethers::contract::Lazy::new(|| + ::ethers::core::utils::__serde_json::from_str(__ABI).expect("ABI is always valid")); + pub struct PaymentProxy(::ethers::contract::Contract); + impl ::core::clone::Clone for PaymentProxy { + fn clone(&self) -> Self { + Self(::core::clone::Clone::clone(&self.0)) + } + } + impl ::core::ops::Deref for PaymentProxy { + type Target = ::ethers::contract::Contract; + fn deref(&self) -> &Self::Target { + &self.0 + } + } + impl ::core::ops::DerefMut for PaymentProxy { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } + } + impl ::core::fmt::Debug for PaymentProxy { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_tuple(stringify!(PaymentProxy)).field(&self.address()).finish() + } + } + impl PaymentProxy { + /// Creates a new contract instance with the specified `ethers` client at + /// `address`. The contract derefs to a `ethers::Contract` object. + pub fn new>( + address: T, + client: ::std::sync::Arc, + ) -> Self { + Self( + ::ethers::contract::Contract::new( + address.into(), + PAYMENTPROXY_ABI.clone(), + client, + ), + ) + } + ///Calls the contract's `implementation` (0x5c60da1b) function + pub fn implementation( + &self, + ) -> ::ethers::contract::builders::ContractCall< + M, + ::ethers::core::types::Address, + > { + self.0 + .method_hash([92, 96, 218, 27], ()) + .expect("method not found (this should never happen)") + } + } + impl From<::ethers::contract::Contract> + for PaymentProxy { + fn from(contract: ::ethers::contract::Contract) -> Self { + Self::new(contract.address(), contract.client()) + } + } + ///Container type for all input parameters for the `implementation` function with signature `implementation()` and selector `0x5c60da1b` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "implementation", abi = "implementation()")] + pub struct ImplementationCall; + ///Container type for all return fields from the `implementation` function with signature `implementation()` and selector `0x5c60da1b` + #[derive( + Clone, + ::ethers::contract::EthAbiType, + ::ethers::contract::EthAbiCodec, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + pub struct ImplementationReturn(pub ::ethers::core::types::Address); +} diff --git a/payment-contracts/src/contracts/payment_sweeper.rs b/payment-contracts/src/contracts/payment_sweeper.rs new file mode 100644 index 00000000..ee46653c --- /dev/null +++ b/payment-contracts/src/contracts/payment_sweeper.rs @@ -0,0 +1,256 @@ +pub use payment_sweeper::*; +/// This module was auto-generated with ethers-rs Abigen. +/// More information at: +#[allow( + clippy::enum_variant_names, + clippy::too_many_arguments, + clippy::upper_case_acronyms, + clippy::type_complexity, + dead_code, + non_camel_case_types, +)] +pub mod payment_sweeper { + #[rustfmt::skip] + const __ABI: &str = "[\n {\n \"stateMutability\": \"nonpayable\",\n \"type\": \"constructor\",\n \"inputs\": [\n {\n \"name\": \"_factory\",\n \"type\": \"address\"\n }\n ],\n \"outputs\": []\n },\n {\n \"stateMutability\": \"nonpayable\",\n \"type\": \"function\",\n \"name\": \"send_token\",\n \"inputs\": [\n {\n \"name\": \"_token\",\n \"type\": \"address\"\n },\n {\n \"name\": \"_amount\",\n \"type\": \"uint256\"\n }\n ],\n \"outputs\": []\n },\n {\n \"stateMutability\": \"nonpayable\",\n \"type\": \"function\",\n \"name\": \"sweep_token_balance\",\n \"inputs\": [\n {\n \"name\": \"_token\",\n \"type\": \"address\"\n }\n ],\n \"outputs\": []\n },\n {\n \"stateMutability\": \"nonpayable\",\n \"type\": \"function\",\n \"name\": \"recover_token_balance\",\n \"inputs\": [\n {\n \"name\": \"_token\",\n \"type\": \"address\"\n }\n ],\n \"outputs\": []\n },\n {\n \"stateMutability\": \"view\",\n \"type\": \"function\",\n \"name\": \"FACTORY\",\n \"inputs\": [],\n \"outputs\": [\n {\n \"name\": \"\",\n \"type\": \"address\"\n }\n ]\n }\n]"; + ///The parsed JSON ABI of the contract. + pub static PAYMENTSWEEPER_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> = ::ethers::contract::Lazy::new(|| + ::ethers::core::utils::__serde_json::from_str(__ABI).expect("ABI is always valid")); + pub struct PaymentSweeper(::ethers::contract::Contract); + impl ::core::clone::Clone for PaymentSweeper { + fn clone(&self) -> Self { + Self(::core::clone::Clone::clone(&self.0)) + } + } + impl ::core::ops::Deref for PaymentSweeper { + type Target = ::ethers::contract::Contract; + fn deref(&self) -> &Self::Target { + &self.0 + } + } + impl ::core::ops::DerefMut for PaymentSweeper { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } + } + impl ::core::fmt::Debug for PaymentSweeper { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_tuple(stringify!(PaymentSweeper)).field(&self.address()).finish() + } + } + impl PaymentSweeper { + /// Creates a new contract instance with the specified `ethers` client at + /// `address`. The contract derefs to a `ethers::Contract` object. + pub fn new>( + address: T, + client: ::std::sync::Arc, + ) -> Self { + Self( + ::ethers::contract::Contract::new( + address.into(), + PAYMENTSWEEPER_ABI.clone(), + client, + ), + ) + } + ///Calls the contract's `FACTORY` (0x2dd31000) function + pub fn factory( + &self, + ) -> ::ethers::contract::builders::ContractCall< + M, + ::ethers::core::types::Address, + > { + self.0 + .method_hash([45, 211, 16, 0], ()) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `recover_token_balance` (0xfb2b77ff) function + pub fn recover_token_balance( + &self, + token: ::ethers::core::types::Address, + ) -> ::ethers::contract::builders::ContractCall { + self.0 + .method_hash([251, 43, 119, 255], token) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `send_token` (0x315a0826) function + pub fn send_token( + &self, + token: ::ethers::core::types::Address, + amount: ::ethers::core::types::U256, + ) -> ::ethers::contract::builders::ContractCall { + self.0 + .method_hash([49, 90, 8, 38], (token, amount)) + .expect("method not found (this should never happen)") + } + ///Calls the contract's `sweep_token_balance` (0x0d7c94a1) function + pub fn sweep_token_balance( + &self, + token: ::ethers::core::types::Address, + ) -> ::ethers::contract::builders::ContractCall { + self.0 + .method_hash([13, 124, 148, 161], token) + .expect("method not found (this should never happen)") + } + } + impl From<::ethers::contract::Contract> + for PaymentSweeper { + fn from(contract: ::ethers::contract::Contract) -> Self { + Self::new(contract.address(), contract.client()) + } + } + ///Container type for all input parameters for the `FACTORY` function with signature `FACTORY()` and selector `0x2dd31000` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "FACTORY", abi = "FACTORY()")] + pub struct FactoryCall; + ///Container type for all input parameters for the `recover_token_balance` function with signature `recover_token_balance(address)` and selector `0xfb2b77ff` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "recover_token_balance", abi = "recover_token_balance(address)")] + pub struct RecoverTokenBalanceCall { + pub token: ::ethers::core::types::Address, + } + ///Container type for all input parameters for the `send_token` function with signature `send_token(address,uint256)` and selector `0x315a0826` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "send_token", abi = "send_token(address,uint256)")] + pub struct SendTokenCall { + pub token: ::ethers::core::types::Address, + pub amount: ::ethers::core::types::U256, + } + ///Container type for all input parameters for the `sweep_token_balance` function with signature `sweep_token_balance(address)` and selector `0x0d7c94a1` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + #[ethcall(name = "sweep_token_balance", abi = "sweep_token_balance(address)")] + pub struct SweepTokenBalanceCall { + pub token: ::ethers::core::types::Address, + } + ///Container type for all of the contract's call + #[derive(Clone, ::ethers::contract::EthAbiType, Debug, PartialEq, Eq, Hash)] + pub enum PaymentSweeperCalls { + Factory(FactoryCall), + RecoverTokenBalance(RecoverTokenBalanceCall), + SendToken(SendTokenCall), + SweepTokenBalance(SweepTokenBalanceCall), + } + impl ::ethers::core::abi::AbiDecode for PaymentSweeperCalls { + fn decode( + data: impl AsRef<[u8]>, + ) -> ::core::result::Result { + let data = data.as_ref(); + if let Ok(decoded) + = ::decode(data) { + return Ok(Self::Factory(decoded)); + } + if let Ok(decoded) + = ::decode( + data, + ) { + return Ok(Self::RecoverTokenBalance(decoded)); + } + if let Ok(decoded) + = ::decode(data) { + return Ok(Self::SendToken(decoded)); + } + if let Ok(decoded) + = ::decode( + data, + ) { + return Ok(Self::SweepTokenBalance(decoded)); + } + Err(::ethers::core::abi::Error::InvalidData.into()) + } + } + impl ::ethers::core::abi::AbiEncode for PaymentSweeperCalls { + fn encode(self) -> Vec { + match self { + Self::Factory(element) => ::ethers::core::abi::AbiEncode::encode(element), + Self::RecoverTokenBalance(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + Self::SendToken(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + Self::SweepTokenBalance(element) => { + ::ethers::core::abi::AbiEncode::encode(element) + } + } + } + } + impl ::core::fmt::Display for PaymentSweeperCalls { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + Self::Factory(element) => ::core::fmt::Display::fmt(element, f), + Self::RecoverTokenBalance(element) => { + ::core::fmt::Display::fmt(element, f) + } + Self::SendToken(element) => ::core::fmt::Display::fmt(element, f), + Self::SweepTokenBalance(element) => ::core::fmt::Display::fmt(element, f), + } + } + } + impl ::core::convert::From for PaymentSweeperCalls { + fn from(value: FactoryCall) -> Self { + Self::Factory(value) + } + } + impl ::core::convert::From for PaymentSweeperCalls { + fn from(value: RecoverTokenBalanceCall) -> Self { + Self::RecoverTokenBalance(value) + } + } + impl ::core::convert::From for PaymentSweeperCalls { + fn from(value: SendTokenCall) -> Self { + Self::SendToken(value) + } + } + impl ::core::convert::From for PaymentSweeperCalls { + fn from(value: SweepTokenBalanceCall) -> Self { + Self::SweepTokenBalance(value) + } + } + ///Container type for all return fields from the `FACTORY` function with signature `FACTORY()` and selector `0x2dd31000` + #[derive( + Clone, + ::ethers::contract::EthAbiType, + ::ethers::contract::EthAbiCodec, + Default, + Debug, + PartialEq, + Eq, + Hash + )] + pub struct FactoryReturn(pub ::ethers::core::types::Address); +}