Files
de-mls/crates/bindings/src/ownable.rs
Ekaterina Broslavskaya ea08e5633f Update add member flow (#26)
* don't work async, prepare to remove

* new flow works good

* refactor
2024-08-15 10:30:45 +03:00

1149 lines
44 KiB
Rust

/**
Generated by the following Solidity interface...
```solidity
interface Ownable {
error OwnableInvalidOwner(address owner);
error OwnableUnauthorizedAccount(address account);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function owner() external view returns (address);
function renounceOwnership() external;
function transferOwnership(address newOwner) external;
}
```
...which was generated by the following JSON ABI:
```json
[
{
"type": "function",
"name": "owner",
"inputs": [],
"outputs": [
{
"name": "",
"type": "address",
"internalType": "address"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "renounceOwnership",
"inputs": [],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "transferOwnership",
"inputs": [
{
"name": "newOwner",
"type": "address",
"internalType": "address"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "event",
"name": "OwnershipTransferred",
"inputs": [
{
"name": "previousOwner",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "newOwner",
"type": "address",
"indexed": true,
"internalType": "address"
}
],
"anonymous": false
},
{
"type": "error",
"name": "OwnableInvalidOwner",
"inputs": [
{
"name": "owner",
"type": "address",
"internalType": "address"
}
]
},
{
"type": "error",
"name": "OwnableUnauthorizedAccount",
"inputs": [
{
"name": "account",
"type": "address",
"internalType": "address"
}
]
}
]
```*/
#[allow(non_camel_case_types, non_snake_case, clippy::style)]
pub mod Ownable {
use super::*;
use alloy::sol_types as alloy_sol_types;
/// The creation / init bytecode of the contract.
///
/// ```text
///0x
/// ```
#[rustfmt::skip]
#[allow(clippy::all)]
pub static BYTECODE: alloy_sol_types::private::Bytes = alloy_sol_types::private::Bytes::from_static(
b"",
);
/// The runtime bytecode of the contract, as deployed on the network.
///
/// ```text
///0x
/// ```
#[rustfmt::skip]
#[allow(clippy::all)]
pub static DEPLOYED_BYTECODE: alloy_sol_types::private::Bytes = alloy_sol_types::private::Bytes::from_static(
b"",
);
/**Custom error with signature `OwnableInvalidOwner(address)` and selector `0x1e4fbdf7`.
```solidity
error OwnableInvalidOwner(address owner);
```*/
#[allow(non_camel_case_types, non_snake_case)]
#[derive(Clone)]
pub struct OwnableInvalidOwner {
pub owner: alloy::sol_types::private::Address,
}
#[allow(non_camel_case_types, non_snake_case, clippy::style)]
const _: () = {
use alloy::sol_types as alloy_sol_types;
#[doc(hidden)]
type UnderlyingSolTuple<'a> = (alloy::sol_types::sol_data::Address,);
#[doc(hidden)]
type UnderlyingRustTuple<'a> = (alloy::sol_types::private::Address,);
#[cfg(test)]
#[allow(dead_code, unreachable_patterns)]
fn _type_assertion(_t: alloy_sol_types::private::AssertTypeEq<UnderlyingRustTuple>) {
match _t {
alloy_sol_types::private::AssertTypeEq::<
<UnderlyingSolTuple as alloy_sol_types::SolType>::RustType,
>(_) => {}
}
}
#[automatically_derived]
#[doc(hidden)]
impl ::core::convert::From<OwnableInvalidOwner> for UnderlyingRustTuple<'_> {
fn from(value: OwnableInvalidOwner) -> Self {
(value.owner,)
}
}
#[automatically_derived]
#[doc(hidden)]
impl ::core::convert::From<UnderlyingRustTuple<'_>> for OwnableInvalidOwner {
fn from(tuple: UnderlyingRustTuple<'_>) -> Self {
Self { owner: tuple.0 }
}
}
#[automatically_derived]
impl alloy_sol_types::SolError for OwnableInvalidOwner {
type Parameters<'a> = UnderlyingSolTuple<'a>;
type Token<'a> = <Self::Parameters<'a> as alloy_sol_types::SolType>::Token<'a>;
const SIGNATURE: &'static str = "OwnableInvalidOwner(address)";
const SELECTOR: [u8; 4] = [30u8, 79u8, 189u8, 247u8];
#[inline]
fn new<'a>(
tuple: <Self::Parameters<'a> as alloy_sol_types::SolType>::RustType,
) -> Self {
tuple.into()
}
#[inline]
fn tokenize(&self) -> Self::Token<'_> {
(
<alloy::sol_types::sol_data::Address as alloy_sol_types::SolType>::tokenize(
&self.owner,
),
)
}
}
};
/**Custom error with signature `OwnableUnauthorizedAccount(address)` and selector `0x118cdaa7`.
```solidity
error OwnableUnauthorizedAccount(address account);
```*/
#[allow(non_camel_case_types, non_snake_case)]
#[derive(Clone)]
pub struct OwnableUnauthorizedAccount {
pub account: alloy::sol_types::private::Address,
}
#[allow(non_camel_case_types, non_snake_case, clippy::style)]
const _: () = {
use alloy::sol_types as alloy_sol_types;
#[doc(hidden)]
type UnderlyingSolTuple<'a> = (alloy::sol_types::sol_data::Address,);
#[doc(hidden)]
type UnderlyingRustTuple<'a> = (alloy::sol_types::private::Address,);
#[cfg(test)]
#[allow(dead_code, unreachable_patterns)]
fn _type_assertion(_t: alloy_sol_types::private::AssertTypeEq<UnderlyingRustTuple>) {
match _t {
alloy_sol_types::private::AssertTypeEq::<
<UnderlyingSolTuple as alloy_sol_types::SolType>::RustType,
>(_) => {}
}
}
#[automatically_derived]
#[doc(hidden)]
impl ::core::convert::From<OwnableUnauthorizedAccount> for UnderlyingRustTuple<'_> {
fn from(value: OwnableUnauthorizedAccount) -> Self {
(value.account,)
}
}
#[automatically_derived]
#[doc(hidden)]
impl ::core::convert::From<UnderlyingRustTuple<'_>> for OwnableUnauthorizedAccount {
fn from(tuple: UnderlyingRustTuple<'_>) -> Self {
Self { account: tuple.0 }
}
}
#[automatically_derived]
impl alloy_sol_types::SolError for OwnableUnauthorizedAccount {
type Parameters<'a> = UnderlyingSolTuple<'a>;
type Token<'a> = <Self::Parameters<'a> as alloy_sol_types::SolType>::Token<'a>;
const SIGNATURE: &'static str = "OwnableUnauthorizedAccount(address)";
const SELECTOR: [u8; 4] = [17u8, 140u8, 218u8, 167u8];
#[inline]
fn new<'a>(
tuple: <Self::Parameters<'a> as alloy_sol_types::SolType>::RustType,
) -> Self {
tuple.into()
}
#[inline]
fn tokenize(&self) -> Self::Token<'_> {
(
<alloy::sol_types::sol_data::Address as alloy_sol_types::SolType>::tokenize(
&self.account,
),
)
}
}
};
/**Event with signature `OwnershipTransferred(address,address)` and selector `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0`.
```solidity
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
```*/
#[allow(non_camel_case_types, non_snake_case, clippy::style)]
#[derive(Clone)]
pub struct OwnershipTransferred {
#[allow(missing_docs)]
pub previousOwner: alloy::sol_types::private::Address,
#[allow(missing_docs)]
pub newOwner: alloy::sol_types::private::Address,
}
#[allow(non_camel_case_types, non_snake_case, clippy::style)]
const _: () = {
use alloy::sol_types as alloy_sol_types;
#[automatically_derived]
impl alloy_sol_types::SolEvent for OwnershipTransferred {
type DataTuple<'a> = ();
type DataToken<'a> = <Self::DataTuple<'a> as alloy_sol_types::SolType>::Token<'a>;
type TopicList = (
alloy_sol_types::sol_data::FixedBytes<32>,
alloy::sol_types::sol_data::Address,
alloy::sol_types::sol_data::Address,
);
const SIGNATURE: &'static str = "OwnershipTransferred(address,address)";
const SIGNATURE_HASH: alloy_sol_types::private::B256 =
alloy_sol_types::private::B256::new([
139u8, 224u8, 7u8, 156u8, 83u8, 22u8, 89u8, 20u8, 19u8, 68u8, 205u8, 31u8,
208u8, 164u8, 242u8, 132u8, 25u8, 73u8, 127u8, 151u8, 34u8, 163u8, 218u8,
175u8, 227u8, 180u8, 24u8, 111u8, 107u8, 100u8, 87u8, 224u8,
]);
const ANONYMOUS: bool = false;
#[allow(unused_variables)]
#[inline]
fn new(
topics: <Self::TopicList as alloy_sol_types::SolType>::RustType,
data: <Self::DataTuple<'_> as alloy_sol_types::SolType>::RustType,
) -> Self {
Self {
previousOwner: topics.1,
newOwner: topics.2,
}
}
#[inline]
fn tokenize_body(&self) -> Self::DataToken<'_> {
()
}
#[inline]
fn topics(&self) -> <Self::TopicList as alloy_sol_types::SolType>::RustType {
(
Self::SIGNATURE_HASH.into(),
self.previousOwner.clone(),
self.newOwner.clone(),
)
}
#[inline]
fn encode_topics_raw(
&self,
out: &mut [alloy_sol_types::abi::token::WordToken],
) -> alloy_sol_types::Result<()> {
if out.len() < <Self::TopicList as alloy_sol_types::TopicList>::COUNT {
return Err(alloy_sol_types::Error::Overrun);
}
out[0usize] = alloy_sol_types::abi::token::WordToken(Self::SIGNATURE_HASH);
out[1usize] = <alloy::sol_types::sol_data::Address as alloy_sol_types::EventTopic>::encode_topic(
&self.previousOwner,
);
out[2usize] = <alloy::sol_types::sol_data::Address as alloy_sol_types::EventTopic>::encode_topic(
&self.newOwner,
);
Ok(())
}
}
#[automatically_derived]
impl alloy_sol_types::private::IntoLogData for OwnershipTransferred {
fn to_log_data(&self) -> alloy_sol_types::private::LogData {
From::from(self)
}
fn into_log_data(self) -> alloy_sol_types::private::LogData {
From::from(&self)
}
}
#[automatically_derived]
impl From<&OwnershipTransferred> for alloy_sol_types::private::LogData {
#[inline]
fn from(this: &OwnershipTransferred) -> alloy_sol_types::private::LogData {
alloy_sol_types::SolEvent::encode_log_data(this)
}
}
};
/**Function with signature `owner()` and selector `0x8da5cb5b`.
```solidity
function owner() external view returns (address);
```*/
#[allow(non_camel_case_types, non_snake_case)]
#[derive(Clone)]
pub struct ownerCall {}
///Container type for the return parameters of the [`owner()`](ownerCall) function.
#[allow(non_camel_case_types, non_snake_case)]
#[derive(Clone)]
pub struct ownerReturn {
pub _0: alloy::sol_types::private::Address,
}
#[allow(non_camel_case_types, non_snake_case, clippy::style)]
const _: () = {
use alloy::sol_types as alloy_sol_types;
{
#[doc(hidden)]
type UnderlyingSolTuple<'a> = ();
#[doc(hidden)]
type UnderlyingRustTuple<'a> = ();
#[cfg(test)]
#[allow(dead_code, unreachable_patterns)]
fn _type_assertion(_t: alloy_sol_types::private::AssertTypeEq<UnderlyingRustTuple>) {
match _t {
alloy_sol_types::private::AssertTypeEq::<
<UnderlyingSolTuple as alloy_sol_types::SolType>::RustType,
>(_) => {}
}
}
#[automatically_derived]
#[doc(hidden)]
impl ::core::convert::From<ownerCall> for UnderlyingRustTuple<'_> {
fn from(value: ownerCall) -> Self {
()
}
}
#[automatically_derived]
#[doc(hidden)]
impl ::core::convert::From<UnderlyingRustTuple<'_>> for ownerCall {
fn from(tuple: UnderlyingRustTuple<'_>) -> Self {
Self {}
}
}
}
{
#[doc(hidden)]
type UnderlyingSolTuple<'a> = (alloy::sol_types::sol_data::Address,);
#[doc(hidden)]
type UnderlyingRustTuple<'a> = (alloy::sol_types::private::Address,);
#[cfg(test)]
#[allow(dead_code, unreachable_patterns)]
fn _type_assertion(_t: alloy_sol_types::private::AssertTypeEq<UnderlyingRustTuple>) {
match _t {
alloy_sol_types::private::AssertTypeEq::<
<UnderlyingSolTuple as alloy_sol_types::SolType>::RustType,
>(_) => {}
}
}
#[automatically_derived]
#[doc(hidden)]
impl ::core::convert::From<ownerReturn> for UnderlyingRustTuple<'_> {
fn from(value: ownerReturn) -> Self {
(value._0,)
}
}
#[automatically_derived]
#[doc(hidden)]
impl ::core::convert::From<UnderlyingRustTuple<'_>> for ownerReturn {
fn from(tuple: UnderlyingRustTuple<'_>) -> Self {
Self { _0: tuple.0 }
}
}
}
#[automatically_derived]
impl alloy_sol_types::SolCall for ownerCall {
type Parameters<'a> = ();
type Token<'a> = <Self::Parameters<'a> as alloy_sol_types::SolType>::Token<'a>;
type Return = ownerReturn;
type ReturnTuple<'a> = (alloy::sol_types::sol_data::Address,);
type ReturnToken<'a> = <Self::ReturnTuple<'a> as alloy_sol_types::SolType>::Token<'a>;
const SIGNATURE: &'static str = "owner()";
const SELECTOR: [u8; 4] = [141u8, 165u8, 203u8, 91u8];
#[inline]
fn new<'a>(
tuple: <Self::Parameters<'a> as alloy_sol_types::SolType>::RustType,
) -> Self {
tuple.into()
}
#[inline]
fn tokenize(&self) -> Self::Token<'_> {
()
}
#[inline]
fn abi_decode_returns(
data: &[u8],
validate: bool,
) -> alloy_sol_types::Result<Self::Return> {
<Self::ReturnTuple<'_> as alloy_sol_types::SolType>::abi_decode_sequence(
data, validate,
)
.map(Into::into)
}
}
};
/**Function with signature `renounceOwnership()` and selector `0x715018a6`.
```solidity
function renounceOwnership() external;
```*/
#[allow(non_camel_case_types, non_snake_case)]
#[derive(Clone)]
pub struct renounceOwnershipCall {}
///Container type for the return parameters of the [`renounceOwnership()`](renounceOwnershipCall) function.
#[allow(non_camel_case_types, non_snake_case)]
#[derive(Clone)]
pub struct renounceOwnershipReturn {}
#[allow(non_camel_case_types, non_snake_case, clippy::style)]
const _: () = {
use alloy::sol_types as alloy_sol_types;
{
#[doc(hidden)]
type UnderlyingSolTuple<'a> = ();
#[doc(hidden)]
type UnderlyingRustTuple<'a> = ();
#[cfg(test)]
#[allow(dead_code, unreachable_patterns)]
fn _type_assertion(_t: alloy_sol_types::private::AssertTypeEq<UnderlyingRustTuple>) {
match _t {
alloy_sol_types::private::AssertTypeEq::<
<UnderlyingSolTuple as alloy_sol_types::SolType>::RustType,
>(_) => {}
}
}
#[automatically_derived]
#[doc(hidden)]
impl ::core::convert::From<renounceOwnershipCall> for UnderlyingRustTuple<'_> {
fn from(value: renounceOwnershipCall) -> Self {
()
}
}
#[automatically_derived]
#[doc(hidden)]
impl ::core::convert::From<UnderlyingRustTuple<'_>> for renounceOwnershipCall {
fn from(tuple: UnderlyingRustTuple<'_>) -> Self {
Self {}
}
}
}
{
#[doc(hidden)]
type UnderlyingSolTuple<'a> = ();
#[doc(hidden)]
type UnderlyingRustTuple<'a> = ();
#[cfg(test)]
#[allow(dead_code, unreachable_patterns)]
fn _type_assertion(_t: alloy_sol_types::private::AssertTypeEq<UnderlyingRustTuple>) {
match _t {
alloy_sol_types::private::AssertTypeEq::<
<UnderlyingSolTuple as alloy_sol_types::SolType>::RustType,
>(_) => {}
}
}
#[automatically_derived]
#[doc(hidden)]
impl ::core::convert::From<renounceOwnershipReturn> for UnderlyingRustTuple<'_> {
fn from(value: renounceOwnershipReturn) -> Self {
()
}
}
#[automatically_derived]
#[doc(hidden)]
impl ::core::convert::From<UnderlyingRustTuple<'_>> for renounceOwnershipReturn {
fn from(tuple: UnderlyingRustTuple<'_>) -> Self {
Self {}
}
}
}
#[automatically_derived]
impl alloy_sol_types::SolCall for renounceOwnershipCall {
type Parameters<'a> = ();
type Token<'a> = <Self::Parameters<'a> as alloy_sol_types::SolType>::Token<'a>;
type Return = renounceOwnershipReturn;
type ReturnTuple<'a> = ();
type ReturnToken<'a> = <Self::ReturnTuple<'a> as alloy_sol_types::SolType>::Token<'a>;
const SIGNATURE: &'static str = "renounceOwnership()";
const SELECTOR: [u8; 4] = [113u8, 80u8, 24u8, 166u8];
#[inline]
fn new<'a>(
tuple: <Self::Parameters<'a> as alloy_sol_types::SolType>::RustType,
) -> Self {
tuple.into()
}
#[inline]
fn tokenize(&self) -> Self::Token<'_> {
()
}
#[inline]
fn abi_decode_returns(
data: &[u8],
validate: bool,
) -> alloy_sol_types::Result<Self::Return> {
<Self::ReturnTuple<'_> as alloy_sol_types::SolType>::abi_decode_sequence(
data, validate,
)
.map(Into::into)
}
}
};
/**Function with signature `transferOwnership(address)` and selector `0xf2fde38b`.
```solidity
function transferOwnership(address newOwner) external;
```*/
#[allow(non_camel_case_types, non_snake_case)]
#[derive(Clone)]
pub struct transferOwnershipCall {
pub newOwner: alloy::sol_types::private::Address,
}
///Container type for the return parameters of the [`transferOwnership(address)`](transferOwnershipCall) function.
#[allow(non_camel_case_types, non_snake_case)]
#[derive(Clone)]
pub struct transferOwnershipReturn {}
#[allow(non_camel_case_types, non_snake_case, clippy::style)]
const _: () = {
use alloy::sol_types as alloy_sol_types;
{
#[doc(hidden)]
type UnderlyingSolTuple<'a> = (alloy::sol_types::sol_data::Address,);
#[doc(hidden)]
type UnderlyingRustTuple<'a> = (alloy::sol_types::private::Address,);
#[cfg(test)]
#[allow(dead_code, unreachable_patterns)]
fn _type_assertion(_t: alloy_sol_types::private::AssertTypeEq<UnderlyingRustTuple>) {
match _t {
alloy_sol_types::private::AssertTypeEq::<
<UnderlyingSolTuple as alloy_sol_types::SolType>::RustType,
>(_) => {}
}
}
#[automatically_derived]
#[doc(hidden)]
impl ::core::convert::From<transferOwnershipCall> for UnderlyingRustTuple<'_> {
fn from(value: transferOwnershipCall) -> Self {
(value.newOwner,)
}
}
#[automatically_derived]
#[doc(hidden)]
impl ::core::convert::From<UnderlyingRustTuple<'_>> for transferOwnershipCall {
fn from(tuple: UnderlyingRustTuple<'_>) -> Self {
Self { newOwner: tuple.0 }
}
}
}
{
#[doc(hidden)]
type UnderlyingSolTuple<'a> = ();
#[doc(hidden)]
type UnderlyingRustTuple<'a> = ();
#[cfg(test)]
#[allow(dead_code, unreachable_patterns)]
fn _type_assertion(_t: alloy_sol_types::private::AssertTypeEq<UnderlyingRustTuple>) {
match _t {
alloy_sol_types::private::AssertTypeEq::<
<UnderlyingSolTuple as alloy_sol_types::SolType>::RustType,
>(_) => {}
}
}
#[automatically_derived]
#[doc(hidden)]
impl ::core::convert::From<transferOwnershipReturn> for UnderlyingRustTuple<'_> {
fn from(value: transferOwnershipReturn) -> Self {
()
}
}
#[automatically_derived]
#[doc(hidden)]
impl ::core::convert::From<UnderlyingRustTuple<'_>> for transferOwnershipReturn {
fn from(tuple: UnderlyingRustTuple<'_>) -> Self {
Self {}
}
}
}
#[automatically_derived]
impl alloy_sol_types::SolCall for transferOwnershipCall {
type Parameters<'a> = (alloy::sol_types::sol_data::Address,);
type Token<'a> = <Self::Parameters<'a> as alloy_sol_types::SolType>::Token<'a>;
type Return = transferOwnershipReturn;
type ReturnTuple<'a> = ();
type ReturnToken<'a> = <Self::ReturnTuple<'a> as alloy_sol_types::SolType>::Token<'a>;
const SIGNATURE: &'static str = "transferOwnership(address)";
const SELECTOR: [u8; 4] = [242u8, 253u8, 227u8, 139u8];
#[inline]
fn new<'a>(
tuple: <Self::Parameters<'a> as alloy_sol_types::SolType>::RustType,
) -> Self {
tuple.into()
}
#[inline]
fn tokenize(&self) -> Self::Token<'_> {
(
<alloy::sol_types::sol_data::Address as alloy_sol_types::SolType>::tokenize(
&self.newOwner,
),
)
}
#[inline]
fn abi_decode_returns(
data: &[u8],
validate: bool,
) -> alloy_sol_types::Result<Self::Return> {
<Self::ReturnTuple<'_> as alloy_sol_types::SolType>::abi_decode_sequence(
data, validate,
)
.map(Into::into)
}
}
};
///Container for all the [`Ownable`](self) function calls.
pub enum OwnableCalls {
owner(ownerCall),
renounceOwnership(renounceOwnershipCall),
transferOwnership(transferOwnershipCall),
}
#[automatically_derived]
impl OwnableCalls {
/// All the selectors of this enum.
///
/// Note that the selectors might not be in the same order as the variants.
/// No guarantees are made about the order of the selectors.
///
/// Prefer using `SolInterface` methods instead.
pub const SELECTORS: &'static [[u8; 4usize]] = &[
[113u8, 80u8, 24u8, 166u8],
[141u8, 165u8, 203u8, 91u8],
[242u8, 253u8, 227u8, 139u8],
];
}
#[automatically_derived]
impl alloy_sol_types::SolInterface for OwnableCalls {
const NAME: &'static str = "OwnableCalls";
const MIN_DATA_LENGTH: usize = 0usize;
const COUNT: usize = 3usize;
#[inline]
fn selector(&self) -> [u8; 4] {
match self {
Self::owner(_) => <ownerCall as alloy_sol_types::SolCall>::SELECTOR,
Self::renounceOwnership(_) => {
<renounceOwnershipCall as alloy_sol_types::SolCall>::SELECTOR
}
Self::transferOwnership(_) => {
<transferOwnershipCall as alloy_sol_types::SolCall>::SELECTOR
}
}
}
#[inline]
fn selector_at(i: usize) -> ::core::option::Option<[u8; 4]> {
Self::SELECTORS.get(i).copied()
}
#[inline]
fn valid_selector(selector: [u8; 4]) -> bool {
Self::SELECTORS.binary_search(&selector).is_ok()
}
#[inline]
#[allow(unsafe_code, non_snake_case)]
fn abi_decode_raw(
selector: [u8; 4],
data: &[u8],
validate: bool,
) -> alloy_sol_types::Result<Self> {
static DECODE_SHIMS: &[fn(&[u8], bool) -> alloy_sol_types::Result<OwnableCalls>] = &[
{
fn renounceOwnership(
data: &[u8],
validate: bool,
) -> alloy_sol_types::Result<OwnableCalls> {
<renounceOwnershipCall as alloy_sol_types::SolCall>::abi_decode_raw(
data, validate,
)
.map(OwnableCalls::renounceOwnership)
}
renounceOwnership
},
{
fn owner(data: &[u8], validate: bool) -> alloy_sol_types::Result<OwnableCalls> {
<ownerCall as alloy_sol_types::SolCall>::abi_decode_raw(data, validate)
.map(OwnableCalls::owner)
}
owner
},
{
fn transferOwnership(
data: &[u8],
validate: bool,
) -> alloy_sol_types::Result<OwnableCalls> {
<transferOwnershipCall as alloy_sol_types::SolCall>::abi_decode_raw(
data, validate,
)
.map(OwnableCalls::transferOwnership)
}
transferOwnership
},
];
let Ok(idx) = Self::SELECTORS.binary_search(&selector) else {
return Err(alloy_sol_types::Error::unknown_selector(
<Self as alloy_sol_types::SolInterface>::NAME,
selector,
));
};
(unsafe { DECODE_SHIMS.get_unchecked(idx) })(data, validate)
}
#[inline]
fn abi_encoded_size(&self) -> usize {
match self {
Self::owner(inner) => {
<ownerCall as alloy_sol_types::SolCall>::abi_encoded_size(inner)
}
Self::renounceOwnership(inner) => {
<renounceOwnershipCall as alloy_sol_types::SolCall>::abi_encoded_size(inner)
}
Self::transferOwnership(inner) => {
<transferOwnershipCall as alloy_sol_types::SolCall>::abi_encoded_size(inner)
}
}
}
#[inline]
fn abi_encode_raw(&self, out: &mut alloy_sol_types::private::Vec<u8>) {
match self {
Self::owner(inner) => {
<ownerCall as alloy_sol_types::SolCall>::abi_encode_raw(inner, out)
}
Self::renounceOwnership(inner) => {
<renounceOwnershipCall as alloy_sol_types::SolCall>::abi_encode_raw(inner, out)
}
Self::transferOwnership(inner) => {
<transferOwnershipCall as alloy_sol_types::SolCall>::abi_encode_raw(inner, out)
}
}
}
}
///Container for all the [`Ownable`](self) custom errors.
pub enum OwnableErrors {
OwnableInvalidOwner(OwnableInvalidOwner),
OwnableUnauthorizedAccount(OwnableUnauthorizedAccount),
}
#[automatically_derived]
impl OwnableErrors {
/// All the selectors of this enum.
///
/// Note that the selectors might not be in the same order as the variants.
/// No guarantees are made about the order of the selectors.
///
/// Prefer using `SolInterface` methods instead.
pub const SELECTORS: &'static [[u8; 4usize]] =
&[[17u8, 140u8, 218u8, 167u8], [30u8, 79u8, 189u8, 247u8]];
}
#[automatically_derived]
impl alloy_sol_types::SolInterface for OwnableErrors {
const NAME: &'static str = "OwnableErrors";
const MIN_DATA_LENGTH: usize = 32usize;
const COUNT: usize = 2usize;
#[inline]
fn selector(&self) -> [u8; 4] {
match self {
Self::OwnableInvalidOwner(_) => {
<OwnableInvalidOwner as alloy_sol_types::SolError>::SELECTOR
}
Self::OwnableUnauthorizedAccount(_) => {
<OwnableUnauthorizedAccount as alloy_sol_types::SolError>::SELECTOR
}
}
}
#[inline]
fn selector_at(i: usize) -> ::core::option::Option<[u8; 4]> {
Self::SELECTORS.get(i).copied()
}
#[inline]
fn valid_selector(selector: [u8; 4]) -> bool {
Self::SELECTORS.binary_search(&selector).is_ok()
}
#[inline]
#[allow(unsafe_code, non_snake_case)]
fn abi_decode_raw(
selector: [u8; 4],
data: &[u8],
validate: bool,
) -> alloy_sol_types::Result<Self> {
static DECODE_SHIMS: &[fn(&[u8], bool) -> alloy_sol_types::Result<OwnableErrors>] = &[
{
fn OwnableUnauthorizedAccount(
data: &[u8],
validate: bool,
) -> alloy_sol_types::Result<OwnableErrors> {
<OwnableUnauthorizedAccount as alloy_sol_types::SolError>::abi_decode_raw(
data, validate,
)
.map(OwnableErrors::OwnableUnauthorizedAccount)
}
OwnableUnauthorizedAccount
},
{
fn OwnableInvalidOwner(
data: &[u8],
validate: bool,
) -> alloy_sol_types::Result<OwnableErrors> {
<OwnableInvalidOwner as alloy_sol_types::SolError>::abi_decode_raw(
data, validate,
)
.map(OwnableErrors::OwnableInvalidOwner)
}
OwnableInvalidOwner
},
];
let Ok(idx) = Self::SELECTORS.binary_search(&selector) else {
return Err(alloy_sol_types::Error::unknown_selector(
<Self as alloy_sol_types::SolInterface>::NAME,
selector,
));
};
(unsafe { DECODE_SHIMS.get_unchecked(idx) })(data, validate)
}
#[inline]
fn abi_encoded_size(&self) -> usize {
match self {
Self::OwnableInvalidOwner(inner) => {
<OwnableInvalidOwner as alloy_sol_types::SolError>::abi_encoded_size(inner)
}
Self::OwnableUnauthorizedAccount(inner) => {
<OwnableUnauthorizedAccount as alloy_sol_types::SolError>::abi_encoded_size(
inner,
)
}
}
}
#[inline]
fn abi_encode_raw(&self, out: &mut alloy_sol_types::private::Vec<u8>) {
match self {
Self::OwnableInvalidOwner(inner) => {
<OwnableInvalidOwner as alloy_sol_types::SolError>::abi_encode_raw(inner, out)
}
Self::OwnableUnauthorizedAccount(inner) => {
<OwnableUnauthorizedAccount as alloy_sol_types::SolError>::abi_encode_raw(
inner, out,
)
}
}
}
}
///Container for all the [`Ownable`](self) events.
pub enum OwnableEvents {
OwnershipTransferred(OwnershipTransferred),
}
#[automatically_derived]
impl OwnableEvents {
/// All the selectors of this enum.
///
/// Note that the selectors might not be in the same order as the variants.
/// No guarantees are made about the order of the selectors.
///
/// Prefer using `SolInterface` methods instead.
pub const SELECTORS: &'static [[u8; 32usize]] = &[[
139u8, 224u8, 7u8, 156u8, 83u8, 22u8, 89u8, 20u8, 19u8, 68u8, 205u8, 31u8, 208u8,
164u8, 242u8, 132u8, 25u8, 73u8, 127u8, 151u8, 34u8, 163u8, 218u8, 175u8, 227u8, 180u8,
24u8, 111u8, 107u8, 100u8, 87u8, 224u8,
]];
}
#[automatically_derived]
impl alloy_sol_types::SolEventInterface for OwnableEvents {
const NAME: &'static str = "OwnableEvents";
const COUNT: usize = 1usize;
fn decode_raw_log(
topics: &[alloy_sol_types::Word],
data: &[u8],
validate: bool,
) -> alloy_sol_types::Result<Self> {
match topics.first().copied() {
Some(<OwnershipTransferred as alloy_sol_types::SolEvent>::SIGNATURE_HASH) => {
<OwnershipTransferred as alloy_sol_types::SolEvent>::decode_raw_log(
topics, data, validate,
)
.map(Self::OwnershipTransferred)
}
_ => alloy_sol_types::private::Err(alloy_sol_types::Error::InvalidLog {
name: <Self as alloy_sol_types::SolEventInterface>::NAME,
log: alloy_sol_types::private::Box::new(
alloy_sol_types::private::LogData::new_unchecked(
topics.to_vec(),
data.to_vec().into(),
),
),
}),
}
}
}
#[automatically_derived]
impl alloy_sol_types::private::IntoLogData for OwnableEvents {
fn to_log_data(&self) -> alloy_sol_types::private::LogData {
match self {
Self::OwnershipTransferred(inner) => {
alloy_sol_types::private::IntoLogData::to_log_data(inner)
}
}
}
fn into_log_data(self) -> alloy_sol_types::private::LogData {
match self {
Self::OwnershipTransferred(inner) => {
alloy_sol_types::private::IntoLogData::into_log_data(inner)
}
}
}
}
use alloy::contract as alloy_contract;
/**Creates a new wrapper around an on-chain [`Ownable`](self) contract instance.
See the [wrapper's documentation](`OwnableInstance`) for more details.*/
#[inline]
pub const fn new<
T: alloy_contract::private::Transport + ::core::clone::Clone,
P: alloy_contract::private::Provider<T, N>,
N: alloy_contract::private::Network,
>(
address: alloy_sol_types::private::Address,
provider: P,
) -> OwnableInstance<T, P, N> {
OwnableInstance::<T, P, N>::new(address, provider)
}
/**Deploys this contract using the given `provider` and constructor arguments, if any.
Returns a new instance of the contract, if the deployment was successful.
For more fine-grained control over the deployment process, use [`deploy_builder`] instead.*/
#[inline]
pub fn deploy<
T: alloy_contract::private::Transport + ::core::clone::Clone,
P: alloy_contract::private::Provider<T, N>,
N: alloy_contract::private::Network,
>(
provider: P,
) -> impl ::core::future::Future<Output = alloy_contract::Result<OwnableInstance<T, P, N>>>
{
OwnableInstance::<T, P, N>::deploy(provider)
}
/**Creates a `RawCallBuilder` for deploying this contract using the given `provider`
and constructor arguments, if any.
This is a simple wrapper around creating a `RawCallBuilder` with the data set to
the bytecode concatenated with the constructor's ABI-encoded arguments.*/
#[inline]
pub fn deploy_builder<
T: alloy_contract::private::Transport + ::core::clone::Clone,
P: alloy_contract::private::Provider<T, N>,
N: alloy_contract::private::Network,
>(
provider: P,
) -> alloy_contract::RawCallBuilder<T, P, N> {
OwnableInstance::<T, P, N>::deploy_builder(provider)
}
/**A [`Ownable`](self) instance.
Contains type-safe methods for interacting with an on-chain instance of the
[`Ownable`](self) contract located at a given `address`, using a given
provider `P`.
If the contract bytecode is available (see the [`sol!`](alloy_sol_types::sol!)
documentation on how to provide it), the `deploy` and `deploy_builder` methods can
be used to deploy a new instance of the contract.
See the [module-level documentation](self) for all the available methods.*/
#[derive(Clone)]
pub struct OwnableInstance<T, P, N = alloy_contract::private::Ethereum> {
address: alloy_sol_types::private::Address,
provider: P,
_network_transport: ::core::marker::PhantomData<(N, T)>,
}
#[automatically_derived]
impl<T, P, N> ::core::fmt::Debug for OwnableInstance<T, P, N> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_tuple("OwnableInstance")
.field(&self.address)
.finish()
}
}
/// Instantiation and getters/setters.
#[automatically_derived]
impl<
T: alloy_contract::private::Transport + ::core::clone::Clone,
P: alloy_contract::private::Provider<T, N>,
N: alloy_contract::private::Network,
> OwnableInstance<T, P, N>
{
/**Creates a new wrapper around an on-chain [`Ownable`](self) contract instance.
See the [wrapper's documentation](`OwnableInstance`) for more details.*/
#[inline]
pub const fn new(address: alloy_sol_types::private::Address, provider: P) -> Self {
Self {
address,
provider,
_network_transport: ::core::marker::PhantomData,
}
}
/**Deploys this contract using the given `provider` and constructor arguments, if any.
Returns a new instance of the contract, if the deployment was successful.
For more fine-grained control over the deployment process, use [`deploy_builder`] instead.*/
#[inline]
pub async fn deploy(provider: P) -> alloy_contract::Result<OwnableInstance<T, P, N>> {
let call_builder = Self::deploy_builder(provider);
let contract_address = call_builder.deploy().await?;
Ok(Self::new(contract_address, call_builder.provider))
}
/**Creates a `RawCallBuilder` for deploying this contract using the given `provider`
and constructor arguments, if any.
This is a simple wrapper around creating a `RawCallBuilder` with the data set to
the bytecode concatenated with the constructor's ABI-encoded arguments.*/
#[inline]
pub fn deploy_builder(provider: P) -> alloy_contract::RawCallBuilder<T, P, N> {
alloy_contract::RawCallBuilder::new_raw_deploy(
provider,
::core::clone::Clone::clone(&BYTECODE),
)
}
/// Returns a reference to the address.
#[inline]
pub const fn address(&self) -> &alloy_sol_types::private::Address {
&self.address
}
/// Sets the address.
#[inline]
pub fn set_address(&mut self, address: alloy_sol_types::private::Address) {
self.address = address;
}
/// Sets the address and returns `self`.
pub fn at(mut self, address: alloy_sol_types::private::Address) -> Self {
self.set_address(address);
self
}
/// Returns a reference to the provider.
#[inline]
pub const fn provider(&self) -> &P {
&self.provider
}
}
impl<T, P: ::core::clone::Clone, N> OwnableInstance<T, &P, N> {
/// Clones the provider and returns a new instance with the cloned provider.
#[inline]
pub fn with_cloned_provider(self) -> OwnableInstance<T, P, N> {
OwnableInstance {
address: self.address,
provider: ::core::clone::Clone::clone(&self.provider),
_network_transport: ::core::marker::PhantomData,
}
}
}
/// Function calls.
#[automatically_derived]
impl<
T: alloy_contract::private::Transport + ::core::clone::Clone,
P: alloy_contract::private::Provider<T, N>,
N: alloy_contract::private::Network,
> OwnableInstance<T, P, N>
{
/// Creates a new call builder using this contract instance's provider and address.
///
/// Note that the call can be any function call, not just those defined in this
/// contract. Prefer using the other methods for building type-safe contract calls.
pub fn call_builder<C: alloy_sol_types::SolCall>(
&self,
call: &C,
) -> alloy_contract::SolCallBuilder<T, &P, C, N> {
alloy_contract::SolCallBuilder::new_sol(&self.provider, &self.address, call)
}
///Creates a new call builder for the [`owner`] function.
pub fn owner(&self) -> alloy_contract::SolCallBuilder<T, &P, ownerCall, N> {
self.call_builder(&ownerCall {})
}
///Creates a new call builder for the [`renounceOwnership`] function.
pub fn renounceOwnership(
&self,
) -> alloy_contract::SolCallBuilder<T, &P, renounceOwnershipCall, N> {
self.call_builder(&renounceOwnershipCall {})
}
///Creates a new call builder for the [`transferOwnership`] function.
pub fn transferOwnership(
&self,
newOwner: alloy::sol_types::private::Address,
) -> alloy_contract::SolCallBuilder<T, &P, transferOwnershipCall, N> {
self.call_builder(&transferOwnershipCall { newOwner })
}
}
/// Event filters.
#[automatically_derived]
impl<
T: alloy_contract::private::Transport + ::core::clone::Clone,
P: alloy_contract::private::Provider<T, N>,
N: alloy_contract::private::Network,
> OwnableInstance<T, P, N>
{
/// Creates a new event filter using this contract instance's provider and address.
///
/// Note that the type can be any event, not just those defined in this contract.
/// Prefer using the other methods for building type-safe event filters.
pub fn event_filter<E: alloy_sol_types::SolEvent>(
&self,
) -> alloy_contract::Event<T, &P, E, N> {
alloy_contract::Event::new_sol(&self.provider, &self.address)
}
///Creates a new event filter for the [`OwnershipTransferred`] event.
pub fn OwnershipTransferred_filter(
&self,
) -> alloy_contract::Event<T, &P, OwnershipTransferred, N> {
self.event_filter::<OwnershipTransferred>()
}
}
}