pub use ierc3156_flash_borrower::*;
/// This module was auto-generated with ethers-rs Abigen.
/// More information at: <https://github.com/gakonst/ethers-rs>
#[allow(
clippy::enum_variant_names,
clippy::too_many_arguments,
clippy::upper_case_acronyms,
clippy::type_complexity,
dead_code,
non_camel_case_types,
)]
pub mod ierc3156_flash_borrower {
#[rustfmt::skip]
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\":[]}]}]";
///The parsed JSON ABI of the contract.
pub static IERC3156FLASHBORROWER_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 IERC3156FlashBorrower<M>(::ethers_contract::Contract<M>);
impl<M> ::core::clone::Clone for IERC3156FlashBorrower<M> {
fn clone(&self) -> Self {
Self(::core::clone::Clone::clone(&self.0))
}
}
impl<M> ::core::ops::Deref for IERC3156FlashBorrower<M> {
type Target = ::ethers_contract::Contract<M>;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl<M> ::core::ops::DerefMut for IERC3156FlashBorrower<M> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl<M> ::core::fmt::Debug for IERC3156FlashBorrower<M> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_tuple(stringify!(IERC3156FlashBorrower))
.field(&self.address())
.finish()
}
}
impl<M: ::ethers_providers::Middleware> IERC3156FlashBorrower<M> {
/// Creates a new contract instance with the specified `ethers` client at
/// `address`. The contract derefs to a `ethers::Contract` object.
pub fn new<T: Into<::ethers_core::types::Address>>(
address: T,
client: ::std::sync::Arc<M>,
) -> Self {
Self(
::ethers_contract::Contract::new(
address.into(),
IERC3156FLASHBORROWER_ABI.clone(),
client,
),
)
}
///Calls the contract's `onFlashLoan` (0x23e30c8b) function
pub fn on_flash_loan(
&self,
initiator: ::ethers_core::types::Address,
token: ::ethers_core::types::Address,
amount: ::ethers_core::types::U256,
fee: ::ethers_core::types::U256,
data: ::ethers_core::types::Bytes,
) -> ::ethers_contract::builders::ContractCall<M, [u8; 32]> {
self.0
.method_hash([35, 227, 12, 139], (initiator, token, amount, fee, data))
.expect("method not found (this should never happen)")
}
}
impl<M: ::ethers_providers::Middleware> From<::ethers_contract::Contract<M>>
for IERC3156FlashBorrower<M> {
fn from(contract: ::ethers_contract::Contract<M>) -> Self {
Self::new(contract.address(), contract.client())
}
}
///Container type for all input parameters for the `onFlashLoan` function with signature `onFlashLoan(address,address,uint256,uint256,bytes)` and selector `0x23e30c8b`
#[derive(
Clone,
::ethers_contract::EthCall,
::ethers_contract::EthDisplay,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
#[ethcall(
name = "onFlashLoan",
abi = "onFlashLoan(address,address,uint256,uint256,bytes)"
)]
pub struct OnFlashLoanCall {
pub initiator: ::ethers_core::types::Address,
pub token: ::ethers_core::types::Address,
pub amount: ::ethers_core::types::U256,
pub fee: ::ethers_core::types::U256,
pub data: ::ethers_core::types::Bytes,
}
///Container type for all return fields from the `onFlashLoan` function with signature `onFlashLoan(address,address,uint256,uint256,bytes)` and selector `0x23e30c8b`
#[derive(
Clone,
::ethers_contract::EthAbiType,
::ethers_contract::EthAbiCodec,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
pub struct OnFlashLoanReturn(pub [u8; 32]);
}