difftreelog
added `mintCross` function for `UniqueExtensoins` interfaces
in: master
20 files changed
Cargo.lockdiffbeforeafterboth608560856086[[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",pallets/fungible/CHANGELOG.mddiffbeforeafterboth445<!-- bureaucrate goes here -->5<!-- bureaucrate goes here -->667## [0.1.9] - 2022-12-0189### Added1011- The functions `mintCross` to `ERC20UniqueExtensions` interface.127## [0.1.8] - 2022-11-1813## [0.1.8] - 2022-11-188149### Added15### Addedpallets/fungible/Cargo.tomldiffbeforeafterboth1[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"66pallets/fungible/src/erc.rsdiffbeforeafterboth174 .collect::<string>())174 .collect::<string>())175 }175 }176177 #[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 = self183 .recorder184 .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 }176189177 #[weight(<SelfWeightOf<T>>::approve())]190 #[weight(<SelfWeightOf<T>>::approve())]178 fn approve_cross(191 fn approve_cross(pallets/fungible/src/stubs/UniqueFungible.soldiffbeforeafterboth152 /// @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 }160160161 /// Get current collection limits.161 /// Get current collection limits.522 bytes value;522 bytes value;523}523}524524525/// @dev the ERC-165 identifier for this interface is 0x5b7038cf525/// @dev the ERC-165 identifier for this interface is 0x7dee5997526contract 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 }535536 /// @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 }535545536 /// @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 amount578 /// @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}612622613/// @dev anonymous struct623/// @dev anonymous struct614struct Tuple8 {624struct Tuple9 {615 address field_0;625 address field_0;616 uint256 field_1;626 uint256 field_1;617}627}pallets/nonfungible/CHANGELOG.mddiffbeforeafterboth445<!-- bureaucrate goes here -->5<!-- bureaucrate goes here -->667## [0.1.11] - 2022-12-167## [0.1.12] - 2022-12-16889### Added9### Added1010141415- Hide `setTokenPropertyPermission` function in `TokenProperties` interface.15- Hide `setTokenPropertyPermission` function in `TokenProperties` interface.161617## [0.1.11] - 2022-12-011819### Added2021- The functions `mintCross` to `ERC721UniqueExtensions` interface.2217## [0.1.10] - 2022-11-1823## [0.1.10] - 2022-11-18182419### Added25### Addedpallets/nonfungible/src/erc.rsdiffbeforeafterboth1070 Ok(true)1070 Ok(true)1071 }1071 }10721073 /// @notice Function to mint token.1074 /// @param to The new owner crossAccountId1075 /// @param properties Properties of minted token1076 /// @return uint256 The id of the newly minted token1077 #[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")?;10871088 let to = to.into_sub_cross_account::<T>()?;10891090 let properties = properties1091 .into_iter()1092 .map(|PropertyStruct { key, value }| {1093 let key = <Vec<u8>>::from(key)1094 .try_into()1095 .map_err(|_| "key too large")?;10961097 let value = value.0.try_into().map_err(|_| "value too large")?;10981099 Ok(Property { key, value })1100 })1101 .collect::<Result<Vec<_>>>()?1102 .try_into()1103 .map_err(|_| Error::Revert(alloc::format!("too many properties")))?;11041105 let caller = T::CrossAccountId::from_eth(caller);11061107 let budget = self1108 .recorder1109 .weight_calls_budget(<StructureWeight<T>>::find_parent());11101111 <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>)?;11211122 Ok(token_id.into())1123 }1072}1124}107311251074#[solidity_interface(1126#[solidity_interface(pallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth290 /// @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 }298298299 /// Get current collection limits.299 /// Get current collection limits.655}655}656656657/// @dev anonymous struct657/// @dev anonymous struct658struct Tuple30 {658struct Tuple32 {659 address field_0;659 address field_0;660 uint256 field_1;660 uint256 field_1;661}661}804}804}805805806/// @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 0x0e48fdb4808contract 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 contract810 /// @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 // }993994995 /// @notice Function to mint token.996 /// @param to The new owner crossAccountId997 /// @param properties Properties of minted token998 /// @return uint256 The id of the newly minted token999 /// @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}9951009996/// @dev anonymous struct1010/// @dev anonymous structpallets/refungible/CHANGELOG.mddiffbeforeafterboth445<!-- bureaucrate goes here -->5<!-- bureaucrate goes here -->667## [0.2.10] - 2022-12-167## [0.2.11] - 2022-12-16889### Added9### Added1010141415- Hide `setTokenPropertyPermission` function in `TokenProperties` interface.15- Hide `setTokenPropertyPermission` function in `TokenProperties` interface.161617## [0.2.10] - 2022-12-011819### Added2021- The functions `mintCross` to `ERC721UniqueExtensions` interface.2217## [0.2.9] - 2022-11-1823## [0.2.9] - 2022-11-18182419### Added25### Addedpallets/refungible/src/erc.rsdiffbeforeafterboth1120 Ok(true)1120 Ok(true)1121 }1121 }11221123 /// @notice Function to mint token.1124 /// @param to The new owner crossAccountId1125 /// @param properties Properties of minted token1126 /// @return uint256 The id of the newly minted token1127 #[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")?;11371138 let to = to.into_sub_cross_account::<T>()?;11391140 let properties = properties1141 .into_iter()1142 .map(|PropertyStruct { key, value }| {1143 let key = <Vec<u8>>::from(key)1144 .try_into()1145 .map_err(|_| "key too large")?;11461147 let value = value.0.try_into().map_err(|_| "value too large")?;11481149 Ok(Property { key, value })1150 })1151 .collect::<Result<Vec<_>>>()?1152 .try_into()1153 .map_err(|_| Error::Revert(alloc::format!("too many properties")))?;11541155 let caller = T::CrossAccountId::from_eth(caller);11561157 let budget = self1158 .recorder1159 .weight_calls_budget(<StructureWeight<T>>::find_parent());11601161 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>)?;11731174 Ok(token_id.into())1175 }112211761123 /// Returns EVM address for refungible token1177 /// Returns EVM address for refungible token1124 ///1178 ///pallets/refungible/src/stubs/UniqueRefungible.soldiffbeforeafterboth290 /// @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 }298298299 /// Get current collection limits.299 /// Get current collection limits.655}655}656656657/// @dev anonymous struct657/// @dev anonymous struct658struct Tuple29 {658struct Tuple31 {659 address field_0;659 address field_0;660 uint256 field_1;660 uint256 field_1;661}661}802}802}803803804/// @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 0xabf30dc2806contract 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 contract808 /// @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 // }981982 /// @notice Function to mint token.983 /// @param to The new owner crossAccountId984 /// @param properties Properties of minted token985 /// @return uint256 The id of the newly minted token986 /// @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 }981995982 /// Returns EVM address for refungible token996 /// Returns EVM address for refungible token983 ///997 ///tests/src/eth/abi/fungible.jsondiffbeforeafterboth322 { "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",tests/src/eth/abi/nonFungible.jsondiffbeforeafterboth352 { "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" },tests/src/eth/abi/reFungible.jsondiffbeforeafterboth334 { "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" },tests/src/eth/api/UniqueFungible.soldiffbeforeafterboth102 /// @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);106106107 /// Get current collection limits.107 /// Get current collection limits.108 ///108 ///362 bytes value;362 bytes value;363}363}364364365/// @dev the ERC-165 identifier for this interface is 0x5b7038cf365/// @dev the ERC-165 identifier for this interface is 0x7dee5997366interface 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);371372 /// @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);371375372 /// @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 amount396 /// @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);399403400 /// @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}412416413/// @dev anonymous struct417/// @dev anonymous struct414struct Tuple8 {418struct Tuple9 {415 address field_0;419 address field_0;416 uint256 field_1;420 uint256 field_1;417}421}tests/src/eth/api/UniqueNFT.soldiffbeforeafterboth198 /// @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);202202203 /// Get current collection limits.203 /// Get current collection limits.204 ///204 ///553}553}554554555/// @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 0x0e48fdb4557interface 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 contract559 /// @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);672673674 /// @notice Function to mint token.675 /// @param to The new owner crossAccountId676 /// @param properties Properties of minted token677 /// @return uint256 The id of the newly minted token678 /// @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}674682675/// @dev anonymous struct683/// @dev anonymous structtests/src/eth/api/UniqueRefungible.soldiffbeforeafterboth198 /// @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);202202203 /// Get current collection limits.203 /// Get current collection limits.204 ///204 ///551}551}552552553/// @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 0xabf30dc2555interface 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 contract557 /// @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);665666 /// @notice Function to mint token.667 /// @param to The new owner crossAccountId668 /// @param properties Properties of minted token669 /// @return uint256 The id of the newly minted token670 /// @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);665673666 /// Returns EVM address for refungible token674 /// Returns EVM address for refungible token667 ///675 ///tests/src/eth/fungible.test.tsdiffbeforeafterboth80 });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});8889 const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);90 const contract = helper.ethNativeContract.collection(collectionAddress, 'ft', ethOwner);9192 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 });8110082 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);tests/src/eth/nonFungible.test.tsdiffbeforeafterboth17import {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';2022212322describe('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);200201 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;210211 expect(tokenId).to.be.equal(expectedTokenId);212 213 expect(await contract.methods.properties(tokenId, []).call()).to.be.like(properties214 .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 methods178 itEth.skip('Can perform mintBulk()', async ({helper}) => {218 itEth.skip('Can perform mintBulk()', async ({helper}) => {tests/src/eth/reFungible.test.tsdiffbeforeafterboth17import {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';202121describe('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);161162 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;171172 expect(tokenId).to.be.equal(expectedTokenId);173 174 expect(await contract.methods.properties(tokenId, []).call()).to.be.like(properties175 .map(p => { return helper.ethProperty.property(p.key, p.value.toString()); }));176 });138177139 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);