This repository has been archived by the owner on Mar 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cids_owners.rs
164 lines (164 loc) · 6.63 KB
/
cids_owners.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
pub use ci_ds_owners::*;
#[allow(clippy::too_many_arguments, non_camel_case_types)]
pub mod ci_ds_owners {
#![allow(clippy::enum_variant_names)]
#![allow(dead_code)]
#![allow(clippy::type_complexity)]
#![allow(unused_imports)]
use ethers::contract::{
builders::{ContractCall, Event},
Contract, Lazy,
};
use ethers::core::{
abi::{Abi, Detokenize, InvalidOutputType, Token, Tokenizable},
types::*,
};
use ethers::providers::Middleware;
#[doc = "CIDsOwners was auto-generated with ethers-rs Abigen. More information at: https://github.com/gakonst/ethers-rs"]
use std::sync::Arc;
# [rustfmt :: skip] const __ABI : & str = "[{\"inputs\":[{\"internalType\":\"string\",\"name\":\"cid\",\"type\":\"string\",\"components\":[]}],\"stateMutability\":\"nonpayable\",\"type\":\"function\",\"name\":\"register\",\"outputs\":[]},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\",\"components\":[]}],\"stateMutability\":\"view\",\"type\":\"function\",\"name\":\"getOwnedCIDs\",\"outputs\":[{\"internalType\":\"string[]\",\"name\":\"cids\",\"type\":\"string[]\",\"components\":[]}]}]" ;
#[doc = r" The parsed JSON-ABI of the contract."]
pub static CIDSOWNERS_ABI: ethers::contract::Lazy<ethers::core::abi::Abi> =
ethers::contract::Lazy::new(|| {
ethers::core::utils::__serde_json::from_str(__ABI).expect("invalid abi")
});
pub struct CIDsOwners<M>(ethers::contract::Contract<M>);
impl<M> Clone for CIDsOwners<M> {
fn clone(&self) -> Self {
CIDsOwners(self.0.clone())
}
}
impl<M> std::ops::Deref for CIDsOwners<M> {
type Target = ethers::contract::Contract<M>;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl<M> std::fmt::Debug for CIDsOwners<M> {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_tuple(stringify!(CIDsOwners))
.field(&self.address())
.finish()
}
}
impl<M: ethers::providers::Middleware> CIDsOwners<M> {
#[doc = r" Creates a new contract instance with the specified `ethers`"]
#[doc = r" client at the given `Address`. The contract derefs to a `ethers::Contract`"]
#[doc = r" object"]
pub fn new<T: Into<ethers::core::types::Address>>(
address: T,
client: ::std::sync::Arc<M>,
) -> Self {
ethers::contract::Contract::new(address.into(), CIDSOWNERS_ABI.clone(), client).into()
}
#[doc = "Calls the contract's `getOwnedCIDs` (0x5ba52c96) function"]
pub fn get_owned_ci_ds(
&self,
owner: ethers::core::types::Address,
) -> ethers::contract::builders::ContractCall<M, ::std::vec::Vec<String>> {
self.0
.method_hash([91, 165, 44, 150], owner)
.expect("method not found (this should never happen)")
}
#[doc = "Calls the contract's `register` (0xf2c298be) function"]
pub fn register(&self, cid: String) -> ethers::contract::builders::ContractCall<M, ()> {
self.0
.method_hash([242, 194, 152, 190], cid)
.expect("method not found (this should never happen)")
}
}
impl<M: ethers::providers::Middleware> From<ethers::contract::Contract<M>> for CIDsOwners<M> {
fn from(contract: ethers::contract::Contract<M>) -> Self {
Self(contract)
}
}
#[doc = "Container type for all input parameters for the `getOwnedCIDs` function with signature `getOwnedCIDs(address)` and selector `[91, 165, 44, 150]`"]
#[derive(
Clone,
Debug,
Eq,
PartialEq,
ethers :: contract :: EthCall,
ethers :: contract :: EthDisplay,
Default,
)]
#[ethcall(name = "getOwnedCIDs", abi = "getOwnedCIDs(address)")]
pub struct GetOwnedCIDsCall {
pub owner: ethers::core::types::Address,
}
#[doc = "Container type for all input parameters for the `register` function with signature `register(string)` and selector `[242, 194, 152, 190]`"]
#[derive(
Clone,
Debug,
Eq,
PartialEq,
ethers :: contract :: EthCall,
ethers :: contract :: EthDisplay,
Default,
)]
#[ethcall(name = "register", abi = "register(string)")]
pub struct RegisterCall {
pub cid: String,
}
#[derive(Debug, Clone, PartialEq, Eq, ethers :: contract :: EthAbiType)]
pub enum CIDsOwnersCalls {
GetOwnedCIDs(GetOwnedCIDsCall),
Register(RegisterCall),
}
impl ethers::core::abi::AbiDecode for CIDsOwnersCalls {
fn decode(
data: impl AsRef<[u8]>,
) -> ::std::result::Result<Self, ethers::core::abi::AbiError> {
if let Ok(decoded) =
<GetOwnedCIDsCall as ethers::core::abi::AbiDecode>::decode(data.as_ref())
{
return Ok(CIDsOwnersCalls::GetOwnedCIDs(decoded));
}
if let Ok(decoded) =
<RegisterCall as ethers::core::abi::AbiDecode>::decode(data.as_ref())
{
return Ok(CIDsOwnersCalls::Register(decoded));
}
Err(ethers::core::abi::Error::InvalidData.into())
}
}
impl ethers::core::abi::AbiEncode for CIDsOwnersCalls {
fn encode(self) -> Vec<u8> {
match self {
CIDsOwnersCalls::GetOwnedCIDs(element) => element.encode(),
CIDsOwnersCalls::Register(element) => element.encode(),
}
}
}
impl ::std::fmt::Display for CIDsOwnersCalls {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
CIDsOwnersCalls::GetOwnedCIDs(element) => element.fmt(f),
CIDsOwnersCalls::Register(element) => element.fmt(f),
}
}
}
impl ::std::convert::From<GetOwnedCIDsCall> for CIDsOwnersCalls {
fn from(var: GetOwnedCIDsCall) -> Self {
CIDsOwnersCalls::GetOwnedCIDs(var)
}
}
impl ::std::convert::From<RegisterCall> for CIDsOwnersCalls {
fn from(var: RegisterCall) -> Self {
CIDsOwnersCalls::Register(var)
}
}
#[doc = "Container type for all return fields from the `getOwnedCIDs` function with signature `getOwnedCIDs(address)` and selector `[91, 165, 44, 150]`"]
#[derive(
Clone,
Debug,
Eq,
PartialEq,
ethers :: contract :: EthAbiType,
ethers :: contract :: EthAbiCodec,
Default,
)]
pub struct GetOwnedCIDsReturn {
pub cids: ::std::vec::Vec<String>,
}
}