difftreelog
Merge pull request #728 from UniqueNetwork/feature/newCallMethods
in: master
Added new call functions
31 files changed
crates/evm-coder/src/abi/impls.rsdiffbeforeafterboth184184185impl AbiWrite for Property {185impl AbiWrite for Property {186 fn abi_write(&self, writer: &mut AbiWriter) {186 fn abi_write(&self, writer: &mut AbiWriter) {187 self.key.abi_write(writer);187 (&self.key, &self.value).abi_write(writer);188 self.value.abi_write(writer);189 }188 }190}189}191190crates/evm-coder/src/abi/traits.rsdiffbeforeafterboth50 }50 }51}51}5253impl<T: AbiWrite> AbiWrite for &T {54 fn abi_write(&self, writer: &mut AbiWriter) {55 T::abi_write(self, writer);56 }57}5258pallets/common/src/erc.rsdiffbeforeafterboth178 ///178 ///179 /// @param keys Properties keys. Empty keys for all propertyes.179 /// @param keys Properties keys. Empty keys for all propertyes.180 /// @return Vector of properties key/value pairs.180 /// @return Vector of properties key/value pairs.181 fn collection_properties(&self, keys: Vec<string>) -> Result<Vec<(string, bytes)>> {181 fn collection_properties(&self, keys: Vec<string>) -> Result<Vec<PropertyStruct>> {182 let keys = keys182 let keys = keys183 .into_iter()183 .into_iter()184 .map(|key| {184 .map(|key| {200 let key =200 let key =201 string::from_utf8(p.key.into()).map_err(|e| Error::Revert(format!("{}", e)))?;201 string::from_utf8(p.key.into()).map_err(|e| Error::Revert(format!("{}", e)))?;202 let value = bytes(p.value.to_vec());202 let value = bytes(p.value.to_vec());203 Ok((key, value))203 Ok(PropertyStruct { key, value })204 })204 })205 .collect::<Result<Vec<_>>>()?;205 .collect::<Result<Vec<_>>>()?;206 Ok(properties)206 Ok(properties)pallets/evm-contract-helpers/src/stubs/ContractHelpers.rawdiffbeforeafterbothbinary blob — no preview
pallets/fungible/CHANGELOG.mddiffbeforeafterboth445<!-- bureaucrate goes here -->5<!-- bureaucrate goes here -->667## [0.1.8] - 2022-11-1889### Added1011- The function `description` to `ERC20UniqueExtensions` interface.127## [0.1.7] - 2022-11-1413## [0.1.7] - 2022-11-148149### Changed15### Changed101611- Added `transfer_cross` in eth functions.17- Added `transfer_cross` in eth functions.1819### Changed2021- Use named structure `EthCrossAccount` in eth functions.122213## [0.1.6] - 2022-11-0223## [0.1.6] - 2022-11-021424pallets/fungible/src/erc.rsdiffbeforeafterboth158where158where159 T::AccountId: From<[u8; 32]>,159 T::AccountId: From<[u8; 32]>,160{160{161 /// @notice A description for the collection.162 fn description(&self) -> Result<string> {163 Ok(decode_utf16(self.description.iter().copied())164 .map(|r| r.unwrap_or(REPLACEMENT_CHARACTER))165 .collect::<string>())166 }167161 #[weight(<SelfWeightOf<T>>::approve())]168 #[weight(<SelfWeightOf<T>>::approve())]162 fn approve_cross(169 fn approve_cross(pallets/fungible/src/stubs/UniqueFungible.rawdiffbeforeafterbothbinary blob — no preview
pallets/fungible/src/stubs/UniqueFungible.soldiffbeforeafterboth87 /// @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 (Tuple16[] memory) {90 function collectionProperties(string[] memory keys) public view returns (Property[] memory) {91 require(false, stub_error);91 require(false, stub_error);92 keys;92 keys;93 dummy;93 dummy;94 return new Tuple16[](0);94 return new Property[](0);95 }95 }969697 // /// Set the sponsor of the collection.97 // /// Set the sponsor of the collection.425 uint256 sub;425 uint256 sub;426}426}427428/// @dev anonymous struct429struct Tuple16 {430 string field_0;431 bytes field_1;432}433427434/// @dev Property struct428/// @dev Property struct435struct Property {429struct Property {436 string key;430 string key;437 bytes value;431 bytes value;438}432}439433440/// @dev the ERC-165 identifier for this interface is 0x29f4dcd9434/// @dev the ERC-165 identifier for this interface is 0x5b7038cf441contract ERC20UniqueExtensions is Dummy, ERC165 {435contract ERC20UniqueExtensions is Dummy, ERC165 {436 /// @notice A description for the collection.437 /// @dev EVM selector for this function is: 0x7284e416,438 /// or in textual repr: description()439 function description() public view returns (string memory) {440 require(false, stub_error);441 dummy;442 return "";443 }444442 /// @dev EVM selector for this function is: 0x0ecd0ab0,445 /// @dev EVM selector for this function is: 0x0ecd0ab0,443 /// or in textual repr: approveCross((address,uint256),uint256)446 /// or in textual repr: approveCross((address,uint256),uint256)pallets/nonfungible/CHANGELOG.mddiffbeforeafterboth445<!-- bureaucrate goes here -->5<!-- bureaucrate goes here -->667## [0.1.10] - 2022-11-1889### Added1011- The functions `description`, `crossOwnerOf`, `tokenProperties` to `ERC721UniqueExtensions` interface.127## [0.1.9] - 2022-11-1413## [0.1.9] - 2022-11-148149### Changed15### Changedpallets/nonfungible/src/erc.rsdiffbeforeafterboth37use sp_std::vec::Vec;37use sp_std::vec::Vec;38use pallet_common::{38use pallet_common::{39 erc::{CommonEvmHandler, PrecompileResult, CollectionCall, static_property::key},39 erc::{CommonEvmHandler, PrecompileResult, CollectionCall, static_property::key},40 CollectionHandle, CollectionPropertyPermissions,40 CollectionHandle, CollectionPropertyPermissions, CommonCollectionOperations,41};41};42use pallet_evm::{account::CrossAccountId, PrecompileHandle};42use pallet_evm::{account::CrossAccountId, PrecompileHandle};43use pallet_evm_coder_substrate::call;43use pallet_evm_coder_substrate::call;278#[solidity_interface(name = ERC721Metadata, expect_selector = 0x5b5e139f)]278#[solidity_interface(name = ERC721Metadata, expect_selector = 0x5b5e139f)]279impl<T: Config> NonfungibleHandle<T>279impl<T: Config> NonfungibleHandle<T>280where280where281 T::AccountId: From<[u8; 32]>,281 T::AccountId: From<[u8; 32]> + AsRef<[u8; 32]>,282{282{283 /// @notice A descriptive name for a collection of NFTs in this contract283 /// @notice A descriptive name for a collection of NFTs in this contract284 /// @dev real implementation of this function lies in `ERC721UniqueExtensions`284 /// @dev real implementation of this function lies in `ERC721UniqueExtensions`686#[solidity_interface(name = ERC721UniqueExtensions)]686#[solidity_interface(name = ERC721UniqueExtensions)]687impl<T: Config> NonfungibleHandle<T>687impl<T: Config> NonfungibleHandle<T>688where688where689 T::AccountId: From<[u8; 32]>,689 T::AccountId: From<[u8; 32]> + AsRef<[u8; 32]>,690{690{691 /// @notice A descriptive name for a collection of NFTs in this contract691 /// @notice A descriptive name for a collection of NFTs in this contract692 fn name(&self) -> Result<string> {692 fn name(&self) -> Result<string> {700 Ok(string::from_utf8_lossy(&self.token_prefix).into())700 Ok(string::from_utf8_lossy(&self.token_prefix).into())701 }701 }702703 /// @notice A description for the collection.704 fn description(&self) -> Result<string> {705 Ok(decode_utf16(self.description.iter().copied())706 .map(|r| r.unwrap_or(REPLACEMENT_CHARACTER))707 .collect::<string>())708 }709710 /// Returns the owner (in cross format) of the token.711 ///712 /// @param tokenId Id for the token.713 fn cross_owner_of(&self, token_id: uint256) -> Result<EthCrossAccount> {714 Self::token_owner(&self, token_id.try_into()?)715 .map(|o| EthCrossAccount::from_sub_cross_account::<T>(&o))716 .ok_or(Error::Revert("key too large".into()))717 }718719 /// Returns the token properties.720 ///721 /// @param tokenId Id for the token.722 /// @param keys Properties keys. Empty keys for all propertyes.723 /// @return Vector of properties key/value pairs.724 fn token_properties(725 &self,726 token_id: uint256,727 keys: Vec<string>,728 ) -> Result<Vec<PropertyStruct>> {729 let keys = keys730 .into_iter()731 .map(|key| {732 <Vec<u8>>::from(key)733 .try_into()734 .map_err(|_| Error::Revert("key too large".into()))735 })736 .collect::<Result<Vec<_>>>()?;737738 <Self as CommonCollectionOperations<T>>::token_properties(739 &self,740 token_id.try_into()?,741 if keys.is_empty() { None } else { Some(keys) },742 )743 .into_iter()744 .map(|p| {745 let key = string::from_utf8(p.key.to_vec())746 .map_err(|e| Error::Revert(alloc::format!("{}", e)))?;747 let value = bytes(p.value.to_vec());748 Ok(PropertyStruct { key, value })749 })750 .collect::<Result<Vec<_>>>()751 }702752703 /// @notice Set or reaffirm the approved address for an NFT753 /// @notice Set or reaffirm the approved address for an NFT704 /// @dev The zero address indicates there is no approved address.754 /// @dev The zero address indicates there is no approved address.pallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterbothbinary blob — no preview
pallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth188 /// @return Vector of properties key/value pairs.188 /// @return Vector of properties key/value pairs.189 /// @dev EVM selector for this function is: 0x285fb8e6,189 /// @dev EVM selector for this function is: 0x285fb8e6,190 /// or in textual repr: collectionProperties(string[])190 /// or in textual repr: collectionProperties(string[])191 function collectionProperties(string[] memory keys) public view returns (Tuple23[] memory) {191 function collectionProperties(string[] memory keys) public view returns (Property[] memory) {192 require(false, stub_error);192 require(false, stub_error);193 keys;193 keys;194 dummy;194 dummy;195 return new Tuple23[](0);195 return new Property[](0);196 }196 }197197198 // /// Set the sponsor of the collection.198 // /// Set the sponsor of the collection.253 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.253 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.254 /// @dev EVM selector for this function is: 0x6ec0a9f1,254 /// @dev EVM selector for this function is: 0x6ec0a9f1,255 /// or in textual repr: collectionSponsor()255 /// or in textual repr: collectionSponsor()256 function collectionSponsor() public view returns (Tuple26 memory) {256 function collectionSponsor() public view returns (Tuple30 memory) {257 require(false, stub_error);257 require(false, stub_error);258 dummy;258 dummy;259 return Tuple26(0x0000000000000000000000000000000000000000, 0);259 return Tuple30(0x0000000000000000000000000000000000000000, 0);260 }260 }261261262 /// Set limits for the collection.262 /// Set limits for the collection.527}527}528528529/// @dev anonymous struct529/// @dev anonymous struct530struct Tuple26 {530struct Tuple30 {531 address field_0;531 address field_0;532 uint256 field_1;532 uint256 field_1;533}533}534535/// @dev anonymous struct536struct Tuple23 {537 string field_0;538 bytes field_1;539}540534541/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension535/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension542/// @dev See https://eips.ethereum.org/EIPS/eip-721536/// @dev See https://eips.ethereum.org/EIPS/eip-721682}676}683677684/// @title Unique extensions for ERC721.678/// @title Unique extensions for ERC721.685/// @dev the ERC-165 identifier for this interface is 0x0e9fc611679/// @dev the ERC-165 identifier for this interface is 0xb8f094a0686contract ERC721UniqueExtensions is Dummy, ERC165 {680contract ERC721UniqueExtensions is Dummy, ERC165 {687 /// @notice A descriptive name for a collection of NFTs in this contract681 /// @notice A descriptive name for a collection of NFTs in this contract688 /// @dev EVM selector for this function is: 0x06fdde03,682 /// @dev EVM selector for this function is: 0x06fdde03,702 return "";696 return "";703 }697 }698699 /// @notice A description for the collection.700 /// @dev EVM selector for this function is: 0x7284e416,701 /// or in textual repr: description()702 function description() public view returns (string memory) {703 require(false, stub_error);704 dummy;705 return "";706 }707708 /// Returns the owner (in cross format) of the token.709 ///710 /// @param tokenId Id for the token.711 /// @dev EVM selector for this function is: 0x2b29dace,712 /// or in textual repr: crossOwnerOf(uint256)713 function crossOwnerOf(uint256 tokenId) public view returns (EthCrossAccount memory) {714 require(false, stub_error);715 tokenId;716 dummy;717 return EthCrossAccount(0x0000000000000000000000000000000000000000, 0);718 }719720 /// Returns the token properties.721 ///722 /// @param tokenId Id for the token.723 /// @param keys Properties keys. Empty keys for all propertyes.724 /// @return Vector of properties key/value pairs.725 /// @dev EVM selector for this function is: 0xefc26c69,726 /// or in textual repr: tokenProperties(uint256,string[])727 function tokenProperties(uint256 tokenId, string[] memory keys) public view returns (Property[] memory) {728 require(false, stub_error);729 tokenId;730 keys;731 dummy;732 return new Property[](0);733 }704734705 /// @notice Set or reaffirm the approved address for an NFT735 /// @notice Set or reaffirm the approved address for an NFT706 /// @dev The zero address indicates there is no approved address.736 /// @dev The zero address indicates there is no approved address.825 // /// @param tokens array of pairs of token ID and token URI for minted tokens855 // /// @param tokens array of pairs of token ID and token URI for minted tokens826 // /// @dev EVM selector for this function is: 0x36543006,856 // /// @dev EVM selector for this function is: 0x36543006,827 // /// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])857 // /// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])828 // function mintBulkWithTokenURI(address to, Tuple11[] memory tokens) public returns (bool) {858 // function mintBulkWithTokenURI(address to, Tuple15[] memory tokens) public returns (bool) {829 // require(false, stub_error);859 // require(false, stub_error);830 // to;860 // to;831 // tokens;861 // tokens;836}866}837867838/// @dev anonymous struct868/// @dev anonymous struct839struct Tuple11 {869struct Tuple15 {840 uint256 field_0;870 uint256 field_0;841 string field_1;871 string field_1;842}872}pallets/refungible/CHANGELOG.mddiffbeforeafterboth445<!-- bureaucrate goes here -->5<!-- bureaucrate goes here -->667## [0.2.9] - 2022-11-1889### Added1011- The functions `description`, `crossOwnerOf`, `tokenProperties` to `ERC721UniqueExtensions` interface.127## [0.2.8] - 2022-11-1413## [0.2.8] - 2022-11-148149### Changed15### Changedpallets/refungible/src/erc.rsdiffbeforeafterboth33use pallet_common::{33use pallet_common::{34 CollectionHandle, CollectionPropertyPermissions,34 CollectionHandle, CollectionPropertyPermissions,35 erc::{CommonEvmHandler, CollectionCall, static_property::key},35 erc::{CommonEvmHandler, CollectionCall, static_property::key},36 CommonCollectionOperations,36};37};37use pallet_evm::{account::CrossAccountId, PrecompileHandle};38use pallet_evm::{account::CrossAccountId, PrecompileHandle};38use pallet_evm_coder_substrate::{call, dispatch_to_evm};39use pallet_evm_coder_substrate::{call, dispatch_to_evm};273#[solidity_interface(name = ERC721Metadata)]274#[solidity_interface(name = ERC721Metadata)]274impl<T: Config> RefungibleHandle<T>275impl<T: Config> RefungibleHandle<T>275where276where276 T::AccountId: From<[u8; 32]>,277 T::AccountId: From<[u8; 32]> + AsRef<[u8; 32]>,277{278{278 /// @notice A descriptive name for a collection of NFTs in this contract279 /// @notice A descriptive name for a collection of NFTs in this contract279 /// @dev real implementation of this function lies in `ERC721UniqueExtensions`280 /// @dev real implementation of this function lies in `ERC721UniqueExtensions`713#[solidity_interface(name = ERC721UniqueExtensions)]714#[solidity_interface(name = ERC721UniqueExtensions)]714impl<T: Config> RefungibleHandle<T>715impl<T: Config> RefungibleHandle<T>715where716where716 T::AccountId: From<[u8; 32]>,717 T::AccountId: From<[u8; 32]> + AsRef<[u8; 32]>,717{718{718 /// @notice A descriptive name for a collection of NFTs in this contract719 /// @notice A descriptive name for a collection of NFTs in this contract719 fn name(&self) -> Result<string> {720 fn name(&self) -> Result<string> {727 Ok(string::from_utf8_lossy(&self.token_prefix).into())728 Ok(string::from_utf8_lossy(&self.token_prefix).into())728 }729 }729730731 /// @notice A description for the collection.732 fn description(&self) -> Result<string> {733 Ok(decode_utf16(self.description.iter().copied())734 .map(|r| r.unwrap_or(REPLACEMENT_CHARACTER))735 .collect::<string>())736 }737738 /// Returns the owner (in cross format) of the token.739 ///740 /// @param tokenId Id for the token.741 fn cross_owner_of(&self, token_id: uint256) -> Result<EthCrossAccount> {742 Self::token_owner(&self, token_id.try_into()?)743 .map(|o| EthCrossAccount::from_sub_cross_account::<T>(&o))744 .ok_or(Error::Revert("key too large".into()))745 }746747 /// Returns the token properties.748 ///749 /// @param tokenId Id for the token.750 /// @param keys Properties keys. Empty keys for all propertyes.751 /// @return Vector of properties key/value pairs.752 fn token_properties(753 &self,754 token_id: uint256,755 keys: Vec<string>,756 ) -> Result<Vec<PropertyStruct>> {757 let keys = keys758 .into_iter()759 .map(|key| {760 <Vec<u8>>::from(key)761 .try_into()762 .map_err(|_| Error::Revert("key too large".into()))763 })764 .collect::<Result<Vec<_>>>()?;765766 <Self as CommonCollectionOperations<T>>::token_properties(767 &self,768 token_id.try_into()?,769 if keys.is_empty() { None } else { Some(keys) },770 )771 .into_iter()772 .map(|p| {773 let key = string::from_utf8(p.key.to_vec())774 .map_err(|e| Error::Revert(alloc::format!("{}", e)))?;775 let value = bytes(p.value.to_vec());776 Ok(PropertyStruct { key, value })777 })778 .collect::<Result<Vec<_>>>()779 }730 /// @notice Transfer ownership of an RFT780 /// @notice Transfer ownership of an RFT731 /// @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`732 /// is the zero address. Throws if `tokenId` is not a valid RFT.782 /// is the zero address. Throws if `tokenId` is not a valid RFT.pallets/refungible/src/stubs/UniqueRefungible.rawdiffbeforeafterbothbinary blob — no preview
pallets/refungible/src/stubs/UniqueRefungible.soldiffbeforeafterboth188 /// @return Vector of properties key/value pairs.188 /// @return Vector of properties key/value pairs.189 /// @dev EVM selector for this function is: 0x285fb8e6,189 /// @dev EVM selector for this function is: 0x285fb8e6,190 /// or in textual repr: collectionProperties(string[])190 /// or in textual repr: collectionProperties(string[])191 function collectionProperties(string[] memory keys) public view returns (Tuple22[] memory) {191 function collectionProperties(string[] memory keys) public view returns (Property[] memory) {192 require(false, stub_error);192 require(false, stub_error);193 keys;193 keys;194 dummy;194 dummy;195 return new Tuple22[](0);195 return new Property[](0);196 }196 }197197198 // /// Set the sponsor of the collection.198 // /// Set the sponsor of the collection.253 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.253 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.254 /// @dev EVM selector for this function is: 0x6ec0a9f1,254 /// @dev EVM selector for this function is: 0x6ec0a9f1,255 /// or in textual repr: collectionSponsor()255 /// or in textual repr: collectionSponsor()256 function collectionSponsor() public view returns (Tuple25 memory) {256 function collectionSponsor() public view returns (Tuple29 memory) {257 require(false, stub_error);257 require(false, stub_error);258 dummy;258 dummy;259 return Tuple25(0x0000000000000000000000000000000000000000, 0);259 return Tuple29(0x0000000000000000000000000000000000000000, 0);260 }260 }261261262 /// Set limits for the collection.262 /// Set limits for the collection.527}527}528528529/// @dev anonymous struct529/// @dev anonymous struct530struct Tuple25 {530struct Tuple29 {531 address field_0;531 address field_0;532 uint256 field_1;532 uint256 field_1;533}533}534535/// @dev anonymous struct536struct Tuple22 {537 string field_0;538 bytes field_1;539}540534541/// @dev the ERC-165 identifier for this interface is 0x5b5e139f535/// @dev the ERC-165 identifier for this interface is 0x5b5e139f542contract ERC721Metadata is Dummy, ERC165 {536contract ERC721Metadata is Dummy, ERC165 {680}674}681675682/// @title Unique extensions for ERC721.676/// @title Unique extensions for ERC721.683/// @dev the ERC-165 identifier for this interface is 0xab243667677/// @dev the ERC-165 identifier for this interface is 0x1d4b64d6684contract ERC721UniqueExtensions is Dummy, ERC165 {678contract ERC721UniqueExtensions is Dummy, ERC165 {685 /// @notice A descriptive name for a collection of NFTs in this contract679 /// @notice A descriptive name for a collection of NFTs in this contract686 /// @dev EVM selector for this function is: 0x06fdde03,680 /// @dev EVM selector for this function is: 0x06fdde03,700 return "";694 return "";701 }695 }696697 /// @notice A description for the collection.698 /// @dev EVM selector for this function is: 0x7284e416,699 /// or in textual repr: description()700 function description() public view returns (string memory) {701 require(false, stub_error);702 dummy;703 return "";704 }705706 /// Returns the owner (in cross format) of the token.707 ///708 /// @param tokenId Id for the token.709 /// @dev EVM selector for this function is: 0x2b29dace,710 /// or in textual repr: crossOwnerOf(uint256)711 function crossOwnerOf(uint256 tokenId) public view returns (EthCrossAccount memory) {712 require(false, stub_error);713 tokenId;714 dummy;715 return EthCrossAccount(0x0000000000000000000000000000000000000000, 0);716 }717718 /// Returns the token properties.719 ///720 /// @param tokenId Id for the token.721 /// @param keys Properties keys. Empty keys for all propertyes.722 /// @return Vector of properties key/value pairs.723 /// @dev EVM selector for this function is: 0xefc26c69,724 /// or in textual repr: tokenProperties(uint256,string[])725 function tokenProperties(uint256 tokenId, string[] memory keys) public view returns (Property[] memory) {726 require(false, stub_error);727 tokenId;728 keys;729 dummy;730 return new Property[](0);731 }702732703 /// @notice Transfer ownership of an RFT733 /// @notice Transfer ownership of an RFT704 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`734 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`813 // /// @param tokens array of pairs of token ID and token URI for minted tokens843 // /// @param tokens array of pairs of token ID and token URI for minted tokens814 // /// @dev EVM selector for this function is: 0x36543006,844 // /// @dev EVM selector for this function is: 0x36543006,815 // /// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])845 // /// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])816 // function mintBulkWithTokenURI(address to, Tuple10[] memory tokens) public returns (bool) {846 // function mintBulkWithTokenURI(address to, Tuple14[] memory tokens) public returns (bool) {817 // require(false, stub_error);847 // require(false, stub_error);818 // to;848 // to;819 // tokens;849 // tokens;835}865}836866837/// @dev anonymous struct867/// @dev anonymous struct838struct Tuple10 {868struct Tuple14 {839 uint256 field_0;869 uint256 field_0;840 string field_1;870 string field_1;841}871}pallets/refungible/src/stubs/UniqueRefungibleToken.rawdiffbeforeafterbothbinary blob — no preview
pallets/unique/src/eth/stubs/CollectionHelpers.rawdiffbeforeafterbothbinary blob — no preview
tests/src/eth/abi/fungible.jsondiffbeforeafterboth216 "outputs": [216 "outputs": [217 {217 {218 "components": [218 "components": [219 { "internalType": "string", "name": "field_0", "type": "string" },219 { "internalType": "string", "name": "key", "type": "string" },220 { "internalType": "bytes", "name": "field_1", "type": "bytes" }220 { "internalType": "bytes", "name": "value", "type": "bytes" }221 ],221 ],222 "internalType": "struct Tuple16[]",222 "internalType": "struct Property[]",223 "name": "",223 "name": "",224 "type": "tuple[]"224 "type": "tuple[]"225 }225 }281 "stateMutability": "nonpayable",281 "stateMutability": "nonpayable",282 "type": "function"282 "type": "function"283 },283 },284 {285 "inputs": [],286 "name": "description",287 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],288 "stateMutability": "view",289 "type": "function"290 },284 {291 {285 "inputs": [],292 "inputs": [],286 "name": "hasCollectionPendingSponsor",293 "name": "hasCollectionPendingSponsor",tests/src/eth/abi/nonFungible.jsondiffbeforeafterboth246 "outputs": [246 "outputs": [247 {247 {248 "components": [248 "components": [249 { "internalType": "string", "name": "field_0", "type": "string" },249 { "internalType": "string", "name": "key", "type": "string" },250 { "internalType": "bytes", "name": "field_1", "type": "bytes" }250 { "internalType": "bytes", "name": "value", "type": "bytes" }251 ],251 ],252 "internalType": "struct Tuple23[]",252 "internalType": "struct Property[]",253 "name": "",253 "name": "",254 "type": "tuple[]"254 "type": "tuple[]"255 }255 }273 { "internalType": "address", "name": "field_0", "type": "address" },273 { "internalType": "address", "name": "field_0", "type": "address" },274 { "internalType": "uint256", "name": "field_1", "type": "uint256" }274 { "internalType": "uint256", "name": "field_1", "type": "uint256" }275 ],275 ],276 "internalType": "struct Tuple26",276 "internalType": "struct Tuple30",277 "name": "",277 "name": "",278 "type": "tuple"278 "type": "tuple"279 }279 }295 "stateMutability": "view",295 "stateMutability": "view",296 "type": "function"296 "type": "function"297 },297 },298 {299 "inputs": [300 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }301 ],302 "name": "crossOwnerOf",303 "outputs": [304 {305 "components": [306 { "internalType": "address", "name": "eth", "type": "address" },307 { "internalType": "uint256", "name": "sub", "type": "uint256" }308 ],309 "internalType": "struct EthCrossAccount",310 "name": "",311 "type": "tuple"312 }313 ],314 "stateMutability": "view",315 "type": "function"316 },298 {317 {299 "inputs": [318 "inputs": [300 { "internalType": "string[]", "name": "keys", "type": "string[]" }319 { "internalType": "string[]", "name": "keys", "type": "string[]" }314 "stateMutability": "nonpayable",333 "stateMutability": "nonpayable",315 "type": "function"334 "type": "function"316 },335 },336 {337 "inputs": [],338 "name": "description",339 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],340 "stateMutability": "view",341 "type": "function"342 },317 {343 {318 "inputs": [],344 "inputs": [],319 "name": "finishMinting",345 "name": "finishMinting",639 "stateMutability": "view",665 "stateMutability": "view",640 "type": "function"666 "type": "function"641 },667 },668 {669 "inputs": [670 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },671 { "internalType": "string[]", "name": "keys", "type": "string[]" }672 ],673 "name": "tokenProperties",674 "outputs": [675 {676 "components": [677 { "internalType": "string", "name": "key", "type": "string" },678 { "internalType": "bytes", "name": "value", "type": "bytes" }679 ],680 "internalType": "struct Property[]",681 "name": "",682 "type": "tuple[]"683 }684 ],685 "stateMutability": "view",686 "type": "function"687 },642 {688 {643 "inputs": [689 "inputs": [644 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }690 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }tests/src/eth/abi/reFungible.jsondiffbeforeafterboth228 "outputs": [228 "outputs": [229 {229 {230 "components": [230 "components": [231 { "internalType": "string", "name": "field_0", "type": "string" },231 { "internalType": "string", "name": "key", "type": "string" },232 { "internalType": "bytes", "name": "field_1", "type": "bytes" }232 { "internalType": "bytes", "name": "value", "type": "bytes" }233 ],233 ],234 "internalType": "struct Tuple22[]",234 "internalType": "struct Property[]",235 "name": "",235 "name": "",236 "type": "tuple[]"236 "type": "tuple[]"237 }237 }255 { "internalType": "address", "name": "field_0", "type": "address" },255 { "internalType": "address", "name": "field_0", "type": "address" },256 { "internalType": "uint256", "name": "field_1", "type": "uint256" }256 { "internalType": "uint256", "name": "field_1", "type": "uint256" }257 ],257 ],258 "internalType": "struct Tuple25",258 "internalType": "struct Tuple29",259 "name": "",259 "name": "",260 "type": "tuple"260 "type": "tuple"261 }261 }277 "stateMutability": "view",277 "stateMutability": "view",278 "type": "function"278 "type": "function"279 },279 },280 {281 "inputs": [282 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }283 ],284 "name": "crossOwnerOf",285 "outputs": [286 {287 "components": [288 { "internalType": "address", "name": "eth", "type": "address" },289 { "internalType": "uint256", "name": "sub", "type": "uint256" }290 ],291 "internalType": "struct EthCrossAccount",292 "name": "",293 "type": "tuple"294 }295 ],296 "stateMutability": "view",297 "type": "function"298 },280 {299 {281 "inputs": [300 "inputs": [282 { "internalType": "string[]", "name": "keys", "type": "string[]" }301 { "internalType": "string[]", "name": "keys", "type": "string[]" }296 "stateMutability": "nonpayable",315 "stateMutability": "nonpayable",297 "type": "function"316 "type": "function"298 },317 },318 {319 "inputs": [],320 "name": "description",321 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],322 "stateMutability": "view",323 "type": "function"324 },299 {325 {300 "inputs": [],326 "inputs": [],301 "name": "finishMinting",327 "name": "finishMinting",630 "stateMutability": "view",656 "stateMutability": "view",631 "type": "function"657 "type": "function"632 },658 },659 {660 "inputs": [661 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },662 { "internalType": "string[]", "name": "keys", "type": "string[]" }663 ],664 "name": "tokenProperties",665 "outputs": [666 {667 "components": [668 { "internalType": "string", "name": "key", "type": "string" },669 { "internalType": "bytes", "name": "value", "type": "bytes" }670 ],671 "internalType": "struct Property[]",672 "name": "",673 "type": "tuple[]"674 }675 ],676 "stateMutability": "view",677 "type": "function"678 },633 {679 {634 "inputs": [680 "inputs": [635 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }681 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }tests/src/eth/api/UniqueFungible.soldiffbeforeafterboth60 /// @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 (Tuple16[] memory);63 function collectionProperties(string[] memory keys) external view returns (Property[] memory);646465 // /// Set the sponsor of the collection.65 // /// Set the sponsor of the collection.66 // ///66 // ///278 uint256 sub;278 uint256 sub;279}279}280281/// @dev anonymous struct282struct Tuple16 {283 string field_0;284 bytes field_1;285}286280287/// @dev Property struct281/// @dev Property struct288struct Property {282struct Property {289 string key;283 string key;290 bytes value;284 bytes value;291}285}292286293/// @dev the ERC-165 identifier for this interface is 0x29f4dcd9287/// @dev the ERC-165 identifier for this interface is 0x5b7038cf294interface ERC20UniqueExtensions is Dummy, ERC165 {288interface ERC20UniqueExtensions is Dummy, ERC165 {289 /// @notice A description for the collection.290 /// @dev EVM selector for this function is: 0x7284e416,291 /// or in textual repr: description()292 function description() external view returns (string memory);293295 /// @dev EVM selector for this function is: 0x0ecd0ab0,294 /// @dev EVM selector for this function is: 0x0ecd0ab0,296 /// or in textual repr: approveCross((address,uint256),uint256)295 /// or in textual repr: approveCross((address,uint256),uint256)tests/src/eth/api/UniqueNFT.soldiffbeforeafterboth127 /// @return Vector of properties key/value pairs.127 /// @return Vector of properties key/value pairs.128 /// @dev EVM selector for this function is: 0x285fb8e6,128 /// @dev EVM selector for this function is: 0x285fb8e6,129 /// or in textual repr: collectionProperties(string[])129 /// or in textual repr: collectionProperties(string[])130 function collectionProperties(string[] memory keys) external view returns (Tuple23[] memory);130 function collectionProperties(string[] memory keys) external view returns (Property[] memory);131131132 // /// Set the sponsor of the collection.132 // /// Set the sponsor of the collection.133 // ///133 // ///169 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.169 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.170 /// @dev EVM selector for this function is: 0x6ec0a9f1,170 /// @dev EVM selector for this function is: 0x6ec0a9f1,171 /// or in textual repr: collectionSponsor()171 /// or in textual repr: collectionSponsor()172 function collectionSponsor() external view returns (Tuple26 memory);172 function collectionSponsor() external view returns (Tuple27 memory);173173174 /// Set limits for the collection.174 /// Set limits for the collection.175 /// @dev Throws error if limit not found.175 /// @dev Throws error if limit not found.346}346}347347348/// @dev anonymous struct348/// @dev anonymous struct349struct Tuple26 {349struct Tuple27 {350 address field_0;350 address field_0;351 uint256 field_1;351 uint256 field_1;352}352}353354/// @dev anonymous struct355struct Tuple23 {356 string field_0;357 bytes field_1;358}359353360/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension354/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension361/// @dev See https://eips.ethereum.org/EIPS/eip-721355/// @dev See https://eips.ethereum.org/EIPS/eip-721452}446}453447454/// @title Unique extensions for ERC721.448/// @title Unique extensions for ERC721.455/// @dev the ERC-165 identifier for this interface is 0x0e9fc611449/// @dev the ERC-165 identifier for this interface is 0xb8f094a0456interface ERC721UniqueExtensions is Dummy, ERC165 {450interface ERC721UniqueExtensions is Dummy, ERC165 {457 /// @notice A descriptive name for a collection of NFTs in this contract451 /// @notice A descriptive name for a collection of NFTs in this contract458 /// @dev EVM selector for this function is: 0x06fdde03,452 /// @dev EVM selector for this function is: 0x06fdde03,464 /// or in textual repr: symbol()458 /// or in textual repr: symbol()465 function symbol() external view returns (string memory);459 function symbol() external view returns (string memory);460461 /// @notice A description for the collection.462 /// @dev EVM selector for this function is: 0x7284e416,463 /// or in textual repr: description()464 function description() external view returns (string memory);465466 /// Returns the owner (in cross format) of the token.467 ///468 /// @param tokenId Id for the token.469 /// @dev EVM selector for this function is: 0x2b29dace,470 /// or in textual repr: crossOwnerOf(uint256)471 function crossOwnerOf(uint256 tokenId) external view returns (EthCrossAccount memory);472473 /// Returns the token properties.474 ///475 /// @param tokenId Id for the token.476 /// @param keys Properties keys. Empty keys for all propertyes.477 /// @return Vector of properties key/value pairs.478 /// @dev EVM selector for this function is: 0xefc26c69,479 /// or in textual repr: tokenProperties(uint256,string[])480 function tokenProperties(uint256 tokenId, string[] memory keys) external view returns (Property[] memory);466481467 /// @notice Set or reaffirm the approved address for an NFT482 /// @notice Set or reaffirm the approved address for an NFT468 /// @dev The zero address indicates there is no approved address.483 /// @dev The zero address indicates there is no approved address.546 // /// @param tokens array of pairs of token ID and token URI for minted tokens561 // /// @param tokens array of pairs of token ID and token URI for minted tokens547 // /// @dev EVM selector for this function is: 0x36543006,562 // /// @dev EVM selector for this function is: 0x36543006,548 // /// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])563 // /// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])549 // function mintBulkWithTokenURI(address to, Tuple11[] memory tokens) external returns (bool);564 // function mintBulkWithTokenURI(address to, Tuple13[] memory tokens) external returns (bool);550565551}566}552567553/// @dev anonymous struct568/// @dev anonymous struct554struct Tuple11 {569struct Tuple13 {555 uint256 field_0;570 uint256 field_0;556 string field_1;571 string field_1;557}572}tests/src/eth/api/UniqueRefungible.soldiffbeforeafterboth127 /// @return Vector of properties key/value pairs.127 /// @return Vector of properties key/value pairs.128 /// @dev EVM selector for this function is: 0x285fb8e6,128 /// @dev EVM selector for this function is: 0x285fb8e6,129 /// or in textual repr: collectionProperties(string[])129 /// or in textual repr: collectionProperties(string[])130 function collectionProperties(string[] memory keys) external view returns (Tuple22[] memory);130 function collectionProperties(string[] memory keys) external view returns (Property[] memory);131131132 // /// Set the sponsor of the collection.132 // /// Set the sponsor of the collection.133 // ///133 // ///169 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.169 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.170 /// @dev EVM selector for this function is: 0x6ec0a9f1,170 /// @dev EVM selector for this function is: 0x6ec0a9f1,171 /// or in textual repr: collectionSponsor()171 /// or in textual repr: collectionSponsor()172 function collectionSponsor() external view returns (Tuple25 memory);172 function collectionSponsor() external view returns (Tuple26 memory);173173174 /// Set limits for the collection.174 /// Set limits for the collection.175 /// @dev Throws error if limit not found.175 /// @dev Throws error if limit not found.346}346}347347348/// @dev anonymous struct348/// @dev anonymous struct349struct Tuple25 {349struct Tuple26 {350 address field_0;350 address field_0;351 uint256 field_1;351 uint256 field_1;352}352}353354/// @dev anonymous struct355struct Tuple22 {356 string field_0;357 bytes field_1;358}359353360/// @dev the ERC-165 identifier for this interface is 0x5b5e139f354/// @dev the ERC-165 identifier for this interface is 0x5b5e139f361interface ERC721Metadata is Dummy, ERC165 {355interface ERC721Metadata is Dummy, ERC165 {450}444}451445452/// @title Unique extensions for ERC721.446/// @title Unique extensions for ERC721.453/// @dev the ERC-165 identifier for this interface is 0xab243667447/// @dev the ERC-165 identifier for this interface is 0x1d4b64d6454interface ERC721UniqueExtensions is Dummy, ERC165 {448interface ERC721UniqueExtensions is Dummy, ERC165 {455 /// @notice A descriptive name for a collection of NFTs in this contract449 /// @notice A descriptive name for a collection of NFTs in this contract456 /// @dev EVM selector for this function is: 0x06fdde03,450 /// @dev EVM selector for this function is: 0x06fdde03,462 /// or in textual repr: symbol()456 /// or in textual repr: symbol()463 function symbol() external view returns (string memory);457 function symbol() external view returns (string memory);458459 /// @notice A description for the collection.460 /// @dev EVM selector for this function is: 0x7284e416,461 /// or in textual repr: description()462 function description() external view returns (string memory);463464 /// Returns the owner (in cross format) of the token.465 ///466 /// @param tokenId Id for the token.467 /// @dev EVM selector for this function is: 0x2b29dace,468 /// or in textual repr: crossOwnerOf(uint256)469 function crossOwnerOf(uint256 tokenId) external view returns (EthCrossAccount memory);470471 /// Returns the token properties.472 ///473 /// @param tokenId Id for the token.474 /// @param keys Properties keys. Empty keys for all propertyes.475 /// @return Vector of properties key/value pairs.476 /// @dev EVM selector for this function is: 0xefc26c69,477 /// or in textual repr: tokenProperties(uint256,string[])478 function tokenProperties(uint256 tokenId, string[] memory keys) external view returns (Property[] memory);464479465 /// @notice Transfer ownership of an RFT480 /// @notice Transfer ownership of an RFT466 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`481 /// @dev Throws unless `msg.sender` is the current owner. Throws if `to`539 // /// @param tokens array of pairs of token ID and token URI for minted tokens554 // /// @param tokens array of pairs of token ID and token URI for minted tokens540 // /// @dev EVM selector for this function is: 0x36543006,555 // /// @dev EVM selector for this function is: 0x36543006,541 // /// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])556 // /// or in textual repr: mintBulkWithTokenURI(address,(uint256,string)[])542 // function mintBulkWithTokenURI(address to, Tuple10[] memory tokens) external returns (bool);557 // function mintBulkWithTokenURI(address to, Tuple12[] memory tokens) external returns (bool);543558544 /// Returns EVM address for refungible token559 /// Returns EVM address for refungible token545 ///560 ///550}565}551566552/// @dev anonymous struct567/// @dev anonymous struct553struct Tuple10 {568struct Tuple12 {554 uint256 field_0;569 uint256 field_0;555 string field_1;570 string field_1;556}571}tests/src/eth/base.test.tsdiffbeforeafterboth117 });117 });118118119 itEth('ERC721UniqueExtensions support', async ({helper}) => {119 itEth('ERC721UniqueExtensions support', async ({helper}) => {120 await checkInterface(helper, '0x0e9fc611', true, true);120 await checkInterface(helper, '0xb8f094a0', true, true);121 });121 });122122123 itEth('ERC721Burnable - 0x42966c68 - support', async ({helper}) => {123 itEth('ERC721Burnable - 0x42966c68 - support', async ({helper}) => {tests/src/eth/createFTCollection.test.tsdiffbeforeafterboth36 const owner = await helper.eth.createAccountWithBalance(donor);36 const owner = await helper.eth.createAccountWithBalance(donor);37 const sponsor = await helper.eth.createAccountWithBalance(donor);37 const sponsor = await helper.eth.createAccountWithBalance(donor);38 const ss58Format = helper.chain.getChainProperties().ss58Format;38 const ss58Format = helper.chain.getChainProperties().ss58Format;39 const description = 'absolutely anything';40 39 const {collectionId, collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Sponsor', DECIMALS, 'absolutely anything', 'ENVY');41 const {collectionId, collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Sponsor', DECIMALS, description, 'ENVY');404241 const collection = helper.ethNativeContract.collection(collectionAddress, 'rft', owner, true);43 const collection = helper.ethNativeContract.collection(collectionAddress, 'ft', owner, true);42 await collection.methods.setCollectionSponsor(sponsor).send();44 await collection.methods.setCollectionSponsor(sponsor).send();434544 let data = (await helper.rft.getData(collectionId))!;46 let data = (await helper.rft.getData(collectionId))!;57 const owner = await helper.eth.createAccountWithBalance(donor);59 const owner = await helper.eth.createAccountWithBalance(donor);58 const sponsor = await helper.eth.createAccountWithBalance(donor);60 const sponsor = await helper.eth.createAccountWithBalance(donor);59 const ss58Format = helper.chain.getChainProperties().ss58Format;61 const ss58Format = helper.chain.getChainProperties().ss58Format;62 const description = 'absolutely anything';60 const {collectionId, collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Sponsor', DECIMALS, 'absolutely anything', 'ENVY');63 const {collectionId, collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Sponsor', DECIMALS, description, 'ENVY');6164 62 const collection = helper.ethNativeContract.collection(collectionAddress, 'rft', owner);65 const collection = helper.ethNativeContract.collection(collectionAddress, 'rft', owner);63 const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);66 const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);737674 data = (await helper.rft.getData(collectionId))!;77 data = (await helper.rft.getData(collectionId))!;75 expect(data.raw.sponsorship.Confirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));78 expect(data.raw.sponsorship.Confirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));79 expect(await collection.methods.description().call()).to.deep.equal(description);76 });80 });778178 itEth('Set limits', async ({helper}) => {82 itEth('Set limits', async ({helper}) => {tests/src/eth/createNFTCollection.test.tsdiffbeforeafterboth28 });28 });29 });29 });303031 itEth('Create collection with properties', async ({helper}) => {31 itEth('Create collection with properties & get desctription', async ({helper}) => {32 const owner = await helper.eth.createAccountWithBalance(donor);32 const owner = await helper.eth.createAccountWithBalance(donor);333334 const name = 'CollectionEVM';34 const name = 'CollectionEVM';37 const baseUri = 'BaseURI';37 const baseUri = 'BaseURI';383839 const {collectionId, collectionAddress, events} = await helper.eth.createERC721MetadataCompatibleNFTCollection(owner, name, description, prefix, baseUri);39 const {collectionId, collectionAddress, events} = await helper.eth.createERC721MetadataCompatibleNFTCollection(owner, name, description, prefix, baseUri);4040 const contract = helper.ethNativeContract.collection(collectionAddress, 'nft');41 41 expect(events).to.be.deep.equal([42 expect(events).to.be.deep.equal([42 {43 {57 expect(data.raw.tokenPrefix).to.be.eq(prefix);58 expect(data.raw.tokenPrefix).to.be.eq(prefix);58 expect(data.raw.mode).to.be.eq('NFT');59 expect(data.raw.mode).to.be.eq('NFT');5960 61 expect(await contract.methods.description().call()).to.deep.equal(description);62 60 const options = await collection.getOptions();63 const options = await collection.getOptions();61 expect(options.tokenPropertyPermissions).to.be.deep.equal([64 expect(options.tokenPropertyPermissions).to.be.deep.equal([92 expect(data.raw.sponsorship.Confirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));95 expect(data.raw.sponsorship.Confirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));93 });96 });949795 itEth('[cross] Set sponsorship', async ({helper}) => {98 itEth('[cross] Set sponsorship & get description', async ({helper}) => {96 const owner = await helper.eth.createAccountWithBalance(donor);99 const owner = await helper.eth.createAccountWithBalance(donor);97 const sponsor = await helper.eth.createAccountWithBalance(donor);100 const sponsor = await helper.eth.createAccountWithBalance(donor);98 const ss58Format = helper.chain.getChainProperties().ss58Format;101 const ss58Format = helper.chain.getChainProperties().ss58Format;102 const description = 'absolutely anything';99 const {collectionId, collectionAddress} = await helper.eth.createNFTCollection(owner, 'Sponsor', 'absolutely anything', 'ROC');103 const {collectionId, collectionAddress} = await helper.eth.createNFTCollection(owner, 'Sponsor', description, 'ROC');100104101 const collection = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);105 const collection = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);102 const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);106 const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);113 data = (await helper.nft.getData(collectionId))!;117 data = (await helper.nft.getData(collectionId))!;114 expect(data.raw.sponsorship.Confirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));118 expect(data.raw.sponsorship.Confirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));119 120 expect(await sponsorCollection.methods.description().call()).to.deep.equal(description);115 });121 });116122117 itEth('Set limits', async ({helper}) => {123 itEth('Set limits', async ({helper}) => {tests/src/eth/createRFTCollection.test.tsdiffbeforeafterboth535354 54 555556 itEth('Create collection with properties', async ({helper}) => {56 itEth('Create collection with properties & get description', async ({helper}) => {57 const owner = await helper.eth.createAccountWithBalance(donor);57 const owner = await helper.eth.createAccountWithBalance(donor);585859 const name = 'CollectionEVM';59 const name = 'CollectionEVM';60 const description = 'Some description';60 const description = 'Some description';61 const prefix = 'token prefix';61 const prefix = 'token prefix';62 const baseUri = 'BaseURI';62 const baseUri = 'BaseURI';636364 const {collectionId} = await helper.eth.createERC721MetadataCompatibleRFTCollection(owner, name, description, prefix, baseUri);64 const {collectionId, collectionAddress} = await helper.eth.createERC721MetadataCompatibleRFTCollection(owner, name, description, prefix, baseUri);65 const contract = helper.ethNativeContract.collection(collectionAddress, 'nft');656666 const collection = helper.rft.getCollectionObject(collectionId);67 const collection = helper.rft.getCollectionObject(collectionId);67 const data = (await collection.getData())!;68 const data = (await collection.getData())!;71 expect(data.raw.tokenPrefix).to.be.eq(prefix);72 expect(data.raw.tokenPrefix).to.be.eq(prefix);72 expect(data.raw.mode).to.be.eq('ReFungible');73 expect(data.raw.mode).to.be.eq('ReFungible');7475 expect(await contract.methods.description().call()).to.deep.equal(description);737674 const options = await collection.getOptions();77 const options = await collection.getOptions();75 expect(options.tokenPropertyPermissions).to.be.deep.equal([78 expect(options.tokenPropertyPermissions).to.be.deep.equal([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';2021212222describe('NFT: Information getting', () => {23describe('NFT: Information getting', () => {149 });150 });150 });151 });151152152 itEth('Can perform mint()', async ({helper}) => {153 itEth('Can perform mint() & get crossOwner()', async ({helper}) => {153 const owner = await helper.eth.createAccountWithBalance(donor);154 const owner = await helper.eth.createAccountWithBalance(donor);154 const receiver = helper.eth.createAccount();155 const receiver = helper.eth.createAccount();155156166 expect(event.returnValues.to).to.be.equal(receiver);167 expect(event.returnValues.to).to.be.equal(receiver);167168168 expect(await contract.methods.tokenURI(tokenId).call()).to.be.equal('Test URI');169 expect(await contract.methods.tokenURI(tokenId).call()).to.be.equal('Test URI');169170 console.log(await contract.methods.crossOwnerOf(tokenId).call());171 expect(await contract.methods.crossOwnerOf(tokenId).call()).to.be.like([receiver, '0']);170 // TODO: this wont work right now, need release 919000 first172 // TODO: this wont work right now, need release 919000 first171 // await helper.methods.setOffchainSchema(collectionIdAddress, 'https://offchain-service.local/token-info/{id}').send();173 // await helper.methods.setOffchainSchema(collectionIdAddress, 'https://offchain-service.local/token-info/{id}').send();172 // const tokenUri = await contract.methods.tokenURI(nextTokenId).call();174 // const tokenUri = await contract.methods.tokenURI(nextTokenId).call();tests/src/eth/reFungible.test.tsdiffbeforeafterboth117 });117 });118 });118 });119119120 itEth('Can perform mint()', async ({helper}) => {120 itEth('Can perform mint() & crossOwnerOf()', async ({helper}) => {121 const owner = await helper.eth.createAccountWithBalance(donor);121 const owner = await helper.eth.createAccountWithBalance(donor);122 const receiver = helper.eth.createAccount();122 const receiver = helper.eth.createAccount();123 const {collectionAddress} = await helper.eth.createERC721MetadataCompatibleRFTCollection(owner, 'Minty', '6', '6', '');123 const {collectionAddress} = await helper.eth.createERC721MetadataCompatibleRFTCollection(owner, 'Minty', '6', '6', '');132 const tokenId = event.returnValues.tokenId;132 const tokenId = event.returnValues.tokenId;133 expect(tokenId).to.be.equal('1');133 expect(tokenId).to.be.equal('1');134134135 expect(await contract.methods.crossOwnerOf(tokenId).call()).to.be.like([receiver, '0']);135 expect(await contract.methods.tokenURI(tokenId).call()).to.be.equal('Test URI');136 expect(await contract.methods.tokenURI(tokenId).call()).to.be.equal('Test URI');136 });137 });137138tests/src/eth/tokenProperties.test.tsdiffbeforeafterboth14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.161617import {itEth, usingEthPlaygrounds, expect} from './util';17import {itEth, usingEthPlaygrounds, expect, EthUniqueHelper} from './util';18import {IKeyringPair} from '@polkadot/types/types';18import {IKeyringPair} from '@polkadot/types/types';19import {ITokenPropertyPermission} from '../util/playgrounds/types';19import {ITokenPropertyPermission, TCollectionMode} from '../util/playgrounds/types';20import {Pallets} from '../util';20import {Pallets} from '../util';21import {UniqueNFTCollection, UniqueRFTCollection} from '../util/playgrounds/unique';212222describe('EVM token properties', () => {23describe('EVM token properties', () => {23 let donor: IKeyringPair;24 let donor: IKeyringPair;95 expect(value).to.equal('testValue');96 expect(value).to.equal('testValue');96 });97 });97 98 98 itEth('Can be multiple set for NFT ', async({helper}) => {99 async function checkProps(helper: EthUniqueHelper, mode: TCollectionMode) {99 const caller = await helper.eth.createAccountWithBalance(donor);100 const caller = await helper.eth.createAccountWithBalance(donor);100 101 101 const properties = Array(5).fill(0).map((_, i) => { return {key: `key_${i}`, value: Buffer.from(`value_${i}`)}; });102 const properties = Array(5).fill(0).map((_, i) => { return {key: `key_${i}`, value: Buffer.from(`value_${i}`)}; });102 const permissions: ITokenPropertyPermission[] = properties.map(p => { return {key: p.key, permission: {tokenOwner: true,103 const permissions: ITokenPropertyPermission[] = properties.map(p => { return {key: p.key, permission: {tokenOwner: true,103 collectionAdmin: true,104 collectionAdmin: true,104 mutable: true}}; });105 mutable: true}}; });105 106 106 const collection = await helper.nft.mintCollection(alice, {107 const collection = await helper[mode].mintCollection(alice, {107 tokenPrefix: 'ethp',108 tokenPrefix: 'ethp',108 tokenPropertyPermissions: permissions,109 tokenPropertyPermissions: permissions,109 });110 }) as UniqueNFTCollection | UniqueRFTCollection;110 111 111 const token = await collection.mintToken(alice);112 const token = await collection.mintToken(alice);112 113 116 await collection.addAdmin(alice, {Ethereum: caller});118 await collection.addAdmin(alice, {Ethereum: caller});117119 118 const address = helper.ethAddress.fromCollectionId(collection.collectionId);120 const address = helper.ethAddress.fromCollectionId(collection.collectionId);119 const contract = helper.ethNativeContract.collection(address, 'nft', caller);121 const contract = helper.ethNativeContract.collection(address, mode, caller);122 123 expect(await contract.methods.tokenProperties(token.tokenId, []).call()).to.be.deep.equal([]);120124121 await contract.methods.setProperties(token.tokenId, properties).send({from: caller});125 await contract.methods.setProperties(token.tokenId, properties).send({from: caller});122126123 const values = await token.getProperties(properties.map(p => p.key));127 const values = await token.getProperties(properties.map(p => p.key));124 expect(values).to.be.deep.equal(properties.map(p => { return {key: p.key, value: p.value.toString()}; }));128 expect(values).to.be.deep.equal(properties.map(p => { return {key: p.key, value: p.value.toString()}; }));129 130 expect(await contract.methods.tokenProperties(token.tokenId, []).call()).to.be.like(properties131 .map(p => { return helper.ethProperty.property(p.key, p.value.toString()); }));132 133 expect(await contract.methods.tokenProperties(token.tokenId, [properties[0].key]).call())134 .to.be.like([helper.ethProperty.property(properties[0].key, properties[0].value.toString())]);125 });135 }126 136 137 itEth('Can be multiple set/read for NFT ', async({helper}) => {138 await checkProps(helper, 'nft');139 });140 127 itEth.ifWithPallets('Can be multiple set for RFT ', [Pallets.ReFungible], async({helper}) => {141 itEth.ifWithPallets('Can be multiple set/read for RFT ', [Pallets.ReFungible], async({helper}) => {128 const caller = await helper.eth.createAccountWithBalance(donor);129 130 const properties = Array(5).fill(0).map((_, i) => { return {key: `key_${i}`, value: Buffer.from(`value_${i}`)}; });131 const permissions: ITokenPropertyPermission[] = properties.map(p => { return {key: p.key, permission: {tokenOwner: true,132 collectionAdmin: true,133 mutable: true}}; });134 135 const collection = await helper.rft.mintCollection(alice, {142 await checkProps(helper, 'rft');136 tokenPrefix: 'ethp',137 tokenPropertyPermissions: permissions,138 });139 140 const token = await collection.mintToken(alice);141 142 const valuesBefore = await token.getProperties(properties.map(p => p.key));143 expect(valuesBefore).to.be.deep.equal([]);144 145 await collection.addAdmin(alice, {Ethereum: caller});146147 const address = helper.ethAddress.fromCollectionId(collection.collectionId);148 const contract = helper.ethNativeContract.collection(address, 'rft', caller);149150 await contract.methods.setProperties(token.tokenId, properties).send({from: caller});151152 const values = await token.getProperties(properties.map(p => p.key));153 expect(values).to.be.deep.equal(properties.map(p => { return {key: p.key, value: p.value.toString()}; }));154 });143 });155144 156 itEth('Can be deleted', async({helper}) => {145 itEth('Can be deleted', async({helper}) => {