git.delta.rocks / unique-network / refs/commits / 5a98909596c7

difftreelog

CORE-386 Rename eth methods

Trubnikov Sergey2022-06-01parent: #9272309.patch.diff
in: master

8 files changed

modifiedpallets/common/src/erc.rsdiffbeforeafterboth
83 Ok(prop.to_vec())83 Ok(prop.to_vec())
84 }84 }
8585
86 fn eth_set_sponsor(&mut self, caller: caller, sponsor: address) -> Result<void> {86 fn set_collection_sponsor(&mut self, caller: caller, sponsor: address) -> Result<void> {
87 check_is_owner(caller, self)?;87 check_is_owner(caller, self)?;
8888
89 let sponsor = T::CrossAccountId::from_eth(sponsor);89 let sponsor = T::CrossAccountId::from_eth(sponsor);
92 Ok(())92 Ok(())
93 }93 }
9494
95 fn eth_confirm_sponsorship(&mut self, caller: caller) -> Result<void> {95 fn confirm_collection_sponsorship(&mut self, caller: caller) -> Result<void> {
96 let caller = T::CrossAccountId::from_eth(caller);96 let caller = T::CrossAccountId::from_eth(caller);
97 if !self.confirm_sponsorship(caller.as_sub()) {97 if !self.confirm_sponsorship(caller.as_sub()) {
98 return Err(Error::Revert("Caller is not set as sponsor".into()));98 return Err(Error::Revert("Caller is not set as sponsor".into()));
101 Ok(())101 Ok(())
102 }102 }
103103
104 #[solidity(rename_selector = "setLimit")]104 #[solidity(rename_selector = "setCollectionLimit")]
105 fn set_int_limit(&mut self, caller: caller, limit: string, value: uint32) -> Result<void> {105 fn set_int_limit(&mut self, caller: caller, limit: string, value: uint32) -> Result<void> {
106 check_is_owner(caller, self)?;106 check_is_owner(caller, self)?;
107 let mut limits = self.limits.clone();107 let mut limits = self.limits.clone();
138 Ok(())138 Ok(())
139 }139 }
140140
141 #[solidity(rename_selector = "setLimit")]141 #[solidity(rename_selector = "setCollectionLimit")]
142 fn set_bool_limit(&mut self, caller: caller, limit: string, value: bool) -> Result<void> {142 fn set_bool_limit(&mut self, caller: caller, limit: string, value: bool) -> Result<void> {
143 check_is_owner(caller, self)?;143 check_is_owner(caller, self)?;
144 let mut limits = self.limits.clone();144 let mut limits = self.limits.clone();
192 // Ok(())192 // Ok(())
193 // }193 // }
194194
195 fn add_admin(&self, caller: caller, new_admin: address) -> Result<void> {195 fn add_collection_admin(&self, caller: caller, new_admin: address) -> Result<void> {
196 let caller = T::CrossAccountId::from_eth(caller);196 let caller = T::CrossAccountId::from_eth(caller);
197 self.check_is_owner_or_admin(&caller)197 self.check_is_owner_or_admin(&caller)
198 .map_err(dispatch_to_evm::<T>)?;198 .map_err(dispatch_to_evm::<T>)?;
202 Ok(())202 Ok(())
203 }203 }
204204
205 fn remove_admin(&self, caller: caller, admin: address) -> Result<void> {205 fn remove_collection_admin(&self, caller: caller, admin: address) -> Result<void> {
206 let caller = T::CrossAccountId::from_eth(caller);206 let caller = T::CrossAccountId::from_eth(caller);
207 self.check_is_owner_or_admin(&caller)207 self.check_is_owner_or_admin(&caller)
208 .map_err(dispatch_to_evm::<T>)?;208 .map_err(dispatch_to_evm::<T>)?;
212 Ok(())212 Ok(())
213 }213 }
214214
215 #[solidity(rename_selector = "setNesting")]215 #[solidity(rename_selector = "setCollectionNesting")]
216 fn set_nesting_bool(&mut self, caller: caller, enable: bool) -> Result<void> {216 fn set_nesting_bool(&mut self, caller: caller, enable: bool) -> Result<void> {
217 let caller = T::CrossAccountId::from_eth(caller);217 let caller = T::CrossAccountId::from_eth(caller);
218 self.check_is_owner_or_admin(&caller)218 self.check_is_owner_or_admin(&caller)
225 Ok(())225 Ok(())
226 }226 }
227227
228 #[solidity(rename_selector = "setNesting")]228 #[solidity(rename_selector = "setCollectionNesting")]
229 fn set_nesting(&mut self, caller: caller, enable: bool, collections: Vec<address>) -> Result<void> {229 fn set_nesting(&mut self, caller: caller, enable: bool, collections: Vec<address>) -> Result<void> {
230 if collections.is_empty() {230 if collections.is_empty() {
231 return Err("No addresses provided".into());231 return Err("No addresses provided".into());
253 Ok(())253 Ok(())
254 }254 }
255255
256 fn set_access(&mut self, caller: caller, mode: string) -> Result<void> {256 fn set_collection_access(&mut self, caller: caller, mode: string) -> Result<void> {
257 let caller = T::CrossAccountId::from_eth(caller);257 let caller = T::CrossAccountId::from_eth(caller);
258 self.check_is_owner_or_admin(&caller)258 self.check_is_owner_or_admin(&caller)
259 .map_err(dispatch_to_evm::<T>)?;259 .map_err(dispatch_to_evm::<T>)?;
266 Ok(())266 Ok(())
267 }267 }
268268
269 fn add_to_allow_list(&self, caller: caller, user: address) -> Result<void> {269 fn add_to_collection_allow_list(&self, caller: caller, user: address) -> Result<void> {
270 let caller = check_is_owner_or_admin(caller, self)?;270 let caller = check_is_owner_or_admin(caller, self)?;
271 let user = T::CrossAccountId::from_eth(user);271 let user = T::CrossAccountId::from_eth(user);
272 <Pallet<T>>::toggle_allowlist(self, &caller, &user, true)272 <Pallet<T>>::toggle_allowlist(self, &caller, &user, true)
273 .map_err(dispatch_to_evm::<T>)?;273 .map_err(dispatch_to_evm::<T>)?;
274 Ok(())274 Ok(())
275 }275 }
276276
277 fn remove_from_allow_list(&self, caller: caller, user: address) -> Result<void> {277 fn remove_from_collection_allow_list(&self, caller: caller, user: address) -> Result<void> {
278 let caller = check_is_owner_or_admin(caller, self)?;278 let caller = check_is_owner_or_admin(caller, self)?;
279 let user = T::CrossAccountId::from_eth(user);279 let user = T::CrossAccountId::from_eth(user);
280 <Pallet<T>>::toggle_allowlist(self, &caller, &user, false)280 <Pallet<T>>::toggle_allowlist(self, &caller, &user, false)
281 .map_err(dispatch_to_evm::<T>)?;281 .map_err(dispatch_to_evm::<T>)?;
282 Ok(())282 Ok(())
283 }283 }
284284
285 fn set_mint_mode(&mut self, caller: caller, mode: bool) -> Result<void> {285 fn set_collection_mint_mode(&mut self, caller: caller, mode: bool) -> Result<void> {
286 check_is_owner_or_admin(caller, self)?;286 check_is_owner_or_admin(caller, self)?;
287 self.collection.permissions.mint_mode = Some(mode);287 self.collection.permissions.mint_mode = Some(mode);
288 save(self);288 save(self);
modifiedpallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth
51 event MintingFinished();51 event MintingFinished();
52}52}
53
54// Selector: 1248b7d1
55contract Collection is Dummy, ERC165 {
56 // Selector: setCollectionProperty(string,bytes) 2f073f66
57 function setCollectionProperty(string memory key, bytes memory value)
58 public
59 {
60 require(false, stub_error);
61 key;
62 value;
63 dummy = 0;
64 }
65
66 // Selector: deleteCollectionProperty(string) 7b7debce
67 function deleteCollectionProperty(string memory key) public {
68 require(false, stub_error);
69 key;
70 dummy = 0;
71 }
72
73 // Throws error if key not found
74 //
75 // Selector: collectionProperty(string) cf24fd6d
76 function collectionProperty(string memory key)
77 public
78 view
79 returns (bytes memory)
80 {
81 require(false, stub_error);
82 key;
83 dummy;
84 return hex"";
85 }
86
87 // Selector: setCollectionSponsor(address) 7623402e
88 function setCollectionSponsor(address sponsor) public {
89 require(false, stub_error);
90 sponsor;
91 dummy = 0;
92 }
93
94 // Selector: confirmCollectionSponsorship() 3c50e97a
95 function confirmCollectionSponsorship() public {
96 require(false, stub_error);
97 dummy = 0;
98 }
99
100 // Selector: setCollectionLimit(string,uint32) 6a3841db
101 function setCollectionLimit(string memory limit, uint32 value) public {
102 require(false, stub_error);
103 limit;
104 value;
105 dummy = 0;
106 }
107
108 // Selector: setCollectionLimit(string,bool) 993b7fba
109 function setCollectionLimit(string memory limit, bool value) public {
110 require(false, stub_error);
111 limit;
112 value;
113 dummy = 0;
114 }
115
116 // Selector: contractAddress() f6b4dfb4
117 function contractAddress() public view returns (address) {
118 require(false, stub_error);
119 dummy;
120 return 0x0000000000000000000000000000000000000000;
121 }
122
123 // Selector: addCollectionAdmin(address) 92e462c7
124 function addCollectionAdmin(address newAdmin) public view {
125 require(false, stub_error);
126 newAdmin;
127 dummy;
128 }
129
130 // Selector: removeCollectionAdmin(address) fafd7b42
131 function removeCollectionAdmin(address admin) public view {
132 require(false, stub_error);
133 admin;
134 dummy;
135 }
136
137 // Selector: setCollectionNesting(bool) 112d4586
138 function setCollectionNesting(bool enable) public {
139 require(false, stub_error);
140 enable;
141 dummy = 0;
142 }
143
144 // Selector: setCollectionNesting(bool,address[]) 64872396
145 function setCollectionNesting(bool enable, address[] memory collections)
146 public
147 {
148 require(false, stub_error);
149 enable;
150 collections;
151 dummy = 0;
152 }
153
154 // Selector: setCollectionAccess(string) 392172a9
155 function setCollectionAccess(string memory mode) public {
156 require(false, stub_error);
157 mode;
158 dummy = 0;
159 }
160
161 // Selector: addToCollectionAllowList(address) 67844fe6
162 function addToCollectionAllowList(address user) public view {
163 require(false, stub_error);
164 user;
165 dummy;
166 }
167
168 // Selector: removeFromCollectionAllowList(address) 85c51acb
169 function removeFromCollectionAllowList(address user) public view {
170 require(false, stub_error);
171 user;
172 dummy;
173 }
174
175 // Selector: setCollectionMintMode(bool) 00018e84
176 function setCollectionMintMode(bool mode) public {
177 require(false, stub_error);
178 mode;
179 dummy = 0;
180 }
181}
53182
54// Selector: 41369377183// Selector: 41369377
55contract TokenProperties is Dummy, ERC165 {184contract TokenProperties is Dummy, ERC165 {
380 }509 }
381}510}
382
383// Selector: f56cd7fa
384contract Collection is Dummy, ERC165 {
385 // Selector: setCollectionProperty(string,bytes) 2f073f66
386 function setCollectionProperty(string memory key, bytes memory value)
387 public
388 {
389 require(false, stub_error);
390 key;
391 value;
392 dummy = 0;
393 }
394
395 // Selector: deleteCollectionProperty(string) 7b7debce
396 function deleteCollectionProperty(string memory key) public {
397 require(false, stub_error);
398 key;
399 dummy = 0;
400 }
401
402 // Throws error if key not found
403 //
404 // Selector: collectionProperty(string) cf24fd6d
405 function collectionProperty(string memory key)
406 public
407 view
408 returns (bytes memory)
409 {
410 require(false, stub_error);
411 key;
412 dummy;
413 return hex"";
414 }
415
416 // Selector: ethSetSponsor(address) 8f9af356
417 function ethSetSponsor(address sponsor) public {
418 require(false, stub_error);
419 sponsor;
420 dummy = 0;
421 }
422
423 // Selector: ethConfirmSponsorship() a8580d1a
424 function ethConfirmSponsorship() public {
425 require(false, stub_error);
426 dummy = 0;
427 }
428
429 // Selector: setLimit(string,uint32) 68db30ca
430 function setLimit(string memory limit, uint32 value) public {
431 require(false, stub_error);
432 limit;
433 value;
434 dummy = 0;
435 }
436
437 // Selector: setLimit(string,bool) ea67e4c2
438 function setLimit(string memory limit, bool value) public {
439 require(false, stub_error);
440 limit;
441 value;
442 dummy = 0;
443 }
444
445 // Selector: contractAddress() f6b4dfb4
446 function contractAddress() public view returns (address) {
447 require(false, stub_error);
448 dummy;
449 return 0x0000000000000000000000000000000000000000;
450 }
451
452 // Selector: addAdmin(address) 70480275
453 function addAdmin(address newAdmin) public view {
454 require(false, stub_error);
455 newAdmin;
456 dummy;
457 }
458
459 // Selector: removeAdmin(address) 1785f53c
460 function removeAdmin(address admin) public view {
461 require(false, stub_error);
462 admin;
463 dummy;
464 }
465
466 // Selector: setNesting(bool) e8fc50dd
467 function setNesting(bool enable) public {
468 require(false, stub_error);
469 enable;
470 dummy = 0;
471 }
472
473 // Selector: setNesting(bool,address[]) 7df12a9a
474 function setNesting(bool enable, address[] memory collections) public {
475 require(false, stub_error);
476 enable;
477 collections;
478 dummy = 0;
479 }
480
481 // Selector: setAccess(string) 488f56aa
482 function setAccess(string memory mode) public {
483 require(false, stub_error);
484 mode;
485 dummy = 0;
486 }
487
488 // Selector: addToAllowList(address) 31f59102
489 function addToAllowList(address user) public view {
490 require(false, stub_error);
491 user;
492 dummy;
493 }
494
495 // Selector: removeFromAllowList(address) eba8dabc
496 function removeFromAllowList(address user) public view {
497 require(false, stub_error);
498 user;
499 dummy;
500 }
501
502 // Selector: setMintMode(bool) 5dea9bd5
503 function setMintMode(bool mode) public {
504 require(false, stub_error);
505 mode;
506 dummy = 0;
507 }
508}
509511
510contract UniqueNFT is512contract UniqueNFT is
511 Dummy,513 Dummy,
modifiedtests/src/eth/api/UniqueNFT.soldiffbeforeafterboth
42 event MintingFinished();42 event MintingFinished();
43}43}
44
45// Selector: 1248b7d1
46interface Collection is Dummy, ERC165 {
47 // Selector: setCollectionProperty(string,bytes) 2f073f66
48 function setCollectionProperty(string memory key, bytes memory value)
49 external;
50
51 // Selector: deleteCollectionProperty(string) 7b7debce
52 function deleteCollectionProperty(string memory key) external;
53
54 // Throws error if key not found
55 //
56 // Selector: collectionProperty(string) cf24fd6d
57 function collectionProperty(string memory key)
58 external
59 view
60 returns (bytes memory);
61
62 // Selector: setCollectionSponsor(address) 7623402e
63 function setCollectionSponsor(address sponsor) external;
64
65 // Selector: confirmCollectionSponsorship() 3c50e97a
66 function confirmCollectionSponsorship() external;
67
68 // Selector: setCollectionLimit(string,uint32) 6a3841db
69 function setCollectionLimit(string memory limit, uint32 value) external;
70
71 // Selector: setCollectionLimit(string,bool) 993b7fba
72 function setCollectionLimit(string memory limit, bool value) external;
73
74 // Selector: contractAddress() f6b4dfb4
75 function contractAddress() external view returns (address);
76
77 // Selector: addCollectionAdmin(address) 92e462c7
78 function addCollectionAdmin(address newAdmin) external view;
79
80 // Selector: removeCollectionAdmin(address) fafd7b42
81 function removeCollectionAdmin(address admin) external view;
82
83 // Selector: setCollectionNesting(bool) 112d4586
84 function setCollectionNesting(bool enable) external;
85
86 // Selector: setCollectionNesting(bool,address[]) 64872396
87 function setCollectionNesting(bool enable, address[] memory collections)
88 external;
89
90 // Selector: setCollectionAccess(string) 392172a9
91 function setCollectionAccess(string memory mode) external;
92
93 // Selector: addToCollectionAllowList(address) 67844fe6
94 function addToCollectionAllowList(address user) external view;
95
96 // Selector: removeFromCollectionAllowList(address) 85c51acb
97 function removeFromCollectionAllowList(address user) external view;
98
99 // Selector: setCollectionMintMode(bool) 00018e84
100 function setCollectionMintMode(bool mode) external;
101}
44102
45// Selector: 41369377103// Selector: 41369377
46interface TokenProperties is Dummy, ERC165 {104interface TokenProperties is Dummy, ERC165 {
213 returns (bool);271 returns (bool);
214}272}
215
216// Selector: f56cd7fa
217interface Collection is Dummy, ERC165 {
218 // Selector: setCollectionProperty(string,bytes) 2f073f66
219 function setCollectionProperty(string memory key, bytes memory value)
220 external;
221
222 // Selector: deleteCollectionProperty(string) 7b7debce
223 function deleteCollectionProperty(string memory key) external;
224
225 // Throws error if key not found
226 //
227 // Selector: collectionProperty(string) cf24fd6d
228 function collectionProperty(string memory key)
229 external
230 view
231 returns (bytes memory);
232
233 // Selector: ethSetSponsor(address) 8f9af356
234 function ethSetSponsor(address sponsor) external;
235
236 // Selector: ethConfirmSponsorship() a8580d1a
237 function ethConfirmSponsorship() external;
238
239 // Selector: setLimit(string,uint32) 68db30ca
240 function setLimit(string memory limit, uint32 value) external;
241
242 // Selector: setLimit(string,bool) ea67e4c2
243 function setLimit(string memory limit, bool value) external;
244
245 // Selector: contractAddress() f6b4dfb4
246 function contractAddress() external view returns (address);
247
248 // Selector: addAdmin(address) 70480275
249 function addAdmin(address newAdmin) external view;
250
251 // Selector: removeAdmin(address) 1785f53c
252 function removeAdmin(address admin) external view;
253
254 // Selector: setNesting(bool) e8fc50dd
255 function setNesting(bool enable) external;
256
257 // Selector: setNesting(bool,address[]) 7df12a9a
258 function setNesting(bool enable, address[] memory collections) external;
259
260 // Selector: setAccess(string) 488f56aa
261 function setAccess(string memory mode) external;
262
263 // Selector: addToAllowList(address) 31f59102
264 function addToAllowList(address user) external view;
265
266 // Selector: removeFromAllowList(address) eba8dabc
267 function removeFromAllowList(address user) external view;
268
269 // Selector: setMintMode(bool) 5dea9bd5
270 function setMintMode(bool mode) external;
271}
272273
273interface UniqueNFT is274interface UniqueNFT is
274 Dummy,275 Dummy,
modifiedtests/src/eth/contractSponsoring.test.tsdiffbeforeafterboth
222 });222 });
223223
224 //TODO: CORE-302 add eth methods224 //TODO: CORE-302 add eth methods
225 itWeb3('Sponsoring collection from evm address via access list', async ({api, web3}) => {225 itWeb3.skip('Sponsoring collection from evm address via access list', async ({api, web3}) => {
226 const owner = await createEthAccountWithBalance(api, web3);226 const owner = await createEthAccountWithBalance(api, web3);
227 const collectionHelpers = evmCollectionHelpers(web3, owner);227 const collectionHelpers = evmCollectionHelpers(web3, owner);
228 let result = await collectionHelpers.methods.createNonfungibleCollection('Sponsor collection', '1', '1').send();228 let result = await collectionHelpers.methods.createNonfungibleCollection('Sponsor collection', '1', '1').send();
292 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);292 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
293 const sponsor = await createEthAccountWithBalance(api, web3);293 const sponsor = await createEthAccountWithBalance(api, web3);
294 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);294 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
295 result = await collectionEvm.methods.ethSetSponsor(sponsor).send();295 result = await collectionEvm.methods.setCollectionSponsor(sponsor).send();
296 let collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;296 let collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;
297 expect(collectionSub.sponsorship.isUnconfirmed).to.be.true;297 expect(collectionSub.sponsorship.isUnconfirmed).to.be.true;
298 expect(collectionSub.sponsorship.asUnconfirmed.toHuman()).to.be.eq(evmToAddress(sponsor));298 expect(collectionSub.sponsorship.asUnconfirmed.toHuman()).to.be.eq(evmToAddress(sponsor));
299 await expect(collectionEvm.methods.ethConfirmSponsorship().call()).to.be.rejectedWith('Caller is not set as sponsor');299 await expect(collectionEvm.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('Caller is not set as sponsor');
300 const sponsorCollection = evmCollection(web3, sponsor, collectionIdAddress);300 const sponsorCollection = evmCollection(web3, sponsor, collectionIdAddress);
301 await sponsorCollection.methods.ethConfirmSponsorship().send();301 await sponsorCollection.methods.confirmCollectionSponsorship().send();
302 collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;302 collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;
303 expect(collectionSub.sponsorship.isConfirmed).to.be.true;303 expect(collectionSub.sponsorship.isConfirmed).to.be.true;
304 expect(collectionSub.sponsorship.asConfirmed.toHuman()).to.be.eq(evmToAddress(sponsor));304 expect(collectionSub.sponsorship.asConfirmed.toHuman()).to.be.eq(evmToAddress(sponsor));
305305
306 const user = createEthAccount(web3);306 const user = createEthAccount(web3);
307 await collectionEvm.methods.addAdmin(user).send();307 await collectionEvm.methods.addCollectionAdmin(user).send();
308 308
309 const ownerBalanceBefore = await ethBalanceViaSub(api, owner);309 const ownerBalanceBefore = await ethBalanceViaSub(api, owner);
310 const sponsorBalanceBefore = await ethBalanceViaSub(api, sponsor);310 const sponsorBalanceBefore = await ethBalanceViaSub(api, sponsor);
modifiedtests/src/eth/createCollection.test.tsdiffbeforeafterboth
75 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);75 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
76 const sponsor = await createEthAccountWithBalance(api, web3);76 const sponsor = await createEthAccountWithBalance(api, web3);
77 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);77 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
78 result = await collectionEvm.methods.ethSetSponsor(sponsor).send();78 result = await collectionEvm.methods.setCollectionSponsor(sponsor).send();
79 let collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;79 let collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;
80 expect(collectionSub.sponsorship.isUnconfirmed).to.be.true;80 expect(collectionSub.sponsorship.isUnconfirmed).to.be.true;
81 expect(collectionSub.sponsorship.asUnconfirmed.toHuman()).to.be.eq(evmToAddress(sponsor));81 expect(collectionSub.sponsorship.asUnconfirmed.toHuman()).to.be.eq(evmToAddress(sponsor));
82 await expect(collectionEvm.methods.ethConfirmSponsorship().call()).to.be.rejectedWith('Caller is not set as sponsor');82 await expect(collectionEvm.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('Caller is not set as sponsor');
83 const sponsorCollection = evmCollection(web3, sponsor, collectionIdAddress);83 const sponsorCollection = evmCollection(web3, sponsor, collectionIdAddress);
84 await sponsorCollection.methods.ethConfirmSponsorship().send();84 await sponsorCollection.methods.confirmCollectionSponsorship().send();
85 collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;85 collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;
86 expect(collectionSub.sponsorship.isConfirmed).to.be.true;86 expect(collectionSub.sponsorship.isConfirmed).to.be.true;
87 expect(collectionSub.sponsorship.asConfirmed.toHuman()).to.be.eq(evmToAddress(sponsor));87 expect(collectionSub.sponsorship.asConfirmed.toHuman()).to.be.eq(evmToAddress(sponsor));
105 };105 };
106106
107 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);107 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
108 await collectionEvm.methods['setLimit(string,uint32)']('accountTokenOwnershipLimit', limits.accountTokenOwnershipLimit).send();108 await collectionEvm.methods['setCollectionLimit(string,uint32)']('accountTokenOwnershipLimit', limits.accountTokenOwnershipLimit).send();
109 await collectionEvm.methods['setLimit(string,uint32)']('sponsoredDataSize', limits.sponsoredDataSize).send();109 await collectionEvm.methods['setCollectionLimit(string,uint32)']('sponsoredDataSize', limits.sponsoredDataSize).send();
110 await collectionEvm.methods['setLimit(string,uint32)']('sponsoredDataRateLimit', limits.sponsoredDataRateLimit).send();110 await collectionEvm.methods['setCollectionLimit(string,uint32)']('sponsoredDataRateLimit', limits.sponsoredDataRateLimit).send();
111 await collectionEvm.methods['setLimit(string,uint32)']('tokenLimit', limits.tokenLimit).send();111 await collectionEvm.methods['setCollectionLimit(string,uint32)']('tokenLimit', limits.tokenLimit).send();
112 await collectionEvm.methods['setLimit(string,uint32)']('sponsorTransferTimeout', limits.sponsorTransferTimeout).send();112 await collectionEvm.methods['setCollectionLimit(string,uint32)']('sponsorTransferTimeout', limits.sponsorTransferTimeout).send();
113 await collectionEvm.methods['setLimit(string,uint32)']('sponsorApproveTimeout', limits.sponsorApproveTimeout).send();113 await collectionEvm.methods['setCollectionLimit(string,uint32)']('sponsorApproveTimeout', limits.sponsorApproveTimeout).send();
114 await collectionEvm.methods['setLimit(string,bool)']('ownerCanTransfer', limits.ownerCanTransfer).send();114 await collectionEvm.methods['setCollectionLimit(string,bool)']('ownerCanTransfer', limits.ownerCanTransfer).send();
115 await collectionEvm.methods['setLimit(string,bool)']('ownerCanDestroy', limits.ownerCanDestroy).send();115 await collectionEvm.methods['setCollectionLimit(string,bool)']('ownerCanDestroy', limits.ownerCanDestroy).send();
116 await collectionEvm.methods['setLimit(string,bool)']('transfersEnabled', limits.transfersEnabled).send();116 await collectionEvm.methods['setCollectionLimit(string,bool)']('transfersEnabled', limits.transfersEnabled).send();
117 117
118 const collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;118 const collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;
119 expect(collectionSub.limits.accountTokenOwnershipLimit.unwrap().toNumber()).to.be.eq(limits.accountTokenOwnershipLimit);119 expect(collectionSub.limits.accountTokenOwnershipLimit.unwrap().toNumber()).to.be.eq(limits.accountTokenOwnershipLimit);
201 {201 {
202 const sponsor = await createEthAccountWithBalance(api, web3);202 const sponsor = await createEthAccountWithBalance(api, web3);
203 await expect(contractEvmFromNotOwner.methods203 await expect(contractEvmFromNotOwner.methods
204 .ethSetSponsor(sponsor)204 .setCollectionSponsor(sponsor)
205 .call()).to.be.rejectedWith(EXPECTED_ERROR);205 .call()).to.be.rejectedWith(EXPECTED_ERROR);
206 206
207 const sponsorCollection = evmCollection(web3, sponsor, collectionIdAddress);207 const sponsorCollection = evmCollection(web3, sponsor, collectionIdAddress);
208 await expect(sponsorCollection.methods208 await expect(sponsorCollection.methods
209 .ethConfirmSponsorship()209 .confirmCollectionSponsorship()
210 .call()).to.be.rejectedWith('Caller is not set as sponsor');210 .call()).to.be.rejectedWith('Caller is not set as sponsor');
211 }211 }
212 {212 {
213 await expect(contractEvmFromNotOwner.methods213 await expect(contractEvmFromNotOwner.methods
214 .setLimit('account_token_ownership_limit', '1000')214 .setCollectionLimit('account_token_ownership_limit', '1000')
215 .call()).to.be.rejectedWith(EXPECTED_ERROR);215 .call()).to.be.rejectedWith(EXPECTED_ERROR);
216 }216 }
217 });217 });
223 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);223 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
224 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);224 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
225 await expect(collectionEvm.methods225 await expect(collectionEvm.methods
226 .setLimit('badLimit', 'true')226 .setCollectionLimit('badLimit', 'true')
227 .call()).to.be.rejectedWith('Unknown boolean limit "badLimit"');227 .call()).to.be.rejectedWith('Unknown boolean limit "badLimit"');
228 });228 });
229});229});
modifiedtests/src/eth/nonFungibleAbi.jsondiffbeforeafterboth
84 "inputs": [84 "inputs": [
85 { "internalType": "address", "name": "newAdmin", "type": "address" }85 { "internalType": "address", "name": "newAdmin", "type": "address" }
86 ],86 ],
87 "name": "addAdmin",87 "name": "addCollectionAdmin",
88 "outputs": [],88 "outputs": [],
89 "stateMutability": "view",89 "stateMutability": "view",
90 "type": "function"90 "type": "function"
93 "inputs": [93 "inputs": [
94 { "internalType": "address", "name": "user", "type": "address" }94 { "internalType": "address", "name": "user", "type": "address" }
95 ],95 ],
96 "name": "addToAllowList",96 "name": "addToCollectionAllowList",
97 "outputs": [],97 "outputs": [],
98 "stateMutability": "view",98 "stateMutability": "view",
99 "type": "function"99 "type": "function"
143 "stateMutability": "view",143 "stateMutability": "view",
144 "type": "function"144 "type": "function"
145 },145 },
146 {
147 "inputs": [],
148 "name": "confirmCollectionSponsorship",
149 "outputs": [],
150 "stateMutability": "nonpayable",
151 "type": "function"
152 },
146 {153 {
147 "inputs": [],154 "inputs": [],
148 "name": "contractAddress",155 "name": "contractAddress",
167 "stateMutability": "nonpayable",174 "stateMutability": "nonpayable",
168 "type": "function"175 "type": "function"
169 },176 },
170 {
171 "inputs": [],
172 "name": "ethConfirmSponsorship",
173 "outputs": [],
174 "stateMutability": "nonpayable",
175 "type": "function"
176 },
177 {
178 "inputs": [
179 { "internalType": "address", "name": "sponsor", "type": "address" }
180 ],
181 "name": "ethSetSponsor",
182 "outputs": [],
183 "stateMutability": "nonpayable",
184 "type": "function"
185 },
186 {177 {
187 "inputs": [],178 "inputs": [],
188 "name": "finishMinting",179 "name": "finishMinting",
302 "inputs": [293 "inputs": [
303 { "internalType": "address", "name": "admin", "type": "address" }294 { "internalType": "address", "name": "admin", "type": "address" }
304 ],295 ],
305 "name": "removeAdmin",296 "name": "removeCollectionAdmin",
306 "outputs": [],297 "outputs": [],
307 "stateMutability": "view",298 "stateMutability": "view",
308 "type": "function"299 "type": "function"
311 "inputs": [302 "inputs": [
312 { "internalType": "address", "name": "user", "type": "address" }303 { "internalType": "address", "name": "user", "type": "address" }
313 ],304 ],
314 "name": "removeFromAllowList",305 "name": "removeFromCollectionAllowList",
315 "outputs": [],306 "outputs": [],
316 "stateMutability": "view",307 "stateMutability": "view",
317 "type": "function"308 "type": "function"
339 "stateMutability": "nonpayable",330 "stateMutability": "nonpayable",
340 "type": "function"331 "type": "function"
341 },332 },
342 {
343 "inputs": [{ "internalType": "string", "name": "mode", "type": "string" }],
344 "name": "setAccess",
345 "outputs": [],
346 "stateMutability": "nonpayable",
347 "type": "function"
348 },
349 {333 {
350 "inputs": [334 "inputs": [
351 { "internalType": "address", "name": "operator", "type": "address" },335 { "internalType": "address", "name": "operator", "type": "address" },
357 "type": "function"341 "type": "function"
358 },342 },
359 {343 {
360 "inputs": [344 "inputs": [{ "internalType": "string", "name": "mode", "type": "string" }],
361 { "internalType": "string", "name": "key", "type": "string" },
362 { "internalType": "bytes", "name": "value", "type": "bytes" }
363 ],
364 "name": "setCollectionProperty",345 "name": "setCollectionAccess",
365 "outputs": [],346 "outputs": [],
366 "stateMutability": "nonpayable",347 "stateMutability": "nonpayable",
367 "type": "function"348 "type": "function"
371 { "internalType": "string", "name": "limit", "type": "string" },352 { "internalType": "string", "name": "limit", "type": "string" },
372 { "internalType": "uint32", "name": "value", "type": "uint32" }353 { "internalType": "uint32", "name": "value", "type": "uint32" }
373 ],354 ],
374 "name": "setLimit",355 "name": "setCollectionLimit",
375 "outputs": [],356 "outputs": [],
376 "stateMutability": "nonpayable",357 "stateMutability": "nonpayable",
377 "type": "function"358 "type": "function"
381 { "internalType": "string", "name": "limit", "type": "string" },362 { "internalType": "string", "name": "limit", "type": "string" },
382 { "internalType": "bool", "name": "value", "type": "bool" }363 { "internalType": "bool", "name": "value", "type": "bool" }
383 ],364 ],
384 "name": "setLimit",365 "name": "setCollectionLimit",
385 "outputs": [],366 "outputs": [],
386 "stateMutability": "nonpayable",367 "stateMutability": "nonpayable",
387 "type": "function"368 "type": "function"
388 },369 },
389 {370 {
390 "inputs": [{ "internalType": "bool", "name": "mode", "type": "bool" }],371 "inputs": [{ "internalType": "bool", "name": "mode", "type": "bool" }],
391 "name": "setMintMode",372 "name": "setCollectionMintMode",
392 "outputs": [],373 "outputs": [],
393 "stateMutability": "nonpayable",374 "stateMutability": "nonpayable",
394 "type": "function"375 "type": "function"
395 },376 },
377 {
378 "inputs": [{ "internalType": "bool", "name": "enable", "type": "bool" }],
379 "name": "setCollectionNesting",
380 "outputs": [],
381 "stateMutability": "nonpayable",
382 "type": "function"
383 },
396 {384 {
397 "inputs": [385 "inputs": [
398 { "internalType": "bool", "name": "enable", "type": "bool" },386 { "internalType": "bool", "name": "enable", "type": "bool" },
402 "type": "address[]"390 "type": "address[]"
403 }391 }
404 ],392 ],
405 "name": "setNesting",393 "name": "setCollectionNesting",
406 "outputs": [],394 "outputs": [],
407 "stateMutability": "nonpayable",395 "stateMutability": "nonpayable",
408 "type": "function"396 "type": "function"
409 },397 },
410 {398 {
411 "inputs": [{ "internalType": "bool", "name": "enable", "type": "bool" }],399 "inputs": [
400 { "internalType": "string", "name": "key", "type": "string" },
401 { "internalType": "bytes", "name": "value", "type": "bytes" }
402 ],
412 "name": "setNesting",403 "name": "setCollectionProperty",
413 "outputs": [],404 "outputs": [],
414 "stateMutability": "nonpayable",405 "stateMutability": "nonpayable",
415 "type": "function"406 "type": "function"
416 },407 },
408 {
409 "inputs": [
410 { "internalType": "address", "name": "sponsor", "type": "address" }
411 ],
412 "name": "setCollectionSponsor",
413 "outputs": [],
414 "stateMutability": "nonpayable",
415 "type": "function"
416 },
417 {417 {
418 "inputs": [418 "inputs": [
419 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },419 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },
modifiedtests/src/eth/proxy/nonFungibleProxy.test.tsdiffbeforeafterboth
99 const collectionEvmOwned = evmCollection(web3, owner, collectionIdAddress);99 const collectionEvmOwned = evmCollection(web3, owner, collectionIdAddress);
100 const collectionEvm = evmCollection(web3, caller, collectionIdAddress);100 const collectionEvm = evmCollection(web3, caller, collectionIdAddress);
101 const contract = await proxyWrap(api, web3, collectionEvm);101 const contract = await proxyWrap(api, web3, collectionEvm);
102 await collectionEvmOwned.methods.addAdmin(contract.options.address).send();102 await collectionEvmOwned.methods.addCollectionAdmin(contract.options.address).send();
103103
104 {104 {
105 const nextTokenId = await contract.methods.nextTokenId().call();105 const nextTokenId = await contract.methods.nextTokenId().call();