openzeppelin_rs/contracts/
IERC3156FlashBorrower.rs1pub use ierc3156_flash_borrower::*;
2#[allow(
5 clippy::enum_variant_names,
6 clippy::too_many_arguments,
7 clippy::upper_case_acronyms,
8 clippy::type_complexity,
9 dead_code,
10 non_camel_case_types,
11)]
12pub mod ierc3156_flash_borrower {
13 #[rustfmt::skip]
14 const __ABI: &str = "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"initiator\",\"type\":\"address\",\"components\":[]},{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\",\"components\":[]},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\",\"components\":[]},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\",\"components\":[]},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\",\"components\":[]}],\"stateMutability\":\"nonpayable\",\"type\":\"function\",\"name\":\"onFlashLoan\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\",\"components\":[]}]}]";
15 pub static IERC3156FLASHBORROWER_ABI: ::ethers_contract::Lazy<
17 ::ethers_core::abi::Abi,
18 > = ::ethers_contract::Lazy::new(|| {
19 ::ethers_core::utils::__serde_json::from_str(__ABI).expect("ABI is always valid")
20 });
21 pub struct IERC3156FlashBorrower<M>(::ethers_contract::Contract<M>);
22 impl<M> ::core::clone::Clone for IERC3156FlashBorrower<M> {
23 fn clone(&self) -> Self {
24 Self(::core::clone::Clone::clone(&self.0))
25 }
26 }
27 impl<M> ::core::ops::Deref for IERC3156FlashBorrower<M> {
28 type Target = ::ethers_contract::Contract<M>;
29 fn deref(&self) -> &Self::Target {
30 &self.0
31 }
32 }
33 impl<M> ::core::ops::DerefMut for IERC3156FlashBorrower<M> {
34 fn deref_mut(&mut self) -> &mut Self::Target {
35 &mut self.0
36 }
37 }
38 impl<M> ::core::fmt::Debug for IERC3156FlashBorrower<M> {
39 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
40 f.debug_tuple(stringify!(IERC3156FlashBorrower))
41 .field(&self.address())
42 .finish()
43 }
44 }
45 impl<M: ::ethers_providers::Middleware> IERC3156FlashBorrower<M> {
46 pub fn new<T: Into<::ethers_core::types::Address>>(
49 address: T,
50 client: ::std::sync::Arc<M>,
51 ) -> Self {
52 Self(
53 ::ethers_contract::Contract::new(
54 address.into(),
55 IERC3156FLASHBORROWER_ABI.clone(),
56 client,
57 ),
58 )
59 }
60 pub fn on_flash_loan(
62 &self,
63 initiator: ::ethers_core::types::Address,
64 token: ::ethers_core::types::Address,
65 amount: ::ethers_core::types::U256,
66 fee: ::ethers_core::types::U256,
67 data: ::ethers_core::types::Bytes,
68 ) -> ::ethers_contract::builders::ContractCall<M, [u8; 32]> {
69 self.0
70 .method_hash([35, 227, 12, 139], (initiator, token, amount, fee, data))
71 .expect("method not found (this should never happen)")
72 }
73 }
74 impl<M: ::ethers_providers::Middleware> From<::ethers_contract::Contract<M>>
75 for IERC3156FlashBorrower<M> {
76 fn from(contract: ::ethers_contract::Contract<M>) -> Self {
77 Self::new(contract.address(), contract.client())
78 }
79 }
80 #[derive(
82 Clone,
83 ::ethers_contract::EthCall,
84 ::ethers_contract::EthDisplay,
85 Default,
86 Debug,
87 PartialEq,
88 Eq,
89 Hash
90 )]
91 #[ethcall(
92 name = "onFlashLoan",
93 abi = "onFlashLoan(address,address,uint256,uint256,bytes)"
94 )]
95 pub struct OnFlashLoanCall {
96 pub initiator: ::ethers_core::types::Address,
97 pub token: ::ethers_core::types::Address,
98 pub amount: ::ethers_core::types::U256,
99 pub fee: ::ethers_core::types::U256,
100 pub data: ::ethers_core::types::Bytes,
101 }
102 #[derive(
104 Clone,
105 ::ethers_contract::EthAbiType,
106 ::ethers_contract::EthAbiCodec,
107 Default,
108 Debug,
109 PartialEq,
110 Eq,
111 Hash
112 )]
113 pub struct OnFlashLoanReturn(pub [u8; 32]);
114}