git.delta.rocks / unique-network / refs/commits / a9c26037395e

difftreelog

misk: Turn off eth metods for substrate addresses.

Trubnikov Sergey2022-09-26parent: #edc6ac8.patch.diff
in: master

16 files changed

modifiedpallets/common/src/erc.rsdiffbeforeafterboth
139 save(self)139 save(self)
140 }140 }
141141
142 // TODO: Temprorary off. Need refactor
142 /// Set the substrate sponsor of the collection.143 // /// Set the substrate sponsor of the collection.
143 ///144 // ///
144 /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.145 // /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
145 ///146 // ///
146 /// @param sponsor Substrate address of the sponsor from whose account funds will be debited for operations with the contract.147 // /// @param sponsor Substrate address of the sponsor from whose account funds will be debited for operations with the contract.
147 fn set_collection_sponsor_substrate(148 // fn set_collection_sponsor_substrate(
148 &mut self,149 // &mut self,
149 caller: caller,150 // caller: caller,
150 sponsor: uint256,151 // sponsor: uint256,
151 ) -> Result<void> {152 // ) -> Result<void> {
152 self.consume_store_reads_and_writes(1, 1)?;153 // self.consume_store_reads_and_writes(1, 1)?;
153154
154 check_is_owner_or_admin(caller, self)?;155 // check_is_owner_or_admin(caller, self)?;
155156
156 let sponsor = convert_uint256_to_cross_account::<T>(sponsor);157 // let sponsor = convert_uint256_to_cross_account::<T>(sponsor);
157 self.set_sponsor(sponsor.as_sub().clone())158 // self.set_sponsor(sponsor.as_sub().clone())
158 .map_err(dispatch_to_evm::<T>)?;159 // .map_err(dispatch_to_evm::<T>)?;
159 save(self)160 // save(self)
160 }161 // }
161162
162 /// Whether there is a pending sponsor.163 /// Whether there is a pending sponsor.
163 fn has_collection_pending_sponsor(&self) -> Result<bool> {164 fn has_collection_pending_sponsor(&self) -> Result<bool> {
299 Ok(crate::eth::collection_id_to_address(self.id))300 Ok(crate::eth::collection_id_to_address(self.id))
300 }301 }
301302
303 // TODO: Temprorary off. Need refactor
302 /// Add collection admin by substrate address.304 // /// Add collection admin by substrate address.
303 /// @param newAdmin Substrate administrator address.305 // /// @param newAdmin Substrate administrator address.
304 fn add_collection_admin_substrate(306 // fn add_collection_admin_substrate(
305 &mut self,307 // &mut self,
306 caller: caller,308 // caller: caller,
307 new_admin: uint256,309 // new_admin: uint256,
308 ) -> Result<void> {310 // ) -> Result<void> {
309 self.consume_store_writes(2)?;311 // self.consume_store_writes(2)?;
310312
311 let caller = T::CrossAccountId::from_eth(caller);313 // let caller = T::CrossAccountId::from_eth(caller);
312 let new_admin = convert_uint256_to_cross_account::<T>(new_admin);314 // let new_admin = convert_uint256_to_cross_account::<T>(new_admin);
313 <Pallet<T>>::toggle_admin(self, &caller, &new_admin, true).map_err(dispatch_to_evm::<T>)?;315 // <Pallet<T>>::toggle_admin(self, &caller, &new_admin, true).map_err(dispatch_to_evm::<T>)?;
314 Ok(())316 // Ok(())
315 }317 // }
316318
319 // TODO: Temprorary off. Need refactor
317 /// Remove collection admin by substrate address.320 // /// Remove collection admin by substrate address.
318 /// @param admin Substrate administrator address.321 // /// @param admin Substrate administrator address.
319 fn remove_collection_admin_substrate(322 // fn remove_collection_admin_substrate(
320 &mut self,323 // &mut self,
321 caller: caller,324 // caller: caller,
322 admin: uint256,325 // admin: uint256,
323 ) -> Result<void> {326 // ) -> Result<void> {
324 self.consume_store_writes(2)?;327 // self.consume_store_writes(2)?;
325328
326 let caller = T::CrossAccountId::from_eth(caller);329 // let caller = T::CrossAccountId::from_eth(caller);
327 let admin = convert_uint256_to_cross_account::<T>(admin);330 // let admin = convert_uint256_to_cross_account::<T>(admin);
328 <Pallet<T>>::toggle_admin(self, &caller, &admin, false).map_err(dispatch_to_evm::<T>)?;331 // <Pallet<T>>::toggle_admin(self, &caller, &admin, false).map_err(dispatch_to_evm::<T>)?;
329 Ok(())332 // Ok(())
330 }333 // }
331334
332 /// Add collection admin.335 /// Add collection admin.
333 /// @param newAdmin Address of the added administrator.336 /// @param newAdmin Address of the added administrator.
476 Ok(())479 Ok(())
477 }480 }
478481
482 // TODO: Temprorary off. Need refactor
479 /// Add substrate user to allowed list.483 // /// Add substrate user to allowed list.
480 ///484 // ///
481 /// @param user User substrate address.485 // /// @param user User substrate address.
482 fn add_to_collection_allow_list_substrate(486 // fn add_to_collection_allow_list_substrate(
483 &mut self,487 // &mut self,
484 caller: caller,488 // caller: caller,
485 user: uint256,489 // user: uint256,
486 ) -> Result<void> {490 // ) -> Result<void> {
487 self.consume_store_writes(1)?;491 // self.consume_store_writes(1)?;
488492
489 let caller = T::CrossAccountId::from_eth(caller);493 // let caller = T::CrossAccountId::from_eth(caller);
490 let user = convert_uint256_to_cross_account::<T>(user);494 // let user = convert_uint256_to_cross_account::<T>(user);
491 Pallet::<T>::toggle_allowlist(self, &caller, &user, true).map_err(dispatch_to_evm::<T>)?;495 // Pallet::<T>::toggle_allowlist(self, &caller, &user, true).map_err(dispatch_to_evm::<T>)?;
492 Ok(())496 // Ok(())
493 }497 // }
494498
495 /// Remove the user from the allowed list.499 /// Remove the user from the allowed list.
496 ///500 ///
504 Ok(())508 Ok(())
505 }509 }
506510
511 // TODO: Temprorary off. Need refactor
507 /// Remove substrate user from allowed list.512 // /// Remove substrate user from allowed list.
508 ///513 // ///
509 /// @param user User substrate address.514 // /// @param user User substrate address.
510 fn remove_from_collection_allow_list_substrate(515 // fn remove_from_collection_allow_list_substrate(
511 &mut self,516 // &mut self,
512 caller: caller,517 // caller: caller,
513 user: uint256,518 // user: uint256,
514 ) -> Result<void> {519 // ) -> Result<void> {
515 self.consume_store_writes(1)?;520 // self.consume_store_writes(1)?;
516521
517 let caller = T::CrossAccountId::from_eth(caller);522 // let caller = T::CrossAccountId::from_eth(caller);
518 let user = convert_uint256_to_cross_account::<T>(user);523 // let user = convert_uint256_to_cross_account::<T>(user);
519 Pallet::<T>::toggle_allowlist(self, &caller, &user, false).map_err(dispatch_to_evm::<T>)?;524 // Pallet::<T>::toggle_allowlist(self, &caller, &user, false).map_err(dispatch_to_evm::<T>)?;
520 Ok(())525 // Ok(())
521 }526 // }
522527
523 /// Switch permission for minting.528 /// Switch permission for minting.
524 ///529 ///
551 Ok(self.is_owner_or_admin(&user))556 Ok(self.is_owner_or_admin(&user))
552 }557 }
553558
559 // TODO: Temprorary off. Need refactor
554 /// Check that substrate account is the owner or admin of the collection560 // /// Check that substrate account is the owner or admin of the collection
555 ///561 // ///
556 /// @param user account to verify562 // /// @param user account to verify
557 /// @return "true" if account is the owner or admin563 // /// @return "true" if account is the owner or admin
558 fn is_owner_or_admin_substrate(&self, user: uint256) -> Result<bool> {564 // fn is_owner_or_admin_substrate(&self, user: uint256) -> Result<bool> {
559 let user = convert_uint256_to_cross_account::<T>(user);565 // let user = convert_uint256_to_cross_account::<T>(user);
560 Ok(self.is_owner_or_admin(&user))566 // Ok(self.is_owner_or_admin(&user))
561 }567 // }
562568
563 /// Returns collection type569 /// Returns collection type
564 ///570 ///
595 .map_err(dispatch_to_evm::<T>)601 .map_err(dispatch_to_evm::<T>)
596 }602 }
597603
604 // TODO: Temprorary off. Need refactor
598 /// Changes collection owner to another substrate account605 // /// Changes collection owner to another substrate account
599 ///606 // ///
600 /// @dev Owner can be changed only by current owner607 // /// @dev Owner can be changed only by current owner
601 /// @param newOwner new owner substrate account608 // /// @param newOwner new owner substrate account
602 fn set_owner_substrate(&mut self, caller: caller, new_owner: uint256) -> Result<void> {609 // fn set_owner_substrate(&mut self, caller: caller, new_owner: uint256) -> Result<void> {
603 self.consume_store_writes(1)?;610 // self.consume_store_writes(1)?;
604611
605 let caller = T::CrossAccountId::from_eth(caller);612 // let caller = T::CrossAccountId::from_eth(caller);
606 let new_owner = convert_uint256_to_cross_account::<T>(new_owner);613 // let new_owner = convert_uint256_to_cross_account::<T>(new_owner);
607 self.set_owner_internal(caller, new_owner)614 // self.set_owner_internal(caller, new_owner)
608 .map_err(dispatch_to_evm::<T>)615 // .map_err(dispatch_to_evm::<T>)
609 }616 // }
610617
611 // TODO: need implement AbiWriter for &Vec<T>618 // TODO: need implement AbiWriter for &Vec<T>
612 // fn collection_admins(&self) -> Result<Vec<(address, uint256)>> {619 // fn collection_admins(&self) -> Result<Vec<(address, uint256)>> {
modifiedpallets/fungible/src/stubs/UniqueFungible.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/fungible/src/stubs/UniqueFungible.soldiffbeforeafterboth
18}18}
1919
20/// @title A contract that allows you to work with collections.20/// @title A contract that allows you to work with collections.
21/// @dev the ERC-165 identifier for this interface is 0x47dbc10521/// @dev the ERC-165 identifier for this interface is 0x3e1e8083
22contract Collection is Dummy, ERC165 {22contract Collection is Dummy, ERC165 {
23 /// Set collection property.23 /// Set collection property.
24 ///24 ///
72 dummy = 0;72 dummy = 0;
73 }73 }
74
75 /// Set the substrate sponsor of the collection.
76 ///
77 /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
78 ///
79 /// @param sponsor Substrate address of the sponsor from whose account funds will be debited for operations with the contract.
80 /// @dev EVM selector for this function is: 0xc74d6751,
81 /// or in textual repr: setCollectionSponsorSubstrate(uint256)
82 function setCollectionSponsorSubstrate(uint256 sponsor) public {
83 require(false, stub_error);
84 sponsor;
85 dummy = 0;
86 }
8774
88 /// Whether there is a pending sponsor.75 /// Whether there is a pending sponsor.
89 /// @dev EVM selector for this function is: 0x058ac185,76 /// @dev EVM selector for this function is: 0x058ac185,
167 return 0x0000000000000000000000000000000000000000;154 return 0x0000000000000000000000000000000000000000;
168 }155 }
169
170 /// Add collection admin by substrate address.
171 /// @param newAdmin Substrate administrator address.
172 /// @dev EVM selector for this function is: 0x5730062b,
173 /// or in textual repr: addCollectionAdminSubstrate(uint256)
174 function addCollectionAdminSubstrate(uint256 newAdmin) public {
175 require(false, stub_error);
176 newAdmin;
177 dummy = 0;
178 }
179
180 /// Remove collection admin by substrate address.
181 /// @param admin Substrate administrator address.
182 /// @dev EVM selector for this function is: 0x4048fcf9,
183 /// or in textual repr: removeCollectionAdminSubstrate(uint256)
184 function removeCollectionAdminSubstrate(uint256 admin) public {
185 require(false, stub_error);
186 admin;
187 dummy = 0;
188 }
189156
190 /// Add collection admin.157 /// Add collection admin.
191 /// @param newAdmin Address of the added administrator.158 /// @param newAdmin Address of the added administrator.
267 dummy = 0;234 dummy = 0;
268 }235 }
269
270 /// Add substrate user to allowed list.
271 ///
272 /// @param user User substrate address.
273 /// @dev EVM selector for this function is: 0xd06ad267,
274 /// or in textual repr: addToCollectionAllowListSubstrate(uint256)
275 function addToCollectionAllowListSubstrate(uint256 user) public {
276 require(false, stub_error);
277 user;
278 dummy = 0;
279 }
280236
281 /// Remove the user from the allowed list.237 /// Remove the user from the allowed list.
282 ///238 ///
289 dummy = 0;245 dummy = 0;
290 }246 }
291
292 /// Remove substrate user from allowed list.
293 ///
294 /// @param user User substrate address.
295 /// @dev EVM selector for this function is: 0xa31913ed,
296 /// or in textual repr: removeFromCollectionAllowListSubstrate(uint256)
297 function removeFromCollectionAllowListSubstrate(uint256 user) public {
298 require(false, stub_error);
299 user;
300 dummy = 0;
301 }
302247
303 /// Switch permission for minting.248 /// Switch permission for minting.
304 ///249 ///
324 return false;269 return false;
325 }270 }
326
327 /// Check that substrate account is the owner or admin of the collection
328 ///
329 /// @param user account to verify
330 /// @return "true" if account is the owner or admin
331 /// @dev EVM selector for this function is: 0x68910e00,
332 /// or in textual repr: isOwnerOrAdminSubstrate(uint256)
333 function isOwnerOrAdminSubstrate(uint256 user) public view returns (bool) {
334 require(false, stub_error);
335 user;
336 dummy;
337 return false;
338 }
339271
340 /// Returns collection type272 /// Returns collection type
341 ///273 ///
372 dummy = 0;304 dummy = 0;
373 }305 }
374
375 /// Changes collection owner to another substrate account
376 ///
377 /// @dev Owner can be changed only by current owner
378 /// @param newOwner new owner substrate account
379 /// @dev EVM selector for this function is: 0xb212138f,
380 /// or in textual repr: setOwnerSubstrate(uint256)
381 function setOwnerSubstrate(uint256 newOwner) public {
382 require(false, stub_error);
383 newOwner;
384 dummy = 0;
385 }
386}306}
387307
388/// @dev the ERC-165 identifier for this interface is 0x63034ac5308/// @dev the ERC-165 identifier for this interface is 0x63034ac5
modifiedpallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth
91}91}
9292
93/// @title A contract that allows you to work with collections.93/// @title A contract that allows you to work with collections.
94/// @dev the ERC-165 identifier for this interface is 0x47dbc10594/// @dev the ERC-165 identifier for this interface is 0x3e1e8083
95contract Collection is Dummy, ERC165 {95contract Collection is Dummy, ERC165 {
96 /// Set collection property.96 /// Set collection property.
97 ///97 ///
145 dummy = 0;145 dummy = 0;
146 }146 }
147
148 /// Set the substrate sponsor of the collection.
149 ///
150 /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
151 ///
152 /// @param sponsor Substrate address of the sponsor from whose account funds will be debited for operations with the contract.
153 /// @dev EVM selector for this function is: 0xc74d6751,
154 /// or in textual repr: setCollectionSponsorSubstrate(uint256)
155 function setCollectionSponsorSubstrate(uint256 sponsor) public {
156 require(false, stub_error);
157 sponsor;
158 dummy = 0;
159 }
160147
161 /// Whether there is a pending sponsor.148 /// Whether there is a pending sponsor.
162 /// @dev EVM selector for this function is: 0x058ac185,149 /// @dev EVM selector for this function is: 0x058ac185,
240 return 0x0000000000000000000000000000000000000000;227 return 0x0000000000000000000000000000000000000000;
241 }228 }
242
243 /// Add collection admin by substrate address.
244 /// @param newAdmin Substrate administrator address.
245 /// @dev EVM selector for this function is: 0x5730062b,
246 /// or in textual repr: addCollectionAdminSubstrate(uint256)
247 function addCollectionAdminSubstrate(uint256 newAdmin) public {
248 require(false, stub_error);
249 newAdmin;
250 dummy = 0;
251 }
252
253 /// Remove collection admin by substrate address.
254 /// @param admin Substrate administrator address.
255 /// @dev EVM selector for this function is: 0x4048fcf9,
256 /// or in textual repr: removeCollectionAdminSubstrate(uint256)
257 function removeCollectionAdminSubstrate(uint256 admin) public {
258 require(false, stub_error);
259 admin;
260 dummy = 0;
261 }
262229
263 /// Add collection admin.230 /// Add collection admin.
264 /// @param newAdmin Address of the added administrator.231 /// @param newAdmin Address of the added administrator.
340 dummy = 0;307 dummy = 0;
341 }308 }
342
343 /// Add substrate user to allowed list.
344 ///
345 /// @param user User substrate address.
346 /// @dev EVM selector for this function is: 0xd06ad267,
347 /// or in textual repr: addToCollectionAllowListSubstrate(uint256)
348 function addToCollectionAllowListSubstrate(uint256 user) public {
349 require(false, stub_error);
350 user;
351 dummy = 0;
352 }
353309
354 /// Remove the user from the allowed list.310 /// Remove the user from the allowed list.
355 ///311 ///
362 dummy = 0;318 dummy = 0;
363 }319 }
364
365 /// Remove substrate user from allowed list.
366 ///
367 /// @param user User substrate address.
368 /// @dev EVM selector for this function is: 0xa31913ed,
369 /// or in textual repr: removeFromCollectionAllowListSubstrate(uint256)
370 function removeFromCollectionAllowListSubstrate(uint256 user) public {
371 require(false, stub_error);
372 user;
373 dummy = 0;
374 }
375320
376 /// Switch permission for minting.321 /// Switch permission for minting.
377 ///322 ///
397 return false;342 return false;
398 }343 }
399
400 /// Check that substrate account is the owner or admin of the collection
401 ///
402 /// @param user account to verify
403 /// @return "true" if account is the owner or admin
404 /// @dev EVM selector for this function is: 0x68910e00,
405 /// or in textual repr: isOwnerOrAdminSubstrate(uint256)
406 function isOwnerOrAdminSubstrate(uint256 user) public view returns (bool) {
407 require(false, stub_error);
408 user;
409 dummy;
410 return false;
411 }
412344
413 /// Returns collection type345 /// Returns collection type
414 ///346 ///
445 dummy = 0;377 dummy = 0;
446 }378 }
447
448 /// Changes collection owner to another substrate account
449 ///
450 /// @dev Owner can be changed only by current owner
451 /// @param newOwner new owner substrate account
452 /// @dev EVM selector for this function is: 0xb212138f,
453 /// or in textual repr: setOwnerSubstrate(uint256)
454 function setOwnerSubstrate(uint256 newOwner) public {
455 require(false, stub_error);
456 newOwner;
457 dummy = 0;
458 }
459}379}
460380
461/// @dev anonymous struct381/// @dev anonymous struct
modifiedpallets/refungible/src/stubs/UniqueRefungible.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/refungible/src/stubs/UniqueRefungible.soldiffbeforeafterboth
91}91}
9292
93/// @title A contract that allows you to work with collections.93/// @title A contract that allows you to work with collections.
94/// @dev the ERC-165 identifier for this interface is 0x47dbc10594/// @dev the ERC-165 identifier for this interface is 0x3e1e8083
95contract Collection is Dummy, ERC165 {95contract Collection is Dummy, ERC165 {
96 /// Set collection property.96 /// Set collection property.
97 ///97 ///
145 dummy = 0;145 dummy = 0;
146 }146 }
147
148 /// Set the substrate sponsor of the collection.
149 ///
150 /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
151 ///
152 /// @param sponsor Substrate address of the sponsor from whose account funds will be debited for operations with the contract.
153 /// @dev EVM selector for this function is: 0xc74d6751,
154 /// or in textual repr: setCollectionSponsorSubstrate(uint256)
155 function setCollectionSponsorSubstrate(uint256 sponsor) public {
156 require(false, stub_error);
157 sponsor;
158 dummy = 0;
159 }
160147
161 /// Whether there is a pending sponsor.148 /// Whether there is a pending sponsor.
162 /// @dev EVM selector for this function is: 0x058ac185,149 /// @dev EVM selector for this function is: 0x058ac185,
240 return 0x0000000000000000000000000000000000000000;227 return 0x0000000000000000000000000000000000000000;
241 }228 }
242
243 /// Add collection admin by substrate address.
244 /// @param newAdmin Substrate administrator address.
245 /// @dev EVM selector for this function is: 0x5730062b,
246 /// or in textual repr: addCollectionAdminSubstrate(uint256)
247 function addCollectionAdminSubstrate(uint256 newAdmin) public {
248 require(false, stub_error);
249 newAdmin;
250 dummy = 0;
251 }
252
253 /// Remove collection admin by substrate address.
254 /// @param admin Substrate administrator address.
255 /// @dev EVM selector for this function is: 0x4048fcf9,
256 /// or in textual repr: removeCollectionAdminSubstrate(uint256)
257 function removeCollectionAdminSubstrate(uint256 admin) public {
258 require(false, stub_error);
259 admin;
260 dummy = 0;
261 }
262229
263 /// Add collection admin.230 /// Add collection admin.
264 /// @param newAdmin Address of the added administrator.231 /// @param newAdmin Address of the added administrator.
340 dummy = 0;307 dummy = 0;
341 }308 }
342
343 /// Add substrate user to allowed list.
344 ///
345 /// @param user User substrate address.
346 /// @dev EVM selector for this function is: 0xd06ad267,
347 /// or in textual repr: addToCollectionAllowListSubstrate(uint256)
348 function addToCollectionAllowListSubstrate(uint256 user) public {
349 require(false, stub_error);
350 user;
351 dummy = 0;
352 }
353309
354 /// Remove the user from the allowed list.310 /// Remove the user from the allowed list.
355 ///311 ///
362 dummy = 0;318 dummy = 0;
363 }319 }
364
365 /// Remove substrate user from allowed list.
366 ///
367 /// @param user User substrate address.
368 /// @dev EVM selector for this function is: 0xa31913ed,
369 /// or in textual repr: removeFromCollectionAllowListSubstrate(uint256)
370 function removeFromCollectionAllowListSubstrate(uint256 user) public {
371 require(false, stub_error);
372 user;
373 dummy = 0;
374 }
375320
376 /// Switch permission for minting.321 /// Switch permission for minting.
377 ///322 ///
397 return false;342 return false;
398 }343 }
399
400 /// Check that substrate account is the owner or admin of the collection
401 ///
402 /// @param user account to verify
403 /// @return "true" if account is the owner or admin
404 /// @dev EVM selector for this function is: 0x68910e00,
405 /// or in textual repr: isOwnerOrAdminSubstrate(uint256)
406 function isOwnerOrAdminSubstrate(uint256 user) public view returns (bool) {
407 require(false, stub_error);
408 user;
409 dummy;
410 return false;
411 }
412344
413 /// Returns collection type345 /// Returns collection type
414 ///346 ///
445 dummy = 0;377 dummy = 0;
446 }378 }
447
448 /// Changes collection owner to another substrate account
449 ///
450 /// @dev Owner can be changed only by current owner
451 /// @param newOwner new owner substrate account
452 /// @dev EVM selector for this function is: 0xb212138f,
453 /// or in textual repr: setOwnerSubstrate(uint256)
454 function setOwnerSubstrate(uint256 newOwner) public {
455 require(false, stub_error);
456 newOwner;
457 dummy = 0;
458 }
459}379}
460380
461/// @dev anonymous struct381/// @dev anonymous struct
modifiedtests/src/eth/allowlist.test.tsdiffbeforeafterboth
95 expect(await collectionEvm.methods.allowed(user).call({from: owner})).to.be.false;95 expect(await collectionEvm.methods.allowed(user).call({from: owner})).to.be.false;
96 });96 });
9797
98 itEth('Collection allowlist can be added and removed by [sub] address', async ({helper}) => {98 // TODO: Temprorary off. Need refactor
99 const owner = await helper.eth.createAccountWithBalance(donor);99 // itEth('Collection allowlist can be added and removed by [sub] address', async ({helper}) => {
100 const user = donor;100 // const owner = await helper.eth.createAccountWithBalance(donor);
101 101 // const user = donor;
102 const {collectionAddress, collectionId} = await helper.eth.createNonfungibleCollection(owner, 'A', 'B', 'C');102
103 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);103 // const {collectionAddress, collectionId} = await helper.eth.createNonfungibleCollection(owner, 'A', 'B', 'C');
104 104 // const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
105 expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;105
106 await collectionEvm.methods.addToCollectionAllowListSubstrate(user.addressRaw).send({from: owner});106 // expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;
107 expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.true;107 // await collectionEvm.methods.addToCollectionAllowListSubstrate(user.addressRaw).send({from: owner});
108 108 // expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.true;
109 await collectionEvm.methods.removeFromCollectionAllowListSubstrate(user.addressRaw).send({from: owner});109
110 expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;110 // await collectionEvm.methods.removeFromCollectionAllowListSubstrate(user.addressRaw).send({from: owner});
111 });111 // expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;
112 // });
112113
113 itEth('Collection allowlist can not be add and remove [eth] address by not owner', async ({helper}) => {114 itEth('Collection allowlist can not be add and remove [eth] address by not owner', async ({helper}) => {
114 const owner = await helper.eth.createAccountWithBalance(donor);115 const owner = await helper.eth.createAccountWithBalance(donor);
128 expect(await collectionEvm.methods.allowed(user).call({from: owner})).to.be.true;129 expect(await collectionEvm.methods.allowed(user).call({from: owner})).to.be.true;
129 });130 });
130131
131 itEth('Collection allowlist can not be add and remove [sub] address by not owner', async ({helper}) => {132 // TODO: Temprorary off. Need refactor
132 const owner = await helper.eth.createAccountWithBalance(donor);133 // itEth('Collection allowlist can not be add and remove [sub] address by not owner', async ({helper}) => {
133 const notOwner = await helper.eth.createAccountWithBalance(donor);134 // const owner = await helper.eth.createAccountWithBalance(donor);
134 const user = donor;135 // const notOwner = await helper.eth.createAccountWithBalance(donor);
135 136 // const user = donor;
136 const {collectionAddress, collectionId} = await helper.eth.createNonfungibleCollection(owner, 'A', 'B', 'C');137
137 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);138 // const {collectionAddress, collectionId} = await helper.eth.createNonfungibleCollection(owner, 'A', 'B', 'C');
138 139 // const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
139 expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;140
140 await expect(collectionEvm.methods.addToCollectionAllowListSubstrate(user.addressRaw).call({from: notOwner})).to.be.rejectedWith('NoPermission');141 // expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;
141 expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;142 // await expect(collectionEvm.methods.addToCollectionAllowListSubstrate(user.addressRaw).call({from: notOwner})).to.be.rejectedWith('NoPermission');
142 await collectionEvm.methods.addToCollectionAllowListSubstrate(user.addressRaw).send({from: owner});143 // expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;
143 144 // await collectionEvm.methods.addToCollectionAllowListSubstrate(user.addressRaw).send({from: owner});
144 expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.true;145
145 await expect(collectionEvm.methods.removeFromCollectionAllowListSubstrate(user.addressRaw).call({from: notOwner})).to.be.rejectedWith('NoPermission');146 // expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.true;
146 expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.true;147 // await expect(collectionEvm.methods.removeFromCollectionAllowListSubstrate(user.addressRaw).call({from: notOwner})).to.be.rejectedWith('NoPermission');
147 });148 // expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.true;
149 // });
148});150});
149151
modifiedtests/src/eth/api/UniqueFungible.soldiffbeforeafterboth
13}13}
1414
15/// @title A contract that allows you to work with collections.15/// @title A contract that allows you to work with collections.
16/// @dev the ERC-165 identifier for this interface is 0x47dbc10516/// @dev the ERC-165 identifier for this interface is 0x3e1e8083
17interface Collection is Dummy, ERC165 {17interface Collection is Dummy, ERC165 {
18 /// Set collection property.18 /// Set collection property.
19 ///19 ///
49 /// or in textual repr: setCollectionSponsor(address)49 /// or in textual repr: setCollectionSponsor(address)
50 function setCollectionSponsor(address sponsor) external;50 function setCollectionSponsor(address sponsor) external;
51
52 /// Set the substrate sponsor of the collection.
53 ///
54 /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
55 ///
56 /// @param sponsor Substrate address of the sponsor from whose account funds will be debited for operations with the contract.
57 /// @dev EVM selector for this function is: 0xc74d6751,
58 /// or in textual repr: setCollectionSponsorSubstrate(uint256)
59 function setCollectionSponsorSubstrate(uint256 sponsor) external;
6051
61 /// Whether there is a pending sponsor.52 /// Whether there is a pending sponsor.
62 /// @dev EVM selector for this function is: 0x058ac185,53 /// @dev EVM selector for this function is: 0x058ac185,
112 /// or in textual repr: contractAddress()103 /// or in textual repr: contractAddress()
113 function contractAddress() external view returns (address);104 function contractAddress() external view returns (address);
114
115 /// Add collection admin by substrate address.
116 /// @param newAdmin Substrate administrator address.
117 /// @dev EVM selector for this function is: 0x5730062b,
118 /// or in textual repr: addCollectionAdminSubstrate(uint256)
119 function addCollectionAdminSubstrate(uint256 newAdmin) external;
120
121 /// Remove collection admin by substrate address.
122 /// @param admin Substrate administrator address.
123 /// @dev EVM selector for this function is: 0x4048fcf9,
124 /// or in textual repr: removeCollectionAdminSubstrate(uint256)
125 function removeCollectionAdminSubstrate(uint256 admin) external;
126105
127 /// Add collection admin.106 /// Add collection admin.
128 /// @param newAdmin Address of the added administrator.107 /// @param newAdmin Address of the added administrator.
174 /// or in textual repr: addToCollectionAllowList(address)153 /// or in textual repr: addToCollectionAllowList(address)
175 function addToCollectionAllowList(address user) external;154 function addToCollectionAllowList(address user) external;
176
177 /// Add substrate user to allowed list.
178 ///
179 /// @param user User substrate address.
180 /// @dev EVM selector for this function is: 0xd06ad267,
181 /// or in textual repr: addToCollectionAllowListSubstrate(uint256)
182 function addToCollectionAllowListSubstrate(uint256 user) external;
183155
184 /// Remove the user from the allowed list.156 /// Remove the user from the allowed list.
185 ///157 ///
188 /// or in textual repr: removeFromCollectionAllowList(address)160 /// or in textual repr: removeFromCollectionAllowList(address)
189 function removeFromCollectionAllowList(address user) external;161 function removeFromCollectionAllowList(address user) external;
190
191 /// Remove substrate user from allowed list.
192 ///
193 /// @param user User substrate address.
194 /// @dev EVM selector for this function is: 0xa31913ed,
195 /// or in textual repr: removeFromCollectionAllowListSubstrate(uint256)
196 function removeFromCollectionAllowListSubstrate(uint256 user) external;
197162
198 /// Switch permission for minting.163 /// Switch permission for minting.
199 ///164 ///
210 /// or in textual repr: isOwnerOrAdmin(address)175 /// or in textual repr: isOwnerOrAdmin(address)
211 function isOwnerOrAdmin(address user) external view returns (bool);176 function isOwnerOrAdmin(address user) external view returns (bool);
212
213 /// Check that substrate account is the owner or admin of the collection
214 ///
215 /// @param user account to verify
216 /// @return "true" if account is the owner or admin
217 /// @dev EVM selector for this function is: 0x68910e00,
218 /// or in textual repr: isOwnerOrAdminSubstrate(uint256)
219 function isOwnerOrAdminSubstrate(uint256 user) external view returns (bool);
220177
221 /// Returns collection type178 /// Returns collection type
222 ///179 ///
241 /// or in textual repr: setOwner(address)198 /// or in textual repr: setOwner(address)
242 function setOwner(address newOwner) external;199 function setOwner(address newOwner) external;
243
244 /// Changes collection owner to another substrate account
245 ///
246 /// @dev Owner can be changed only by current owner
247 /// @param newOwner new owner substrate account
248 /// @dev EVM selector for this function is: 0xb212138f,
249 /// or in textual repr: setOwnerSubstrate(uint256)
250 function setOwnerSubstrate(uint256 newOwner) external;
251}200}
252201
253/// @dev the ERC-165 identifier for this interface is 0x63034ac5202/// @dev the ERC-165 identifier for this interface is 0x63034ac5
modifiedtests/src/eth/api/UniqueNFT.soldiffbeforeafterboth
62}62}
6363
64/// @title A contract that allows you to work with collections.64/// @title A contract that allows you to work with collections.
65/// @dev the ERC-165 identifier for this interface is 0x47dbc10565/// @dev the ERC-165 identifier for this interface is 0x3e1e8083
66interface Collection is Dummy, ERC165 {66interface Collection is Dummy, ERC165 {
67 /// Set collection property.67 /// Set collection property.
68 ///68 ///
98 /// or in textual repr: setCollectionSponsor(address)98 /// or in textual repr: setCollectionSponsor(address)
99 function setCollectionSponsor(address sponsor) external;99 function setCollectionSponsor(address sponsor) external;
100
101 /// Set the substrate sponsor of the collection.
102 ///
103 /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
104 ///
105 /// @param sponsor Substrate address of the sponsor from whose account funds will be debited for operations with the contract.
106 /// @dev EVM selector for this function is: 0xc74d6751,
107 /// or in textual repr: setCollectionSponsorSubstrate(uint256)
108 function setCollectionSponsorSubstrate(uint256 sponsor) external;
109100
110 /// Whether there is a pending sponsor.101 /// Whether there is a pending sponsor.
111 /// @dev EVM selector for this function is: 0x058ac185,102 /// @dev EVM selector for this function is: 0x058ac185,
161 /// or in textual repr: contractAddress()152 /// or in textual repr: contractAddress()
162 function contractAddress() external view returns (address);153 function contractAddress() external view returns (address);
163
164 /// Add collection admin by substrate address.
165 /// @param newAdmin Substrate administrator address.
166 /// @dev EVM selector for this function is: 0x5730062b,
167 /// or in textual repr: addCollectionAdminSubstrate(uint256)
168 function addCollectionAdminSubstrate(uint256 newAdmin) external;
169
170 /// Remove collection admin by substrate address.
171 /// @param admin Substrate administrator address.
172 /// @dev EVM selector for this function is: 0x4048fcf9,
173 /// or in textual repr: removeCollectionAdminSubstrate(uint256)
174 function removeCollectionAdminSubstrate(uint256 admin) external;
175154
176 /// Add collection admin.155 /// Add collection admin.
177 /// @param newAdmin Address of the added administrator.156 /// @param newAdmin Address of the added administrator.
223 /// or in textual repr: addToCollectionAllowList(address)202 /// or in textual repr: addToCollectionAllowList(address)
224 function addToCollectionAllowList(address user) external;203 function addToCollectionAllowList(address user) external;
225
226 /// Add substrate user to allowed list.
227 ///
228 /// @param user User substrate address.
229 /// @dev EVM selector for this function is: 0xd06ad267,
230 /// or in textual repr: addToCollectionAllowListSubstrate(uint256)
231 function addToCollectionAllowListSubstrate(uint256 user) external;
232204
233 /// Remove the user from the allowed list.205 /// Remove the user from the allowed list.
234 ///206 ///
237 /// or in textual repr: removeFromCollectionAllowList(address)209 /// or in textual repr: removeFromCollectionAllowList(address)
238 function removeFromCollectionAllowList(address user) external;210 function removeFromCollectionAllowList(address user) external;
239
240 /// Remove substrate user from allowed list.
241 ///
242 /// @param user User substrate address.
243 /// @dev EVM selector for this function is: 0xa31913ed,
244 /// or in textual repr: removeFromCollectionAllowListSubstrate(uint256)
245 function removeFromCollectionAllowListSubstrate(uint256 user) external;
246211
247 /// Switch permission for minting.212 /// Switch permission for minting.
248 ///213 ///
259 /// or in textual repr: isOwnerOrAdmin(address)224 /// or in textual repr: isOwnerOrAdmin(address)
260 function isOwnerOrAdmin(address user) external view returns (bool);225 function isOwnerOrAdmin(address user) external view returns (bool);
261
262 /// Check that substrate account is the owner or admin of the collection
263 ///
264 /// @param user account to verify
265 /// @return "true" if account is the owner or admin
266 /// @dev EVM selector for this function is: 0x68910e00,
267 /// or in textual repr: isOwnerOrAdminSubstrate(uint256)
268 function isOwnerOrAdminSubstrate(uint256 user) external view returns (bool);
269226
270 /// Returns collection type227 /// Returns collection type
271 ///228 ///
290 /// or in textual repr: setOwner(address)247 /// or in textual repr: setOwner(address)
291 function setOwner(address newOwner) external;248 function setOwner(address newOwner) external;
292
293 /// Changes collection owner to another substrate account
294 ///
295 /// @dev Owner can be changed only by current owner
296 /// @param newOwner new owner substrate account
297 /// @dev EVM selector for this function is: 0xb212138f,
298 /// or in textual repr: setOwnerSubstrate(uint256)
299 function setOwnerSubstrate(uint256 newOwner) external;
300}249}
301250
302/// @dev anonymous struct251/// @dev anonymous struct
modifiedtests/src/eth/api/UniqueRefungible.soldiffbeforeafterboth
62}62}
6363
64/// @title A contract that allows you to work with collections.64/// @title A contract that allows you to work with collections.
65/// @dev the ERC-165 identifier for this interface is 0x47dbc10565/// @dev the ERC-165 identifier for this interface is 0x3e1e8083
66interface Collection is Dummy, ERC165 {66interface Collection is Dummy, ERC165 {
67 /// Set collection property.67 /// Set collection property.
68 ///68 ///
98 /// or in textual repr: setCollectionSponsor(address)98 /// or in textual repr: setCollectionSponsor(address)
99 function setCollectionSponsor(address sponsor) external;99 function setCollectionSponsor(address sponsor) external;
100
101 /// Set the substrate sponsor of the collection.
102 ///
103 /// @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
104 ///
105 /// @param sponsor Substrate address of the sponsor from whose account funds will be debited for operations with the contract.
106 /// @dev EVM selector for this function is: 0xc74d6751,
107 /// or in textual repr: setCollectionSponsorSubstrate(uint256)
108 function setCollectionSponsorSubstrate(uint256 sponsor) external;
109100
110 /// Whether there is a pending sponsor.101 /// Whether there is a pending sponsor.
111 /// @dev EVM selector for this function is: 0x058ac185,102 /// @dev EVM selector for this function is: 0x058ac185,
161 /// or in textual repr: contractAddress()152 /// or in textual repr: contractAddress()
162 function contractAddress() external view returns (address);153 function contractAddress() external view returns (address);
163
164 /// Add collection admin by substrate address.
165 /// @param newAdmin Substrate administrator address.
166 /// @dev EVM selector for this function is: 0x5730062b,
167 /// or in textual repr: addCollectionAdminSubstrate(uint256)
168 function addCollectionAdminSubstrate(uint256 newAdmin) external;
169
170 /// Remove collection admin by substrate address.
171 /// @param admin Substrate administrator address.
172 /// @dev EVM selector for this function is: 0x4048fcf9,
173 /// or in textual repr: removeCollectionAdminSubstrate(uint256)
174 function removeCollectionAdminSubstrate(uint256 admin) external;
175154
176 /// Add collection admin.155 /// Add collection admin.
177 /// @param newAdmin Address of the added administrator.156 /// @param newAdmin Address of the added administrator.
223 /// or in textual repr: addToCollectionAllowList(address)202 /// or in textual repr: addToCollectionAllowList(address)
224 function addToCollectionAllowList(address user) external;203 function addToCollectionAllowList(address user) external;
225
226 /// Add substrate user to allowed list.
227 ///
228 /// @param user User substrate address.
229 /// @dev EVM selector for this function is: 0xd06ad267,
230 /// or in textual repr: addToCollectionAllowListSubstrate(uint256)
231 function addToCollectionAllowListSubstrate(uint256 user) external;
232204
233 /// Remove the user from the allowed list.205 /// Remove the user from the allowed list.
234 ///206 ///
237 /// or in textual repr: removeFromCollectionAllowList(address)209 /// or in textual repr: removeFromCollectionAllowList(address)
238 function removeFromCollectionAllowList(address user) external;210 function removeFromCollectionAllowList(address user) external;
239
240 /// Remove substrate user from allowed list.
241 ///
242 /// @param user User substrate address.
243 /// @dev EVM selector for this function is: 0xa31913ed,
244 /// or in textual repr: removeFromCollectionAllowListSubstrate(uint256)
245 function removeFromCollectionAllowListSubstrate(uint256 user) external;
246211
247 /// Switch permission for minting.212 /// Switch permission for minting.
248 ///213 ///
259 /// or in textual repr: isOwnerOrAdmin(address)224 /// or in textual repr: isOwnerOrAdmin(address)
260 function isOwnerOrAdmin(address user) external view returns (bool);225 function isOwnerOrAdmin(address user) external view returns (bool);
261
262 /// Check that substrate account is the owner or admin of the collection
263 ///
264 /// @param user account to verify
265 /// @return "true" if account is the owner or admin
266 /// @dev EVM selector for this function is: 0x68910e00,
267 /// or in textual repr: isOwnerOrAdminSubstrate(uint256)
268 function isOwnerOrAdminSubstrate(uint256 user) external view returns (bool);
269226
270 /// Returns collection type227 /// Returns collection type
271 ///228 ///
290 /// or in textual repr: setOwner(address)247 /// or in textual repr: setOwner(address)
291 function setOwner(address newOwner) external;248 function setOwner(address newOwner) external;
292
293 /// Changes collection owner to another substrate account
294 ///
295 /// @dev Owner can be changed only by current owner
296 /// @param newOwner new owner substrate account
297 /// @dev EVM selector for this function is: 0xb212138f,
298 /// or in textual repr: setOwnerSubstrate(uint256)
299 function setOwnerSubstrate(uint256 newOwner) external;
300}249}
301250
302/// @dev anonymous struct251/// @dev anonymous struct
modifiedtests/src/eth/collectionAdmin.test.tsdiffbeforeafterboth
44 .to.be.eq(newAdmin.toLocaleLowerCase());44 .to.be.eq(newAdmin.toLocaleLowerCase());
45 });45 });
4646
47 itWeb3('Add substrate admin by owner', async ({api, web3, privateKeyWrapper}) => {47 // TODO: Temprorary off. Need refactor
48 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);48 // itWeb3('Add substrate admin by owner', async ({api, web3, privateKeyWrapper}) => {
49 const collectionHelper = evmCollectionHelpers(web3, owner);49 // const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
50 50 // const collectionHelper = evmCollectionHelpers(web3, owner);
51 const result = await collectionHelper.methods51
52 .createNonfungibleCollection('A', 'B', 'C')52 // const result = await collectionHelper.methods
53 .send();53 // .createNonfungibleCollection('A', 'B', 'C')
54 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);54 // .send();
5555 // const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
56 const newAdmin = privateKeyWrapper('//Alice');56
57 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);57 // const newAdmin = privateKeyWrapper('//Alice');
58 await collectionEvm.methods.addCollectionAdminSubstrate(newAdmin.addressRaw).send();58 // const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
5959 // await collectionEvm.methods.addCollectionAdminSubstrate(newAdmin.addressRaw).send();
60 const adminList = await api.rpc.unique.adminlist(collectionId);60
61 expect(adminList[0].asSubstrate.toString().toLocaleLowerCase())61 // const adminList = await api.rpc.unique.adminlist(collectionId);
62 .to.be.eq(newAdmin.address.toLocaleLowerCase());62 // expect(adminList[0].asSubstrate.toString().toLocaleLowerCase())
63 });63 // .to.be.eq(newAdmin.address.toLocaleLowerCase());
64 64 // });
65
65 itWeb3('Verify owner or admin', async ({api, web3, privateKeyWrapper}) => {66 itWeb3('Verify owner or admin', async ({api, web3, privateKeyWrapper}) => {
66 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);67 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
121 expect(adminList.length).to.be.eq(0);122 expect(adminList.length).to.be.eq(0);
122 });123 });
123124
124 itWeb3('(!negative tests!) Add substrate admin by ADMIN is not allowed', async ({api, web3, privateKeyWrapper}) => {125 // TODO: Temprorary off. Need refactor
125 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);126 // itWeb3('(!negative tests!) Add substrate admin by ADMIN is not allowed', async ({api, web3, privateKeyWrapper}) => {
126 const collectionHelper = evmCollectionHelpers(web3, owner);127 // const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
127 128 // const collectionHelper = evmCollectionHelpers(web3, owner);
128 const result = await collectionHelper.methods129
129 .createNonfungibleCollection('A', 'B', 'C')130 // const result = await collectionHelper.methods
130 .send();131 // .createNonfungibleCollection('A', 'B', 'C')
131 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);132 // .send();
132133 // const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
133 const admin = await createEthAccountWithBalance(api, web3, privateKeyWrapper);134
134 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);135 // const admin = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
135 await collectionEvm.methods.addCollectionAdmin(admin).send();136 // const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
136137 // await collectionEvm.methods.addCollectionAdmin(admin).send();
137 const notAdmin = privateKey('//Alice');138
138 await expect(collectionEvm.methods.addCollectionAdminSubstrate(notAdmin.addressRaw).call({from: admin}))139 // const notAdmin = privateKey('//Alice');
139 .to.be.rejectedWith('NoPermission');140 // await expect(collectionEvm.methods.addCollectionAdminSubstrate(notAdmin.addressRaw).call({from: admin}))
140141 // .to.be.rejectedWith('NoPermission');
141 const adminList = await api.rpc.unique.adminlist(collectionId);142
142 expect(adminList.length).to.be.eq(1);143 // const adminList = await api.rpc.unique.adminlist(collectionId);
143 expect(adminList[0].asEthereum.toString().toLocaleLowerCase())144 // expect(adminList.length).to.be.eq(1);
144 .to.be.eq(admin.toLocaleLowerCase());145 // expect(adminList[0].asEthereum.toString().toLocaleLowerCase())
145 });146 // .to.be.eq(admin.toLocaleLowerCase());
146 147 // });
147 itWeb3('(!negative tests!) Add substrate admin by USER is not allowed', async ({api, web3, privateKeyWrapper}) => {148
148 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);149 // TODO: Temprorary off. Need refactor
149 const collectionHelper = evmCollectionHelpers(web3, owner);150 // itWeb3('(!negative tests!) Add substrate admin by USER is not allowed', async ({api, web3, privateKeyWrapper}) => {
150 151 // const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
151 const result = await collectionHelper.methods152 // const collectionHelper = evmCollectionHelpers(web3, owner);
152 .createNonfungibleCollection('A', 'B', 'C')153
153 .send();154 // const result = await collectionHelper.methods
154 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);155 // .createNonfungibleCollection('A', 'B', 'C')
155156 // .send();
156 const notAdmin0 = await createEthAccountWithBalance(api, web3, privateKeyWrapper);157 // const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
157 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);158
158 const notAdmin1 = privateKey('//Alice');159 // const notAdmin0 = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
159 await expect(collectionEvm.methods.addCollectionAdminSubstrate(notAdmin1.addressRaw).call({from: notAdmin0}))160 // const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
160 .to.be.rejectedWith('NoPermission');161 // const notAdmin1 = privateKey('//Alice');
161162 // await expect(collectionEvm.methods.addCollectionAdminSubstrate(notAdmin1.addressRaw).call({from: notAdmin0}))
162 const adminList = await api.rpc.unique.adminlist(collectionId);163 // .to.be.rejectedWith('NoPermission');
163 expect(adminList.length).to.be.eq(0);164
164 });165 // const adminList = await api.rpc.unique.adminlist(collectionId);
166 // expect(adminList.length).to.be.eq(0);
167 // });
165});168});
166169
167describe('Remove collection admins', () => {170describe('Remove collection admins', () => {
189 expect(adminList.length).to.be.eq(0);192 expect(adminList.length).to.be.eq(0);
190 });193 });
191194
192 itWeb3('Remove substrate admin by owner', async ({api, web3, privateKeyWrapper}) => {195 // TODO: Temprorary off. Need refactor
193 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);196 // itWeb3('Remove substrate admin by owner', async ({api, web3, privateKeyWrapper}) => {
194 const collectionHelper = evmCollectionHelpers(web3, owner);197 // const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
195 198 // const collectionHelper = evmCollectionHelpers(web3, owner);
196 const result = await collectionHelper.methods199
197 .createNonfungibleCollection('A', 'B', 'C')200 // const result = await collectionHelper.methods
198 .send();201 // .createNonfungibleCollection('A', 'B', 'C')
199 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);202 // .send();
200203 // const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
201 const newAdmin = privateKeyWrapper('//Alice');204
202 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);205 // const newAdmin = privateKeyWrapper('//Alice');
203 await collectionEvm.methods.addCollectionAdminSubstrate(newAdmin.addressRaw).send();206 // const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
204 {207 // await collectionEvm.methods.addCollectionAdminSubstrate(newAdmin.addressRaw).send();
205 const adminList = await api.rpc.unique.adminlist(collectionId);208 // {
206 expect(adminList[0].asSubstrate.toString().toLocaleLowerCase())209 // const adminList = await api.rpc.unique.adminlist(collectionId);
207 .to.be.eq(newAdmin.address.toLocaleLowerCase());210 // expect(adminList[0].asSubstrate.toString().toLocaleLowerCase())
208 }211 // .to.be.eq(newAdmin.address.toLocaleLowerCase());
209 212 // }
210 await collectionEvm.methods.removeCollectionAdminSubstrate(newAdmin.addressRaw).send();213
211 const adminList = await api.rpc.unique.adminlist(collectionId);214 // await collectionEvm.methods.removeCollectionAdminSubstrate(newAdmin.addressRaw).send();
212 expect(adminList.length).to.be.eq(0);215 // const adminList = await api.rpc.unique.adminlist(collectionId);
213 });216 // expect(adminList.length).to.be.eq(0);
217 // });
214218
215 itWeb3('(!negative tests!) Remove admin by ADMIN is not allowed', async ({api, web3, privateKeyWrapper}) => {219 itWeb3('(!negative tests!) Remove admin by ADMIN is not allowed', async ({api, web3, privateKeyWrapper}) => {
216 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);220 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
264 }268 }
265 });269 });
266270
267 itWeb3('(!negative tests!) Remove substrate admin by ADMIN is not allowed', async ({api, web3, privateKeyWrapper}) => {271 // TODO: Temprorary off. Need refactor
268 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);272 // itWeb3('(!negative tests!) Remove substrate admin by ADMIN is not allowed', async ({api, web3, privateKeyWrapper}) => {
269 const collectionHelper = evmCollectionHelpers(web3, owner);273 // const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
270 274 // const collectionHelper = evmCollectionHelpers(web3, owner);
271 const result = await collectionHelper.methods275
272 .createNonfungibleCollection('A', 'B', 'C')276 // const result = await collectionHelper.methods
273 .send();277 // .createNonfungibleCollection('A', 'B', 'C')
274 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);278 // .send();
275279 // const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
276 const adminSub = privateKeyWrapper('//Alice');280
277 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);281 // const adminSub = privateKeyWrapper('//Alice');
278 await collectionEvm.methods.addCollectionAdminSubstrate(adminSub.addressRaw).send();282 // const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
279 const adminEth = await createEthAccountWithBalance(api, web3, privateKeyWrapper);283 // await collectionEvm.methods.addCollectionAdminSubstrate(adminSub.addressRaw).send();
280 await collectionEvm.methods.addCollectionAdmin(adminEth).send();284 // const adminEth = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
281285 // await collectionEvm.methods.addCollectionAdmin(adminEth).send();
282 await expect(collectionEvm.methods.removeCollectionAdminSubstrate(adminSub.addressRaw).call({from: adminEth}))286
283 .to.be.rejectedWith('NoPermission');287 // await expect(collectionEvm.methods.removeCollectionAdminSubstrate(adminSub.addressRaw).call({from: adminEth}))
284288 // .to.be.rejectedWith('NoPermission');
285 const adminList = await api.rpc.unique.adminlist(collectionId);289
286 expect(adminList.length).to.be.eq(2);290 // const adminList = await api.rpc.unique.adminlist(collectionId);
287 expect(adminList.toString().toLocaleLowerCase())291 // expect(adminList.length).to.be.eq(2);
288 .to.be.deep.contains(adminSub.address.toLocaleLowerCase())292 // expect(adminList.toString().toLocaleLowerCase())
289 .to.be.deep.contains(adminEth.toLocaleLowerCase());293 // .to.be.deep.contains(adminSub.address.toLocaleLowerCase())
290 });294 // .to.be.deep.contains(adminEth.toLocaleLowerCase());
291295 // });
292 itWeb3('(!negative tests!) Remove substrate admin by USER is not allowed', async ({api, web3, privateKeyWrapper}) => {296
293 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);297 // TODO: Temprorary off. Need refactor
294 const collectionHelper = evmCollectionHelpers(web3, owner);298 // itWeb3('(!negative tests!) Remove substrate admin by USER is not allowed', async ({api, web3, privateKeyWrapper}) => {
295 299 // const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
296 const result = await collectionHelper.methods300 // const collectionHelper = evmCollectionHelpers(web3, owner);
297 .createNonfungibleCollection('A', 'B', 'C')301
298 .send();302 // const result = await collectionHelper.methods
299 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);303 // .createNonfungibleCollection('A', 'B', 'C')
300304 // .send();
301 const adminSub = privateKeyWrapper('//Alice');305 // const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
302 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);306
303 await collectionEvm.methods.addCollectionAdminSubstrate(adminSub.addressRaw).send();307 // const adminSub = privateKeyWrapper('//Alice');
304 const notAdminEth = await createEthAccountWithBalance(api, web3, privateKeyWrapper);308 // const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
305309 // await collectionEvm.methods.addCollectionAdminSubstrate(adminSub.addressRaw).send();
306 await expect(collectionEvm.methods.removeCollectionAdminSubstrate(adminSub.addressRaw).call({from: notAdminEth}))310 // const notAdminEth = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
307 .to.be.rejectedWith('NoPermission');311
308312 // await expect(collectionEvm.methods.removeCollectionAdminSubstrate(adminSub.addressRaw).call({from: notAdminEth}))
309 const adminList = await api.rpc.unique.adminlist(collectionId);313 // .to.be.rejectedWith('NoPermission');
310 expect(adminList.length).to.be.eq(1);314
311 expect(adminList[0].asSubstrate.toString().toLocaleLowerCase())315 // const adminList = await api.rpc.unique.adminlist(collectionId);
312 .to.be.eq(adminSub.address.toLocaleLowerCase());316 // expect(adminList.length).to.be.eq(1);
313 });317 // expect(adminList[0].asSubstrate.toString().toLocaleLowerCase())
318 // .to.be.eq(adminSub.address.toLocaleLowerCase());
319 // });
314});320});
315321
316describe('Change owner tests', () => {322describe('Change owner tests', () => {
361});367});
362368
363describe('Change substrate owner tests', () => {369describe('Change substrate owner tests', () => {
364 itWeb3('Change owner', async ({api, web3, privateKeyWrapper}) => {370 // TODO: Temprorary off. Need refactor
365 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);371 // itWeb3('Change owner', async ({api, web3, privateKeyWrapper}) => {
366 const newOwner = privateKeyWrapper('//Alice');372 // const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
367 const collectionHelper = evmCollectionHelpers(web3, owner);373 // const newOwner = privateKeyWrapper('//Alice');
368 const result = await collectionHelper.methods374 // const collectionHelper = evmCollectionHelpers(web3, owner);
369 .createNonfungibleCollection('A', 'B', 'C')375 // const result = await collectionHelper.methods
370 .send();376 // .createNonfungibleCollection('A', 'B', 'C')
371 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);377 // .send();
372 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);378 // const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
373 379 // const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
374 expect(await collectionEvm.methods.isOwnerOrAdmin(owner).call()).to.be.true;380
375 expect(await collectionEvm.methods.isOwnerOrAdminSubstrate(newOwner.addressRaw).call()).to.be.false;381 // expect(await collectionEvm.methods.isOwnerOrAdmin(owner).call()).to.be.true;
376 382 // expect(await collectionEvm.methods.isOwnerOrAdminSubstrate(newOwner.addressRaw).call()).to.be.false;
377 await collectionEvm.methods.setOwnerSubstrate(newOwner.addressRaw).send();383
378 384 // await collectionEvm.methods.setOwnerSubstrate(newOwner.addressRaw).send();
379 expect(await collectionEvm.methods.isOwnerOrAdmin(owner).call()).to.be.false;385
380 expect(await collectionEvm.methods.isOwnerOrAdminSubstrate(newOwner.addressRaw).call()).to.be.true;386 // expect(await collectionEvm.methods.isOwnerOrAdmin(owner).call()).to.be.false;
381 });387 // expect(await collectionEvm.methods.isOwnerOrAdminSubstrate(newOwner.addressRaw).call()).to.be.true;
382388 // });
383 itWeb3('change owner call fee', async ({web3, api, privateKeyWrapper}) => {389
384 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);390 // TODO: Temprorary off. Need refactor
385 const newOwner = privateKeyWrapper('//Alice');391 // itWeb3('change owner call fee', async ({web3, api, privateKeyWrapper}) => {
386 const collectionHelper = evmCollectionHelpers(web3, owner);392 // const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
387 const result = await collectionHelper.methods393 // const newOwner = privateKeyWrapper('//Alice');
388 .createNonfungibleCollection('A', 'B', 'C')394 // const collectionHelper = evmCollectionHelpers(web3, owner);
389 .send();395 // const result = await collectionHelper.methods
390 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);396 // .createNonfungibleCollection('A', 'B', 'C')
391 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);397 // .send();
392398 // const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
393 const cost = await recordEthFee(api, owner, () => collectionEvm.methods.setOwnerSubstrate(newOwner.addressRaw).send());399 // const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
394 expect(cost < BigInt(0.2 * Number(UNIQUE)));400
395 expect(cost > 0);401 // const cost = await recordEthFee(api, owner, () => collectionEvm.methods.setOwnerSubstrate(newOwner.addressRaw).send());
396 });402 // expect(cost < BigInt(0.2 * Number(UNIQUE)));
397403 // expect(cost > 0);
398 itWeb3('(!negative tests!) call setOwner by non owner', async ({api, web3, privateKeyWrapper}) => {404 // });
399 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);405
400 const otherReceiver = await createEthAccountWithBalance(api, web3, privateKeyWrapper);406 // TODO: Temprorary off. Need refactor
401 const newOwner = privateKeyWrapper('//Alice');407 // itWeb3('(!negative tests!) call setOwner by non owner', async ({api, web3, privateKeyWrapper}) => {
402 const collectionHelper = evmCollectionHelpers(web3, owner);408 // const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
403 const result = await collectionHelper.methods409 // const otherReceiver = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
404 .createNonfungibleCollection('A', 'B', 'C')410 // const newOwner = privateKeyWrapper('//Alice');
405 .send();411 // const collectionHelper = evmCollectionHelpers(web3, owner);
406 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);412 // const result = await collectionHelper.methods
407 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);413 // .createNonfungibleCollection('A', 'B', 'C')
408 414 // .send();
409 await expect(collectionEvm.methods.setOwnerSubstrate(newOwner.addressRaw).send({from: otherReceiver})).to.be.rejected;415 // const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
410 expect(await collectionEvm.methods.isOwnerOrAdminSubstrate(newOwner.addressRaw).call()).to.be.false;416 // const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
411 });417
418 // await expect(collectionEvm.methods.setOwnerSubstrate(newOwner.addressRaw).send({from: otherReceiver})).to.be.rejected;
419 // expect(await collectionEvm.methods.isOwnerOrAdminSubstrate(newOwner.addressRaw).call()).to.be.false;
420 // });
412});421});
modifiedtests/src/eth/collectionSponsoring.test.tsdiffbeforeafterboth
40 ]);40 ]);
41 });41 });
4242
43 itWeb3('Set substrate sponsor', async ({api, web3, privateKeyWrapper}) => {43 // TODO: Temprorary off. Need refactor
44 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);44 // itWeb3('Set substrate sponsor', async ({api, web3, privateKeyWrapper}) => {
45 const collectionHelpers = evmCollectionHelpers(web3, owner);45 // const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
46 let result = await collectionHelpers.methods.createNonfungibleCollection('Sponsor collection', '1', '1').send();46 // const collectionHelpers = evmCollectionHelpers(web3, owner);
47 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);47 // let result = await collectionHelpers.methods.createNonfungibleCollection('Sponsor collection', '1', '1').send();
48 const sponsor = privateKeyWrapper('//Alice');48 // const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
49 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);49 // const sponsor = privateKeyWrapper('//Alice');
5050 // const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
51 expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.false;51
52 result = await collectionEvm.methods.setCollectionSponsorSubstrate(sponsor.addressRaw).send({from: owner});52 // expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.false;
53 expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.true;53 // result = await collectionEvm.methods.setCollectionSponsorSubstrate(sponsor.addressRaw).send({from: owner});
54 54 // expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.true;
55 const confirmTx = await api.tx.unique.confirmSponsorship(collectionId);55
56 await submitTransactionAsync(sponsor, confirmTx);56 // const confirmTx = await api.tx.unique.confirmSponsorship(collectionId);
57 expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.false;57 // await submitTransactionAsync(sponsor, confirmTx);
58 58 // expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.false;
59 const sponsorTuple = await collectionEvm.methods.collectionSponsor().call({from: owner});59
60 expect(bigIntToSub(api, BigInt(sponsorTuple[1]))).to.be.eq(sponsor.address);60 // const sponsorTuple = await collectionEvm.methods.collectionSponsor().call({from: owner});
61 });61 // expect(bigIntToSub(api, BigInt(sponsorTuple[1]))).to.be.eq(sponsor.address);
62 // });
6263
63 itWeb3('Remove sponsor', async ({api, web3, privateKeyWrapper}) => {64 itWeb3('Remove sponsor', async ({api, web3, privateKeyWrapper}) => {
64 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);65 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
150 }151 }
151 });152 });
152153
153 itWeb3('Sponsoring collection from substrate address via access list', async ({api, web3, privateKeyWrapper}) => {154 // TODO: Temprorary off. Need refactor
154 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);155 // itWeb3('Sponsoring collection from substrate address via access list', async ({api, web3, privateKeyWrapper}) => {
155 const collectionHelpers = evmCollectionHelpers(web3, owner);156 // const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
156 const result = await collectionHelpers.methods.createNonfungibleCollection('Sponsor collection', '1', '1').send();157 // const collectionHelpers = evmCollectionHelpers(web3, owner);
157 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);158 // const result = await collectionHelpers.methods.createNonfungibleCollection('Sponsor collection', '1', '1').send();
158 const sponsor = privateKeyWrapper('//Alice');159 // const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
159 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);160 // const sponsor = privateKeyWrapper('//Alice');
160161 // const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
161 await collectionEvm.methods.setCollectionSponsorSubstrate(sponsor.addressRaw).send({from: owner});162
162 163 // await collectionEvm.methods.setCollectionSponsorSubstrate(sponsor.addressRaw).send({from: owner});
163 const confirmTx = await api.tx.unique.confirmSponsorship(collectionId);164
164 await submitTransactionAsync(sponsor, confirmTx);165 // const confirmTx = await api.tx.unique.confirmSponsorship(collectionId);
165 166 // await submitTransactionAsync(sponsor, confirmTx);
166 const user = createEthAccount(web3);167
167 const nextTokenId = await collectionEvm.methods.nextTokenId().call();168 // const user = createEthAccount(web3);
168 expect(nextTokenId).to.be.equal('1');169 // const nextTokenId = await collectionEvm.methods.nextTokenId().call();
169170 // expect(nextTokenId).to.be.equal('1');
170 await collectionEvm.methods.setCollectionAccess(1 /*'AllowList'*/).send({from: owner});171
171 await collectionEvm.methods.addToCollectionAllowList(user).send({from: owner});172 // await collectionEvm.methods.setCollectionAccess(1 /*'AllowList'*/).send({from: owner});
172 await collectionEvm.methods.setCollectionMintMode(true).send({from: owner});173 // await collectionEvm.methods.addToCollectionAllowList(user).send({from: owner});
173174 // await collectionEvm.methods.setCollectionMintMode(true).send({from: owner});
174 const ownerBalanceBefore = await ethBalanceViaSub(api, owner);175
175 const sponsorBalanceBefore = (await getBalance(api, [sponsor.address]))[0];176 // const ownerBalanceBefore = await ethBalanceViaSub(api, owner);
176177 // const sponsorBalanceBefore = (await getBalance(api, [sponsor.address]))[0];
177 {178
178 const nextTokenId = await collectionEvm.methods.nextTokenId().call();179 // {
179 expect(nextTokenId).to.be.equal('1');180 // const nextTokenId = await collectionEvm.methods.nextTokenId().call();
180 const result = await collectionEvm.methods.mintWithTokenURI(181 // expect(nextTokenId).to.be.equal('1');
181 user,182 // const result = await collectionEvm.methods.mintWithTokenURI(
182 nextTokenId,183 // user,
183 'Test URI',184 // nextTokenId,
184 ).send({from: user});185 // 'Test URI',
185 const events = normalizeEvents(result.events);186 // ).send({from: user});
186187 // const events = normalizeEvents(result.events);
187 expect(events).to.be.deep.equal([188
188 {189 // expect(events).to.be.deep.equal([
189 address: collectionIdAddress,190 // {
190 event: 'Transfer',191 // address: collectionIdAddress,
191 args: {192 // event: 'Transfer',
192 from: '0x0000000000000000000000000000000000000000',193 // args: {
193 to: user,194 // from: '0x0000000000000000000000000000000000000000',
194 tokenId: nextTokenId,195 // to: user,
195 },196 // tokenId: nextTokenId,
196 },197 // },
197 ]);198 // },
198199 // ]);
199 const ownerBalanceAfter = await ethBalanceViaSub(api, owner);200
200 const sponsorBalanceAfter = (await getBalance(api, [sponsor.address]))[0];201 // const ownerBalanceAfter = await ethBalanceViaSub(api, owner);
201202 // const sponsorBalanceAfter = (await getBalance(api, [sponsor.address]))[0];
202 expect(await collectionEvm.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI');203
203 expect(ownerBalanceBefore).to.be.eq(ownerBalanceAfter);204 // expect(await collectionEvm.methods.tokenURI(nextTokenId).call()).to.be.equal('Test URI');
204 expect(sponsorBalanceBefore > sponsorBalanceAfter).to.be.true;205 // expect(ownerBalanceBefore).to.be.eq(ownerBalanceAfter);
205 }206 // expect(sponsorBalanceBefore > sponsorBalanceAfter).to.be.true;
206 });207 // }
208 // });
207209
208 itWeb3('Check that transaction via EVM spend money from sponsor address', async ({api, web3, privateKeyWrapper}) => {210 itWeb3('Check that transaction via EVM spend money from sponsor address', async ({api, web3, privateKeyWrapper}) => {
209 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);211 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
modifiedtests/src/eth/fungibleAbi.jsondiffbeforeafterboth
58 "stateMutability": "nonpayable",58 "stateMutability": "nonpayable",
59 "type": "function"59 "type": "function"
60 },60 },
61 {
62 "inputs": [
63 { "internalType": "uint256", "name": "newAdmin", "type": "uint256" }
64 ],
65 "name": "addCollectionAdminSubstrate",
66 "outputs": [],
67 "stateMutability": "nonpayable",
68 "type": "function"
69 },
70 {61 {
71 "inputs": [62 "inputs": [
72 { "internalType": "address", "name": "user", "type": "address" }63 { "internalType": "address", "name": "user", "type": "address" }
76 "stateMutability": "nonpayable",67 "stateMutability": "nonpayable",
77 "type": "function"68 "type": "function"
78 },69 },
79 {
80 "inputs": [
81 { "internalType": "uint256", "name": "user", "type": "uint256" }
82 ],
83 "name": "addToCollectionAllowListSubstrate",
84 "outputs": [],
85 "stateMutability": "nonpayable",
86 "type": "function"
87 },
88 {70 {
89 "inputs": [71 "inputs": [
90 { "internalType": "address", "name": "owner", "type": "address" },72 { "internalType": "address", "name": "owner", "type": "address" },
218 "stateMutability": "view",200 "stateMutability": "view",
219 "type": "function"201 "type": "function"
220 },202 },
221 {
222 "inputs": [
223 { "internalType": "uint256", "name": "user", "type": "uint256" }
224 ],
225 "name": "isOwnerOrAdminSubstrate",
226 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
227 "stateMutability": "view",
228 "type": "function"
229 },
230 {203 {
231 "inputs": [204 "inputs": [
232 { "internalType": "address", "name": "to", "type": "address" },205 { "internalType": "address", "name": "to", "type": "address" },
270 "stateMutability": "nonpayable",243 "stateMutability": "nonpayable",
271 "type": "function"244 "type": "function"
272 },245 },
273 {
274 "inputs": [
275 { "internalType": "uint256", "name": "admin", "type": "uint256" }
276 ],
277 "name": "removeCollectionAdminSubstrate",
278 "outputs": [],
279 "stateMutability": "nonpayable",
280 "type": "function"
281 },
282 {246 {
283 "inputs": [],247 "inputs": [],
284 "name": "removeCollectionSponsor",248 "name": "removeCollectionSponsor",
295 "stateMutability": "nonpayable",259 "stateMutability": "nonpayable",
296 "type": "function"260 "type": "function"
297 },261 },
298 {
299 "inputs": [
300 { "internalType": "uint256", "name": "user", "type": "uint256" }
301 ],
302 "name": "removeFromCollectionAllowListSubstrate",
303 "outputs": [],
304 "stateMutability": "nonpayable",
305 "type": "function"
306 },
307 {262 {
308 "inputs": [{ "internalType": "uint8", "name": "mode", "type": "uint8" }],263 "inputs": [{ "internalType": "uint8", "name": "mode", "type": "uint8" }],
309 "name": "setCollectionAccess",264 "name": "setCollectionAccess",
378 "stateMutability": "nonpayable",333 "stateMutability": "nonpayable",
379 "type": "function"334 "type": "function"
380 },335 },
381 {
382 "inputs": [
383 { "internalType": "uint256", "name": "sponsor", "type": "uint256" }
384 ],
385 "name": "setCollectionSponsorSubstrate",
386 "outputs": [],
387 "stateMutability": "nonpayable",
388 "type": "function"
389 },
390 {336 {
391 "inputs": [337 "inputs": [
392 { "internalType": "address", "name": "newOwner", "type": "address" }338 { "internalType": "address", "name": "newOwner", "type": "address" }
396 "stateMutability": "nonpayable",342 "stateMutability": "nonpayable",
397 "type": "function"343 "type": "function"
398 },344 },
399 {
400 "inputs": [
401 { "internalType": "uint256", "name": "newOwner", "type": "uint256" }
402 ],
403 "name": "setOwnerSubstrate",
404 "outputs": [],
405 "stateMutability": "nonpayable",
406 "type": "function"
407 },
408 {345 {
409 "inputs": [346 "inputs": [
410 { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }347 { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }
modifiedtests/src/eth/nonFungibleAbi.jsondiffbeforeafterboth
89 "stateMutability": "nonpayable",89 "stateMutability": "nonpayable",
90 "type": "function"90 "type": "function"
91 },91 },
92 {
93 "inputs": [
94 { "internalType": "uint256", "name": "newAdmin", "type": "uint256" }
95 ],
96 "name": "addCollectionAdminSubstrate",
97 "outputs": [],
98 "stateMutability": "nonpayable",
99 "type": "function"
100 },
101 {92 {
102 "inputs": [93 "inputs": [
103 { "internalType": "address", "name": "user", "type": "address" }94 { "internalType": "address", "name": "user", "type": "address" }
107 "stateMutability": "nonpayable",98 "stateMutability": "nonpayable",
108 "type": "function"99 "type": "function"
109 },100 },
110 {
111 "inputs": [
112 { "internalType": "uint256", "name": "user", "type": "uint256" }
113 ],
114 "name": "addToCollectionAllowListSubstrate",
115 "outputs": [],
116 "stateMutability": "nonpayable",
117 "type": "function"
118 },
119 {101 {
120 "inputs": [102 "inputs": [
121 { "internalType": "address", "name": "user", "type": "address" }103 { "internalType": "address", "name": "user", "type": "address" }
277 "stateMutability": "view",259 "stateMutability": "view",
278 "type": "function"260 "type": "function"
279 },261 },
280 {
281 "inputs": [
282 { "internalType": "uint256", "name": "user", "type": "uint256" }
283 ],
284 "name": "isOwnerOrAdminSubstrate",
285 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
286 "stateMutability": "view",
287 "type": "function"
288 },
289 {262 {
290 "inputs": [263 "inputs": [
291 { "internalType": "address", "name": "to", "type": "address" },264 { "internalType": "address", "name": "to", "type": "address" },
384 "stateMutability": "nonpayable",357 "stateMutability": "nonpayable",
385 "type": "function"358 "type": "function"
386 },359 },
387 {
388 "inputs": [
389 { "internalType": "uint256", "name": "admin", "type": "uint256" }
390 ],
391 "name": "removeCollectionAdminSubstrate",
392 "outputs": [],
393 "stateMutability": "nonpayable",
394 "type": "function"
395 },
396 {360 {
397 "inputs": [],361 "inputs": [],
398 "name": "removeCollectionSponsor",362 "name": "removeCollectionSponsor",
409 "stateMutability": "nonpayable",373 "stateMutability": "nonpayable",
410 "type": "function"374 "type": "function"
411 },375 },
412 {
413 "inputs": [
414 { "internalType": "uint256", "name": "user", "type": "uint256" }
415 ],
416 "name": "removeFromCollectionAllowListSubstrate",
417 "outputs": [],
418 "stateMutability": "nonpayable",
419 "type": "function"
420 },
421 {376 {
422 "inputs": [377 "inputs": [
423 { "internalType": "address", "name": "from", "type": "address" },378 { "internalType": "address", "name": "from", "type": "address" },
525 "stateMutability": "nonpayable",480 "stateMutability": "nonpayable",
526 "type": "function"481 "type": "function"
527 },482 },
528 {
529 "inputs": [
530 { "internalType": "uint256", "name": "sponsor", "type": "uint256" }
531 ],
532 "name": "setCollectionSponsorSubstrate",
533 "outputs": [],
534 "stateMutability": "nonpayable",
535 "type": "function"
536 },
537 {483 {
538 "inputs": [484 "inputs": [
539 { "internalType": "address", "name": "newOwner", "type": "address" }485 { "internalType": "address", "name": "newOwner", "type": "address" }
543 "stateMutability": "nonpayable",489 "stateMutability": "nonpayable",
544 "type": "function"490 "type": "function"
545 },491 },
546 {
547 "inputs": [
548 { "internalType": "uint256", "name": "newOwner", "type": "uint256" }
549 ],
550 "name": "setOwnerSubstrate",
551 "outputs": [],
552 "stateMutability": "nonpayable",
553 "type": "function"
554 },
555 {492 {
556 "inputs": [493 "inputs": [
557 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },494 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },
modifiedtests/src/eth/reFungibleAbi.jsondiffbeforeafterboth
89 "stateMutability": "nonpayable",89 "stateMutability": "nonpayable",
90 "type": "function"90 "type": "function"
91 },91 },
92 {
93 "inputs": [
94 { "internalType": "uint256", "name": "newAdmin", "type": "uint256" }
95 ],
96 "name": "addCollectionAdminSubstrate",
97 "outputs": [],
98 "stateMutability": "nonpayable",
99 "type": "function"
100 },
101 {92 {
102 "inputs": [93 "inputs": [
103 { "internalType": "address", "name": "user", "type": "address" }94 { "internalType": "address", "name": "user", "type": "address" }
107 "stateMutability": "nonpayable",98 "stateMutability": "nonpayable",
108 "type": "function"99 "type": "function"
109 },100 },
110 {
111 "inputs": [
112 { "internalType": "uint256", "name": "user", "type": "uint256" }
113 ],
114 "name": "addToCollectionAllowListSubstrate",
115 "outputs": [],
116 "stateMutability": "nonpayable",
117 "type": "function"
118 },
119 {101 {
120 "inputs": [102 "inputs": [
121 { "internalType": "address", "name": "user", "type": "address" }103 { "internalType": "address", "name": "user", "type": "address" }
277 "stateMutability": "view",259 "stateMutability": "view",
278 "type": "function"260 "type": "function"
279 },261 },
280 {
281 "inputs": [
282 { "internalType": "uint256", "name": "user", "type": "uint256" }
283 ],
284 "name": "isOwnerOrAdminSubstrate",
285 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
286 "stateMutability": "view",
287 "type": "function"
288 },
289 {262 {
290 "inputs": [263 "inputs": [
291 { "internalType": "address", "name": "to", "type": "address" },264 { "internalType": "address", "name": "to", "type": "address" },
384 "stateMutability": "nonpayable",357 "stateMutability": "nonpayable",
385 "type": "function"358 "type": "function"
386 },359 },
387 {
388 "inputs": [
389 { "internalType": "uint256", "name": "admin", "type": "uint256" }
390 ],
391 "name": "removeCollectionAdminSubstrate",
392 "outputs": [],
393 "stateMutability": "nonpayable",
394 "type": "function"
395 },
396 {360 {
397 "inputs": [],361 "inputs": [],
398 "name": "removeCollectionSponsor",362 "name": "removeCollectionSponsor",
409 "stateMutability": "nonpayable",373 "stateMutability": "nonpayable",
410 "type": "function"374 "type": "function"
411 },375 },
412 {
413 "inputs": [
414 { "internalType": "uint256", "name": "user", "type": "uint256" }
415 ],
416 "name": "removeFromCollectionAllowListSubstrate",
417 "outputs": [],
418 "stateMutability": "nonpayable",
419 "type": "function"
420 },
421 {376 {
422 "inputs": [377 "inputs": [
423 { "internalType": "address", "name": "from", "type": "address" },378 { "internalType": "address", "name": "from", "type": "address" },
525 "stateMutability": "nonpayable",480 "stateMutability": "nonpayable",
526 "type": "function"481 "type": "function"
527 },482 },
528 {
529 "inputs": [
530 { "internalType": "uint256", "name": "sponsor", "type": "uint256" }
531 ],
532 "name": "setCollectionSponsorSubstrate",
533 "outputs": [],
534 "stateMutability": "nonpayable",
535 "type": "function"
536 },
537 {483 {
538 "inputs": [484 "inputs": [
539 { "internalType": "address", "name": "newOwner", "type": "address" }485 { "internalType": "address", "name": "newOwner", "type": "address" }
543 "stateMutability": "nonpayable",489 "stateMutability": "nonpayable",
544 "type": "function"490 "type": "function"
545 },491 },
546 {
547 "inputs": [
548 { "internalType": "uint256", "name": "newOwner", "type": "uint256" }
549 ],
550 "name": "setOwnerSubstrate",
551 "outputs": [],
552 "stateMutability": "nonpayable",
553 "type": "function"
554 },
555 {492 {
556 "inputs": [493 "inputs": [
557 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },494 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },