215 lines
8.0 KiB
Rust
215 lines
8.0 KiB
Rust
pub use owned::*;
|
|
/// 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 owned {
|
|
#[rustfmt::skip]
|
|
const __ABI: &str = "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\",\"components\":[],\"indexed\":true},{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\",\"components\":[],\"indexed\":true}],\"type\":\"event\",\"name\":\"OwnershipTransferred\",\"outputs\":[],\"anonymous\":false},{\"inputs\":[],\"stateMutability\":\"view\",\"type\":\"function\",\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\",\"components\":[]}]},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\",\"components\":[]}],\"stateMutability\":\"nonpayable\",\"type\":\"function\",\"name\":\"transferOwnership\",\"outputs\":[]}]";
|
|
///The parsed JSON ABI of the contract.
|
|
pub static OWNED_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 Owned<M>(::ethers::contract::Contract<M>);
|
|
impl<M> ::core::clone::Clone for Owned<M> {
|
|
fn clone(&self) -> Self {
|
|
Self(::core::clone::Clone::clone(&self.0))
|
|
}
|
|
}
|
|
impl<M> ::core::ops::Deref for Owned<M> {
|
|
type Target = ::ethers::contract::Contract<M>;
|
|
fn deref(&self) -> &Self::Target {
|
|
&self.0
|
|
}
|
|
}
|
|
impl<M> ::core::ops::DerefMut for Owned<M> {
|
|
fn deref_mut(&mut self) -> &mut Self::Target {
|
|
&mut self.0
|
|
}
|
|
}
|
|
impl<M> ::core::fmt::Debug for Owned<M> {
|
|
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
|
|
f.debug_tuple(stringify!(Owned)).field(&self.address()).finish()
|
|
}
|
|
}
|
|
impl<M: ::ethers::providers::Middleware> Owned<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(),
|
|
OWNED_ABI.clone(),
|
|
client,
|
|
),
|
|
)
|
|
}
|
|
///Calls the contract's `owner` (0x8da5cb5b) function
|
|
pub fn owner(
|
|
&self,
|
|
) -> ::ethers::contract::builders::ContractCall<
|
|
M,
|
|
::ethers::core::types::Address,
|
|
> {
|
|
self.0
|
|
.method_hash([141, 165, 203, 91], ())
|
|
.expect("method not found (this should never happen)")
|
|
}
|
|
///Calls the contract's `transferOwnership` (0xf2fde38b) function
|
|
pub fn transfer_ownership(
|
|
&self,
|
|
new_owner: ::ethers::core::types::Address,
|
|
) -> ::ethers::contract::builders::ContractCall<M, ()> {
|
|
self.0
|
|
.method_hash([242, 253, 227, 139], new_owner)
|
|
.expect("method not found (this should never happen)")
|
|
}
|
|
///Gets the contract's `OwnershipTransferred` event
|
|
pub fn ownership_transferred_filter(
|
|
&self,
|
|
) -> ::ethers::contract::builders::Event<
|
|
::std::sync::Arc<M>,
|
|
M,
|
|
OwnershipTransferredFilter,
|
|
> {
|
|
self.0.event()
|
|
}
|
|
/// Returns an `Event` builder for all the events of this contract.
|
|
pub fn events(
|
|
&self,
|
|
) -> ::ethers::contract::builders::Event<
|
|
::std::sync::Arc<M>,
|
|
M,
|
|
OwnershipTransferredFilter,
|
|
> {
|
|
self.0.event_with_filter(::core::default::Default::default())
|
|
}
|
|
}
|
|
impl<M: ::ethers::providers::Middleware> From<::ethers::contract::Contract<M>>
|
|
for Owned<M> {
|
|
fn from(contract: ::ethers::contract::Contract<M>) -> Self {
|
|
Self::new(contract.address(), contract.client())
|
|
}
|
|
}
|
|
#[derive(
|
|
Clone,
|
|
::ethers::contract::EthEvent,
|
|
::ethers::contract::EthDisplay,
|
|
Default,
|
|
Debug,
|
|
PartialEq,
|
|
Eq,
|
|
Hash
|
|
)]
|
|
#[ethevent(
|
|
name = "OwnershipTransferred",
|
|
abi = "OwnershipTransferred(address,address)"
|
|
)]
|
|
pub struct OwnershipTransferredFilter {
|
|
#[ethevent(indexed)]
|
|
pub user: ::ethers::core::types::Address,
|
|
#[ethevent(indexed)]
|
|
pub new_owner: ::ethers::core::types::Address,
|
|
}
|
|
///Container type for all input parameters for the `owner` function with signature `owner()` and selector `0x8da5cb5b`
|
|
#[derive(
|
|
Clone,
|
|
::ethers::contract::EthCall,
|
|
::ethers::contract::EthDisplay,
|
|
Default,
|
|
Debug,
|
|
PartialEq,
|
|
Eq,
|
|
Hash
|
|
)]
|
|
#[ethcall(name = "owner", abi = "owner()")]
|
|
pub struct OwnerCall;
|
|
///Container type for all input parameters for the `transferOwnership` function with signature `transferOwnership(address)` and selector `0xf2fde38b`
|
|
#[derive(
|
|
Clone,
|
|
::ethers::contract::EthCall,
|
|
::ethers::contract::EthDisplay,
|
|
Default,
|
|
Debug,
|
|
PartialEq,
|
|
Eq,
|
|
Hash
|
|
)]
|
|
#[ethcall(name = "transferOwnership", abi = "transferOwnership(address)")]
|
|
pub struct TransferOwnershipCall {
|
|
pub new_owner: ::ethers::core::types::Address,
|
|
}
|
|
///Container type for all of the contract's call
|
|
#[derive(Clone, ::ethers::contract::EthAbiType, Debug, PartialEq, Eq, Hash)]
|
|
pub enum OwnedCalls {
|
|
Owner(OwnerCall),
|
|
TransferOwnership(TransferOwnershipCall),
|
|
}
|
|
impl ::ethers::core::abi::AbiDecode for OwnedCalls {
|
|
fn decode(
|
|
data: impl AsRef<[u8]>,
|
|
) -> ::core::result::Result<Self, ::ethers::core::abi::AbiError> {
|
|
let data = data.as_ref();
|
|
if let Ok(decoded)
|
|
= <OwnerCall as ::ethers::core::abi::AbiDecode>::decode(data) {
|
|
return Ok(Self::Owner(decoded));
|
|
}
|
|
if let Ok(decoded)
|
|
= <TransferOwnershipCall as ::ethers::core::abi::AbiDecode>::decode(
|
|
data,
|
|
) {
|
|
return Ok(Self::TransferOwnership(decoded));
|
|
}
|
|
Err(::ethers::core::abi::Error::InvalidData.into())
|
|
}
|
|
}
|
|
impl ::ethers::core::abi::AbiEncode for OwnedCalls {
|
|
fn encode(self) -> Vec<u8> {
|
|
match self {
|
|
Self::Owner(element) => ::ethers::core::abi::AbiEncode::encode(element),
|
|
Self::TransferOwnership(element) => {
|
|
::ethers::core::abi::AbiEncode::encode(element)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
impl ::core::fmt::Display for OwnedCalls {
|
|
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
|
|
match self {
|
|
Self::Owner(element) => ::core::fmt::Display::fmt(element, f),
|
|
Self::TransferOwnership(element) => ::core::fmt::Display::fmt(element, f),
|
|
}
|
|
}
|
|
}
|
|
impl ::core::convert::From<OwnerCall> for OwnedCalls {
|
|
fn from(value: OwnerCall) -> Self {
|
|
Self::Owner(value)
|
|
}
|
|
}
|
|
impl ::core::convert::From<TransferOwnershipCall> for OwnedCalls {
|
|
fn from(value: TransferOwnershipCall) -> Self {
|
|
Self::TransferOwnership(value)
|
|
}
|
|
}
|
|
///Container type for all return fields from the `owner` function with signature `owner()` and selector `0x8da5cb5b`
|
|
#[derive(
|
|
Clone,
|
|
::ethers::contract::EthAbiType,
|
|
::ethers::contract::EthAbiCodec,
|
|
Default,
|
|
Debug,
|
|
PartialEq,
|
|
Eq,
|
|
Hash
|
|
)]
|
|
pub struct OwnerReturn(pub ::ethers::core::types::Address);
|
|
}
|