git.delta.rocks / unique-network / refs/commits / 48f959311e08

difftreelog

chore code review requests

Grigoriy Simonov2022-10-12parent: #f8de52d.patch.diff
in: master

8 files changed

modifiedpallets/common/src/erc.rsdiffbeforeafterboth
--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -709,9 +709,6 @@
 		/// Value "1" ERC721 metadata supported.
 		pub const ERC721_METADATA_SUPPORTED: &[u8] = b"1";
 
-		/// Value "0" ERC721 metadata supported.
-		pub const ERC721_METADATA_UNSUPPORTED: &[u8] = b"0";
-
 		/// Value for [`ERC721_METADATA`].
 		pub fn erc721() -> up_data_structs::PropertyValue {
 			property_value_from_bytes(ERC721_METADATA).expect(EXPECT_CONVERT_ERROR)
modifiedpallets/unique/src/eth/mod.rsdiffbeforeafterboth
--- a/pallets/unique/src/eth/mod.rs
+++ b/pallets/unique/src/eth/mod.rs
@@ -104,7 +104,7 @@
 		.try_push(up_data_structs::PropertyKeyPermission {
 			key: key::url(),
 			permission: up_data_structs::PropertyPermission {
-				mutable: false,
+				mutable: true,
 				collection_admin: true,
 				token_owner: false,
 			},
@@ -115,17 +115,6 @@
 		token_property_permissions
 			.try_push(up_data_structs::PropertyKeyPermission {
 				key: key::suffix(),
-				permission: up_data_structs::PropertyPermission {
-					mutable: true,
-					collection_admin: true,
-					token_owner: false,
-				},
-			})
-			.map_err(|e| Error::Revert(format!("{:?}", e)))?;
-
-		token_property_permissions
-			.try_push(up_data_structs::PropertyKeyPermission {
-				key: key::url(),
 				permission: up_data_structs::PropertyPermission {
 					mutable: true,
 					collection_admin: true,
modifiedtests/src/deprecated-helpers/helpers.tsdiffbeforeafterboth
433 mode: {type: 'NFT'},433 mode: {type: 'NFT'},
434 name: 'name',434 name: 'name',
435 tokenPrefix: 'prefix',435 tokenPrefix: 'prefix',
436 properties: [{key: 'ERC721Metadata', value: '1'}],
437};436};
438437
439export async function438export async function
modifiedtests/src/eth/base.test.tsdiffbeforeafterboth
--- a/tests/src/eth/base.test.ts
+++ b/tests/src/eth/base.test.ts
@@ -80,7 +80,7 @@
     await usingEthPlaygrounds(async (helper, privateKey) => {
       const donor = privateKey('//Alice');
       const [alice] = await helper.arrange.createAccounts([10n], donor);
-      ({collectionId: collection} = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'}));
+      ({collectionId: collection} = await helper.nft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test', properties: [{key: 'ERC721Metadata', value: '1'}]}));
       minter = helper.eth.createAccount();
     });
   });
modifiedtests/src/eth/nonFungible.test.tsdiffbeforeafterboth
--- a/tests/src/eth/nonFungible.test.ts
+++ b/tests/src/eth/nonFungible.test.ts
@@ -501,7 +501,7 @@
 
   itEth('Returns collection name', async ({helper}) => {
     const caller = await helper.eth.createAccountWithBalance(donor);
-    const collection = await helper.nft.mintCollection(alice, {name: 'oh River', tokenPrefix: 'CHANGE'});
+    const collection = await helper.nft.mintCollection(alice, {name: 'oh River', tokenPrefix: 'CHANGE', properties: [{key: 'ERC721Metadata', value: '1'}]});
 
     const contract = helper.ethNativeContract.collectionById(collection.collectionId, 'nft', caller);
     const name = await contract.methods.name().call();
@@ -510,7 +510,7 @@
 
   itEth('Returns symbol name', async ({helper}) => {
     const caller = await helper.eth.createAccountWithBalance(donor);
-    const collection = await helper.nft.mintCollection(alice, {name: 'oh River', tokenPrefix: 'CHANGE'});
+    const collection = await helper.nft.mintCollection(alice, {name: 'oh River', tokenPrefix: 'CHANGE', properties: [{key: 'ERC721Metadata', value: '1'}]});
 
     const contract = helper.ethNativeContract.collectionById(collection.collectionId, 'nft', caller);
     const symbol = await contract.methods.symbol().call();
modifiedtests/src/eth/reFungible.test.tsdiffbeforeafterboth
--- a/tests/src/eth/reFungible.test.ts
+++ b/tests/src/eth/reFungible.test.ts
@@ -377,7 +377,7 @@
 
   itEth('Returns collection name', async ({helper}) => {
     const caller = helper.eth.createAccount();
-    const collection = await helper.rft.mintCollection(alice, {name: 'Leviathan', tokenPrefix: '11'});
+    const collection = await helper.rft.mintCollection(alice, {name: 'Leviathan', tokenPrefix: '11', properties: [{key: 'ERC721Metadata', value: '1'}]});
     
     const contract = helper.ethNativeContract.collectionById(collection.collectionId, 'rft', caller);
     const name = await contract.methods.name().call();
@@ -386,7 +386,7 @@
 
   itEth('Returns symbol name', async ({helper}) => {
     const caller = await helper.eth.createAccountWithBalance(donor);
-    const {collectionId} = await helper.rft.mintCollection(alice, {name: 'Leviathan', tokenPrefix: '12'});
+    const {collectionId} = await helper.rft.mintCollection(alice, {name: 'Leviathan', tokenPrefix: '12', properties: [{key: 'ERC721Metadata', value: '1'}]});
     const contract = helper.ethNativeContract.collectionById(collectionId, 'rft', caller);
     const symbol = await contract.methods.symbol().call();
     expect(symbol).to.equal('12');
modifiedtests/src/nesting/properties.test.tsdiffbeforeafterboth
--- a/tests/src/nesting/properties.test.ts
+++ b/tests/src/nesting/properties.test.ts
@@ -35,7 +35,7 @@
     expect(collectionOption).is.not.null;
     let collection = collectionOption;
     expect(collection.tokenPropertyPermissions).to.be.empty;
-    expect(collection.properties).to.be.deep.equal([{key: 'ERC721Metadata', value: '1'}]);
+    expect(collection.properties).to.be.empty;
 
     const propertyPermissions = [
       {key: 'mindgame', permission: {collectionAdmin: true, mutable: false, tokenOwner: true}},
@@ -44,7 +44,6 @@
     await expect(await baseCollection.setTokenPropertyPermissions(alice, propertyPermissions)).to.be.true;
 
     const collectionProperties = [
-      {key: 'ERC721Metadata', value: '1'}, 
       {key: 'black_hole', value: 'LIGO'},
       {key: 'electron', value: 'come bond'}, 
     ];
@@ -80,10 +79,7 @@
   itSub('Properties are initially empty', async ({helper}) => {
     const collection = await helper.nft.mintCollection(alice);
     const properties = await collection.getProperties();
-    expect(properties).to.be.deep.equal([{
-      'key': 'ERC721Metadata',
-      'value': '1',
-    }]);
+    expect(properties).to.be.empty;
   });
 
   async function testSetsPropertiesForCollection(collection: UniqueBaseCollection) {
@@ -201,10 +197,7 @@
       .to.be.rejectedWith(/common\.NoPermission/);
 
     const properties = await collection.getProperties();
-    expect(properties).to.be.deep.equal([{
-      'key': 'ERC721Metadata',
-      'value': '1',
-    }]);
+    expect(properties).to.be.empty;
   }
 
   itSub('Fails to set properties in a NFT collection if not its onwer/administrator', async ({helper}) =>  {
@@ -257,10 +250,7 @@
       to.be.rejectedWith(/common\.PropertyLimitReached/);
 
     const properties = await collection.getProperties();
-    expect(properties).to.be.deep.equal([{
-      'key': 'ERC721Metadata',
-      'value': '1',
-    }]);
+    expect(properties).to.be.empty;
   }
 
   itSub('Fails to set more properties than it is allowed (NFT)', async ({helper}) =>  {
modifiedtests/src/util/playgrounds/unique.tsdiffbeforeafterboth
--- a/tests/src/util/playgrounds/unique.ts
+++ b/tests/src/util/playgrounds/unique.ts
@@ -1297,7 +1297,6 @@
   async mintCollection(signer: TSigner, collectionOptions: ICollectionCreationOptions, mode: 'NFT' | 'RFT'): Promise<UniqueBaseCollection> {
     collectionOptions = JSON.parse(JSON.stringify(collectionOptions)) as ICollectionCreationOptions; // Clone object
     collectionOptions.mode = (mode === 'NFT') ? {nft: null} : {refungible: null};
-    collectionOptions.properties = collectionOptions.properties || [{key: 'ERC721Metadata', value: '1'}];
     for (const key of ['name', 'description', 'tokenPrefix']) {
       if (typeof collectionOptions[key as 'name' | 'description' | 'tokenPrefix'] === 'string') collectionOptions[key as 'name' | 'description' | 'tokenPrefix'] = this.helper.util.str2vec(collectionOptions[key as 'name' | 'description' | 'tokenPrefix'] as string);
     }