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

difftreelog

feature(common-pallet): add changeOwner method

Grigoriy Simonov2022-08-23parent: #565dfea.patch.diff
in: master

14 files changed

modifiedpallets/common/src/erc.rsdiffbeforeafterboth
--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -431,6 +431,27 @@
 		};
 		Ok(mode.into())
 	}
+
+	/// Changes collection owner
+	///
+	/// @dev Owner can be changed only by current owner
+	/// @param newOwner new owner
+	fn change_owner(&mut self, caller: caller, new_owner: address) -> Result<void> {
+		let caller = T::CrossAccountId::from_eth(caller);
+		let new_owner = T::CrossAccountId::from_eth(new_owner);
+		self.change_owner_internal(caller, new_owner)
+	}
+
+impl<T: Config> CollectionHandle<T>
+where
+	T::AccountId: From<[u8; 32]>,
+{
+
+	fn change_owner_internal(&mut self, caller: T::CrossAccountId, new_owner: T::CrossAccountId) -> Result<void> {
+		self.check_is_owner(&caller).map_err(dispatch_to_evm::<T>)?;
+		self.collection.owner = new_owner.as_sub().clone();
+		save(self)
+	}
 }
 
 fn check_is_owner_or_admin<T: Config>(
@@ -440,12 +461,13 @@
 	let caller = T::CrossAccountId::from_eth(caller);
 	collection
 		.check_is_owner_or_admin(&caller)
-		.map_err(pallet_evm_coder_substrate::dispatch_to_evm::<T>)?;
+		.map_err(dispatch_to_evm::<T>)?;
 	Ok(caller)
 }
 
 fn save<T: Config>(collection: &CollectionHandle<T>) -> Result<void> {
 	// TODO possibly delete for the lack of transaction
+	collection.consume_store_writes(1)?;
 	collection
 		.check_is_internal()
 		.map_err(dispatch_to_evm::<T>)?;
modifiedpallets/fungible/src/stubs/UniqueFungible.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/fungible/src/stubs/UniqueFungible.soldiffbeforeafterboth
--- a/pallets/fungible/src/stubs/UniqueFungible.sol
+++ b/pallets/fungible/src/stubs/UniqueFungible.sol
@@ -31,7 +31,103 @@
 	);
 }
 
-// Selector: 6cf113cd
+// Selector: 79cc6790
+contract ERC20UniqueExtensions is Dummy, ERC165 {
+	// Selector: burnFrom(address,uint256) 79cc6790
+	function burnFrom(address from, uint256 amount) public returns (bool) {
+		require(false, stub_error);
+		from;
+		amount;
+		dummy = 0;
+		return false;
+	}
+}
+
+// Selector: 942e8b22
+contract ERC20 is Dummy, ERC165, ERC20Events {
+	// Selector: name() 06fdde03
+	function name() public view returns (string memory) {
+		require(false, stub_error);
+		dummy;
+		return "";
+	}
+
+	// Selector: symbol() 95d89b41
+	function symbol() public view returns (string memory) {
+		require(false, stub_error);
+		dummy;
+		return "";
+	}
+
+	// Selector: totalSupply() 18160ddd
+	function totalSupply() public view returns (uint256) {
+		require(false, stub_error);
+		dummy;
+		return 0;
+	}
+
+	// Selector: decimals() 313ce567
+	function decimals() public view returns (uint8) {
+		require(false, stub_error);
+		dummy;
+		return 0;
+	}
+
+	// Selector: balanceOf(address) 70a08231
+	function balanceOf(address owner) public view returns (uint256) {
+		require(false, stub_error);
+		owner;
+		dummy;
+		return 0;
+	}
+
+	// Selector: transfer(address,uint256) a9059cbb
+	function transfer(address to, uint256 amount) public returns (bool) {
+		require(false, stub_error);
+		to;
+		amount;
+		dummy = 0;
+		return false;
+	}
+
+	// Selector: transferFrom(address,address,uint256) 23b872dd
+	function transferFrom(
+		address from,
+		address to,
+		uint256 amount
+	) public returns (bool) {
+		require(false, stub_error);
+		from;
+		to;
+		amount;
+		dummy = 0;
+		return false;
+	}
+
+	// Selector: approve(address,uint256) 095ea7b3
+	function approve(address spender, uint256 amount) public returns (bool) {
+		require(false, stub_error);
+		spender;
+		amount;
+		dummy = 0;
+		return false;
+	}
+
+	// Selector: allowance(address,address) dd62ed3e
+	function allowance(address owner, address spender)
+		public
+		view
+		returns (uint256)
+	{
+		require(false, stub_error);
+		owner;
+		spender;
+		dummy;
+		return 0;
+	}
+}
+
+// Selector: ca08c92c
 contract Collection is Dummy, ERC165 {
 	// Set collection property.
 	//
@@ -276,105 +372,21 @@
 	//
 	// Selector: uniqueCollectionType() d34b55b8
 	function uniqueCollectionType() public returns (string memory) {
-		require(false, stub_error);
-		dummy = 0;
-		return "";
-	}
-}
-
-// Selector: 79cc6790
-contract ERC20UniqueExtensions is Dummy, ERC165 {
-	// Selector: burnFrom(address,uint256) 79cc6790
-	function burnFrom(address from, uint256 amount) public returns (bool) {
 		require(false, stub_error);
-		from;
-		amount;
 		dummy = 0;
-		return false;
-	}
-}
-
-// Selector: 942e8b22
-contract ERC20 is Dummy, ERC165, ERC20Events {
-	// Selector: name() 06fdde03
-	function name() public view returns (string memory) {
-		require(false, stub_error);
-		dummy;
-		return "";
-	}
-
-	// Selector: symbol() 95d89b41
-	function symbol() public view returns (string memory) {
-		require(false, stub_error);
-		dummy;
 		return "";
-	}
-
-	// Selector: totalSupply() 18160ddd
-	function totalSupply() public view returns (uint256) {
-		require(false, stub_error);
-		dummy;
-		return 0;
-	}
-
-	// Selector: decimals() 313ce567
-	function decimals() public view returns (uint8) {
-		require(false, stub_error);
-		dummy;
-		return 0;
-	}
-
-	// Selector: balanceOf(address) 70a08231
-	function balanceOf(address owner) public view returns (uint256) {
-		require(false, stub_error);
-		owner;
-		dummy;
-		return 0;
 	}
 
-	// Selector: transfer(address,uint256) a9059cbb
-	function transfer(address to, uint256 amount) public returns (bool) {
-		require(false, stub_error);
-		to;
-		amount;
-		dummy = 0;
-		return false;
-	}
-
-	// Selector: transferFrom(address,address,uint256) 23b872dd
-	function transferFrom(
-		address from,
-		address to,
-		uint256 amount
-	) public returns (bool) {
-		require(false, stub_error);
-		from;
-		to;
-		amount;
-		dummy = 0;
-		return false;
-	}
-
-	// Selector: approve(address,uint256) 095ea7b3
-	function approve(address spender, uint256 amount) public returns (bool) {
+	// Changes collection owner
+	//
+	// @dev Owner can be changed only by current owner
+	// @param newOwner new owner
+	//
+	// Selector: changeOwner(address) a6f9dae1
+	function changeOwner(address newOwner) public {
 		require(false, stub_error);
-		spender;
-		amount;
+		newOwner;
 		dummy = 0;
-		return false;
-	}
-
-	// Selector: allowance(address,address) dd62ed3e
-	function allowance(address owner, address spender)
-		public
-		view
-		returns (uint256)
-	{
-		require(false, stub_error);
-		owner;
-		spender;
-		dummy;
-		return 0;
 	}
 }
 
modifiedpallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth
--- a/pallets/nonfungible/src/stubs/UniqueNFT.sol
+++ b/pallets/nonfungible/src/stubs/UniqueNFT.sol
@@ -373,7 +373,49 @@
 	}
 }
 
-// Selector: 6cf113cd
+// Selector: 780e9d63
+contract ERC721Enumerable is Dummy, ERC165 {
+	// @notice Enumerate valid NFTs
+	// @param index A counter less than `totalSupply()`
+	// @return The token identifier for the `index`th NFT,
+	//  (sort order not specified)
+	//
+	// Selector: tokenByIndex(uint256) 4f6ccce7
+	function tokenByIndex(uint256 index) public view returns (uint256) {
+		require(false, stub_error);
+		index;
+		dummy;
+		return 0;
+	}
+
+	// @dev Not implemented
+	//
+	// Selector: tokenOfOwnerByIndex(address,uint256) 2f745c59
+	function tokenOfOwnerByIndex(address owner, uint256 index)
+		public
+		view
+		returns (uint256)
+	{
+		require(false, stub_error);
+		owner;
+		index;
+		dummy;
+		return 0;
+	}
+
+	// @notice Count NFTs tracked by this contract
+	// @return A count of valid NFTs tracked by this contract, where each one of
+	//  them has an assigned and queryable owner not equal to the zero address
+	//
+	// Selector: totalSupply() 18160ddd
+	function totalSupply() public view returns (uint256) {
+		require(false, stub_error);
+		dummy;
+		return 0;
+	}
+}
+
+// Selector: ca08c92c
 contract Collection is Dummy, ERC165 {
 	// Set collection property.
 	//
@@ -622,47 +664,17 @@
 		dummy = 0;
 		return "";
 	}
-}
 
-// Selector: 780e9d63
-contract ERC721Enumerable is Dummy, ERC165 {
-	// @notice Enumerate valid NFTs
-	// @param index A counter less than `totalSupply()`
-	// @return The token identifier for the `index`th NFT,
-	//  (sort order not specified)
+	// Changes collection owner
 	//
-	// Selector: tokenByIndex(uint256) 4f6ccce7
-	function tokenByIndex(uint256 index) public view returns (uint256) {
-		require(false, stub_error);
-		index;
-		dummy;
-		return 0;
-	}
-
-	// @dev Not implemented
+	// @dev Owner can be changed only by current owner
+	// @param newOwner new owner
 	//
-	// Selector: tokenOfOwnerByIndex(address,uint256) 2f745c59
-	function tokenOfOwnerByIndex(address owner, uint256 index)
-		public
-		view
-		returns (uint256)
-	{
+	// Selector: changeOwner(address) a6f9dae1
+	function changeOwner(address newOwner) public {
 		require(false, stub_error);
-		owner;
-		index;
-		dummy;
-		return 0;
-	}
-
-	// @notice Count NFTs tracked by this contract
-	// @return A count of valid NFTs tracked by this contract, where each one of
-	//  them has an assigned and queryable owner not equal to the zero address
-	//
-	// Selector: totalSupply() 18160ddd
-	function totalSupply() public view returns (uint256) {
-		require(false, stub_error);
-		dummy;
-		return 0;
+		newOwner;
+		dummy = 0;
 	}
 }
 
modifiedpallets/refungible/src/stubs/UniqueRefungible.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/refungible/src/stubs/UniqueRefungible.soldiffbeforeafterboth
371 }371 }
372}372}
373
374// Selector: 6cf113cd
375contract Collection is Dummy, ERC165 {
376 // Set collection property.
377 //
378 // @param key Property key.
379 // @param value Propery value.
380 //
381 // Selector: setCollectionProperty(string,bytes) 2f073f66
382 function setCollectionProperty(string memory key, bytes memory value)
383 public
384 {
385 require(false, stub_error);
386 key;
387 value;
388 dummy = 0;
389 }
390
391 // Delete collection property.
392 //
393 // @param key Property key.
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 // Get collection property.
403 //
404 // @dev Throws error if key not found.
405 //
406 // @param key Property key.
407 // @return bytes The property corresponding to the key.
408 //
409 // Selector: collectionProperty(string) cf24fd6d
410 function collectionProperty(string memory key)
411 public
412 view
413 returns (bytes memory)
414 {
415 require(false, stub_error);
416 key;
417 dummy;
418 return hex"";
419 }
420
421 // Set the sponsor of the collection.
422 //
423 // @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
424 //
425 // @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.
426 //
427 // Selector: setCollectionSponsor(address) 7623402e
428 function setCollectionSponsor(address sponsor) public {
429 require(false, stub_error);
430 sponsor;
431 dummy = 0;
432 }
433
434 // Collection sponsorship confirmation.
435 //
436 // @dev After setting the sponsor for the collection, it must be confirmed with this function.
437 //
438 // Selector: confirmCollectionSponsorship() 3c50e97a
439 function confirmCollectionSponsorship() public {
440 require(false, stub_error);
441 dummy = 0;
442 }
443
444 // Set limits for the collection.
445 // @dev Throws error if limit not found.
446 // @param limit Name of the limit. Valid names:
447 // "accountTokenOwnershipLimit",
448 // "sponsoredDataSize",
449 // "sponsoredDataRateLimit",
450 // "tokenLimit",
451 // "sponsorTransferTimeout",
452 // "sponsorApproveTimeout"
453 // @param value Value of the limit.
454 //
455 // Selector: setCollectionLimit(string,uint32) 6a3841db
456 function setCollectionLimit(string memory limit, uint32 value) public {
457 require(false, stub_error);
458 limit;
459 value;
460 dummy = 0;
461 }
462
463 // Set limits for the collection.
464 // @dev Throws error if limit not found.
465 // @param limit Name of the limit. Valid names:
466 // "ownerCanTransfer",
467 // "ownerCanDestroy",
468 // "transfersEnabled"
469 // @param value Value of the limit.
470 //
471 // Selector: setCollectionLimit(string,bool) 993b7fba
472 function setCollectionLimit(string memory limit, bool value) public {
473 require(false, stub_error);
474 limit;
475 value;
476 dummy = 0;
477 }
478
479 // Get contract address.
480 //
481 // Selector: contractAddress() f6b4dfb4
482 function contractAddress() public view returns (address) {
483 require(false, stub_error);
484 dummy;
485 return 0x0000000000000000000000000000000000000000;
486 }
487
488 // Add collection admin by substrate address.
489 // @param new_admin Substrate administrator address.
490 //
491 // Selector: addCollectionAdminSubstrate(uint256) 5730062b
492 function addCollectionAdminSubstrate(uint256 newAdmin) public {
493 require(false, stub_error);
494 newAdmin;
495 dummy = 0;
496 }
497
498 // Remove collection admin by substrate address.
499 // @param admin Substrate administrator address.
500 //
501 // Selector: removeCollectionAdminSubstrate(uint256) 4048fcf9
502 function removeCollectionAdminSubstrate(uint256 admin) public {
503 require(false, stub_error);
504 admin;
505 dummy = 0;
506 }
507
508 // Add collection admin.
509 // @param new_admin Address of the added administrator.
510 //
511 // Selector: addCollectionAdmin(address) 92e462c7
512 function addCollectionAdmin(address newAdmin) public {
513 require(false, stub_error);
514 newAdmin;
515 dummy = 0;
516 }
517
518 // Remove collection admin.
519 //
520 // @param new_admin Address of the removed administrator.
521 //
522 // Selector: removeCollectionAdmin(address) fafd7b42
523 function removeCollectionAdmin(address admin) public {
524 require(false, stub_error);
525 admin;
526 dummy = 0;
527 }
528
529 // Toggle accessibility of collection nesting.
530 //
531 // @param enable If "true" degenerates to nesting: 'Owner' else to nesting: 'Disabled'
532 //
533 // Selector: setCollectionNesting(bool) 112d4586
534 function setCollectionNesting(bool enable) public {
535 require(false, stub_error);
536 enable;
537 dummy = 0;
538 }
539
540 // Toggle accessibility of collection nesting.
541 //
542 // @param enable If "true" degenerates to nesting: {OwnerRestricted: [1, 2, 3]} else to nesting: 'Disabled'
543 // @param collections Addresses of collections that will be available for nesting.
544 //
545 // Selector: setCollectionNesting(bool,address[]) 64872396
546 function setCollectionNesting(bool enable, address[] memory collections)
547 public
548 {
549 require(false, stub_error);
550 enable;
551 collections;
552 dummy = 0;
553 }
554
555 // Set the collection access method.
556 // @param mode Access mode
557 // 0 for Normal
558 // 1 for AllowList
559 //
560 // Selector: setCollectionAccess(uint8) 41835d4c
561 function setCollectionAccess(uint8 mode) public {
562 require(false, stub_error);
563 mode;
564 dummy = 0;
565 }
566
567 // Add the user to the allowed list.
568 //
569 // @param user Address of a trusted user.
570 //
571 // Selector: addToCollectionAllowList(address) 67844fe6
572 function addToCollectionAllowList(address user) public {
573 require(false, stub_error);
574 user;
575 dummy = 0;
576 }
577
578 // Remove the user from the allowed list.
579 //
580 // @param user Address of a removed user.
581 //
582 // Selector: removeFromCollectionAllowList(address) 85c51acb
583 function removeFromCollectionAllowList(address user) public {
584 require(false, stub_error);
585 user;
586 dummy = 0;
587 }
588
589 // Switch permission for minting.
590 //
591 // @param mode Enable if "true".
592 //
593 // Selector: setCollectionMintMode(bool) 00018e84
594 function setCollectionMintMode(bool mode) public {
595 require(false, stub_error);
596 mode;
597 dummy = 0;
598 }
599
600 // Check that account is the owner or admin of the collection
601 //
602 // @param user account to verify
603 // @return "true" if account is the owner or admin
604 //
605 // Selector: verifyOwnerOrAdmin(address) c2282493
606 function verifyOwnerOrAdmin(address user) public view returns (bool) {
607 require(false, stub_error);
608 user;
609 dummy;
610 return false;
611 }
612
613 // Returns collection type
614 //
615 // @return `Fungible` or `NFT` or `ReFungible`
616 //
617 // Selector: uniqueCollectionType() d34b55b8
618 function uniqueCollectionType() public returns (string memory) {
619 require(false, stub_error);
620 dummy = 0;
621 return "";
622 }
623}
624373
625// Selector: 780e9d63374// Selector: 780e9d63
626contract ERC721Enumerable is Dummy, ERC165 {375contract ERC721Enumerable is Dummy, ERC165 {
757 }506 }
758}507}
508
509// Selector: ca08c92c
510contract Collection is Dummy, ERC165 {
511 // Set collection property.
512 //
513 // @param key Property key.
514 // @param value Propery value.
515 //
516 // Selector: setCollectionProperty(string,bytes) 2f073f66
517 function setCollectionProperty(string memory key, bytes memory value)
518 public
519 {
520 require(false, stub_error);
521 key;
522 value;
523 dummy = 0;
524 }
525
526 // Delete collection property.
527 //
528 // @param key Property key.
529 //
530 // Selector: deleteCollectionProperty(string) 7b7debce
531 function deleteCollectionProperty(string memory key) public {
532 require(false, stub_error);
533 key;
534 dummy = 0;
535 }
536
537 // Get collection property.
538 //
539 // @dev Throws error if key not found.
540 //
541 // @param key Property key.
542 // @return bytes The property corresponding to the key.
543 //
544 // Selector: collectionProperty(string) cf24fd6d
545 function collectionProperty(string memory key)
546 public
547 view
548 returns (bytes memory)
549 {
550 require(false, stub_error);
551 key;
552 dummy;
553 return hex"";
554 }
555
556 // Set the sponsor of the collection.
557 //
558 // @dev In order for sponsorship to work, it must be confirmed on behalf of the sponsor.
559 //
560 // @param sponsor Address of the sponsor from whose account funds will be debited for operations with the contract.
561 //
562 // Selector: setCollectionSponsor(address) 7623402e
563 function setCollectionSponsor(address sponsor) public {
564 require(false, stub_error);
565 sponsor;
566 dummy = 0;
567 }
568
569 // Collection sponsorship confirmation.
570 //
571 // @dev After setting the sponsor for the collection, it must be confirmed with this function.
572 //
573 // Selector: confirmCollectionSponsorship() 3c50e97a
574 function confirmCollectionSponsorship() public {
575 require(false, stub_error);
576 dummy = 0;
577 }
578
579 // Set limits for the collection.
580 // @dev Throws error if limit not found.
581 // @param limit Name of the limit. Valid names:
582 // "accountTokenOwnershipLimit",
583 // "sponsoredDataSize",
584 // "sponsoredDataRateLimit",
585 // "tokenLimit",
586 // "sponsorTransferTimeout",
587 // "sponsorApproveTimeout"
588 // @param value Value of the limit.
589 //
590 // Selector: setCollectionLimit(string,uint32) 6a3841db
591 function setCollectionLimit(string memory limit, uint32 value) public {
592 require(false, stub_error);
593 limit;
594 value;
595 dummy = 0;
596 }
597
598 // Set limits for the collection.
599 // @dev Throws error if limit not found.
600 // @param limit Name of the limit. Valid names:
601 // "ownerCanTransfer",
602 // "ownerCanDestroy",
603 // "transfersEnabled"
604 // @param value Value of the limit.
605 //
606 // Selector: setCollectionLimit(string,bool) 993b7fba
607 function setCollectionLimit(string memory limit, bool value) public {
608 require(false, stub_error);
609 limit;
610 value;
611 dummy = 0;
612 }
613
614 // Get contract address.
615 //
616 // Selector: contractAddress() f6b4dfb4
617 function contractAddress() public view returns (address) {
618 require(false, stub_error);
619 dummy;
620 return 0x0000000000000000000000000000000000000000;
621 }
622
623 // Add collection admin by substrate address.
624 // @param new_admin Substrate administrator address.
625 //
626 // Selector: addCollectionAdminSubstrate(uint256) 5730062b
627 function addCollectionAdminSubstrate(uint256 newAdmin) public {
628 require(false, stub_error);
629 newAdmin;
630 dummy = 0;
631 }
632
633 // Remove collection admin by substrate address.
634 // @param admin Substrate administrator address.
635 //
636 // Selector: removeCollectionAdminSubstrate(uint256) 4048fcf9
637 function removeCollectionAdminSubstrate(uint256 admin) public {
638 require(false, stub_error);
639 admin;
640 dummy = 0;
641 }
642
643 // Add collection admin.
644 // @param new_admin Address of the added administrator.
645 //
646 // Selector: addCollectionAdmin(address) 92e462c7
647 function addCollectionAdmin(address newAdmin) public {
648 require(false, stub_error);
649 newAdmin;
650 dummy = 0;
651 }
652
653 // Remove collection admin.
654 //
655 // @param new_admin Address of the removed administrator.
656 //
657 // Selector: removeCollectionAdmin(address) fafd7b42
658 function removeCollectionAdmin(address admin) public {
659 require(false, stub_error);
660 admin;
661 dummy = 0;
662 }
663
664 // Toggle accessibility of collection nesting.
665 //
666 // @param enable If "true" degenerates to nesting: 'Owner' else to nesting: 'Disabled'
667 //
668 // Selector: setCollectionNesting(bool) 112d4586
669 function setCollectionNesting(bool enable) public {
670 require(false, stub_error);
671 enable;
672 dummy = 0;
673 }
674
675 // Toggle accessibility of collection nesting.
676 //
677 // @param enable If "true" degenerates to nesting: {OwnerRestricted: [1, 2, 3]} else to nesting: 'Disabled'
678 // @param collections Addresses of collections that will be available for nesting.
679 //
680 // Selector: setCollectionNesting(bool,address[]) 64872396
681 function setCollectionNesting(bool enable, address[] memory collections)
682 public
683 {
684 require(false, stub_error);
685 enable;
686 collections;
687 dummy = 0;
688 }
689
690 // Set the collection access method.
691 // @param mode Access mode
692 // 0 for Normal
693 // 1 for AllowList
694 //
695 // Selector: setCollectionAccess(uint8) 41835d4c
696 function setCollectionAccess(uint8 mode) public {
697 require(false, stub_error);
698 mode;
699 dummy = 0;
700 }
701
702 // Add the user to the allowed list.
703 //
704 // @param user Address of a trusted user.
705 //
706 // Selector: addToCollectionAllowList(address) 67844fe6
707 function addToCollectionAllowList(address user) public {
708 require(false, stub_error);
709 user;
710 dummy = 0;
711 }
712
713 // Remove the user from the allowed list.
714 //
715 // @param user Address of a removed user.
716 //
717 // Selector: removeFromCollectionAllowList(address) 85c51acb
718 function removeFromCollectionAllowList(address user) public {
719 require(false, stub_error);
720 user;
721 dummy = 0;
722 }
723
724 // Switch permission for minting.
725 //
726 // @param mode Enable if "true".
727 //
728 // Selector: setCollectionMintMode(bool) 00018e84
729 function setCollectionMintMode(bool mode) public {
730 require(false, stub_error);
731 mode;
732 dummy = 0;
733 }
734
735 // Check that account is the owner or admin of the collection
736 //
737 // @param user account to verify
738 // @return "true" if account is the owner or admin
739 //
740 // Selector: verifyOwnerOrAdmin(address) c2282493
741 function verifyOwnerOrAdmin(address user) public view returns (bool) {
742 require(false, stub_error);
743 user;
744 dummy;
745 return false;
746 }
747
748 // Returns collection type
749 //
750 // @return `Fungible` or `NFT` or `ReFungible`
751 //
752 // Selector: uniqueCollectionType() d34b55b8
753 function uniqueCollectionType() public returns (string memory) {
754 require(false, stub_error);
755 dummy = 0;
756 return "";
757 }
758
759 // Changes collection owner
760 //
761 // @dev Owner can be changed only by current owner
762 // @param newOwner new owner
763 //
764 // Selector: changeOwner(address) a6f9dae1
765 function changeOwner(address newOwner) public {
766 require(false, stub_error);
767 newOwner;
768 dummy = 0;
769 }
770}
759771
760contract UniqueRefungible is772contract UniqueRefungible is
761 Dummy,773 Dummy,
modifiedtests/src/eth/api/UniqueFungible.soldiffbeforeafterboth
--- a/tests/src/eth/api/UniqueFungible.sol
+++ b/tests/src/eth/api/UniqueFungible.sol
@@ -22,7 +22,50 @@
 	);
 }
 
-// Selector: 6cf113cd
+// Selector: 79cc6790
+interface ERC20UniqueExtensions is Dummy, ERC165 {
+	// Selector: burnFrom(address,uint256) 79cc6790
+	function burnFrom(address from, uint256 amount) external returns (bool);
+}
+
+// Selector: 942e8b22
+interface ERC20 is Dummy, ERC165, ERC20Events {
+	// Selector: name() 06fdde03
+	function name() external view returns (string memory);
+
+	// Selector: symbol() 95d89b41
+	function symbol() external view returns (string memory);
+
+	// Selector: totalSupply() 18160ddd
+	function totalSupply() external view returns (uint256);
+
+	// Selector: decimals() 313ce567
+	function decimals() external view returns (uint8);
+
+	// Selector: balanceOf(address) 70a08231
+	function balanceOf(address owner) external view returns (uint256);
+
+	// Selector: transfer(address,uint256) a9059cbb
+	function transfer(address to, uint256 amount) external returns (bool);
+
+	// Selector: transferFrom(address,address,uint256) 23b872dd
+	function transferFrom(
+		address from,
+		address to,
+		uint256 amount
+	) external returns (bool);
+
+	// Selector: approve(address,uint256) 095ea7b3
+	function approve(address spender, uint256 amount) external returns (bool);
+
+	// Selector: allowance(address,address) dd62ed3e
+	function allowance(address owner, address spender)
+		external
+		view
+		returns (uint256);
+}
+
+// Selector: ca08c92c
 interface Collection is Dummy, ERC165 {
 	// Set collection property.
 	//
@@ -183,49 +226,14 @@
 	//
 	// Selector: uniqueCollectionType() d34b55b8
 	function uniqueCollectionType() external returns (string memory);
-}
 
-// Selector: 79cc6790
-interface ERC20UniqueExtensions is Dummy, ERC165 {
-	// Selector: burnFrom(address,uint256) 79cc6790
-	function burnFrom(address from, uint256 amount) external returns (bool);
-}
-
-// Selector: 942e8b22
-interface ERC20 is Dummy, ERC165, ERC20Events {
-	// Selector: name() 06fdde03
-	function name() external view returns (string memory);
-
-	// Selector: symbol() 95d89b41
-	function symbol() external view returns (string memory);
-
-	// Selector: totalSupply() 18160ddd
-	function totalSupply() external view returns (uint256);
-
-	// Selector: decimals() 313ce567
-	function decimals() external view returns (uint8);
-
-	// Selector: balanceOf(address) 70a08231
-	function balanceOf(address owner) external view returns (uint256);
-
-	// Selector: transfer(address,uint256) a9059cbb
-	function transfer(address to, uint256 amount) external returns (bool);
-
-	// Selector: transferFrom(address,address,uint256) 23b872dd
-	function transferFrom(
-		address from,
-		address to,
-		uint256 amount
-	) external returns (bool);
-
-	// Selector: approve(address,uint256) 095ea7b3
-	function approve(address spender, uint256 amount) external returns (bool);
-
-	// Selector: allowance(address,address) dd62ed3e
-	function allowance(address owner, address spender)
-		external
-		view
-		returns (uint256);
+	// Changes collection owner
+	//
+	// @dev Owner can be changed only by current owner
+	// @param newOwner new owner
+	//
+	// Selector: changeOwner(address) a6f9dae1
+	function changeOwner(address newOwner) external;
 }
 
 interface UniqueFungible is
modifiedtests/src/eth/api/UniqueNFT.soldiffbeforeafterboth
--- a/tests/src/eth/api/UniqueNFT.sol
+++ b/tests/src/eth/api/UniqueNFT.sol
@@ -250,7 +250,33 @@
 	function finishMinting() external returns (bool);
 }
 
-// Selector: 6cf113cd
+// Selector: 780e9d63
+interface ERC721Enumerable is Dummy, ERC165 {
+	// @notice Enumerate valid NFTs
+	// @param index A counter less than `totalSupply()`
+	// @return The token identifier for the `index`th NFT,
+	//  (sort order not specified)
+	//
+	// Selector: tokenByIndex(uint256) 4f6ccce7
+	function tokenByIndex(uint256 index) external view returns (uint256);
+
+	// @dev Not implemented
+	//
+	// Selector: tokenOfOwnerByIndex(address,uint256) 2f745c59
+	function tokenOfOwnerByIndex(address owner, uint256 index)
+		external
+		view
+		returns (uint256);
+
+	// @notice Count NFTs tracked by this contract
+	// @return A count of valid NFTs tracked by this contract, where each one of
+	//  them has an assigned and queryable owner not equal to the zero address
+	//
+	// Selector: totalSupply() 18160ddd
+	function totalSupply() external view returns (uint256);
+}
+
+// Selector: ca08c92c
 interface Collection is Dummy, ERC165 {
 	// Set collection property.
 	//
@@ -411,32 +437,14 @@
 	//
 	// Selector: uniqueCollectionType() d34b55b8
 	function uniqueCollectionType() external returns (string memory);
-}
 
-// Selector: 780e9d63
-interface ERC721Enumerable is Dummy, ERC165 {
-	// @notice Enumerate valid NFTs
-	// @param index A counter less than `totalSupply()`
-	// @return The token identifier for the `index`th NFT,
-	//  (sort order not specified)
+	// Changes collection owner
 	//
-	// Selector: tokenByIndex(uint256) 4f6ccce7
-	function tokenByIndex(uint256 index) external view returns (uint256);
-
-	// @dev Not implemented
+	// @dev Owner can be changed only by current owner
+	// @param newOwner new owner
 	//
-	// Selector: tokenOfOwnerByIndex(address,uint256) 2f745c59
-	function tokenOfOwnerByIndex(address owner, uint256 index)
-		external
-		view
-		returns (uint256);
-
-	// @notice Count NFTs tracked by this contract
-	// @return A count of valid NFTs tracked by this contract, where each one of
-	//  them has an assigned and queryable owner not equal to the zero address
-	//
-	// Selector: totalSupply() 18160ddd
-	function totalSupply() external view returns (uint256);
+	// Selector: changeOwner(address) a6f9dae1
+	function changeOwner(address newOwner) external;
 }
 
 // Selector: d74d154f
modifiedtests/src/eth/api/UniqueRefungible.soldiffbeforeafterboth
--- a/tests/src/eth/api/UniqueRefungible.sol
+++ b/tests/src/eth/api/UniqueRefungible.sol
@@ -248,7 +248,96 @@
 	function finishMinting() external returns (bool);
 }
 
-// Selector: 6cf113cd
+// Selector: 780e9d63
+interface ERC721Enumerable is Dummy, ERC165 {
+	// @notice Enumerate valid RFTs
+	// @param index A counter less than `totalSupply()`
+	// @return The token identifier for the `index`th NFT,
+	//  (sort order not specified)
+	//
+	// Selector: tokenByIndex(uint256) 4f6ccce7
+	function tokenByIndex(uint256 index) external view returns (uint256);
+
+	// Not implemented
+	//
+	// Selector: tokenOfOwnerByIndex(address,uint256) 2f745c59
+	function tokenOfOwnerByIndex(address owner, uint256 index)
+		external
+		view
+		returns (uint256);
+
+	// @notice Count RFTs tracked by this contract
+	// @return A count of valid RFTs tracked by this contract, where each one of
+	//  them has an assigned and queryable owner not equal to the zero address
+	//
+	// Selector: totalSupply() 18160ddd
+	function totalSupply() external view returns (uint256);
+}
+
+// Selector: 7c3bef89
+interface ERC721UniqueExtensions is Dummy, ERC165 {
+	// @notice Transfer ownership of an RFT
+	// @dev Throws unless `msg.sender` is the current owner. Throws if `to`
+	//  is the zero address. Throws if `tokenId` is not a valid RFT.
+	//  Throws if RFT pieces have multiple owners.
+	// @param to The new owner
+	// @param tokenId The RFT to transfer
+	// @param _value Not used for an RFT
+	//
+	// Selector: transfer(address,uint256) a9059cbb
+	function transfer(address to, uint256 tokenId) external;
+
+	// @notice Burns a specific ERC721 token.
+	// @dev Throws unless `msg.sender` is the current owner or an authorized
+	//  operator for this RFT. Throws if `from` is not the current owner. Throws
+	//  if `to` is the zero address. Throws if `tokenId` is not a valid RFT.
+	//  Throws if RFT pieces have multiple owners.
+	// @param from The current owner of the RFT
+	// @param tokenId The RFT to transfer
+	// @param _value Not used for an RFT
+	//
+	// Selector: burnFrom(address,uint256) 79cc6790
+	function burnFrom(address from, uint256 tokenId) external;
+
+	// @notice Returns next free RFT ID.
+	//
+	// Selector: nextTokenId() 75794a3c
+	function nextTokenId() external view returns (uint256);
+
+	// @notice Function to mint multiple tokens.
+	// @dev `tokenIds` should be an array of consecutive numbers and first number
+	//  should be obtained with `nextTokenId` method
+	// @param to The new owner
+	// @param tokenIds IDs of the minted RFTs
+	//
+	// Selector: mintBulk(address,uint256[]) 44a9945e
+	function mintBulk(address to, uint256[] memory tokenIds)
+		external
+		returns (bool);
+
+	// @notice Function to mint multiple tokens with the given tokenUris.
+	// @dev `tokenIds` is array of pairs of token ID and token URI. Token IDs should be consecutive
+	//  numbers and first number should be obtained with `nextTokenId` method
+	// @param to The new owner
+	// @param tokens array of pairs of token ID and token URI for minted tokens
+	//
+	// Selector: mintBulkWithTokenURI(address,(uint256,string)[]) 36543006
+	function mintBulkWithTokenURI(address to, Tuple0[] memory tokens)
+		external
+		returns (bool);
+
+	// Returns EVM address for refungible token
+	//
+	// @param token ID of the token
+	//
+	// Selector: tokenContractAddress(uint256) ab76fac6
+	function tokenContractAddress(uint256 token)
+		external
+		view
+		returns (address);
+}
+
+// Selector: ca08c92c
 interface Collection is Dummy, ERC165 {
 	// Set collection property.
 	//
@@ -409,95 +498,14 @@
 	//
 	// Selector: uniqueCollectionType() d34b55b8
 	function uniqueCollectionType() external returns (string memory);
-}
-
-// Selector: 780e9d63
-interface ERC721Enumerable is Dummy, ERC165 {
-	// @notice Enumerate valid RFTs
-	// @param index A counter less than `totalSupply()`
-	// @return The token identifier for the `index`th NFT,
-	//  (sort order not specified)
-	//
-	// Selector: tokenByIndex(uint256) 4f6ccce7
-	function tokenByIndex(uint256 index) external view returns (uint256);
-
-	// Not implemented
-	//
-	// Selector: tokenOfOwnerByIndex(address,uint256) 2f745c59
-	function tokenOfOwnerByIndex(address owner, uint256 index)
-		external
-		view
-		returns (uint256);
-
-	// @notice Count RFTs tracked by this contract
-	// @return A count of valid RFTs tracked by this contract, where each one of
-	//  them has an assigned and queryable owner not equal to the zero address
-	//
-	// Selector: totalSupply() 18160ddd
-	function totalSupply() external view returns (uint256);
-}
 
-// Selector: 7c3bef89
-interface ERC721UniqueExtensions is Dummy, ERC165 {
-	// @notice Transfer ownership of an RFT
-	// @dev Throws unless `msg.sender` is the current owner. Throws if `to`
-	//  is the zero address. Throws if `tokenId` is not a valid RFT.
-	//  Throws if RFT pieces have multiple owners.
-	// @param to The new owner
-	// @param tokenId The RFT to transfer
-	// @param _value Not used for an RFT
-	//
-	// Selector: transfer(address,uint256) a9059cbb
-	function transfer(address to, uint256 tokenId) external;
-
-	// @notice Burns a specific ERC721 token.
-	// @dev Throws unless `msg.sender` is the current owner or an authorized
-	//  operator for this RFT. Throws if `from` is not the current owner. Throws
-	//  if `to` is the zero address. Throws if `tokenId` is not a valid RFT.
-	//  Throws if RFT pieces have multiple owners.
-	// @param from The current owner of the RFT
-	// @param tokenId The RFT to transfer
-	// @param _value Not used for an RFT
-	//
-	// Selector: burnFrom(address,uint256) 79cc6790
-	function burnFrom(address from, uint256 tokenId) external;
-
-	// @notice Returns next free RFT ID.
-	//
-	// Selector: nextTokenId() 75794a3c
-	function nextTokenId() external view returns (uint256);
-
-	// @notice Function to mint multiple tokens.
-	// @dev `tokenIds` should be an array of consecutive numbers and first number
-	//  should be obtained with `nextTokenId` method
-	// @param to The new owner
-	// @param tokenIds IDs of the minted RFTs
-	//
-	// Selector: mintBulk(address,uint256[]) 44a9945e
-	function mintBulk(address to, uint256[] memory tokenIds)
-		external
-		returns (bool);
-
-	// @notice Function to mint multiple tokens with the given tokenUris.
-	// @dev `tokenIds` is array of pairs of token ID and token URI. Token IDs should be consecutive
-	//  numbers and first number should be obtained with `nextTokenId` method
-	// @param to The new owner
-	// @param tokens array of pairs of token ID and token URI for minted tokens
+	// Changes collection owner
 	//
-	// Selector: mintBulkWithTokenURI(address,(uint256,string)[]) 36543006
-	function mintBulkWithTokenURI(address to, Tuple0[] memory tokens)
-		external
-		returns (bool);
-
-	// Returns EVM address for refungible token
-	//
-	// @param token ID of the token
+	// @dev Owner can be changed only by current owner
+	// @param newOwner new owner
 	//
-	// Selector: tokenContractAddress(uint256) ab76fac6
-	function tokenContractAddress(uint256 token)
-		external
-		view
-		returns (address);
+	// Selector: changeOwner(address) a6f9dae1
+	function changeOwner(address newOwner) external;
 }
 
 interface UniqueRefungible is
modifiedtests/src/eth/collectionAdmin.test.tsdiffbeforeafterboth
--- a/tests/src/eth/collectionAdmin.test.ts
+++ b/tests/src/eth/collectionAdmin.test.ts
@@ -15,6 +15,7 @@
 
 import {expect} from 'chai';
 import privateKey from '../substrate/privateKey';
+import { UNIQUE } from '../util/helpers';
 import {
   createEthAccount,
   createEthAccountWithBalance, 
@@ -22,6 +23,7 @@
   evmCollectionHelpers, 
   getCollectionAddressFromResult, 
   itWeb3,
+  recordEthFee,
 } from './util/helpers';
 
 describe('Add collection admins', () => {
@@ -309,4 +311,51 @@
     expect(adminList[0].asSubstrate.toString().toLocaleLowerCase())
       .to.be.eq(adminSub.address.toLocaleLowerCase());
   });
+});
+
+describe('Change owner tests', () => {
+  itWeb3('Change owner', async ({api, web3, privateKeyWrapper}) => {
+    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
+    const newOwner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
+    const collectionHelper = evmCollectionHelpers(web3, owner);
+    const result = await collectionHelper.methods
+      .createNonfungibleCollection('A', 'B', 'C')
+      .send();
+    const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
+    const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
+  
+    await collectionEvm.methods.changeOwner(newOwner).send();
+  
+    expect(await collectionEvm.methods.verifyOwnerOrAdmin(owner).call()).to.be.false;
+    expect(await collectionEvm.methods.verifyOwnerOrAdmin(newOwner).call()).to.be.true;
+  });
+
+  itWeb3('change owner call fee', async ({web3, api, privateKeyWrapper}) => {
+    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
+    const newOwner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
+    const collectionHelper = evmCollectionHelpers(web3, owner);
+    const result = await collectionHelper.methods
+      .createNonfungibleCollection('A', 'B', 'C')
+      .send();
+    const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
+    const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
+
+    const cost = await recordEthFee(api, owner, () => collectionEvm.methods.changeOwner(newOwner).send());
+    expect(cost < BigInt(0.2 * Number(UNIQUE)));
+    expect(cost > 0);
+  });
+
+  itWeb3('(!negative tests!) call changeOwner by not owner', async ({api, web3, privateKeyWrapper}) => {
+    const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
+    const newOwner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
+    const collectionHelper = evmCollectionHelpers(web3, owner);
+    const result = await collectionHelper.methods
+      .createNonfungibleCollection('A', 'B', 'C')
+      .send();
+    const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);
+    const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
+  
+    await expect(collectionEvm.methods.changeOwner(newOwner).send({from: newOwner})).to.be.rejected;
+    expect(await collectionEvm.methods.verifyOwnerOrAdmin(newOwner).call()).to.be.false;
+  });
 });
\ No newline at end of file
modifiedtests/src/eth/fungibleAbi.jsondiffbeforeafterboth
--- a/tests/src/eth/fungibleAbi.json
+++ b/tests/src/eth/fungibleAbi.json
@@ -116,6 +116,15 @@
     "type": "function"
   },
   {
+    "inputs": [
+      { "internalType": "address", "name": "newOwner", "type": "address" }
+    ],
+    "name": "changeOwner",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
     "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],
     "name": "collectionProperty",
     "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],
modifiedtests/src/eth/nonFungibleAbi.jsondiffbeforeafterboth
--- a/tests/src/eth/nonFungibleAbi.json
+++ b/tests/src/eth/nonFungibleAbi.json
@@ -146,6 +146,15 @@
     "type": "function"
   },
   {
+    "inputs": [
+      { "internalType": "address", "name": "newOwner", "type": "address" }
+    ],
+    "name": "changeOwner",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
     "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],
     "name": "collectionProperty",
     "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],
modifiedtests/src/eth/reFungibleAbi.jsondiffbeforeafterboth
--- a/tests/src/eth/reFungibleAbi.json
+++ b/tests/src/eth/reFungibleAbi.json
@@ -146,6 +146,15 @@
     "type": "function"
   },
   {
+    "inputs": [
+      { "internalType": "address", "name": "newOwner", "type": "address" }
+    ],
+    "name": "changeOwner",
+    "outputs": [],
+    "stateMutability": "nonpayable",
+    "type": "function"
+  },
+  {
     "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],
     "name": "collectionProperty",
     "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],