267 lines
12 KiB
Rust
267 lines
12 KiB
Rust
pub use erc1155_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 erc1155_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 ERC1155RECEIVER_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 ERC1155Receiver<M>(::ethers::contract::Contract<M>);
|
|
impl<M> ::core::clone::Clone for ERC1155Receiver<M> {
|
|
fn clone(&self) -> Self {
|
|
Self(::core::clone::Clone::clone(&self.0))
|
|
}
|
|
}
|
|
impl<M> ::core::ops::Deref for ERC1155Receiver<M> {
|
|
type Target = ::ethers::contract::Contract<M>;
|
|
fn deref(&self) -> &Self::Target {
|
|
&self.0
|
|
}
|
|
}
|
|
impl<M> ::core::ops::DerefMut for ERC1155Receiver<M> {
|
|
fn deref_mut(&mut self) -> &mut Self::Target {
|
|
&mut self.0
|
|
}
|
|
}
|
|
impl<M> ::core::fmt::Debug for ERC1155Receiver<M> {
|
|
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
|
|
f.debug_tuple(stringify!(ERC1155Receiver)).field(&self.address()).finish()
|
|
}
|
|
}
|
|
impl<M: ::ethers::providers::Middleware> ERC1155Receiver<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(),
|
|
ERC1155RECEIVER_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 ERC1155Receiver<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 ERC1155ReceiverCalls {
|
|
OnERC1155BatchReceived(OnERC1155BatchReceivedCall),
|
|
OnERC1155Received(OnERC1155ReceivedCall),
|
|
SupportsInterface(SupportsInterfaceCall),
|
|
}
|
|
impl ::ethers::core::abi::AbiDecode for ERC1155ReceiverCalls {
|
|
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 ERC1155ReceiverCalls {
|
|
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 ERC1155ReceiverCalls {
|
|
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 ERC1155ReceiverCalls {
|
|
fn from(value: OnERC1155BatchReceivedCall) -> Self {
|
|
Self::OnERC1155BatchReceived(value)
|
|
}
|
|
}
|
|
impl ::core::convert::From<OnERC1155ReceivedCall> for ERC1155ReceiverCalls {
|
|
fn from(value: OnERC1155ReceivedCall) -> Self {
|
|
Self::OnERC1155Received(value)
|
|
}
|
|
}
|
|
impl ::core::convert::From<SupportsInterfaceCall> for ERC1155ReceiverCalls {
|
|
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);
|
|
}
|