git.delta.rocks / unique-network / refs/commits / 3d14ec560294

difftreelog

feat generate solidity documentation

Yaroslav Bolyukin2021-11-05parent: #a5e777f.patch.diff
in: master

9 files changed

modifiedcrates/evm-coder-macros/src/solidity_interface.rsdiffbeforeafterboth
6use std::fmt::Write;6use std::fmt::Write;
7use syn::{7use syn::{
8 Expr, FnArg, GenericArgument, Generics, Ident, ImplItem, ImplItemMethod, ItemImpl, Lit, Meta,8 Expr, FnArg, GenericArgument, Generics, Ident, ImplItem, ImplItemMethod, ItemImpl, Lit, Meta,
9 NestedMeta, PatType, Path, PathArguments, ReturnType, Type, spanned::Spanned,9 MetaNameValue, NestedMeta, PatType, Path, PathArguments, ReturnType, Type, spanned::Spanned,
10};10};
1111
12use crate::{12use crate::{
362 has_normal_args: bool,362 has_normal_args: bool,
363 mutability: Mutability,363 mutability: Mutability,
364 result: Type,364 result: Type,
365 docs: Vec<String>,
365}366}
366impl Method {367impl Method {
367 fn try_from(value: &ImplItemMethod) -> syn::Result<Self> {368 fn try_from(value: &ImplItemMethod) -> syn::Result<Self> {
368 let mut info = MethodInfo {369 let mut info = MethodInfo {
369 rename_selector: None,370 rename_selector: None,
370 };371 };
372 let mut docs = Vec::new();
371 for attr in &value.attrs {373 for attr in &value.attrs {
372 let ident = parse_ident_from_path(&attr.path, false)?;374 let ident = parse_ident_from_path(&attr.path, false)?;
373 if ident == "solidity" {375 if ident == "solidity" {
374 let args = attr.parse_meta().unwrap();376 let args = attr.parse_meta().unwrap();
375 info = MethodInfo::from_meta(&args).unwrap();377 info = MethodInfo::from_meta(&args).unwrap();
376 } else if ident == "doc" {378 } else if ident == "doc" {
377 // TODO: Add docs to evm interfaces379 let args = attr.parse_meta().unwrap();
380 let value = match args {
381 Meta::NameValue(MetaNameValue {
382 lit: Lit::Str(str), ..
383 }) => str.value(),
384 _ => unreachable!(),
385 };
386 docs.push(value);
378 }387 }
379 }388 }
380 let ident = &value.sig.ident;389 let ident = &value.sig.ident;
457 has_normal_args,466 has_normal_args,
458 mutability,467 mutability,
459 result: result.clone(),468 result: result.clone(),
469 docs,
460 })470 })
461 }471 }
462 fn expand_call_def(&self) -> proc_macro2::TokenStream {472 fn expand_call_def(&self) -> proc_macro2::TokenStream {
570 .iter()580 .iter()
571 .filter(|a| !a.is_special())581 .filter(|a| !a.is_special())
572 .map(MethodArg::expand_solidity_argument);582 .map(MethodArg::expand_solidity_argument);
583 let docs = self.docs.iter();
573 let selector = format!("{} {:0>8x}", self.selector_str, self.selector);584 let selector = format!("{} {:0>8x}", self.selector_str, self.selector);
574585
575 quote! {586 quote! {
576 SolidityFunction {587 SolidityFunction {
588 docs: &[#(#docs),*],
577 selector: #selector,589 selector: #selector,
578 name: #camel_name,590 name: #camel_name,
579 mutability: #mutability,591 mutability: #mutability,
704 use core::fmt::Write;716 use core::fmt::Write;
705 let interface = SolidityInterface {717 let interface = SolidityInterface {
706 name: #solidity_name,718 name: #solidity_name,
719 selector: Self::interface_id(),
707 is: &["Dummy", "ERC165", #(720 is: &["Dummy", "ERC165", #(
708 #solidity_is,721 #solidity_is,
709 )* #(722 )* #(
modifiedcrates/evm-coder-macros/src/to_log.rsdiffbeforeafterboth
183 use evm_coder::solidity::*;183 use evm_coder::solidity::*;
184 use core::fmt::Write;184 use core::fmt::Write;
185 let interface = SolidityInterface {185 let interface = SolidityInterface {
186 selector: 0,
186 name: #solidity_name,187 name: #solidity_name,
187 is: &[],188 is: &[],
188 functions: (#(189 functions: (#(
modifiedcrates/evm-coder/src/solidity.rsdiffbeforeafterboth
84solidity_type_name! {84solidity_type_name! {
85 uint8 => "uint8" true = "0",85 uint8 => "uint8" true = "0",
86 uint32 => "uint32" true = "0",86 uint32 => "uint32" true = "0",
87 uint64 => "uint64" true = "0",
87 uint128 => "uint128" true = "0",88 uint128 => "uint128" true = "0",
88 uint256 => "uint256" true = "0",89 uint256 => "uint256" true = "0",
89 address => "address" true = "0x0000000000000000000000000000000000000000",90 address => "address" true = "0x0000000000000000000000000000000000000000",
376 Mutable,377 Mutable,
377}378}
378pub struct SolidityFunction<A, R> {379pub struct SolidityFunction<A, R> {
380 pub docs: &'static [&'static str],
379 pub selector: &'static str,381 pub selector: &'static str,
380 pub name: &'static str,382 pub name: &'static str,
381 pub args: A,383 pub args: A,
389 writer: &mut impl fmt::Write,391 writer: &mut impl fmt::Write,
390 tc: &TypeCollector,392 tc: &TypeCollector,
391 ) -> fmt::Result {393 ) -> fmt::Result {
394 for doc in self.docs {
395 writeln!(writer, "\t//{}", doc)?;
396 }
397 if !self.docs.is_empty() {
398 writeln!(writer, "\t//")?;
399 }
392 writeln!(writer, "\t// Selector: {}", self.selector)?;400 writeln!(writer, "\t// Selector: {}", self.selector)?;
393 write!(writer, "\tfunction {}(", self.name)?;401 write!(writer, "\tfunction {}(", self.name)?;
394 self.args.solidity_name(writer, tc)?;402 self.args.solidity_name(writer, tc)?;
449}457}
450458
451pub struct SolidityInterface<F: SolidityFunctions> {459pub struct SolidityInterface<F: SolidityFunctions> {
460 pub selector: u32,
452 pub name: &'static str,461 pub name: &'static str,
453 pub is: &'static [&'static str],462 pub is: &'static [&'static str],
454 pub functions: F,463 pub functions: F,
461 out: &mut impl fmt::Write,470 out: &mut impl fmt::Write,
462 tc: &TypeCollector,471 tc: &TypeCollector,
463 ) -> fmt::Result {472 ) -> fmt::Result {
473 if self.selector != 0 {
474 writeln!(out, "// Selector: {:0>8x}", self.selector)?;
475 }
464 if is_impl {476 if is_impl {
465 write!(out, "contract ")?;477 write!(out, "contract ")?;
466 } else {478 } else {
modifiedpallets/fungible/src/stubs/UniqueFungible.soldiffbeforeafterboth
31 );31 );
32}32}
3333
34// Selector: 942e8b22
34contract ERC20 is Dummy, ERC165, ERC20Events {35contract ERC20 is Dummy, ERC165, ERC20Events {
35 // Selector: name() 06fdde0336 // Selector: name() 06fdde03
36 function name() public view returns (string memory) {37 function name() public view returns (string memory) {
modifiedpallets/nonfungible/src/erc.rsdiffbeforeafterboth
61 Ok(string::from_utf8_lossy(&self.token_prefix).into())61 Ok(string::from_utf8_lossy(&self.token_prefix).into())
62 }62 }
6363
64 /// Returns token's const_metadata
64 #[solidity(rename_selector = "tokenURI")]65 #[solidity(rename_selector = "tokenURI")]
65 fn token_uri(&self, token_id: uint256) -> Result<string> {66 fn token_uri(&self, token_id: uint256) -> Result<string> {
66 let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;67 let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
79 Ok(index)80 Ok(index)
80 }81 }
8182
83 /// Not implemented
82 fn token_of_owner_by_index(&self, _owner: address, _index: uint256) -> Result<uint256> {84 fn token_of_owner_by_index(&self, _owner: address, _index: uint256) -> Result<uint256> {
83 // TODO: Not implemetable85 // TODO: Not implemetable
84 Err("not implemented".into())86 Err("not implemented".into())
103 .owner105 .owner
104 .as_eth())106 .as_eth())
105 }107 }
108 /// Not implemented
106 fn safe_transfer_from_with_data(109 fn safe_transfer_from_with_data(
107 &mut self,110 &mut self,
108 _from: address,111 _from: address,
114 // TODO: Not implemetable117 // TODO: Not implemetable
115 Err("not implemented".into())118 Err("not implemented".into())
116 }119 }
120 /// Not implemented
117 fn safe_transfer_from(121 fn safe_transfer_from(
118 &mut self,122 &mut self,
119 _from: address,123 _from: address,
159 Ok(())163 Ok(())
160 }164 }
161165
166 /// Not implemented
162 fn set_approval_for_all(167 fn set_approval_for_all(
163 &mut self,168 &mut self,
164 _caller: caller,169 _caller: caller,
169 Err("not implemented".into())174 Err("not implemented".into())
170 }175 }
171176
177 /// Not implemented
172 fn get_approved(&self, _token_id: uint256) -> Result<address> {178 fn get_approved(&self, _token_id: uint256) -> Result<address> {
173 // TODO: Not implemetable179 // TODO: Not implemetable
174 Err("not implemented".into())180 Err("not implemented".into())
175 }181 }
176182
183 /// Not implemented
177 fn is_approved_for_all(&self, _owner: address, _operator: address) -> Result<address> {184 fn is_approved_for_all(&self, _owner: address, _operator: address) -> Result<address> {
178 // TODO: Not implemetable185 // TODO: Not implemetable
179 Err("not implemented".into())186 Err("not implemented".into())
197 Ok(false)204 Ok(false)
198 }205 }
199206
207 /// `token_id` should be obtained with `next_token_id` method,
208 /// unlike standard, you can't specify it manually
200 fn mint(&mut self, caller: caller, to: address, token_id: uint256) -> Result<bool> {209 fn mint(&mut self, caller: caller, to: address, token_id: uint256) -> Result<bool> {
201 let caller = T::CrossAccountId::from_eth(caller);210 let caller = T::CrossAccountId::from_eth(caller);
202 let to = T::CrossAccountId::from_eth(to);211 let to = T::CrossAccountId::from_eth(to);
223 Ok(true)232 Ok(true)
224 }233 }
225234
235 /// `token_id` should be obtained with `next_token_id` method,
236 /// unlike standard, you can't specify it manually
226 #[solidity(rename_selector = "mintWithTokenURI")]237 #[solidity(rename_selector = "mintWithTokenURI")]
227 fn mint_with_token_uri(238 fn mint_with_token_uri(
228 &mut self,239 &mut self,
257 Ok(true)268 Ok(true)
258 }269 }
259270
271 /// Not implemented
260 fn finish_minting(&mut self, _caller: caller) -> Result<bool> {272 fn finish_minting(&mut self, _caller: caller) -> Result<bool> {
261 Err("not implementable".into())273 Err("not implementable".into())
262 }274 }
modifiedpallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth
51 event MintingFinished();51 event MintingFinished();
52}52}
5353
54contract ERC721 is Dummy, ERC165, ERC721Events {54// Selector: 42966c68
55 // Selector: balanceOf(address) 70a08231
56 function balanceOf(address owner) public view returns (uint256) {
57 require(false, stub_error);
58 owner;
59 dummy;
60 return 0;
61 }
62
63 // Selector: ownerOf(uint256) 6352211e
64 function ownerOf(uint256 tokenId) public view returns (address) {
65 require(false, stub_error);
66 tokenId;
67 dummy;
68 return 0x0000000000000000000000000000000000000000;
69 }
70
71 // Selector: safeTransferFromWithData(address,address,uint256,bytes) 60a11672
72 function safeTransferFromWithData(
73 address from,
74 address to,
75 uint256 tokenId,
76 bytes memory data
77 ) public {
78 require(false, stub_error);
79 from;
80 to;
81 tokenId;
82 data;
83 dummy = 0;
84 }
85
86 // Selector: safeTransferFrom(address,address,uint256) 42842e0e
87 function safeTransferFrom(
88 address from,
89 address to,
90 uint256 tokenId
91 ) public {
92 require(false, stub_error);
93 from;
94 to;
95 tokenId;
96 dummy = 0;
97 }
98
99 // Selector: transferFrom(address,address,uint256) 23b872dd
100 function transferFrom(
101 address from,
102 address to,
103 uint256 tokenId
104 ) public {
105 require(false, stub_error);
106 from;
107 to;
108 tokenId;
109 dummy = 0;
110 }
111
112 // Selector: approve(address,uint256) 095ea7b3
113 function approve(address approved, uint256 tokenId) public {
114 require(false, stub_error);
115 approved;
116 tokenId;
117 dummy = 0;
118 }
119
120 // Selector: setApprovalForAll(address,bool) a22cb465
121 function setApprovalForAll(address operator, bool approved) public {
122 require(false, stub_error);
123 operator;
124 approved;
125 dummy = 0;
126 }
127
128 // Selector: getApproved(uint256) 081812fc
129 function getApproved(uint256 tokenId) public view returns (address) {
130 require(false, stub_error);
131 tokenId;
132 dummy;
133 return 0x0000000000000000000000000000000000000000;
134 }
135
136 // Selector: isApprovedForAll(address,address) e985e9c5
137 function isApprovedForAll(address owner, address operator)
138 public
139 view
140 returns (address)
141 {
142 require(false, stub_error);
143 owner;
144 operator;
145 dummy;
146 return 0x0000000000000000000000000000000000000000;
147 }
148}
149
150contract ERC721Burnable is Dummy, ERC165 {55contract ERC721Burnable is Dummy, ERC165 {
151 // Selector: burn(uint256) 42966c6856 // Selector: burn(uint256) 42966c68
156 }61 }
157}62}
15863
64// Selector: 58800161
159contract ERC721Enumerable is Dummy, ERC165 {65contract ERC721 is Dummy, ERC165, ERC721Events {
160 // Selector: tokenByIndex(uint256) 4f6ccce766 // Selector: balanceOf(address) 70a08231
161 function tokenByIndex(uint256 index) public view returns (uint256) {67 function balanceOf(address owner) public view returns (uint256) {
162 require(false, stub_error);68 require(false, stub_error);
163 index;69 owner;
164 dummy;70 dummy;
165 return 0;71 return 0;
166 }72 }
73
74 // Selector: ownerOf(uint256) 6352211e
75 function ownerOf(uint256 tokenId) public view returns (address) {
76 require(false, stub_error);
77 tokenId;
78 dummy;
79 return 0x0000000000000000000000000000000000000000;
80 }
81
82 // Not implemented
83 //
84 // Selector: safeTransferFromWithData(address,address,uint256,bytes) 60a11672
85 function safeTransferFromWithData(
86 address from,
87 address to,
88 uint256 tokenId,
89 bytes memory data
90 ) public {
91 require(false, stub_error);
92 from;
93 to;
94 tokenId;
95 data;
96 dummy = 0;
97 }
98
99 // Not implemented
100 //
101 // Selector: safeTransferFrom(address,address,uint256) 42842e0e
102 function safeTransferFrom(
103 address from,
104 address to,
105 uint256 tokenId
106 ) public {
107 require(false, stub_error);
108 from;
109 to;
110 tokenId;
111 dummy = 0;
112 }
167113
168 // Selector: tokenOfOwnerByIndex(address,uint256) 2f745c59114 // Selector: transferFrom(address,address,uint256) 23b872dd
169 function tokenOfOwnerByIndex(address owner, uint256 index)115 function transferFrom(
116 address from,
117 address to,
118 uint256 tokenId
119 ) public {
120 require(false, stub_error);
121 from;
122 to;
123 tokenId;
124 dummy = 0;
125 }
126
127 // Selector: approve(address,uint256) 095ea7b3
170 public128 function approve(address approved, uint256 tokenId) public {
129 require(false, stub_error);
130 approved;
131 tokenId;
132 dummy = 0;
133 }
134
135 // Not implemented
136 //
137 // Selector: setApprovalForAll(address,bool) a22cb465
138 function setApprovalForAll(address operator, bool approved) public {
139 require(false, stub_error);
140 operator;
141 approved;
142 dummy = 0;
143 }
144
145 // Not implemented
146 //
147 // Selector: getApproved(uint256) 081812fc
171 view148 function getApproved(uint256 tokenId) public view returns (address) {
172 returns (uint256)
173 {
174 require(false, stub_error);149 require(false, stub_error);
175 owner;150 tokenId;
176 index;
177 dummy;151 dummy;
178 return 0;152 return 0x0000000000000000000000000000000000000000;
179 }153 }
180154
181 // Selector: totalSupply() 18160ddd155 // Not implemented
156 //
157 // Selector: isApprovedForAll(address,address) e985e9c5
182 function totalSupply() public view returns (uint256) {158 function isApprovedForAll(address owner, address operator)
159 public
160 view
161 returns (address)
162 {
183 require(false, stub_error);163 require(false, stub_error);
164 owner;
165 operator;
184 dummy;166 dummy;
185 return 0;167 return 0x0000000000000000000000000000000000000000;
186 }168 }
187}169}
188170
171// Selector: 5b5e139f
189contract ERC721Metadata is Dummy, ERC165 {172contract ERC721Metadata is Dummy, ERC165 {
190 // Selector: name() 06fdde03173 // Selector: name() 06fdde03
191 function name() public view returns (string memory) {174 function name() public view returns (string memory) {
201 return "";184 return "";
202 }185 }
203186
187 // Returns token's const_metadata
188 //
204 // Selector: tokenURI(uint256) c87b56dd189 // Selector: tokenURI(uint256) c87b56dd
205 function tokenURI(uint256 tokenId) public view returns (string memory) {190 function tokenURI(uint256 tokenId) public view returns (string memory) {
206 require(false, stub_error);191 require(false, stub_error);
210 }195 }
211}196}
212197
198// Selector: 68ccfe89
213contract ERC721Mintable is Dummy, ERC165, ERC721MintableEvents {199contract ERC721Mintable is Dummy, ERC165, ERC721MintableEvents {
214 // Selector: mintingFinished() 05d2035b200 // Selector: mintingFinished() 05d2035b
215 function mintingFinished() public view returns (bool) {201 function mintingFinished() public view returns (bool) {
218 return false;204 return false;
219 }205 }
220206
207 // `token_id` should be obtained with `next_token_id` method,
208 // unlike standard, you can't specify it manually
209 //
221 // Selector: mint(address,uint256) 40c10f19210 // Selector: mint(address,uint256) 40c10f19
222 function mint(address to, uint256 tokenId) public returns (bool) {211 function mint(address to, uint256 tokenId) public returns (bool) {
223 require(false, stub_error);212 require(false, stub_error);
227 return false;216 return false;
228 }217 }
229218
219 // `token_id` should be obtained with `next_token_id` method,
220 // unlike standard, you can't specify it manually
221 //
230 // Selector: mintWithTokenURI(address,uint256,string) 50bb4e7f222 // Selector: mintWithTokenURI(address,uint256,string) 50bb4e7f
231 function mintWithTokenURI(223 function mintWithTokenURI(
232 address to,224 address to,
241 return false;233 return false;
242 }234 }
243235
236 // Not implemented
237 //
244 // Selector: finishMinting() 7d64bcb4238 // Selector: finishMinting() 7d64bcb4
245 function finishMinting() public returns (bool) {239 function finishMinting() public returns (bool) {
246 require(false, stub_error);240 require(false, stub_error);
249 }243 }
250}244}
251245
246// Selector: 780e9d63
247contract ERC721Enumerable is Dummy, ERC165 {
248 // Selector: tokenByIndex(uint256) 4f6ccce7
249 function tokenByIndex(uint256 index) public view returns (uint256) {
250 require(false, stub_error);
251 index;
252 dummy;
253 return 0;
254 }
255
256 // Not implemented
257 //
258 // Selector: tokenOfOwnerByIndex(address,uint256) 2f745c59
259 function tokenOfOwnerByIndex(address owner, uint256 index)
260 public
261 view
262 returns (uint256)
263 {
264 require(false, stub_error);
265 owner;
266 index;
267 dummy;
268 return 0;
269 }
270
271 // Selector: totalSupply() 18160ddd
272 function totalSupply() public view returns (uint256) {
273 require(false, stub_error);
274 dummy;
275 return 0;
276 }
277}
278
279// Selector: e562194d
252contract ERC721UniqueExtensions is Dummy, ERC165 {280contract ERC721UniqueExtensions is Dummy, ERC165 {
253 // Selector: transfer(address,uint256) a9059cbb281 // Selector: transfer(address,uint256) a9059cbb
254 function transfer(address to, uint256 tokenId) public {282 function transfer(address to, uint256 tokenId) public {
modifiedtests/src/eth/api/ContractHelpers.soldiffbeforeafterboth
12 function supportsInterface(bytes4 interfaceID) external view returns (bool);12 function supportsInterface(bytes4 interfaceID) external view returns (bool);
13}13}
1414
15// Selector: 31acb1fe
15interface ContractHelpers is Dummy, ERC165 {16interface ContractHelpers is Dummy, ERC165 {
16 // Selector: contractOwner(address) 5152b14c17 // Selector: contractOwner(address) 5152b14c
17 function contractOwner(address contractAddress)18 function contractOwner(address contractAddress)
modifiedtests/src/eth/api/UniqueFungible.soldiffbeforeafterboth
22 );22 );
23}23}
2424
25// Selector: 942e8b22
25interface ERC20 is Dummy, ERC165, ERC20Events {26interface ERC20 is Dummy, ERC165, ERC20Events {
26 // Selector: name() 06fdde0327 // Selector: name() 06fdde03
27 function name() external view returns (string memory);28 function name() external view returns (string memory);
modifiedtests/src/eth/api/UniqueNFT.soldiffbeforeafterboth
42 event MintingFinished();42 event MintingFinished();
43}43}
4444
45interface ERC721 is Dummy, ERC165, ERC721Events {45// Selector: 42966c68
46 // Selector: balanceOf(address) 70a08231
47 function balanceOf(address owner) external view returns (uint256);
48
49 // Selector: ownerOf(uint256) 6352211e
50 function ownerOf(uint256 tokenId) external view returns (address);
51
52 // Selector: safeTransferFromWithData(address,address,uint256,bytes) 60a11672
53 function safeTransferFromWithData(
54 address from,
55 address to,
56 uint256 tokenId,
57 bytes memory data
58 ) external;
59
60 // Selector: safeTransferFrom(address,address,uint256) 42842e0e
61 function safeTransferFrom(
62 address from,
63 address to,
64 uint256 tokenId
65 ) external;
66
67 // Selector: transferFrom(address,address,uint256) 23b872dd
68 function transferFrom(
69 address from,
70 address to,
71 uint256 tokenId
72 ) external;
73
74 // Selector: approve(address,uint256) 095ea7b3
75 function approve(address approved, uint256 tokenId) external;
76
77 // Selector: setApprovalForAll(address,bool) a22cb465
78 function setApprovalForAll(address operator, bool approved) external;
79
80 // Selector: getApproved(uint256) 081812fc
81 function getApproved(uint256 tokenId) external view returns (address);
82
83 // Selector: isApprovedForAll(address,address) e985e9c5
84 function isApprovedForAll(address owner, address operator)
85 external
86 view
87 returns (address);
88}
89
90interface ERC721Burnable is Dummy, ERC165 {46interface ERC721Burnable is Dummy, ERC165 {
91 // Selector: burn(uint256) 42966c6847 // Selector: burn(uint256) 42966c68
92 function burn(uint256 tokenId) external;48 function burn(uint256 tokenId) external;
93}49}
9450
51// Selector: 58800161
95interface ERC721Enumerable is Dummy, ERC165 {52interface ERC721 is Dummy, ERC165, ERC721Events {
96 // Selector: tokenByIndex(uint256) 4f6ccce753 // Selector: balanceOf(address) 70a08231
97 function tokenByIndex(uint256 index) external view returns (uint256);54 function balanceOf(address owner) external view returns (uint256);
55
56 // Selector: ownerOf(uint256) 6352211e
57 function ownerOf(uint256 tokenId) external view returns (address);
58
59 // Not implemented
60 //
61 // Selector: safeTransferFromWithData(address,address,uint256,bytes) 60a11672
62 function safeTransferFromWithData(
63 address from,
64 address to,
65 uint256 tokenId,
66 bytes memory data
67 ) external;
68
69 // Not implemented
70 //
71 // Selector: safeTransferFrom(address,address,uint256) 42842e0e
72 function safeTransferFrom(
73 address from,
74 address to,
75 uint256 tokenId
76 ) external;
9877
99 // Selector: tokenOfOwnerByIndex(address,uint256) 2f745c5978 // Selector: transferFrom(address,address,uint256) 23b872dd
100 function tokenOfOwnerByIndex(address owner, uint256 index)79 function transferFrom(
80 address from,
81 address to,
82 uint256 tokenId
83 ) external;
84
85 // Selector: approve(address,uint256) 095ea7b3
101 external86 function approve(address approved, uint256 tokenId) external;
87
88 // Not implemented
89 //
90 // Selector: setApprovalForAll(address,bool) a22cb465
91 function setApprovalForAll(address operator, bool approved) external;
92
93 // Not implemented
94 //
95 // Selector: getApproved(uint256) 081812fc
102 view96 function getApproved(uint256 tokenId) external view returns (address);
103 returns (uint256);97
10498 // Not implemented
105 // Selector: totalSupply() 18160ddd99 //
100 // Selector: isApprovedForAll(address,address) e985e9c5
106 function totalSupply() external view returns (uint256);101 function isApprovedForAll(address owner, address operator)
102 external
103 view
104 returns (address);
107}105}
108106
107// Selector: 5b5e139f
109interface ERC721Metadata is Dummy, ERC165 {108interface ERC721Metadata is Dummy, ERC165 {
110 // Selector: name() 06fdde03109 // Selector: name() 06fdde03
111 function name() external view returns (string memory);110 function name() external view returns (string memory);
112111
113 // Selector: symbol() 95d89b41112 // Selector: symbol() 95d89b41
114 function symbol() external view returns (string memory);113 function symbol() external view returns (string memory);
115114
115 // Returns token's const_metadata
116 //
116 // Selector: tokenURI(uint256) c87b56dd117 // Selector: tokenURI(uint256) c87b56dd
117 function tokenURI(uint256 tokenId) external view returns (string memory);118 function tokenURI(uint256 tokenId) external view returns (string memory);
118}119}
119120
121// Selector: 68ccfe89
120interface ERC721Mintable is Dummy, ERC165, ERC721MintableEvents {122interface ERC721Mintable is Dummy, ERC165, ERC721MintableEvents {
121 // Selector: mintingFinished() 05d2035b123 // Selector: mintingFinished() 05d2035b
122 function mintingFinished() external view returns (bool);124 function mintingFinished() external view returns (bool);
123125
126 // `token_id` should be obtained with `next_token_id` method,
127 // unlike standard, you can't specify it manually
128 //
124 // Selector: mint(address,uint256) 40c10f19129 // Selector: mint(address,uint256) 40c10f19
125 function mint(address to, uint256 tokenId) external returns (bool);130 function mint(address to, uint256 tokenId) external returns (bool);
126131
132 // `token_id` should be obtained with `next_token_id` method,
133 // unlike standard, you can't specify it manually
134 //
127 // Selector: mintWithTokenURI(address,uint256,string) 50bb4e7f135 // Selector: mintWithTokenURI(address,uint256,string) 50bb4e7f
128 function mintWithTokenURI(136 function mintWithTokenURI(
129 address to,137 address to,
130 uint256 tokenId,138 uint256 tokenId,
131 string memory tokenUri139 string memory tokenUri
132 ) external returns (bool);140 ) external returns (bool);
133141
142 // Not implemented
143 //
134 // Selector: finishMinting() 7d64bcb4144 // Selector: finishMinting() 7d64bcb4
135 function finishMinting() external returns (bool);145 function finishMinting() external returns (bool);
136}146}
137147
148// Selector: 780e9d63
149interface ERC721Enumerable is Dummy, ERC165 {
150 // Selector: tokenByIndex(uint256) 4f6ccce7
151 function tokenByIndex(uint256 index) external view returns (uint256);
152
153 // Not implemented
154 //
155 // Selector: tokenOfOwnerByIndex(address,uint256) 2f745c59
156 function tokenOfOwnerByIndex(address owner, uint256 index)
157 external
158 view
159 returns (uint256);
160
161 // Selector: totalSupply() 18160ddd
162 function totalSupply() external view returns (uint256);
163}
164
165// Selector: e562194d
138interface ERC721UniqueExtensions is Dummy, ERC165 {166interface ERC721UniqueExtensions is Dummy, ERC165 {
139 // Selector: transfer(address,uint256) a9059cbb167 // Selector: transfer(address,uint256) a9059cbb
140 function transfer(address to, uint256 tokenId) external;168 function transfer(address to, uint256 tokenId) external;