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

difftreelog

added `mintCross` function for `UniqueExtensoins` interfaces

PraetorP2022-12-01parent: #0a1b898.patch.diff
in: master

20 files changed

modifiedCargo.lockdiffbeforeafterboth
60856085
6086[[package]]6086[[package]]
6087name = "pallet-fungible"6087name = "pallet-fungible"
6088version = "0.1.7"6088version = "0.1.9"
6089dependencies = [6089dependencies = [
6090 "ethereum 0.14.0",6090 "ethereum 0.14.0",
6091 "evm-coder",6091 "evm-coder",
modifiedpallets/fungible/CHANGELOG.mddiffbeforeafterboth
44
5<!-- bureaucrate goes here -->5<!-- bureaucrate goes here -->
66
7## [0.1.9] - 2022-12-01
8
9### Added
10
11- The functions `mintCross` to `ERC20UniqueExtensions` interface.
12
7## [0.1.8] - 2022-11-1813## [0.1.8] - 2022-11-18
814
9### Added15### Added
modifiedpallets/fungible/Cargo.tomldiffbeforeafterboth
1[package]1[package]
2name = "pallet-fungible"2name = "pallet-fungible"
3version = "0.1.7"3version = "0.1.9"
4license = "GPLv3"4license = "GPLv3"
5edition = "2021"5edition = "2021"
66
modifiedpallets/fungible/src/erc.rsdiffbeforeafterboth
174 .collect::<string>())174 .collect::<string>())
175 }175 }
176
177 #[weight(<SelfWeightOf<T>>::create_item())]
178 fn mint_cross(&mut self, caller: caller, to: EthCrossAccount, amount: uint256) -> Result<bool> {
179 let caller = T::CrossAccountId::from_eth(caller);
180 let to = to.into_sub_cross_account::<T>()?;
181 let amount = amount.try_into().map_err(|_| "amount overflow")?;
182 let budget = self
183 .recorder
184 .weight_calls_budget(<StructureWeight<T>>::find_parent());
185 <Pallet<T>>::create_item(&self, &caller, (to, amount), &budget)
186 .map_err(dispatch_to_evm::<T>)?;
187 Ok(true)
188 }
176189
177 #[weight(<SelfWeightOf<T>>::approve())]190 #[weight(<SelfWeightOf<T>>::approve())]
178 fn approve_cross(191 fn approve_cross(
modifiedpallets/fungible/src/stubs/UniqueFungible.soldiffbeforeafterboth
152 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.152 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.
153 /// @dev EVM selector for this function is: 0x6ec0a9f1,153 /// @dev EVM selector for this function is: 0x6ec0a9f1,
154 /// or in textual repr: collectionSponsor()154 /// or in textual repr: collectionSponsor()
155 function collectionSponsor() public view returns (Tuple8 memory) {155 function collectionSponsor() public view returns (Tuple9 memory) {
156 require(false, stub_error);156 require(false, stub_error);
157 dummy;157 dummy;
158 return Tuple8(0x0000000000000000000000000000000000000000, 0);158 return Tuple9(0x0000000000000000000000000000000000000000, 0);
159 }159 }
160160
161 /// Get current collection limits.161 /// Get current collection limits.
522 bytes value;522 bytes value;
523}523}
524524
525/// @dev the ERC-165 identifier for this interface is 0x5b7038cf525/// @dev the ERC-165 identifier for this interface is 0x7dee5997
526contract ERC20UniqueExtensions is Dummy, ERC165 {526contract ERC20UniqueExtensions is Dummy, ERC165 {
527 /// @notice A description for the collection.527 /// @notice A description for the collection.
528 /// @dev EVM selector for this function is: 0x7284e416,528 /// @dev EVM selector for this function is: 0x7284e416,
533 return "";533 return "";
534 }534 }
535
536 /// @dev EVM selector for this function is: 0x269e6158,
537 /// or in textual repr: mintCross((address,uint256),uint256)
538 function mintCross(EthCrossAccount memory to, uint256 amount) public returns (bool) {
539 require(false, stub_error);
540 to;
541 amount;
542 dummy = 0;
543 return false;
544 }
535545
536 /// @dev EVM selector for this function is: 0x0ecd0ab0,546 /// @dev EVM selector for this function is: 0x0ecd0ab0,
537 /// or in textual repr: approveCross((address,uint256),uint256)547 /// or in textual repr: approveCross((address,uint256),uint256)
577 /// @param amounts array of pairs of account address and amount587 /// @param amounts array of pairs of account address and amount
578 /// @dev EVM selector for this function is: 0x1acf2d55,588 /// @dev EVM selector for this function is: 0x1acf2d55,
579 /// or in textual repr: mintBulk((address,uint256)[])589 /// or in textual repr: mintBulk((address,uint256)[])
580 function mintBulk(Tuple8[] memory amounts) public returns (bool) {590 function mintBulk(Tuple9[] memory amounts) public returns (bool) {
581 require(false, stub_error);591 require(false, stub_error);
582 amounts;592 amounts;
583 dummy = 0;593 dummy = 0;
611}621}
612622
613/// @dev anonymous struct623/// @dev anonymous struct
614struct Tuple8 {624struct Tuple9 {
615 address field_0;625 address field_0;
616 uint256 field_1;626 uint256 field_1;
617}627}
modifiedpallets/nonfungible/CHANGELOG.mddiffbeforeafterboth
44
5<!-- bureaucrate goes here -->5<!-- bureaucrate goes here -->
66
7## [0.1.11] - 2022-12-167## [0.1.12] - 2022-12-16
88
9### Added9### Added
1010
1414
15- Hide `setTokenPropertyPermission` function in `TokenProperties` interface.15- Hide `setTokenPropertyPermission` function in `TokenProperties` interface.
1616
17## [0.1.11] - 2022-12-01
18
19### Added
20
21- The functions `mintCross` to `ERC721UniqueExtensions` interface.
22
17## [0.1.10] - 2022-11-1823## [0.1.10] - 2022-11-18
1824
19### Added25### Added
modifiedpallets/nonfungible/src/erc.rsdiffbeforeafterboth
1070 Ok(true)1070 Ok(true)
1071 }1071 }
1072
1073 /// @notice Function to mint token.
1074 /// @param to The new owner crossAccountId
1075 /// @param properties Properties of minted token
1076 /// @return uint256 The id of the newly minted token
1077 #[weight(<SelfWeightOf<T>>::create_item())]
1078 fn mint_cross(
1079 &mut self,
1080 caller: caller,
1081 to: EthCrossAccount,
1082 properties: Vec<PropertyStruct>,
1083 ) -> Result<uint256> {
1084 let token_id = <TokensMinted<T>>::get(self.id)
1085 .checked_add(1)
1086 .ok_or("item id overflow")?;
1087
1088 let to = to.into_sub_cross_account::<T>()?;
1089
1090 let properties = properties
1091 .into_iter()
1092 .map(|PropertyStruct { key, value }| {
1093 let key = <Vec<u8>>::from(key)
1094 .try_into()
1095 .map_err(|_| "key too large")?;
1096
1097 let value = value.0.try_into().map_err(|_| "value too large")?;
1098
1099 Ok(Property { key, value })
1100 })
1101 .collect::<Result<Vec<_>>>()?
1102 .try_into()
1103 .map_err(|_| Error::Revert(alloc::format!("too many properties")))?;
1104
1105 let caller = T::CrossAccountId::from_eth(caller);
1106
1107 let budget = self
1108 .recorder
1109 .weight_calls_budget(<StructureWeight<T>>::find_parent());
1110
1111 <Pallet<T>>::create_item(
1112 self,
1113 &caller,
1114 CreateItemData::<T> {
1115 properties,
1116 owner: to,
1117 },
1118 &budget,
1119 )
1120 .map_err(dispatch_to_evm::<T>)?;
1121
1122 Ok(token_id.into())
1123 }
1072}1124}
10731125
1074#[solidity_interface(1126#[solidity_interface(
modifiedpallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth
290 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.290 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.
291 /// @dev EVM selector for this function is: 0x6ec0a9f1,291 /// @dev EVM selector for this function is: 0x6ec0a9f1,
292 /// or in textual repr: collectionSponsor()292 /// or in textual repr: collectionSponsor()
293 function collectionSponsor() public view returns (Tuple30 memory) {293 function collectionSponsor() public view returns (Tuple32 memory) {
294 require(false, stub_error);294 require(false, stub_error);
295 dummy;295 dummy;
296 return Tuple30(0x0000000000000000000000000000000000000000, 0);296 return Tuple32(0x0000000000000000000000000000000000000000, 0);
297 }297 }
298298
299 /// Get current collection limits.299 /// Get current collection limits.
655}655}
656656
657/// @dev anonymous struct657/// @dev anonymous struct
658struct Tuple30 {658struct Tuple32 {
659 address field_0;659 address field_0;
660 uint256 field_1;660 uint256 field_1;
661}661}
804}804}
805805
806/// @title Unique extensions for ERC721.806/// @title Unique extensions for ERC721.
807/// @dev the ERC-165 identifier for this interface is 0xb74c26b7807/// @dev the ERC-165 identifier for this interface is 0x0e48fdb4
808contract ERC721UniqueExtensions is Dummy, ERC165 {808contract ERC721UniqueExtensions is Dummy, ERC165 {
809 /// @notice A descriptive name for a collection of NFTs in this contract809 /// @notice A descriptive name for a collection of NFTs in this contract
810 /// @dev EVM selector for this function is: 0x06fdde03,810 /// @dev EVM selector for this function is: 0x06fdde03,
991 // return false;992 // return false;
992 // }993 // }
993994
995 /// @notice Function to mint token.
996 /// @param to The new owner crossAccountId
997 /// @param properties Properties of minted token
998 /// @return uint256 The id of the newly minted token
999 /// @dev EVM selector for this function is: 0xb904db03,
1000 /// or in textual repr: mintCross((address,uint256),(string,bytes)[])
1001 function mintCross(EthCrossAccount memory to, Property[] memory properties) public returns (uint256) {
1002 require(false, stub_error);
1003 to;
1004 properties;
1005 dummy = 0;
1006 return 0;
1007 }
994}1008}
9951009
996/// @dev anonymous struct1010/// @dev anonymous struct
modifiedpallets/refungible/CHANGELOG.mddiffbeforeafterboth
44
5<!-- bureaucrate goes here -->5<!-- bureaucrate goes here -->
66
7## [0.2.10] - 2022-12-167## [0.2.11] - 2022-12-16
88
9### Added9### Added
1010
1414
15- Hide `setTokenPropertyPermission` function in `TokenProperties` interface.15- Hide `setTokenPropertyPermission` function in `TokenProperties` interface.
1616
17## [0.2.10] - 2022-12-01
18
19### Added
20
21- The functions `mintCross` to `ERC721UniqueExtensions` interface.
22
17## [0.2.9] - 2022-11-1823## [0.2.9] - 2022-11-18
1824
19### Added25### Added
modifiedpallets/refungible/src/erc.rsdiffbeforeafterboth
1120 Ok(true)1120 Ok(true)
1121 }1121 }
1122
1123 /// @notice Function to mint token.
1124 /// @param to The new owner crossAccountId
1125 /// @param properties Properties of minted token
1126 /// @return uint256 The id of the newly minted token
1127 #[weight(<SelfWeightOf<T>>::create_item())]
1128 fn mint_cross(
1129 &mut self,
1130 caller: caller,
1131 to: EthCrossAccount,
1132 properties: Vec<PropertyStruct>,
1133 ) -> Result<uint256> {
1134 let token_id = <TokensMinted<T>>::get(self.id)
1135 .checked_add(1)
1136 .ok_or("item id overflow")?;
1137
1138 let to = to.into_sub_cross_account::<T>()?;
1139
1140 let properties = properties
1141 .into_iter()
1142 .map(|PropertyStruct { key, value }| {
1143 let key = <Vec<u8>>::from(key)
1144 .try_into()
1145 .map_err(|_| "key too large")?;
1146
1147 let value = value.0.try_into().map_err(|_| "value too large")?;
1148
1149 Ok(Property { key, value })
1150 })
1151 .collect::<Result<Vec<_>>>()?
1152 .try_into()
1153 .map_err(|_| Error::Revert(alloc::format!("too many properties")))?;
1154
1155 let caller = T::CrossAccountId::from_eth(caller);
1156
1157 let budget = self
1158 .recorder
1159 .weight_calls_budget(<StructureWeight<T>>::find_parent());
1160
1161 let users = [(to, 1)]
1162 .into_iter()
1163 .collect::<BTreeMap<_, _>>()
1164 .try_into()
1165 .unwrap();
1166 <Pallet<T>>::create_item(
1167 self,
1168 &caller,
1169 CreateItemData::<T::CrossAccountId> { users, properties },
1170 &budget,
1171 )
1172 .map_err(dispatch_to_evm::<T>)?;
1173
1174 Ok(token_id.into())
1175 }
11221176
1123 /// Returns EVM address for refungible token1177 /// Returns EVM address for refungible token
1124 ///1178 ///
modifiedpallets/refungible/src/stubs/UniqueRefungible.soldiffbeforeafterboth
290 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.290 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.
291 /// @dev EVM selector for this function is: 0x6ec0a9f1,291 /// @dev EVM selector for this function is: 0x6ec0a9f1,
292 /// or in textual repr: collectionSponsor()292 /// or in textual repr: collectionSponsor()
293 function collectionSponsor() public view returns (Tuple29 memory) {293 function collectionSponsor() public view returns (Tuple31 memory) {
294 require(false, stub_error);294 require(false, stub_error);
295 dummy;295 dummy;
296 return Tuple29(0x0000000000000000000000000000000000000000, 0);296 return Tuple31(0x0000000000000000000000000000000000000000, 0);
297 }297 }
298298
299 /// Get current collection limits.299 /// Get current collection limits.
655}655}
656656
657/// @dev anonymous struct657/// @dev anonymous struct
658struct Tuple29 {658struct Tuple31 {
659 address field_0;659 address field_0;
660 uint256 field_1;660 uint256 field_1;
661}661}
802}802}
803803
804/// @title Unique extensions for ERC721.804/// @title Unique extensions for ERC721.
805/// @dev the ERC-165 identifier for this interface is 0x12f7d6c1805/// @dev the ERC-165 identifier for this interface is 0xabf30dc2
806contract ERC721UniqueExtensions is Dummy, ERC165 {806contract ERC721UniqueExtensions is Dummy, ERC165 {
807 /// @notice A descriptive name for a collection of NFTs in this contract807 /// @notice A descriptive name for a collection of NFTs in this contract
808 /// @dev EVM selector for this function is: 0x06fdde03,808 /// @dev EVM selector for this function is: 0x06fdde03,
979 // return false;979 // return false;
980 // }980 // }
981
982 /// @notice Function to mint token.
983 /// @param to The new owner crossAccountId
984 /// @param properties Properties of minted token
985 /// @return uint256 The id of the newly minted token
986 /// @dev EVM selector for this function is: 0xb904db03,
987 /// or in textual repr: mintCross((address,uint256),(string,bytes)[])
988 function mintCross(EthCrossAccount memory to, Property[] memory properties) public returns (uint256) {
989 require(false, stub_error);
990 to;
991 properties;
992 dummy = 0;
993 return 0;
994 }
981995
982 /// Returns EVM address for refungible token996 /// Returns EVM address for refungible token
983 ///997 ///
modifiedtests/src/eth/abi/fungible.jsondiffbeforeafterboth
322 { "internalType": "address", "name": "field_0", "type": "address" },322 { "internalType": "address", "name": "field_0", "type": "address" },
323 { "internalType": "uint256", "name": "field_1", "type": "uint256" }323 { "internalType": "uint256", "name": "field_1", "type": "uint256" }
324 ],324 ],
325 "internalType": "struct Tuple8",325 "internalType": "struct Tuple9",
326 "name": "",326 "name": "",
327 "type": "tuple"327 "type": "tuple"
328 }328 }
408 { "internalType": "address", "name": "field_0", "type": "address" },408 { "internalType": "address", "name": "field_0", "type": "address" },
409 { "internalType": "uint256", "name": "field_1", "type": "uint256" }409 { "internalType": "uint256", "name": "field_1", "type": "uint256" }
410 ],410 ],
411 "internalType": "struct Tuple8[]",411 "internalType": "struct Tuple9[]",
412 "name": "amounts",412 "name": "amounts",
413 "type": "tuple[]"413 "type": "tuple[]"
414 }414 }
418 "stateMutability": "nonpayable",418 "stateMutability": "nonpayable",
419 "type": "function"419 "type": "function"
420 },420 },
421 {
422 "inputs": [
423 {
424 "components": [
425 { "internalType": "address", "name": "eth", "type": "address" },
426 { "internalType": "uint256", "name": "sub", "type": "uint256" }
427 ],
428 "internalType": "struct EthCrossAccount",
429 "name": "to",
430 "type": "tuple"
431 },
432 { "internalType": "uint256", "name": "amount", "type": "uint256" }
433 ],
434 "name": "mintCross",
435 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
436 "stateMutability": "nonpayable",
437 "type": "function"
438 },
421 {439 {
422 "inputs": [],440 "inputs": [],
423 "name": "name",441 "name": "name",
modifiedtests/src/eth/abi/nonFungible.jsondiffbeforeafterboth
352 { "internalType": "address", "name": "field_0", "type": "address" },352 { "internalType": "address", "name": "field_0", "type": "address" },
353 { "internalType": "uint256", "name": "field_1", "type": "uint256" }353 { "internalType": "uint256", "name": "field_1", "type": "uint256" }
354 ],354 ],
355 "internalType": "struct Tuple30",355 "internalType": "struct Tuple32",
356 "name": "",356 "name": "",
357 "type": "tuple"357 "type": "tuple"
358 }358 }
476 "stateMutability": "nonpayable",476 "stateMutability": "nonpayable",
477 "type": "function"477 "type": "function"
478 },478 },
479 {
480 "inputs": [
481 {
482 "components": [
483 { "internalType": "address", "name": "eth", "type": "address" },
484 { "internalType": "uint256", "name": "sub", "type": "uint256" }
485 ],
486 "internalType": "struct EthCrossAccount",
487 "name": "to",
488 "type": "tuple"
489 },
490 {
491 "components": [
492 { "internalType": "string", "name": "key", "type": "string" },
493 { "internalType": "bytes", "name": "value", "type": "bytes" }
494 ],
495 "internalType": "struct Property[]",
496 "name": "properties",
497 "type": "tuple[]"
498 }
499 ],
500 "name": "mintCross",
501 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
502 "stateMutability": "nonpayable",
503 "type": "function"
504 },
479 {505 {
480 "inputs": [506 "inputs": [
481 { "internalType": "address", "name": "to", "type": "address" },507 { "internalType": "address", "name": "to", "type": "address" },
modifiedtests/src/eth/abi/reFungible.jsondiffbeforeafterboth
334 { "internalType": "address", "name": "field_0", "type": "address" },334 { "internalType": "address", "name": "field_0", "type": "address" },
335 { "internalType": "uint256", "name": "field_1", "type": "uint256" }335 { "internalType": "uint256", "name": "field_1", "type": "uint256" }
336 ],336 ],
337 "internalType": "struct Tuple29",337 "internalType": "struct Tuple31",
338 "name": "",338 "name": "",
339 "type": "tuple"339 "type": "tuple"
340 }340 }
458 "stateMutability": "nonpayable",458 "stateMutability": "nonpayable",
459 "type": "function"459 "type": "function"
460 },460 },
461 {
462 "inputs": [
463 {
464 "components": [
465 { "internalType": "address", "name": "eth", "type": "address" },
466 { "internalType": "uint256", "name": "sub", "type": "uint256" }
467 ],
468 "internalType": "struct EthCrossAccount",
469 "name": "to",
470 "type": "tuple"
471 },
472 {
473 "components": [
474 { "internalType": "string", "name": "key", "type": "string" },
475 { "internalType": "bytes", "name": "value", "type": "bytes" }
476 ],
477 "internalType": "struct Property[]",
478 "name": "properties",
479 "type": "tuple[]"
480 }
481 ],
482 "name": "mintCross",
483 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
484 "stateMutability": "nonpayable",
485 "type": "function"
486 },
461 {487 {
462 "inputs": [488 "inputs": [
463 { "internalType": "address", "name": "to", "type": "address" },489 { "internalType": "address", "name": "to", "type": "address" },
modifiedtests/src/eth/api/UniqueFungible.soldiffbeforeafterboth
102 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.102 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.
103 /// @dev EVM selector for this function is: 0x6ec0a9f1,103 /// @dev EVM selector for this function is: 0x6ec0a9f1,
104 /// or in textual repr: collectionSponsor()104 /// or in textual repr: collectionSponsor()
105 function collectionSponsor() external view returns (Tuple8 memory);105 function collectionSponsor() external view returns (Tuple9 memory);
106106
107 /// Get current collection limits.107 /// Get current collection limits.
108 ///108 ///
362 bytes value;362 bytes value;
363}363}
364364
365/// @dev the ERC-165 identifier for this interface is 0x5b7038cf365/// @dev the ERC-165 identifier for this interface is 0x7dee5997
366interface ERC20UniqueExtensions is Dummy, ERC165 {366interface ERC20UniqueExtensions is Dummy, ERC165 {
367 /// @notice A description for the collection.367 /// @notice A description for the collection.
368 /// @dev EVM selector for this function is: 0x7284e416,368 /// @dev EVM selector for this function is: 0x7284e416,
369 /// or in textual repr: description()369 /// or in textual repr: description()
370 function description() external view returns (string memory);370 function description() external view returns (string memory);
371
372 /// @dev EVM selector for this function is: 0x269e6158,
373 /// or in textual repr: mintCross((address,uint256),uint256)
374 function mintCross(EthCrossAccount memory to, uint256 amount) external returns (bool);
371375
372 /// @dev EVM selector for this function is: 0x0ecd0ab0,376 /// @dev EVM selector for this function is: 0x0ecd0ab0,
373 /// or in textual repr: approveCross((address,uint256),uint256)377 /// or in textual repr: approveCross((address,uint256),uint256)
395 /// @param amounts array of pairs of account address and amount399 /// @param amounts array of pairs of account address and amount
396 /// @dev EVM selector for this function is: 0x1acf2d55,400 /// @dev EVM selector for this function is: 0x1acf2d55,
397 /// or in textual repr: mintBulk((address,uint256)[])401 /// or in textual repr: mintBulk((address,uint256)[])
398 function mintBulk(Tuple8[] memory amounts) external returns (bool);402 function mintBulk(Tuple9[] memory amounts) external returns (bool);
399403
400 /// @dev EVM selector for this function is: 0x2ada85ff,404 /// @dev EVM selector for this function is: 0x2ada85ff,
401 /// or in textual repr: transferCross((address,uint256),uint256)405 /// or in textual repr: transferCross((address,uint256),uint256)
411}415}
412416
413/// @dev anonymous struct417/// @dev anonymous struct
414struct Tuple8 {418struct Tuple9 {
415 address field_0;419 address field_0;
416 uint256 field_1;420 uint256 field_1;
417}421}
modifiedtests/src/eth/api/UniqueNFT.soldiffbeforeafterboth
198 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.198 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.
199 /// @dev EVM selector for this function is: 0x6ec0a9f1,199 /// @dev EVM selector for this function is: 0x6ec0a9f1,
200 /// or in textual repr: collectionSponsor()200 /// or in textual repr: collectionSponsor()
201 function collectionSponsor() external view returns (Tuple27 memory);201 function collectionSponsor() external view returns (Tuple29 memory);
202202
203 /// Get current collection limits.203 /// Get current collection limits.
204 ///204 ///
553}553}
554554
555/// @title Unique extensions for ERC721.555/// @title Unique extensions for ERC721.
556/// @dev the ERC-165 identifier for this interface is 0xb74c26b7556/// @dev the ERC-165 identifier for this interface is 0x0e48fdb4
557interface ERC721UniqueExtensions is Dummy, ERC165 {557interface ERC721UniqueExtensions is Dummy, ERC165 {
558 /// @notice A descriptive name for a collection of NFTs in this contract558 /// @notice A descriptive name for a collection of NFTs in this contract
559 /// @dev EVM selector for this function is: 0x06fdde03,559 /// @dev EVM selector for this function is: 0x06fdde03,
670 // /// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])671 // /// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])
671 // function mintBulkWithTokenURI(address to, Tuple13[] memory tokens) external returns (bool);672 // function mintBulkWithTokenURI(address to, Tuple13[] memory tokens) external returns (bool);
672673
674 /// @notice Function to mint token.
675 /// @param to The new owner crossAccountId
676 /// @param properties Properties of minted token
677 /// @return uint256 The id of the newly minted token
678 /// @dev EVM selector for this function is: 0xb904db03,
679 /// or in textual repr: mintCross((address,uint256),(string,bytes)[])
680 function mintCross(EthCrossAccount memory to, Property[] memory properties) external returns (uint256);
673}681}
674682
675/// @dev anonymous struct683/// @dev anonymous struct
modifiedtests/src/eth/api/UniqueRefungible.soldiffbeforeafterboth
198 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.198 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.
199 /// @dev EVM selector for this function is: 0x6ec0a9f1,199 /// @dev EVM selector for this function is: 0x6ec0a9f1,
200 /// or in textual repr: collectionSponsor()200 /// or in textual repr: collectionSponsor()
201 function collectionSponsor() external view returns (Tuple26 memory);201 function collectionSponsor() external view returns (Tuple28 memory);
202202
203 /// Get current collection limits.203 /// Get current collection limits.
204 ///204 ///
551}551}
552552
553/// @title Unique extensions for ERC721.553/// @title Unique extensions for ERC721.
554/// @dev the ERC-165 identifier for this interface is 0x12f7d6c1554/// @dev the ERC-165 identifier for this interface is 0xabf30dc2
555interface ERC721UniqueExtensions is Dummy, ERC165 {555interface ERC721UniqueExtensions is Dummy, ERC165 {
556 /// @notice A descriptive name for a collection of NFTs in this contract556 /// @notice A descriptive name for a collection of NFTs in this contract
557 /// @dev EVM selector for this function is: 0x06fdde03,557 /// @dev EVM selector for this function is: 0x06fdde03,
663 // /// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])663 // /// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])
664 // function mintBulkWithTokenURI(address to, Tuple12[] memory tokens) external returns (bool);664 // function mintBulkWithTokenURI(address to, Tuple12[] memory tokens) external returns (bool);
665
666 /// @notice Function to mint token.
667 /// @param to The new owner crossAccountId
668 /// @param properties Properties of minted token
669 /// @return uint256 The id of the newly minted token
670 /// @dev EVM selector for this function is: 0xb904db03,
671 /// or in textual repr: mintCross((address,uint256),(string,bytes)[])
672 function mintCross(EthCrossAccount memory to, Property[] memory properties) external returns (uint256);
665673
666 /// Returns EVM address for refungible token674 /// Returns EVM address for refungible token
667 ///675 ///
modifiedtests/src/eth/fungible.test.tsdiffbeforeafterboth
80 });80 });
81
82
83 itEth('Can perform mintCross()', async ({helper}) => {
84 const receiverCross = helper.ethCrossAccount.fromKeyringPair(owner);
85 const ethOwner = await helper.eth.createAccountWithBalance(donor);
86 const collection = await helper.ft.mintCollection(alice);
87 await collection.addAdmin(alice, {Ethereum: ethOwner});
88
89 const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);
90 const contract = helper.ethNativeContract.collection(collectionAddress, 'ft', ethOwner);
91
92 const result = await contract.methods.mintCross(receiverCross, 100).send();
93
94 const event = result.events.Transfer;
95 expect(event.address).to.equal(collectionAddress);
96 expect(event.returnValues.from).to.equal('0x0000000000000000000000000000000000000000');
97 expect(event.returnValues.to).to.equal(helper.address.substrateToEth(owner.address));
98 expect(event.returnValues.value).to.equal('100');
99 });
81100
82 itEth('Can perform mintBulk()', async ({helper}) => {101 itEth('Can perform mintBulk()', async ({helper}) => {
83 const owner = await helper.eth.createAccountWithBalance(donor);102 const owner = await helper.eth.createAccountWithBalance(donor);
modifiedtests/src/eth/nonFungible.test.tsdiffbeforeafterboth
17import {itEth, usingEthPlaygrounds, expect, EthUniqueHelper} from './util';17import {itEth, usingEthPlaygrounds, expect, EthUniqueHelper} from './util';
18import {IKeyringPair} from '@polkadot/types/types';18import {IKeyringPair} from '@polkadot/types/types';
19import {Contract} from 'web3-eth-contract';19import {Contract} from 'web3-eth-contract';
20import exp from 'constants';
21import {ITokenPropertyPermission} from '../util/playgrounds/types';
2022
2123
22describe('NFT: Information getting', () => {24describe('NFT: Information getting', () => {
174 // expect(tokenUri).to.be.equal(`https://offchain-service.local/token-info/${nextTokenId}`);176 // expect(tokenUri).to.be.equal(`https://offchain-service.local/token-info/${nextTokenId}`);
175 });177 });
176178
179 itEth('Can perform mintCross()', async ({helper}) => {
180 const caller = await helper.eth.createAccountWithBalance(donor);
181 const receiverCross = helper.ethCrossAccount.fromKeyringPair(bob);
182 const properties = Array(5).fill(0).map((_, i) => { return {key: `key_${i}`, value: Buffer.from(`value_${i}`)}; });
183 const permissions: ITokenPropertyPermission[] = properties.map(p => { return {key: p.key, permission: {tokenOwner: true,
184 collectionAdmin: true,
185 mutable: true}}; });
186
187
188 const collection = await helper.nft.mintCollection(minter, {
189 tokenPrefix: 'ethp',
190 tokenPropertyPermissions: permissions,
191 });
192 await collection.addAdmin(minter, {Ethereum: caller});
193
194 const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);
195 const contract = helper.ethNativeContract.collection(collectionAddress, 'nft', caller, true);
196 let expectedTokenId = await contract.methods.nextTokenId().call();
197 let result = await contract.methods.mintCross(receiverCross, []).send();
198 let tokenId = result.events.Transfer.returnValues.tokenId;
199 expect(tokenId).to.be.equal(expectedTokenId);
200
201 const event = result.events.Transfer;
202 expect(event.address).to.be.equal(collectionAddress);
203 expect(event.returnValues.from).to.be.equal('0x0000000000000000000000000000000000000000');
204 expect(event.returnValues.to).to.be.equal(helper.address.substrateToEth(bob.address));
205 expect(await contract.methods.properties(tokenId, []).call()).to.be.like([]);
206
207 expectedTokenId = await contract.methods.nextTokenId().call();
208 result = await contract.methods.mintCross(receiverCross, properties).send();
209 tokenId = result.events.Transfer.returnValues.tokenId;
210
211 expect(tokenId).to.be.equal(expectedTokenId);
212
213 expect(await contract.methods.properties(tokenId, []).call()).to.be.like(properties
214 .map(p => { return helper.ethProperty.property(p.key, p.value.toString()); }));
215 });
216
177 //TODO: CORE-302 add eth methods217 //TODO: CORE-302 add eth methods
178 itEth.skip('Can perform mintBulk()', async ({helper}) => {218 itEth.skip('Can perform mintBulk()', async ({helper}) => {
modifiedtests/src/eth/reFungible.test.tsdiffbeforeafterboth
17import {Pallets, requirePalletsOrSkip} from '../util';17import {Pallets, requirePalletsOrSkip} from '../util';
18import {expect, itEth, usingEthPlaygrounds} from './util';18import {expect, itEth, usingEthPlaygrounds} from './util';
19import {IKeyringPair} from '@polkadot/types/types';19import {IKeyringPair} from '@polkadot/types/types';
20import { ITokenPropertyPermission } from '../util/playgrounds/types';
2021
21describe('Refungible: Information getting', () => {22describe('Refungible: Information getting', () => {
22 let donor: IKeyringPair;23 let donor: IKeyringPair;
136 expect(await contract.methods.tokenURI(tokenId).call()).to.be.equal('Test URI');137 expect(await contract.methods.tokenURI(tokenId).call()).to.be.equal('Test URI');
137 });138 });
139
140 itEth('Can perform mintCross()', async ({helper}) => {
141 const caller = await helper.eth.createAccountWithBalance(donor);
142 const receiverCross = helper.ethCrossAccount.fromKeyringPair(bob);
143 const properties = Array(5).fill(0).map((_, i) => { return {key: `key_${i}`, value: Buffer.from(`value_${i}`)}; });
144 const permissions: ITokenPropertyPermission[] = properties.map(p => { return {key: p.key, permission: {tokenOwner: true,
145 collectionAdmin: true,
146 mutable: true}}; });
147
148
149 const collection = await helper.rft.mintCollection(minter, {
150 tokenPrefix: 'ethp',
151 tokenPropertyPermissions: permissions,
152 });
153 await collection.addAdmin(minter, {Ethereum: caller});
154
155 const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);
156 const contract = helper.ethNativeContract.collection(collectionAddress, 'rft', caller, true);
157 let expectedTokenId = await contract.methods.nextTokenId().call();
158 let result = await contract.methods.mintCross(receiverCross, []).send();
159 let tokenId = result.events.Transfer.returnValues.tokenId;
160 expect(tokenId).to.be.equal(expectedTokenId);
161
162 const event = result.events.Transfer;
163 expect(event.address).to.be.equal(collectionAddress);
164 expect(event.returnValues.from).to.be.equal('0x0000000000000000000000000000000000000000');
165 expect(event.returnValues.to).to.be.equal(helper.address.substrateToEth(bob.address));
166 expect(await contract.methods.properties(tokenId, []).call()).to.be.like([]);
167
168 expectedTokenId = await contract.methods.nextTokenId().call();
169 result = await contract.methods.mintCross(receiverCross, properties).send();
170 tokenId = result.events.Transfer.returnValues.tokenId;
171
172 expect(tokenId).to.be.equal(expectedTokenId);
173
174 expect(await contract.methods.properties(tokenId, []).call()).to.be.like(properties
175 .map(p => { return helper.ethProperty.property(p.key, p.value.toString()); }));
176 });
138177
139 itEth.skip('Can perform mintBulk()', async ({helper}) => {178 itEth.skip('Can perform mintBulk()', async ({helper}) => {
140 const owner = await helper.eth.createAccountWithBalance(donor);179 const owner = await helper.eth.createAccountWithBalance(donor);