pub use ierc1155_receiver::*;
/// 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 ierc1155_receiver {
#[rustfmt::skip]
const __ABI: &str = "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\",\"components\":[]},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\",\"components\":[]},{\"internalType\":\"uint256[]\",\"name\":\"ids\",\"type\":\"uint256[]\",\"components\":[]},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\",\"components\":[]},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\",\"components\":[]}],\"stateMutability\":\"nonpayable\",\"type\":\"function\",\"name\":\"onERC1155BatchReceived\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\",\"components\":[]}]},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\",\"components\":[]},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\",\"components\":[]},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\",\"components\":[]},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\",\"components\":[]},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\",\"components\":[]}],\"stateMutability\":\"nonpayable\",\"type\":\"function\",\"name\":\"onERC1155Received\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\",\"components\":[]}]},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\",\"components\":[]}],\"stateMutability\":\"view\",\"type\":\"function\",\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\",\"components\":[]}]}]";
///The parsed JSON ABI of the contract.
pub static IERC1155RECEIVER_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 IERC1155Receiver<M>(::ethers_contract::Contract<M>);
impl<M> ::core::clone::Clone for IERC1155Receiver<M> {
fn clone(&self) -> Self {
Self(::core::clone::Clone::clone(&self.0))
}
}
impl<M> ::core::ops::Deref for IERC1155Receiver<M> {
type Target = ::ethers_contract::Contract<M>;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl<M> ::core::ops::DerefMut for IERC1155Receiver<M> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl<M> ::core::fmt::Debug for IERC1155Receiver<M> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_tuple(stringify!(IERC1155Receiver)).field(&self.address()).finish()
}
}
impl<M: ::ethers_providers::Middleware> IERC1155Receiver<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(),
IERC1155RECEIVER_ABI.clone(),
client,
),
)
}
///Calls the contract's `onERC1155BatchReceived` (0xbc197c81) function
pub fn on_erc1155_batch_received(
&self,
operator: ::ethers_core::types::Address,
from: ::ethers_core::types::Address,
ids: ::std::vec::Vec<::ethers_core::types::U256>,
values: ::std::vec::Vec<::ethers_core::types::U256>,
data: ::ethers_core::types::Bytes,
) -> ::ethers_contract::builders::ContractCall<M, [u8; 4]> {
self.0
.method_hash([188, 25, 124, 129], (operator, from, ids, values, data))
.expect("method not found (this should never happen)")
}
///Calls the contract's `onERC1155Received` (0xf23a6e61) function
pub fn on_erc1155_received(
&self,
operator: ::ethers_core::types::Address,
from: ::ethers_core::types::Address,
id: ::ethers_core::types::U256,
value: ::ethers_core::types::U256,
data: ::ethers_core::types::Bytes,
) -> ::ethers_contract::builders::ContractCall<M, [u8; 4]> {
self.0
.method_hash([242, 58, 110, 97], (operator, from, id, value, data))
.expect("method not found (this should never happen)")
}
///Calls the contract's `supportsInterface` (0x01ffc9a7) function
pub fn supports_interface(
&self,
interface_id: [u8; 4],
) -> ::ethers_contract::builders::ContractCall<M, bool> {
self.0
.method_hash([1, 255, 201, 167], interface_id)
.expect("method not found (this should never happen)")
}
}
impl<M: ::ethers_providers::Middleware> From<::ethers_contract::Contract<M>>
for IERC1155Receiver<M> {
fn from(contract: ::ethers_contract::Contract<M>) -> Self {
Self::new(contract.address(), contract.client())
}
}
///Container type for all input parameters for the `onERC1155BatchReceived` function with signature `onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)` and selector `0xbc197c81`
#[derive(
Clone,
::ethers_contract::EthCall,
::ethers_contract::EthDisplay,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
#[ethcall(
name = "onERC1155BatchReceived",
abi = "onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"
)]
pub struct OnERC1155BatchReceivedCall {
pub operator: ::ethers_core::types::Address,
pub from: ::ethers_core::types::Address,
pub ids: ::std::vec::Vec<::ethers_core::types::U256>,
pub values: ::std::vec::Vec<::ethers_core::types::U256>,
pub data: ::ethers_core::types::Bytes,
}
///Container type for all input parameters for the `onERC1155Received` function with signature `onERC1155Received(address,address,uint256,uint256,bytes)` and selector `0xf23a6e61`
#[derive(
Clone,
::ethers_contract::EthCall,
::ethers_contract::EthDisplay,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
#[ethcall(
name = "onERC1155Received",
abi = "onERC1155Received(address,address,uint256,uint256,bytes)"
)]
pub struct OnERC1155ReceivedCall {
pub operator: ::ethers_core::types::Address,
pub from: ::ethers_core::types::Address,
pub id: ::ethers_core::types::U256,
pub value: ::ethers_core::types::U256,
pub data: ::ethers_core::types::Bytes,
}
///Container type for all input parameters for the `supportsInterface` function with signature `supportsInterface(bytes4)` and selector `0x01ffc9a7`
#[derive(
Clone,
::ethers_contract::EthCall,
::ethers_contract::EthDisplay,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
#[ethcall(name = "supportsInterface", abi = "supportsInterface(bytes4)")]
pub struct SupportsInterfaceCall {
pub interface_id: [u8; 4],
}
///Container type for all of the contract's call
#[derive(Clone, ::ethers_contract::EthAbiType, Debug, PartialEq, Eq, Hash)]
pub enum IERC1155ReceiverCalls {
OnERC1155BatchReceived(OnERC1155BatchReceivedCall),
OnERC1155Received(OnERC1155ReceivedCall),
SupportsInterface(SupportsInterfaceCall),
}
impl ::ethers_core::abi::AbiDecode for IERC1155ReceiverCalls {
fn decode(
data: impl AsRef<[u8]>,
) -> ::core::result::Result<Self, ::ethers_core::abi::AbiError> {
let data = data.as_ref();
if let Ok(decoded)
= <OnERC1155BatchReceivedCall as ::ethers_core::abi::AbiDecode>::decode(
data,
) {
return Ok(Self::OnERC1155BatchReceived(decoded));
}
if let Ok(decoded)
= <OnERC1155ReceivedCall as ::ethers_core::abi::AbiDecode>::decode(
data,
) {
return Ok(Self::OnERC1155Received(decoded));
}
if let Ok(decoded)
= <SupportsInterfaceCall as ::ethers_core::abi::AbiDecode>::decode(
data,
) {
return Ok(Self::SupportsInterface(decoded));
}
Err(::ethers_core::abi::Error::InvalidData.into())
}
}
impl ::ethers_core::abi::AbiEncode for IERC1155ReceiverCalls {
fn encode(self) -> Vec<u8> {
match self {
Self::OnERC1155BatchReceived(element) => {
::ethers_core::abi::AbiEncode::encode(element)
}
Self::OnERC1155Received(element) => {
::ethers_core::abi::AbiEncode::encode(element)
}
Self::SupportsInterface(element) => {
::ethers_core::abi::AbiEncode::encode(element)
}
}
}
}
impl ::core::fmt::Display for IERC1155ReceiverCalls {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
match self {
Self::OnERC1155BatchReceived(element) => {
::core::fmt::Display::fmt(element, f)
}
Self::OnERC1155Received(element) => ::core::fmt::Display::fmt(element, f),
Self::SupportsInterface(element) => ::core::fmt::Display::fmt(element, f),
}
}
}
impl ::core::convert::From<OnERC1155BatchReceivedCall> for IERC1155ReceiverCalls {
fn from(value: OnERC1155BatchReceivedCall) -> Self {
Self::OnERC1155BatchReceived(value)
}
}
impl ::core::convert::From<OnERC1155ReceivedCall> for IERC1155ReceiverCalls {
fn from(value: OnERC1155ReceivedCall) -> Self {
Self::OnERC1155Received(value)
}
}
impl ::core::convert::From<SupportsInterfaceCall> for IERC1155ReceiverCalls {
fn from(value: SupportsInterfaceCall) -> Self {
Self::SupportsInterface(value)
}
}
///Container type for all return fields from the `onERC1155BatchReceived` function with signature `onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)` and selector `0xbc197c81`
#[derive(
Clone,
::ethers_contract::EthAbiType,
::ethers_contract::EthAbiCodec,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
pub struct OnERC1155BatchReceivedReturn(pub [u8; 4]);
///Container type for all return fields from the `onERC1155Received` function with signature `onERC1155Received(address,address,uint256,uint256,bytes)` and selector `0xf23a6e61`
#[derive(
Clone,
::ethers_contract::EthAbiType,
::ethers_contract::EthAbiCodec,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
pub struct OnERC1155ReceivedReturn(pub [u8; 4]);
///Container type for all return fields from the `supportsInterface` function with signature `supportsInterface(bytes4)` and selector `0x01ffc9a7`
#[derive(
Clone,
::ethers_contract::EthAbiType,
::ethers_contract::EthAbiCodec,
Default,
Debug,
PartialEq,
Eq,
Hash
)]
pub struct SupportsInterfaceReturn(pub bool);
}