git.delta.rocks / unique-network / refs/commits / 149c99dda705

difftreelog

Merge pull request #719 from UniqueNetwork/feature/transferCross

Yaroslav Bolyukin2022-11-21parents: #5f0218a #171847d.patch.diff
in: master

26 files changed

modifiedCargo.lockdiffbeforeafterboth
61216121
6122[[package]]6122[[package]]
6123name = "pallet-fungible"6123name = "pallet-fungible"
6124version = "0.1.6"6124version = "0.1.7"
6125dependencies = [6125dependencies = [
6126 "ethereum",6126 "ethereum",
6127 "evm-coder",6127 "evm-coder",
63766376
6377[[package]]6377[[package]]
6378name = "pallet-nonfungible"6378name = "pallet-nonfungible"
6379version = "0.1.8"6379version = "0.1.9"
6380dependencies = [6380dependencies = [
6381 "ethereum",6381 "ethereum",
6382 "evm-coder",6382 "evm-coder",
64986498
6499[[package]]6499[[package]]
6500name = "pallet-refungible"6500name = "pallet-refungible"
6501version = "0.2.7"6501version = "0.2.8"
6502dependencies = [6502dependencies = [
6503 "derivative",6503 "derivative",
6504 "ethereum",6504 "ethereum",
modifiedpallets/fungible/CHANGELOG.mddiffbeforeafterboth
22
3All notable changes to this project will be documented in this file.3All notable changes to this project will be documented in this file.
44
5<!-- bureaucrate goes here -->
6
7## [0.1.7] - 2022-11-14
8
9### Changed
10
11- Added `transfer_cross` in eth functions.
12
5## [0.1.6] - 2022-11-0213## [0.1.6] - 2022-11-02
14
6### Changed15### Changed
7 - Use named structure `EthCrossAccount` in eth functions.
816
17- Use named structure `EthCrossAccount` in eth functions.
18
9## [0.1.5] - 2022-08-2919## [0.1.5] - 2022-08-29
1020
11### Added21### Added
1222
13 - Implementation of `mint` and `mint_bulk` methods for ERC20 API.23- Implementation of `mint` and `mint_bulk` methods for ERC20 API.
1424
15## [v0.1.4] - 2022-08-2425## [v0.1.4] - 2022-08-24
1626
17### Change27### Change
18 - Add bound `AsRef<[u8; 32]>` to `T::CrossAccountId`.
1928
20<!-- bureaucrate goes here -->29- Add bound `AsRef<[u8; 32]>` to `T::CrossAccountId`.
30
21## [v0.1.3] 2022-08-1631## [v0.1.3] 2022-08-16
2232
4151
42### Fixed52### Fixed
4353
44 - Issue with ItemCreated event containing total supply of tokens instead minted amount54- Issue with ItemCreated event containing total supply of tokens instead minted amount
4555
46## [0.1.1] - 2022-07-1456## [0.1.1] - 2022-07-14
4757
48### Added58### Added
4959
50 - Implementation of RPC method `token_owners` returning 10 owners in no particular order.60- Implementation of RPC method `token_owners` returning 10 owners in no particular order.
51 This was an internal request to improve the web interface and support fractionalization event.61 This was an internal request to improve the web interface and support fractionalization event.
5262
modifiedpallets/fungible/Cargo.tomldiffbeforeafterboth
1[package]1[package]
2name = "pallet-fungible"2name = "pallet-fungible"
3version = "0.1.6"3version = "0.1.7"
4license = "GPLv3"4license = "GPLv3"
5edition = "2021"5edition = "2021"
66
modifiedpallets/fungible/src/erc.rsdiffbeforeafterboth
238 Ok(true)239 Ok(true)
239 }240 }
241
242 #[weight(<SelfWeightOf<T>>::transfer())]
243 fn transfer_cross(
244 &mut self,
245 caller: caller,
246 to: EthCrossAccount,
247 amount: uint256,
248 ) -> Result<bool> {
249 let caller = T::CrossAccountId::from_eth(caller);
250 let to = to.into_sub_cross_account::<T>()?;
251 let amount = amount.try_into().map_err(|_| "amount overflow")?;
252 let budget = self
253 .recorder
254 .weight_calls_budget(<StructureWeight<T>>::find_parent());
255
256 <Pallet<T>>::transfer(self, &caller, &to, amount, &budget).map_err(|_| "transfer error")?;
257 Ok(true)
258 }
240259
241 #[weight(<SelfWeightOf<T>>::transfer_from())]260 #[weight(<SelfWeightOf<T>>::transfer_from())]
242 fn transfer_from_cross(261 fn transfer_from_cross(
modifiedpallets/fungible/src/stubs/UniqueFungible.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/fungible/src/stubs/UniqueFungible.soldiffbeforeafterboth
38 /// @param properties Vector of properties key/value pair.38 /// @param properties Vector of properties key/value pair.
39 /// @dev EVM selector for this function is: 0x50b26b2a,39 /// @dev EVM selector for this function is: 0x50b26b2a,
40 /// or in textual repr: setCollectionProperties((string,bytes)[])40 /// or in textual repr: setCollectionProperties((string,bytes)[])
41 function setCollectionProperties(Tuple14[] memory properties) public {41 function setCollectionProperties(Tuple15[] memory properties) public {
42 require(false, stub_error);42 require(false, stub_error);
43 properties;43 properties;
44 dummy = 0;44 dummy = 0;
87 /// @return Vector of properties key/value pairs.87 /// @return Vector of properties key/value pairs.
88 /// @dev EVM selector for this function is: 0x285fb8e6,88 /// @dev EVM selector for this function is: 0x285fb8e6,
89 /// or in textual repr: collectionProperties(string[])89 /// or in textual repr: collectionProperties(string[])
90 function collectionProperties(string[] memory keys) public view returns (Tuple14[] memory) {90 function collectionProperties(string[] memory keys) public view returns (Tuple15[] memory) {
91 require(false, stub_error);91 require(false, stub_error);
92 keys;92 keys;
93 dummy;93 dummy;
94 return new Tuple14[](0);94 return new Tuple15[](0);
95 }95 }
9696
97 /// Set the sponsor of the collection.97 /// Set the sponsor of the collection.
439}439}
440440
441/// @dev anonymous struct441/// @dev anonymous struct
442struct Tuple14 {442struct Tuple15 {
443 string field_0;443 string field_0;
444 bytes field_1;444 bytes field_1;
445}445}
446446
447/// @dev the ERC-165 identifier for this interface is 0x032e5926447/// @dev the ERC-165 identifier for this interface is 0x29f4dcd9
448contract ERC20UniqueExtensions is Dummy, ERC165 {448contract ERC20UniqueExtensions is Dummy, ERC165 {
449 /// @dev EVM selector for this function is: 0x0ecd0ab0,449 /// @dev EVM selector for this function is: 0x0ecd0ab0,
450 /// or in textual repr: approveCross((address,uint256),uint256)450 /// or in textual repr: approveCross((address,uint256),uint256)
497 return false;497 return false;
498 }498 }
499
500 /// @dev EVM selector for this function is: 0x2ada85ff,
501 /// or in textual repr: transferCross((address,uint256),uint256)
502 function transferCross(EthCrossAccount memory to, uint256 amount) public returns (bool) {
503 require(false, stub_error);
504 to;
505 amount;
506 dummy = 0;
507 return false;
508 }
499509
500 /// @dev EVM selector for this function is: 0xd5cf430b,510 /// @dev EVM selector for this function is: 0xd5cf430b,
501 /// or in textual repr: transferFromCross((address,uint256),(address,uint256),uint256)511 /// or in textual repr: transferFromCross((address,uint256),(address,uint256),uint256)
modifiedpallets/nonfungible/CHANGELOG.mddiffbeforeafterboth
44
5<!-- bureaucrate goes here -->5<!-- bureaucrate goes here -->
66
7## [0.1.9] - 2022-11-14
8
9### Changed
10
11- Added `transfer_cross` in eth functions.
12
7## [v0.1.8] - 2022-11-1113## [v0.1.8] - 2022-11-11
814
9### Changed15### Changed
modifiedpallets/nonfungible/Cargo.tomldiffbeforeafterboth
1[package]1[package]
2name = "pallet-nonfungible"2name = "pallet-nonfungible"
3version = "0.1.8"3version = "0.1.9"
4license = "GPLv3"4license = "GPLv3"
5edition = "2021"5edition = "2021"
66
modifiedpallets/nonfungible/src/erc.rsdiffbeforeafterboth
739 Ok(())739 Ok(())
740 }740 }
741
742 /// @notice Transfer ownership of an NFT
743 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`
744 /// is the zero address. Throws if `tokenId` is not a valid NFT.
745 /// @param to The new owner
746 /// @param tokenId The NFT to transfer
747 #[weight(<SelfWeightOf<T>>::transfer())]
748 fn transfer_cross(
749 &mut self,
750 caller: caller,
751 to: EthCrossAccount,
752 token_id: uint256,
753 ) -> Result<void> {
754 let caller = T::CrossAccountId::from_eth(caller);
755 let to = to.into_sub_cross_account::<T>()?;
756 let token = token_id.try_into()?;
757 let budget = self
758 .recorder
759 .weight_calls_budget(<StructureWeight<T>>::find_parent());
760
761 <Pallet<T>>::transfer(self, &caller, &to, token, &budget).map_err(dispatch_to_evm::<T>)?;
762 Ok(())
763 }
741764
742 /// @notice Transfer ownership of an NFT from cross account address to cross account address765 /// @notice Transfer ownership of an NFT from cross account address to cross account address
743 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`766 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`
modifiedpallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth
67 /// @param properties settable properties67 /// @param properties settable properties
68 /// @dev EVM selector for this function is: 0x14ed3a6e,68 /// @dev EVM selector for this function is: 0x14ed3a6e,
69 /// or in textual repr: setProperties(uint256,(string,bytes)[])69 /// or in textual repr: setProperties(uint256,(string,bytes)[])
70 function setProperties(uint256 tokenId, Tuple21[] memory properties) public {70 function setProperties(uint256 tokenId, Tuple22[] memory properties) public {
71 require(false, stub_error);71 require(false, stub_error);
72 tokenId;72 tokenId;
73 properties;73 properties;
137 /// @param properties Vector of properties key/value pair.137 /// @param properties Vector of properties key/value pair.
138 /// @dev EVM selector for this function is: 0x50b26b2a,138 /// @dev EVM selector for this function is: 0x50b26b2a,
139 /// or in textual repr: setCollectionProperties((string,bytes)[])139 /// or in textual repr: setCollectionProperties((string,bytes)[])
140 function setCollectionProperties(Tuple21[] memory properties) public {140 function setCollectionProperties(Tuple22[] memory properties) public {
141 require(false, stub_error);141 require(false, stub_error);
142 properties;142 properties;
143 dummy = 0;143 dummy = 0;
186 /// @return Vector of properties key/value pairs.186 /// @return Vector of properties key/value pairs.
187 /// @dev EVM selector for this function is: 0x285fb8e6,187 /// @dev EVM selector for this function is: 0x285fb8e6,
188 /// or in textual repr: collectionProperties(string[])188 /// or in textual repr: collectionProperties(string[])
189 function collectionProperties(string[] memory keys) public view returns (Tuple21[] memory) {189 function collectionProperties(string[] memory keys) public view returns (Tuple22[] memory) {
190 require(false, stub_error);190 require(false, stub_error);
191 keys;191 keys;
192 dummy;192 dummy;
193 return new Tuple21[](0);193 return new Tuple22[](0);
194 }194 }
195195
196 /// Set the sponsor of the collection.196 /// Set the sponsor of the collection.
251 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.251 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.
252 /// @dev EVM selector for this function is: 0x6ec0a9f1,252 /// @dev EVM selector for this function is: 0x6ec0a9f1,
253 /// or in textual repr: collectionSponsor()253 /// or in textual repr: collectionSponsor()
254 function collectionSponsor() public view returns (Tuple24 memory) {254 function collectionSponsor() public view returns (Tuple25 memory) {
255 require(false, stub_error);255 require(false, stub_error);
256 dummy;256 dummy;
257 return Tuple24(0x0000000000000000000000000000000000000000, 0);257 return Tuple25(0x0000000000000000000000000000000000000000, 0);
258 }258 }
259259
260 /// Set limits for the collection.260 /// Set limits for the collection.
538}538}
539539
540/// @dev anonymous struct540/// @dev anonymous struct
541struct Tuple24 {541struct Tuple25 {
542 address field_0;542 address field_0;
543 uint256 field_1;543 uint256 field_1;
544}544}
545545
546/// @dev anonymous struct546/// @dev anonymous struct
547struct Tuple21 {547struct Tuple22 {
548 string field_0;548 string field_0;
549 bytes field_1;549 bytes field_1;
550}550}
693}693}
694694
695/// @title Unique extensions for ERC721.695/// @title Unique extensions for ERC721.
696/// @dev the ERC-165 identifier for this interface is 0x244543ee696/// @dev the ERC-165 identifier for this interface is 0x0e9fc611
697contract ERC721UniqueExtensions is Dummy, ERC165 {697contract ERC721UniqueExtensions is Dummy, ERC165 {
698 /// @notice A descriptive name for a collection of NFTs in this contract698 /// @notice A descriptive name for a collection of NFTs in this contract
699 /// @dev EVM selector for this function is: 0x06fdde03,699 /// @dev EVM selector for this function is: 0x06fdde03,
742 dummy = 0;742 dummy = 0;
743 }743 }
744
745 /// @notice Transfer ownership of an NFT
746 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`
747 /// is the zero address. Throws if `tokenId` is not a valid NFT.
748 /// @param to The new owner
749 /// @param tokenId The NFT to transfer
750 /// @dev EVM selector for this function is: 0x2ada85ff,
751 /// or in textual repr: transferCross((address,uint256),uint256)
752 function transferCross(EthCrossAccount memory to, uint256 tokenId) public {
753 require(false, stub_error);
754 to;
755 tokenId;
756 dummy = 0;
757 }
744758
745 /// @notice Transfer ownership of an NFT from cross account address to cross account address759 /// @notice Transfer ownership of an NFT from cross account address to cross account address
746 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`760 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`
822 // /// @param tokens array of pairs of token ID and token URI for minted tokens836 // /// @param tokens array of pairs of token ID and token URI for minted tokens
823 // /// @dev EVM selector for this function is: 0x36543006,837 // /// @dev EVM selector for this function is: 0x36543006,
824 // /// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])838 // /// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])
825 // function mintBulkWithTokenURI(address to, Tuple10[] memory tokens) public returns (bool) {839 // function mintBulkWithTokenURI(address to, Tuple11[] memory tokens) public returns (bool) {
826 // require(false, stub_error);840 // require(false, stub_error);
827 // to;841 // to;
828 // tokens;842 // tokens;
833}847}
834848
835/// @dev anonymous struct849/// @dev anonymous struct
836struct Tuple10 {850struct Tuple11 {
837 uint256 field_0;851 uint256 field_0;
838 string field_1;852 string field_1;
839}853}
modifiedpallets/refungible/CHANGELOG.mddiffbeforeafterboth
44
5<!-- bureaucrate goes here -->5<!-- bureaucrate goes here -->
66
7## [0.2.8] - 2022-11-14
8
9### Changed
10
11- Added `transfer_cross` in eth functions.
12
7## [v0.2.7] - 2022-11-1113## [v0.2.7] - 2022-11-11
814
9### Changed15### Changed
modifiedpallets/refungible/Cargo.tomldiffbeforeafterboth
1[package]1[package]
2name = "pallet-refungible"2name = "pallet-refungible"
3version = "0.2.7"3version = "0.2.8"
4license = "GPLv3"4license = "GPLv3"
5edition = "2021"5edition = "2021"
66
modifiedpallets/refungible/src/erc.rsdiffbeforeafterboth
749 Ok(())749 Ok(())
750 }750 }
751
752 /// @notice Transfer ownership of an RFT
753 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`
754 /// is the zero address. Throws if `tokenId` is not a valid RFT.
755 /// Throws if RFT pieces have multiple owners.
756 /// @param to The new owner
757 /// @param tokenId The RFT to transfer
758 #[weight(<SelfWeightOf<T>>::transfer_creating_removing())]
759 fn transfer_cross(
760 &mut self,
761 caller: caller,
762 to: EthCrossAccount,
763 token_id: uint256,
764 ) -> Result<void> {
765 let caller = T::CrossAccountId::from_eth(caller);
766 let to = to.into_sub_cross_account::<T>()?;
767 let token = token_id.try_into()?;
768 let budget = self
769 .recorder
770 .weight_calls_budget(<StructureWeight<T>>::find_parent());
771
772 let balance = balance(self, token, &caller)?;
773 ensure_single_owner(self, token, balance)?;
774
775 <Pallet<T>>::transfer(self, &caller, &to, token, balance, &budget)
776 .map_err(dispatch_to_evm::<T>)?;
777 Ok(())
778 }
751779
752 /// @notice Transfer ownership of an RFT780 /// @notice Transfer ownership of an RFT
753 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`781 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`
modifiedpallets/refungible/src/stubs/UniqueRefungible.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/refungible/src/stubs/UniqueRefungible.soldiffbeforeafterboth
67 /// @param properties settable properties67 /// @param properties settable properties
68 /// @dev EVM selector for this function is: 0x14ed3a6e,68 /// @dev EVM selector for this function is: 0x14ed3a6e,
69 /// or in textual repr: setProperties(uint256,(string,bytes)[])69 /// or in textual repr: setProperties(uint256,(string,bytes)[])
70 function setProperties(uint256 tokenId, Tuple20[] memory properties) public {70 function setProperties(uint256 tokenId, Tuple21[] memory properties) public {
71 require(false, stub_error);71 require(false, stub_error);
72 tokenId;72 tokenId;
73 properties;73 properties;
137 /// @param properties Vector of properties key/value pair.137 /// @param properties Vector of properties key/value pair.
138 /// @dev EVM selector for this function is: 0x50b26b2a,138 /// @dev EVM selector for this function is: 0x50b26b2a,
139 /// or in textual repr: setCollectionProperties((string,bytes)[])139 /// or in textual repr: setCollectionProperties((string,bytes)[])
140 function setCollectionProperties(Tuple20[] memory properties) public {140 function setCollectionProperties(Tuple21[] memory properties) public {
141 require(false, stub_error);141 require(false, stub_error);
142 properties;142 properties;
143 dummy = 0;143 dummy = 0;
186 /// @return Vector of properties key/value pairs.186 /// @return Vector of properties key/value pairs.
187 /// @dev EVM selector for this function is: 0x285fb8e6,187 /// @dev EVM selector for this function is: 0x285fb8e6,
188 /// or in textual repr: collectionProperties(string[])188 /// or in textual repr: collectionProperties(string[])
189 function collectionProperties(string[] memory keys) public view returns (Tuple20[] memory) {189 function collectionProperties(string[] memory keys) public view returns (Tuple21[] memory) {
190 require(false, stub_error);190 require(false, stub_error);
191 keys;191 keys;
192 dummy;192 dummy;
193 return new Tuple20[](0);193 return new Tuple21[](0);
194 }194 }
195195
196 /// Set the sponsor of the collection.196 /// Set the sponsor of the collection.
251 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.251 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.
252 /// @dev EVM selector for this function is: 0x6ec0a9f1,252 /// @dev EVM selector for this function is: 0x6ec0a9f1,
253 /// or in textual repr: collectionSponsor()253 /// or in textual repr: collectionSponsor()
254 function collectionSponsor() public view returns (Tuple23 memory) {254 function collectionSponsor() public view returns (Tuple24 memory) {
255 require(false, stub_error);255 require(false, stub_error);
256 dummy;256 dummy;
257 return Tuple23(0x0000000000000000000000000000000000000000, 0);257 return Tuple24(0x0000000000000000000000000000000000000000, 0);
258 }258 }
259259
260 /// Set limits for the collection.260 /// Set limits for the collection.
538}538}
539539
540/// @dev anonymous struct540/// @dev anonymous struct
541struct Tuple23 {541struct Tuple24 {
542 address field_0;542 address field_0;
543 uint256 field_1;543 uint256 field_1;
544}544}
545545
546/// @dev anonymous struct546/// @dev anonymous struct
547struct Tuple20 {547struct Tuple21 {
548 string field_0;548 string field_0;
549 bytes field_1;549 bytes field_1;
550}550}
691}691}
692692
693/// @title Unique extensions for ERC721.693/// @title Unique extensions for ERC721.
694/// @dev the ERC-165 identifier for this interface is 0x81feb398694/// @dev the ERC-165 identifier for this interface is 0xab243667
695contract ERC721UniqueExtensions is Dummy, ERC165 {695contract ERC721UniqueExtensions is Dummy, ERC165 {
696 /// @notice A descriptive name for a collection of NFTs in this contract696 /// @notice A descriptive name for a collection of NFTs in this contract
697 /// @dev EVM selector for this function is: 0x06fdde03,697 /// @dev EVM selector for this function is: 0x06fdde03,
730 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`730 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`
731 /// is the zero address. Throws if `tokenId` is not a valid RFT.731 /// is the zero address. Throws if `tokenId` is not a valid RFT.
732 /// Throws if RFT pieces have multiple owners.732 /// Throws if RFT pieces have multiple owners.
733 /// @param to The new owner
734 /// @param tokenId The RFT to transfer
735 /// @dev EVM selector for this function is: 0x2ada85ff,
736 /// or in textual repr: transferCross((address,uint256),uint256)
737 function transferCross(EthCrossAccount memory to, uint256 tokenId) public {
738 require(false, stub_error);
739 to;
740 tokenId;
741 dummy = 0;
742 }
743
744 /// @notice Transfer ownership of an RFT
745 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`
746 /// is the zero address. Throws if `tokenId` is not a valid RFT.
747 /// Throws if RFT pieces have multiple owners.
733 /// @param to The new owner748 /// @param to The new owner
734 /// @param tokenId The RFT to transfer749 /// @param tokenId The RFT to transfer
735 /// @dev EVM selector for this function is: 0xd5cf430b,750 /// @dev EVM selector for this function is: 0xd5cf430b,
809 // /// @param tokens array of pairs of token ID and token URI for minted tokens824 // /// @param tokens array of pairs of token ID and token URI for minted tokens
810 // /// @dev EVM selector for this function is: 0x36543006,825 // /// @dev EVM selector for this function is: 0x36543006,
811 // /// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])826 // /// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])
812 // function mintBulkWithTokenURI(address to, Tuple9[] memory tokens) public returns (bool) {827 // function mintBulkWithTokenURI(address to, Tuple10[] memory tokens) public returns (bool) {
813 // require(false, stub_error);828 // require(false, stub_error);
814 // to;829 // to;
815 // tokens;830 // tokens;
831}846}
832847
833/// @dev anonymous struct848/// @dev anonymous struct
834struct Tuple9 {849struct Tuple10 {
835 uint256 field_0;850 uint256 field_0;
836 string field_1;851 string field_1;
837}852}
modifiedtests/src/eth/api/UniqueFungible.soldiffbeforeafterboth
28 /// @param properties Vector of properties key/value pair.28 /// @param properties Vector of properties key/value pair.
29 /// @dev EVM selector for this function is: 0x50b26b2a,29 /// @dev EVM selector for this function is: 0x50b26b2a,
30 /// or in textual repr: setCollectionProperties((string,bytes)[])30 /// or in textual repr: setCollectionProperties((string,bytes)[])
31 function setCollectionProperties(Tuple14[] memory properties) external;31 function setCollectionProperties(Tuple15[] memory properties) external;
3232
33 /// Delete collection property.33 /// Delete collection property.
34 ///34 ///
60 /// @return Vector of properties key/value pairs.60 /// @return Vector of properties key/value pairs.
61 /// @dev EVM selector for this function is: 0x285fb8e6,61 /// @dev EVM selector for this function is: 0x285fb8e6,
62 /// or in textual repr: collectionProperties(string[])62 /// or in textual repr: collectionProperties(string[])
63 function collectionProperties(string[] memory keys) external view returns (Tuple14[] memory);63 function collectionProperties(string[] memory keys) external view returns (Tuple15[] memory);
6464
65 /// Set the sponsor of the collection.65 /// Set the sponsor of the collection.
66 ///66 ///
287}287}
288288
289/// @dev anonymous struct289/// @dev anonymous struct
290struct Tuple14 {290struct Tuple15 {
291 string field_0;291 string field_0;
292 bytes field_1;292 bytes field_1;
293}293}
294294
295/// @dev the ERC-165 identifier for this interface is 0x032e5926295/// @dev the ERC-165 identifier for this interface is 0x29f4dcd9
296interface ERC20UniqueExtensions is Dummy, ERC165 {296interface ERC20UniqueExtensions is Dummy, ERC165 {
297 /// @dev EVM selector for this function is: 0x0ecd0ab0,297 /// @dev EVM selector for this function is: 0x0ecd0ab0,
298 /// or in textual repr: approveCross((address,uint256),uint256)298 /// or in textual repr: approveCross((address,uint256),uint256)
322 /// or in textual repr: mintBulk((address,uint256)[])322 /// or in textual repr: mintBulk((address,uint256)[])
323 function mintBulk(Tuple8[] memory amounts) external returns (bool);323 function mintBulk(Tuple8[] memory amounts) external returns (bool);
324
325 /// @dev EVM selector for this function is: 0x2ada85ff,
326 /// or in textual repr: transferCross((address,uint256),uint256)
327 function transferCross(EthCrossAccount memory to, uint256 amount) external returns (bool);
324328
325 /// @dev EVM selector for this function is: 0xd5cf430b,329 /// @dev EVM selector for this function is: 0xd5cf430b,
326 /// or in textual repr: transferFromCross((address,uint256),(address,uint256),uint256)330 /// or in textual repr: transferFromCross((address,uint256),(address,uint256),uint256)
modifiedtests/src/eth/api/UniqueNFT.soldiffbeforeafterboth
49 /// @param properties settable properties49 /// @param properties settable properties
50 /// @dev EVM selector for this function is: 0x14ed3a6e,50 /// @dev EVM selector for this function is: 0x14ed3a6e,
51 /// or in textual repr: setProperties(uint256,(string,bytes)[])51 /// or in textual repr: setProperties(uint256,(string,bytes)[])
52 function setProperties(uint256 tokenId, Tuple21[] memory properties) external;52 function setProperties(uint256 tokenId, Tuple22[] memory properties) external;
5353
54 // /// @notice Delete token property value.54 // /// @notice Delete token property value.
55 // /// @dev Throws error if `msg.sender` has no permission to edit the property.55 // /// @dev Throws error if `msg.sender` has no permission to edit the property.
93 /// @param properties Vector of properties key/value pair.93 /// @param properties Vector of properties key/value pair.
94 /// @dev EVM selector for this function is: 0x50b26b2a,94 /// @dev EVM selector for this function is: 0x50b26b2a,
95 /// or in textual repr: setCollectionProperties((string,bytes)[])95 /// or in textual repr: setCollectionProperties((string,bytes)[])
96 function setCollectionProperties(Tuple21[] memory properties) external;96 function setCollectionProperties(Tuple22[] memory properties) external;
9797
98 /// Delete collection property.98 /// Delete collection property.
99 ///99 ///
125 /// @return Vector of properties key/value pairs.125 /// @return Vector of properties key/value pairs.
126 /// @dev EVM selector for this function is: 0x285fb8e6,126 /// @dev EVM selector for this function is: 0x285fb8e6,
127 /// or in textual repr: collectionProperties(string[])127 /// or in textual repr: collectionProperties(string[])
128 function collectionProperties(string[] memory keys) external view returns (Tuple21[] memory);128 function collectionProperties(string[] memory keys) external view returns (Tuple22[] memory);
129129
130 /// Set the sponsor of the collection.130 /// Set the sponsor of the collection.
131 ///131 ///
167 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.167 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.
168 /// @dev EVM selector for this function is: 0x6ec0a9f1,168 /// @dev EVM selector for this function is: 0x6ec0a9f1,
169 /// or in textual repr: collectionSponsor()169 /// or in textual repr: collectionSponsor()
170 function collectionSponsor() external view returns (Tuple24 memory);170 function collectionSponsor() external view returns (Tuple25 memory);
171171
172 /// Set limits for the collection.172 /// Set limits for the collection.
173 /// @dev Throws error if limit not found.173 /// @dev Throws error if limit not found.
352}352}
353353
354/// @dev anonymous struct354/// @dev anonymous struct
355struct Tuple24 {355struct Tuple25 {
356 address field_0;356 address field_0;
357 uint256 field_1;357 uint256 field_1;
358}358}
359359
360/// @dev anonymous struct360/// @dev anonymous struct
361struct Tuple21 {361struct Tuple22 {
362 string field_0;362 string field_0;
363 bytes field_1;363 bytes field_1;
364}364}
458}458}
459459
460/// @title Unique extensions for ERC721.460/// @title Unique extensions for ERC721.
461/// @dev the ERC-165 identifier for this interface is 0x244543ee461/// @dev the ERC-165 identifier for this interface is 0x0e9fc611
462interface ERC721UniqueExtensions is Dummy, ERC165 {462interface ERC721UniqueExtensions is Dummy, ERC165 {
463 /// @notice A descriptive name for a collection of NFTs in this contract463 /// @notice A descriptive name for a collection of NFTs in this contract
464 /// @dev EVM selector for this function is: 0x06fdde03,464 /// @dev EVM selector for this function is: 0x06fdde03,
489 /// or in textual repr: transfer(address,uint256)489 /// or in textual repr: transfer(address,uint256)
490 function transfer(address to, uint256 tokenId) external;490 function transfer(address to, uint256 tokenId) external;
491
492 /// @notice Transfer ownership of an NFT
493 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`
494 /// is the zero address. Throws if `tokenId` is not a valid NFT.
495 /// @param to The new owner
496 /// @param tokenId The NFT to transfer
497 /// @dev EVM selector for this function is: 0x2ada85ff,
498 /// or in textual repr: transferCross((address,uint256),uint256)
499 function transferCross(EthCrossAccount memory to, uint256 tokenId) external;
491500
492 /// @notice Transfer ownership of an NFT from cross account address to cross account address501 /// @notice Transfer ownership of an NFT from cross account address to cross account address
493 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`502 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`
543 // /// @param tokens array of pairs of token ID and token URI for minted tokens552 // /// @param tokens array of pairs of token ID and token URI for minted tokens
544 // /// @dev EVM selector for this function is: 0x36543006,553 // /// @dev EVM selector for this function is: 0x36543006,
545 // /// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])554 // /// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])
546 // function mintBulkWithTokenURI(address to, Tuple10[] memory tokens) external returns (bool);555 // function mintBulkWithTokenURI(address to, Tuple11[] memory tokens) external returns (bool);
547556
548}557}
549558
550/// @dev anonymous struct559/// @dev anonymous struct
551struct Tuple10 {560struct Tuple11 {
552 uint256 field_0;561 uint256 field_0;
553 string field_1;562 string field_1;
554}563}
modifiedtests/src/eth/api/UniqueRefungible.soldiffbeforeafterboth
49 /// @param properties settable properties49 /// @param properties settable properties
50 /// @dev EVM selector for this function is: 0x14ed3a6e,50 /// @dev EVM selector for this function is: 0x14ed3a6e,
51 /// or in textual repr: setProperties(uint256,(string,bytes)[])51 /// or in textual repr: setProperties(uint256,(string,bytes)[])
52 function setProperties(uint256 tokenId, Tuple20[] memory properties) external;52 function setProperties(uint256 tokenId, Tuple21[] memory properties) external;
5353
54 // /// @notice Delete token property value.54 // /// @notice Delete token property value.
55 // /// @dev Throws error if `msg.sender` has no permission to edit the property.55 // /// @dev Throws error if `msg.sender` has no permission to edit the property.
93 /// @param properties Vector of properties key/value pair.93 /// @param properties Vector of properties key/value pair.
94 /// @dev EVM selector for this function is: 0x50b26b2a,94 /// @dev EVM selector for this function is: 0x50b26b2a,
95 /// or in textual repr: setCollectionProperties((string,bytes)[])95 /// or in textual repr: setCollectionProperties((string,bytes)[])
96 function setCollectionProperties(Tuple20[] memory properties) external;96 function setCollectionProperties(Tuple21[] memory properties) external;
9797
98 /// Delete collection property.98 /// Delete collection property.
99 ///99 ///
125 /// @return Vector of properties key/value pairs.125 /// @return Vector of properties key/value pairs.
126 /// @dev EVM selector for this function is: 0x285fb8e6,126 /// @dev EVM selector for this function is: 0x285fb8e6,
127 /// or in textual repr: collectionProperties(string[])127 /// or in textual repr: collectionProperties(string[])
128 function collectionProperties(string[] memory keys) external view returns (Tuple20[] memory);128 function collectionProperties(string[] memory keys) external view returns (Tuple21[] memory);
129129
130 /// Set the sponsor of the collection.130 /// Set the sponsor of the collection.
131 ///131 ///
167 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.167 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.
168 /// @dev EVM selector for this function is: 0x6ec0a9f1,168 /// @dev EVM selector for this function is: 0x6ec0a9f1,
169 /// or in textual repr: collectionSponsor()169 /// or in textual repr: collectionSponsor()
170 function collectionSponsor() external view returns (Tuple23 memory);170 function collectionSponsor() external view returns (Tuple24 memory);
171171
172 /// Set limits for the collection.172 /// Set limits for the collection.
173 /// @dev Throws error if limit not found.173 /// @dev Throws error if limit not found.
352}352}
353353
354/// @dev anonymous struct354/// @dev anonymous struct
355struct Tuple23 {355struct Tuple24 {
356 address field_0;356 address field_0;
357 uint256 field_1;357 uint256 field_1;
358}358}
359359
360/// @dev anonymous struct360/// @dev anonymous struct
361struct Tuple20 {361struct Tuple21 {
362 string field_0;362 string field_0;
363 bytes field_1;363 bytes field_1;
364}364}
456}456}
457457
458/// @title Unique extensions for ERC721.458/// @title Unique extensions for ERC721.
459/// @dev the ERC-165 identifier for this interface is 0x81feb398459/// @dev the ERC-165 identifier for this interface is 0xab243667
460interface ERC721UniqueExtensions is Dummy, ERC165 {460interface ERC721UniqueExtensions is Dummy, ERC165 {
461 /// @notice A descriptive name for a collection of NFTs in this contract461 /// @notice A descriptive name for a collection of NFTs in this contract
462 /// @dev EVM selector for this function is: 0x06fdde03,462 /// @dev EVM selector for this function is: 0x06fdde03,
482 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`482 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`
483 /// is the zero address. Throws if `tokenId` is not a valid RFT.483 /// is the zero address. Throws if `tokenId` is not a valid RFT.
484 /// Throws if RFT pieces have multiple owners.484 /// Throws if RFT pieces have multiple owners.
485 /// @param to The new owner
486 /// @param tokenId The RFT to transfer
487 /// @dev EVM selector for this function is: 0x2ada85ff,
488 /// or in textual repr: transferCross((address,uint256),uint256)
489 function transferCross(EthCrossAccount memory to, uint256 tokenId) external;
490
491 /// @notice Transfer ownership of an RFT
492 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`
493 /// is the zero address. Throws if `tokenId` is not a valid RFT.
494 /// Throws if RFT pieces have multiple owners.
485 /// @param to The new owner495 /// @param to The new owner
486 /// @param tokenId The RFT to transfer496 /// @param tokenId The RFT to transfer
487 /// @dev EVM selector for this function is: 0xd5cf430b,497 /// @dev EVM selector for this function is: 0xd5cf430b,
535 // /// @param tokens array of pairs of token ID and token URI for minted tokens545 // /// @param tokens array of pairs of token ID and token URI for minted tokens
536 // /// @dev EVM selector for this function is: 0x36543006,546 // /// @dev EVM selector for this function is: 0x36543006,
537 // /// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])547 // /// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])
538 // function mintBulkWithTokenURI(address to, Tuple9[] memory tokens) external returns (bool);548 // function mintBulkWithTokenURI(address to, Tuple10[] memory tokens) external returns (bool);
539549
540 /// Returns EVM address for refungible token550 /// Returns EVM address for refungible token
541 ///551 ///
546}556}
547557
548/// @dev anonymous struct558/// @dev anonymous struct
549struct Tuple9 {559struct Tuple10 {
550 uint256 field_0;560 uint256 field_0;
551 string field_1;561 string field_1;
552}562}
modifiedtests/src/eth/base.test.tsdiffbeforeafterboth
117 });117 });
118118
119 itEth('ERC721UniqueExtensions support', async ({helper}) => {119 itEth('ERC721UniqueExtensions support', async ({helper}) => {
120 await checkInterface(helper, '0x244543ee', true, true);120 await checkInterface(helper, '0x0e9fc611', true, true);
121 });121 });
122122
123 itEth('ERC721Burnable - 0x42966c68 - support', async ({helper}) => {123 itEth('ERC721Burnable - 0x42966c68 - support', async ({helper}) => {
modifiedtests/src/eth/fungible.test.tsdiffbeforeafterboth
230 }230 }
231 });231 });
232232
233 itEth('Can perform transferCross()', async ({helper}) => {
234 const owner = await helper.eth.createAccountWithBalance(donor);
235 const receiver = await helper.eth.createAccountWithBalance(donor);
236 const to = helper.ethCrossAccount.fromAddress(receiver);
237 const toSubstrate = helper.ethCrossAccount.fromKeyringPair(donor);
238 const collection = await helper.ft.mintCollection(alice);
239 await collection.mint(alice, 200n, {Ethereum: owner});
240
241 const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);
242 const contract = helper.ethNativeContract.collection(collectionAddress, 'ft', owner);
243
244 {
245 const result = await contract.methods.transferCross(to, 50).send({from: owner});
246
247 const event = result.events.Transfer;
248 expect(event.address).to.be.equal(collectionAddress);
249 expect(event.returnValues.from).to.be.equal(owner);
250 expect(event.returnValues.to).to.be.equal(receiver);
251 expect(event.returnValues.value).to.be.equal('50');
252 }
253
254 {
255 const balance = await contract.methods.balanceOf(owner).call();
256 expect(+balance).to.equal(150);
257 }
258
259 {
260 const balance = await contract.methods.balanceOf(receiver).call();
261 expect(+balance).to.equal(50);
262 }
263
264 {
265 const result = await contract.methods.transferCross(toSubstrate, 50).send({from: owner});
266
267 const event = result.events.Transfer;
268 expect(event.address).to.be.equal(collectionAddress);
269 expect(event.returnValues.from).to.be.equal(owner);
270 expect(event.returnValues.to).to.be.equal(helper.address.substrateToEth(donor.address));
271 expect(event.returnValues.value).to.be.equal('50');
272 }
273
274 {
275 const balance = await collection.getBalance({Ethereum: owner});
276 expect(balance).to.equal(100n);
277 }
278
279 {
280 const balance = await collection.getBalance({Substrate: donor.address});
281 expect(balance).to.equal(50n);
282 }
283
284 });
285
233 itEth('Can perform transfer()', async ({helper}) => {286 itEth('Can perform transfer()', async ({helper}) => {
234 const owner = await helper.eth.createAccountWithBalance(donor);287 const owner = await helper.eth.createAccountWithBalance(donor);
modifiedtests/src/eth/fungibleAbi.jsondiffbeforeafterboth
239 { "internalType": "string", "name": "field_0", "type": "string" },239 { "internalType": "string", "name": "field_0", "type": "string" },
240 { "internalType": "bytes", "name": "field_1", "type": "bytes" }240 { "internalType": "bytes", "name": "field_1", "type": "bytes" }
241 ],241 ],
242 "internalType": "struct Tuple14[]",242 "internalType": "struct Tuple15[]",
243 "name": "",243 "name": "",
244 "type": "tuple[]"244 "type": "tuple[]"
245 }245 }
496 { "internalType": "string", "name": "field_0", "type": "string" },496 { "internalType": "string", "name": "field_0", "type": "string" },
497 { "internalType": "bytes", "name": "field_1", "type": "bytes" }497 { "internalType": "bytes", "name": "field_1", "type": "bytes" }
498 ],498 ],
499 "internalType": "struct Tuple14[]",499 "internalType": "struct Tuple15[]",
500 "name": "properties",500 "name": "properties",
501 "type": "tuple[]"501 "type": "tuple[]"
502 }502 }
592 "stateMutability": "nonpayable",592 "stateMutability": "nonpayable",
593 "type": "function"593 "type": "function"
594 },594 },
595 {
596 "inputs": [
597 {
598 "components": [
599 { "internalType": "address", "name": "eth", "type": "address" },
600 { "internalType": "uint256", "name": "sub", "type": "uint256" }
601 ],
602 "internalType": "struct EthCrossAccount",
603 "name": "to",
604 "type": "tuple"
605 },
606 { "internalType": "uint256", "name": "amount", "type": "uint256" }
607 ],
608 "name": "transferCross",
609 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
610 "stateMutability": "nonpayable",
611 "type": "function"
612 },
595 {613 {
596 "inputs": [614 "inputs": [
597 { "internalType": "address", "name": "from", "type": "address" },615 { "internalType": "address", "name": "from", "type": "address" },
modifiedtests/src/eth/nonFungible.test.tsdiffbeforeafterboth
403 }403 }
404 });404 });
405
406 itEth('Can perform transferCross()', async ({helper}) => {
407 const collection = await helper.nft.mintCollection(minter, {});
408 const owner = await helper.eth.createAccountWithBalance(donor);
409 const receiver = await helper.eth.createAccountWithBalance(donor);
410 const to = helper.ethCrossAccount.fromAddress(receiver);
411 const toSubstrate = helper.ethCrossAccount.fromKeyringPair(minter);
412
413 const {tokenId} = await collection.mintToken(minter, {Ethereum: owner});
414
415 const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);
416 const contract = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
417
418 {
419 const result = await contract.methods.transferCross(to, tokenId).send({from: owner});
420
421 const event = result.events.Transfer;
422 expect(event.address).to.be.equal(collectionAddress);
423 expect(event.returnValues.from).to.be.equal(owner);
424 expect(event.returnValues.to).to.be.equal(receiver);
425 expect(event.returnValues.tokenId).to.be.equal(`${tokenId}`);
426 }
427
428 {
429 const balance = await contract.methods.balanceOf(owner).call();
430 expect(+balance).to.equal(0);
431 }
432
433 {
434 const balance = await contract.methods.balanceOf(receiver).call();
435 expect(+balance).to.equal(1);
436 }
437
438 {
439 const substrateResult = await contract.methods.transferCross(toSubstrate, tokenId).send({from: receiver});
440
441
442 const event = substrateResult.events.Transfer;
443 expect(event.address).to.be.equal(collectionAddress);
444 expect(event.returnValues.from).to.be.equal(receiver);
445 expect(event.returnValues.to).to.be.equal(helper.address.substrateToEth(minter.address));
446 expect(event.returnValues.tokenId).to.be.equal(`${tokenId}`);
447 }
448
449 {
450 const balance = await contract.methods.balanceOf(receiver).call();
451 expect(+balance).to.equal(0);
452 }
453
454 {
455 const balance = await helper.nft.getTokensByAddress(collection.collectionId, {Substrate: minter.address});
456 expect(balance).to.be.contain(tokenId);
457 }
458 });
405});459});
406460
407describe('NFT: Fees', () => {461describe('NFT: Fees', () => {
modifiedtests/src/eth/nonFungibleAbi.jsondiffbeforeafterboth
269 { "internalType": "string", "name": "field_0", "type": "string" },269 { "internalType": "string", "name": "field_0", "type": "string" },
270 { "internalType": "bytes", "name": "field_1", "type": "bytes" }270 { "internalType": "bytes", "name": "field_1", "type": "bytes" }
271 ],271 ],
272 "internalType": "struct Tuple21[]",272 "internalType": "struct Tuple22[]",
273 "name": "",273 "name": "",
274 "type": "tuple[]"274 "type": "tuple[]"
275 }275 }
293 { "internalType": "address", "name": "field_0", "type": "address" },293 { "internalType": "address", "name": "field_0", "type": "address" },
294 { "internalType": "uint256", "name": "field_1", "type": "uint256" }294 { "internalType": "uint256", "name": "field_1", "type": "uint256" }
295 ],295 ],
296 "internalType": "struct Tuple24",296 "internalType": "struct Tuple25",
297 "name": "",297 "name": "",
298 "type": "tuple"298 "type": "tuple"
299 }299 }
611 { "internalType": "string", "name": "field_0", "type": "string" },611 { "internalType": "string", "name": "field_0", "type": "string" },
612 { "internalType": "bytes", "name": "field_1", "type": "bytes" }612 { "internalType": "bytes", "name": "field_1", "type": "bytes" }
613 ],613 ],
614 "internalType": "struct Tuple21[]",614 "internalType": "struct Tuple22[]",
615 "name": "properties",615 "name": "properties",
616 "type": "tuple[]"616 "type": "tuple[]"
617 }617 }
682 { "internalType": "string", "name": "field_0", "type": "string" },682 { "internalType": "string", "name": "field_0", "type": "string" },
683 { "internalType": "bytes", "name": "field_1", "type": "bytes" }683 { "internalType": "bytes", "name": "field_1", "type": "bytes" }
684 ],684 ],
685 "internalType": "struct Tuple21[]",685 "internalType": "struct Tuple22[]",
686 "name": "properties",686 "name": "properties",
687 "type": "tuple[]"687 "type": "tuple[]"
688 }688 }
776 "stateMutability": "nonpayable",776 "stateMutability": "nonpayable",
777 "type": "function"777 "type": "function"
778 },778 },
779 {
780 "inputs": [
781 {
782 "components": [
783 { "internalType": "address", "name": "eth", "type": "address" },
784 { "internalType": "uint256", "name": "sub", "type": "uint256" }
785 ],
786 "internalType": "struct EthCrossAccount",
787 "name": "to",
788 "type": "tuple"
789 },
790 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
791 ],
792 "name": "transferCross",
793 "outputs": [],
794 "stateMutability": "nonpayable",
795 "type": "function"
796 },
779 {797 {
780 "inputs": [798 "inputs": [
781 { "internalType": "address", "name": "from", "type": "address" },799 { "internalType": "address", "name": "from", "type": "address" },
modifiedtests/src/eth/reFungible.test.tsdiffbeforeafterboth
360 }360 }
361 });361 });
362
363 itEth('Can perform transferCross()', async ({helper}) => {
364 const caller = await helper.eth.createAccountWithBalance(donor);
365 const receiver = await helper.eth.createAccountWithBalance(donor);
366 const to = helper.ethCrossAccount.fromAddress(receiver);
367 const toSubstrate = helper.ethCrossAccount.fromKeyringPair(minter);
368 const collection = await helper.rft.mintCollection(minter, {});
369 const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);
370 const contract = helper.ethNativeContract.collection(collectionAddress, 'rft', caller);
371
372 const {tokenId} = await collection.mintToken(minter, 1n, {Ethereum: caller});
373
374 {
375 const result = await contract.methods.transferCross(to, tokenId).send({from: caller});
376
377 const event = result.events.Transfer;
378 expect(event.address).to.equal(collectionAddress);
379 expect(event.returnValues.from).to.equal(caller);
380 expect(event.returnValues.to).to.equal(receiver);
381 expect(event.returnValues.tokenId).to.equal(tokenId.toString());
382 }
383
384 {
385 const balance = await contract.methods.balanceOf(caller).call();
386 expect(+balance).to.equal(0);
387 }
388
389 {
390 const balance = await contract.methods.balanceOf(receiver).call();
391 expect(+balance).to.equal(1);
392 }
393
394 {
395 const substrateResult = await contract.methods.transferCross(toSubstrate, tokenId).send({from: receiver});
396
397
398 const event = substrateResult.events.Transfer;
399 expect(event.address).to.be.equal(collectionAddress);
400 expect(event.returnValues.from).to.be.equal(receiver);
401 expect(event.returnValues.to).to.be.equal(helper.address.substrateToEth(minter.address));
402 expect(event.returnValues.tokenId).to.be.equal(`${tokenId}`);
403 }
404
405 {
406 const balance = await contract.methods.balanceOf(receiver).call();
407 expect(+balance).to.equal(0);
408 }
409
410 {
411 const balance = await helper.nft.getTokensByAddress(collection.collectionId, {Substrate: minter.address});
412 expect(balance).to.be.contain(tokenId);
413 }
414 });
362415
363 itEth('transfer event on transfer from partial ownership to full ownership', async ({helper}) => {416 itEth('transfer event on transfer from partial ownership to full ownership', async ({helper}) => {
364 const caller = await helper.eth.createAccountWithBalance(donor);417 const caller = await helper.eth.createAccountWithBalance(donor);
modifiedtests/src/eth/reFungibleAbi.jsondiffbeforeafterboth
251 { "internalType": "string", "name": "field_0", "type": "string" },251 { "internalType": "string", "name": "field_0", "type": "string" },
252 { "internalType": "bytes", "name": "field_1", "type": "bytes" }252 { "internalType": "bytes", "name": "field_1", "type": "bytes" }
253 ],253 ],
254 "internalType": "struct Tuple20[]",254 "internalType": "struct Tuple21[]",
255 "name": "",255 "name": "",
256 "type": "tuple[]"256 "type": "tuple[]"
257 }257 }
275 { "internalType": "address", "name": "field_0", "type": "address" },275 { "internalType": "address", "name": "field_0", "type": "address" },
276 { "internalType": "uint256", "name": "field_1", "type": "uint256" }276 { "internalType": "uint256", "name": "field_1", "type": "uint256" }
277 ],277 ],
278 "internalType": "struct Tuple23",278 "internalType": "struct Tuple24",
279 "name": "",279 "name": "",
280 "type": "tuple"280 "type": "tuple"
281 }281 }
593 { "internalType": "string", "name": "field_0", "type": "string" },593 { "internalType": "string", "name": "field_0", "type": "string" },
594 { "internalType": "bytes", "name": "field_1", "type": "bytes" }594 { "internalType": "bytes", "name": "field_1", "type": "bytes" }
595 ],595 ],
596 "internalType": "struct Tuple20[]",596 "internalType": "struct Tuple21[]",
597 "name": "properties",597 "name": "properties",
598 "type": "tuple[]"598 "type": "tuple[]"
599 }599 }
664 { "internalType": "string", "name": "field_0", "type": "string" },664 { "internalType": "string", "name": "field_0", "type": "string" },
665 { "internalType": "bytes", "name": "field_1", "type": "bytes" }665 { "internalType": "bytes", "name": "field_1", "type": "bytes" }
666 ],666 ],
667 "internalType": "struct Tuple20[]",667 "internalType": "struct Tuple21[]",
668 "name": "properties",668 "name": "properties",
669 "type": "tuple[]"669 "type": "tuple[]"
670 }670 }
767 "stateMutability": "nonpayable",767 "stateMutability": "nonpayable",
768 "type": "function"768 "type": "function"
769 },769 },
770 {
771 "inputs": [
772 {
773 "components": [
774 { "internalType": "address", "name": "eth", "type": "address" },
775 { "internalType": "uint256", "name": "sub", "type": "uint256" }
776 ],
777 "internalType": "struct EthCrossAccount",
778 "name": "to",
779 "type": "tuple"
780 },
781 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }
782 ],
783 "name": "transferCross",
784 "outputs": [],
785 "stateMutability": "nonpayable",
786 "type": "function"
787 },
770 {788 {
771 "inputs": [789 "inputs": [
772 { "internalType": "address", "name": "from", "type": "address" },790 { "internalType": "address", "name": "from", "type": "address" },