openzeppelin_rs/contracts/
ERC2981.rs

1pub use erc2981::*;
2/// This module was auto-generated with ethers-rs Abigen.
3/// More information at: <https://github.com/gakonst/ethers-rs>
4#[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 erc2981 {
13    #[rustfmt::skip]
14    const __ABI: &str = "[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\",\"components\":[]},{\"internalType\":\"uint256\",\"name\":\"salePrice\",\"type\":\"uint256\",\"components\":[]}],\"stateMutability\":\"view\",\"type\":\"function\",\"name\":\"royaltyInfo\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\",\"components\":[]},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\",\"components\":[]}]},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\",\"components\":[]}],\"stateMutability\":\"view\",\"type\":\"function\",\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\",\"components\":[]}]}]";
15    ///The parsed JSON ABI of the contract.
16    pub static ERC2981_ABI: ::ethers_contract::Lazy<::ethers_core::abi::Abi> = ::ethers_contract::Lazy::new(||
17    ::ethers_core::utils::__serde_json::from_str(__ABI).expect("ABI is always valid"));
18    pub struct ERC2981<M>(::ethers_contract::Contract<M>);
19    impl<M> ::core::clone::Clone for ERC2981<M> {
20        fn clone(&self) -> Self {
21            Self(::core::clone::Clone::clone(&self.0))
22        }
23    }
24    impl<M> ::core::ops::Deref for ERC2981<M> {
25        type Target = ::ethers_contract::Contract<M>;
26        fn deref(&self) -> &Self::Target {
27            &self.0
28        }
29    }
30    impl<M> ::core::ops::DerefMut for ERC2981<M> {
31        fn deref_mut(&mut self) -> &mut Self::Target {
32            &mut self.0
33        }
34    }
35    impl<M> ::core::fmt::Debug for ERC2981<M> {
36        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
37            f.debug_tuple(stringify!(ERC2981)).field(&self.address()).finish()
38        }
39    }
40    impl<M: ::ethers_providers::Middleware> ERC2981<M> {
41        /// Creates a new contract instance with the specified `ethers` client at
42        /// `address`. The contract derefs to a `ethers::Contract` object.
43        pub fn new<T: Into<::ethers_core::types::Address>>(
44            address: T,
45            client: ::std::sync::Arc<M>,
46        ) -> Self {
47            Self(
48                ::ethers_contract::Contract::new(
49                    address.into(),
50                    ERC2981_ABI.clone(),
51                    client,
52                ),
53            )
54        }
55        ///Calls the contract's `royaltyInfo` (0x2a55205a) function
56        pub fn royalty_info(
57            &self,
58            token_id: ::ethers_core::types::U256,
59            sale_price: ::ethers_core::types::U256,
60        ) -> ::ethers_contract::builders::ContractCall<
61            M,
62            (::ethers_core::types::Address, ::ethers_core::types::U256),
63        > {
64            self.0
65                .method_hash([42, 85, 32, 90], (token_id, sale_price))
66                .expect("method not found (this should never happen)")
67        }
68        ///Calls the contract's `supportsInterface` (0x01ffc9a7) function
69        pub fn supports_interface(
70            &self,
71            interface_id: [u8; 4],
72        ) -> ::ethers_contract::builders::ContractCall<M, bool> {
73            self.0
74                .method_hash([1, 255, 201, 167], interface_id)
75                .expect("method not found (this should never happen)")
76        }
77    }
78    impl<M: ::ethers_providers::Middleware> From<::ethers_contract::Contract<M>>
79    for ERC2981<M> {
80        fn from(contract: ::ethers_contract::Contract<M>) -> Self {
81            Self::new(contract.address(), contract.client())
82        }
83    }
84    ///Container type for all input parameters for the `royaltyInfo` function with signature `royaltyInfo(uint256,uint256)` and selector `0x2a55205a`
85    #[derive(
86        Clone,
87        ::ethers_contract::EthCall,
88        ::ethers_contract::EthDisplay,
89        Default,
90        Debug,
91        PartialEq,
92        Eq,
93        Hash
94    )]
95    #[ethcall(name = "royaltyInfo", abi = "royaltyInfo(uint256,uint256)")]
96    pub struct RoyaltyInfoCall {
97        pub token_id: ::ethers_core::types::U256,
98        pub sale_price: ::ethers_core::types::U256,
99    }
100    ///Container type for all input parameters for the `supportsInterface` function with signature `supportsInterface(bytes4)` and selector `0x01ffc9a7`
101    #[derive(
102        Clone,
103        ::ethers_contract::EthCall,
104        ::ethers_contract::EthDisplay,
105        Default,
106        Debug,
107        PartialEq,
108        Eq,
109        Hash
110    )]
111    #[ethcall(name = "supportsInterface", abi = "supportsInterface(bytes4)")]
112    pub struct SupportsInterfaceCall {
113        pub interface_id: [u8; 4],
114    }
115    ///Container type for all of the contract's call
116    #[derive(Clone, ::ethers_contract::EthAbiType, Debug, PartialEq, Eq, Hash)]
117    pub enum ERC2981Calls {
118        RoyaltyInfo(RoyaltyInfoCall),
119        SupportsInterface(SupportsInterfaceCall),
120    }
121    impl ::ethers_core::abi::AbiDecode for ERC2981Calls {
122        fn decode(
123            data: impl AsRef<[u8]>,
124        ) -> ::core::result::Result<Self, ::ethers_core::abi::AbiError> {
125            let data = data.as_ref();
126            if let Ok(decoded)
127                = <RoyaltyInfoCall as ::ethers_core::abi::AbiDecode>::decode(data) {
128                return Ok(Self::RoyaltyInfo(decoded));
129            }
130            if let Ok(decoded)
131                = <SupportsInterfaceCall as ::ethers_core::abi::AbiDecode>::decode(
132                    data,
133                ) {
134                return Ok(Self::SupportsInterface(decoded));
135            }
136            Err(::ethers_core::abi::Error::InvalidData.into())
137        }
138    }
139    impl ::ethers_core::abi::AbiEncode for ERC2981Calls {
140        fn encode(self) -> Vec<u8> {
141            match self {
142                Self::RoyaltyInfo(element) => {
143                    ::ethers_core::abi::AbiEncode::encode(element)
144                }
145                Self::SupportsInterface(element) => {
146                    ::ethers_core::abi::AbiEncode::encode(element)
147                }
148            }
149        }
150    }
151    impl ::core::fmt::Display for ERC2981Calls {
152        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
153            match self {
154                Self::RoyaltyInfo(element) => ::core::fmt::Display::fmt(element, f),
155                Self::SupportsInterface(element) => ::core::fmt::Display::fmt(element, f),
156            }
157        }
158    }
159    impl ::core::convert::From<RoyaltyInfoCall> for ERC2981Calls {
160        fn from(value: RoyaltyInfoCall) -> Self {
161            Self::RoyaltyInfo(value)
162        }
163    }
164    impl ::core::convert::From<SupportsInterfaceCall> for ERC2981Calls {
165        fn from(value: SupportsInterfaceCall) -> Self {
166            Self::SupportsInterface(value)
167        }
168    }
169    ///Container type for all return fields from the `royaltyInfo` function with signature `royaltyInfo(uint256,uint256)` and selector `0x2a55205a`
170    #[derive(
171        Clone,
172        ::ethers_contract::EthAbiType,
173        ::ethers_contract::EthAbiCodec,
174        Default,
175        Debug,
176        PartialEq,
177        Eq,
178        Hash
179    )]
180    pub struct RoyaltyInfoReturn(
181        pub ::ethers_core::types::Address,
182        pub ::ethers_core::types::U256,
183    );
184    ///Container type for all return fields from the `supportsInterface` function with signature `supportsInterface(bytes4)` and selector `0x01ffc9a7`
185    #[derive(
186        Clone,
187        ::ethers_contract::EthAbiType,
188        ::ethers_contract::EthAbiCodec,
189        Default,
190        Debug,
191        PartialEq,
192        Eq,
193        Hash
194    )]
195    pub struct SupportsInterfaceReturn(pub bool);
196}