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

difftreelog

refac: rename substrate methods to cross

Trubnikov Sergey2022-09-28parent: #01b189e.patch.diff
in: master

16 files changed

modifiedpallets/common/src/erc.rsdiffbeforeafterboth
--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -656,7 +656,7 @@
 
 	/// Get collection owner.
 	///
-	/// @return Tuple with sponsor address and his substrate mirror.
+	/// @return Tuble with sponsor address and his substrate mirror.
 	/// If address is canonical then substrate mirror is zero and vice versa.
 	fn collection_owner(&self) -> Result<(address, uint256)> {
 		Ok(convert_cross_account_to_tuple::<T>(
modifiedpallets/fungible/src/stubs/UniqueFungible.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/fungible/src/stubs/UniqueFungible.soldiffbeforeafterboth
--- a/pallets/fungible/src/stubs/UniqueFungible.sol
+++ b/pallets/fungible/src/stubs/UniqueFungible.sol
@@ -385,7 +385,7 @@
 
 	/// Get collection owner.
 	///
-	/// @return Tuple with sponsor address and his substrate mirror.
+	/// @return Tuble with sponsor address and his substrate mirror.
 	/// If address is canonical then substrate mirror is zero and vice versa.
 	/// @dev EVM selector for this function is: 0xdf727d3b,
 	///  or in textual repr: collectionOwner()
modifiedpallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth
--- a/pallets/nonfungible/src/stubs/UniqueNFT.sol
+++ b/pallets/nonfungible/src/stubs/UniqueNFT.sol
@@ -471,7 +471,7 @@
 
 	/// Get collection owner.
 	///
-	/// @return Tuple with sponsor address and his substrate mirror.
+	/// @return Tuble with sponsor address and his substrate mirror.
 	/// If address is canonical then substrate mirror is zero and vice versa.
 	/// @dev EVM selector for this function is: 0xdf727d3b,
 	///  or in textual repr: collectionOwner()
modifiedpallets/refungible/src/stubs/UniqueRefungible.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/refungible/src/stubs/UniqueRefungible.soldiffbeforeafterboth
--- a/pallets/refungible/src/stubs/UniqueRefungible.sol
+++ b/pallets/refungible/src/stubs/UniqueRefungible.sol
@@ -471,7 +471,7 @@
 
 	/// Get collection owner.
 	///
-	/// @return Tuple with sponsor address and his substrate mirror.
+	/// @return Tuble with sponsor address and his substrate mirror.
 	/// If address is canonical then substrate mirror is zero and vice versa.
 	/// @dev EVM selector for this function is: 0xdf727d3b,
 	///  or in textual repr: collectionOwner()
modifiedtests/src/eth/allowlist.test.tsdiffbeforeafterboth
--- a/tests/src/eth/allowlist.test.ts
+++ b/tests/src/eth/allowlist.test.ts
@@ -89,21 +89,21 @@
     expect(await collectionEvm.methods.allowed(user).call({from: owner})).to.be.false;
   });
 
-  //itEth('Collection allowlist can be added and removed by [cross] address', async ({helper}) => {
-  //  const owner = await helper.eth.createAccountWithBalance(donor);
-  //  const user = donor;
-  //  
-  //  const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
-  //  const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
-  //  const userCross = helper.ethCrossAccount.fromKeyringPair(user);
-  //  
-  //  expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;
-  //  await collectionEvm.methods.addToCollectionAllowListCross(userCross).send({from: owner});
-  //  expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.true;
-  //  
-  //  await collectionEvm.methods.removeFromCollectionAllowListCross(userCross).send({from: owner});
-  //  expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;
-  //});
+  itEth('Collection allowlist can be added and removed by [cross] address', async ({helper}) => {
+    const owner = await helper.eth.createAccountWithBalance(donor);
+    const user = donor;
+    
+    const {collectionAddress, collectionId} = await helper.eth.createNonfungibleCollection(owner, 'A', 'B', 'C');
+    const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
+    const userCross = helper.ethCrossAccount.fromKeyringPair(user);
+    
+    expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;
+    await collectionEvm.methods.addToCollectionAllowListCross(userCross).send({from: owner});
+    expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.true;
+    
+    await collectionEvm.methods.removeFromCollectionAllowListCross(userCross).send({from: owner});
+    expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;
+  });
 
   itEth('Collection allowlist can not be add and remove [eth] address by not owner', async ({helper}) => {
     const owner = await helper.eth.createAccountWithBalance(donor);
@@ -122,22 +122,22 @@
     expect(await collectionEvm.methods.allowed(user).call({from: owner})).to.be.true;
   });
 
-  //itEth('Collection allowlist can not be add and remove [cross] address by not owner', async ({helper}) => {
-  //  const owner = await helper.eth.createAccountWithBalance(donor);
-  //  const notOwner = await helper.eth.createAccountWithBalance(donor);
-  //  const user = donor;
-  //  
-  //  const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
-  //  const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
-  //  
-  //  expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;
-  //  const userCross = helper.ethCrossAccount.fromKeyringPair(user);
-  //  await expect(collectionEvm.methods.addToCollectionAllowListCross(userCross).call({from: notOwner})).to.be.rejectedWith('NoPermission');
-  //  expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;
-  //  await collectionEvm.methods.addToCollectionAllowListCross(userCross).send({from: owner});
-  //  
-  //  expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.true;
-  //  await expect(collectionEvm.methods.removeFromCollectionAllowListCross(userCross).call({from: notOwner})).to.be.rejectedWith('NoPermission');
-  //  expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.true;
-  //});
+  itEth('Collection allowlist can not be add and remove [cross] address by not owner', async ({helper}) => {
+    const owner = await helper.eth.createAccountWithBalance(donor);
+    const notOwner = await helper.eth.createAccountWithBalance(donor);
+    const user = donor;
+    
+    const {collectionAddress, collectionId} = await helper.eth.createNonfungibleCollection(owner, 'A', 'B', 'C');
+    const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
+    
+    expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;
+    const userCross = helper.ethCrossAccount.fromKeyringPair(user);
+    await expect(collectionEvm.methods.addToCollectionAllowListCross(userCross).call({from: notOwner})).to.be.rejectedWith('NoPermission');
+    expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;
+    await collectionEvm.methods.addToCollectionAllowListCross(userCross).send({from: owner});
+    
+    expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.true;
+    await expect(collectionEvm.methods.removeFromCollectionAllowListCross(userCross).call({from: notOwner})).to.be.rejectedWith('NoPermission');
+    expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.true;
+  });
 });
modifiedtests/src/eth/api/UniqueFungible.soldiffbeforeafterboth
--- a/tests/src/eth/api/UniqueFungible.sol
+++ b/tests/src/eth/api/UniqueFungible.sol
@@ -249,7 +249,7 @@
 
 	/// Get collection owner.
 	///
-	/// @return Tuple with sponsor address and his substrate mirror.
+	/// @return Tuble with sponsor address and his substrate mirror.
 	/// If address is canonical then substrate mirror is zero and vice versa.
 	/// @dev EVM selector for this function is: 0xdf727d3b,
 	///  or in textual repr: collectionOwner()
modifiedtests/src/eth/api/UniqueNFT.soldiffbeforeafterboth
--- a/tests/src/eth/api/UniqueNFT.sol
+++ b/tests/src/eth/api/UniqueNFT.sol
@@ -306,7 +306,7 @@
 
 	/// Get collection owner.
 	///
-	/// @return Tuple with sponsor address and his substrate mirror.
+	/// @return Tuble with sponsor address and his substrate mirror.
 	/// If address is canonical then substrate mirror is zero and vice versa.
 	/// @dev EVM selector for this function is: 0xdf727d3b,
 	///  or in textual repr: collectionOwner()
modifiedtests/src/eth/api/UniqueRefungible.soldiffbeforeafterboth
--- a/tests/src/eth/api/UniqueRefungible.sol
+++ b/tests/src/eth/api/UniqueRefungible.sol
@@ -306,7 +306,7 @@
 
 	/// Get collection owner.
 	///
-	/// @return Tuple with sponsor address and his substrate mirror.
+	/// @return Tuble with sponsor address and his substrate mirror.
 	/// If address is canonical then substrate mirror is zero and vice versa.
 	/// @dev EVM selector for this function is: 0xdf727d3b,
 	///  or in textual repr: collectionOwner()
modifiedtests/src/eth/collectionAdmin.test.tsdiffbeforeafterboth
--- a/tests/src/eth/collectionAdmin.test.ts
+++ b/tests/src/eth/collectionAdmin.test.ts
@@ -53,10 +53,10 @@
   itEth('Add cross account admin by owner', async ({helper, privateKey}) => {
     const owner = await helper.eth.createAccountWithBalance(donor);
         
-    const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
+    const {collectionAddress, collectionId} = await helper.eth.createNonfungibleCollection(owner, 'A', 'B', 'C');
     const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
     
-    const newAdmin = await privateKey('//Bob');
+    const newAdmin = privateKey('//Bob');
     const newAdminCross = helper.ethCrossAccount.fromKeyringPair(newAdmin);
     await collectionEvm.methods.addCollectionAdminCross(newAdminCross).send();
 
modifiedtests/src/eth/fungible.test.tsdiffbeforeafterboth
--- a/tests/src/eth/fungible.test.ts
+++ b/tests/src/eth/fungible.test.ts
@@ -149,7 +149,7 @@
   });
 
   itEth('Can perform burnFromCross()', async ({helper, privateKey}) => {
-    const alice = await privateKey('//Alice');
+    const alice = privateKey('//Alice');
     const sender = await helper.eth.createAccountWithBalance(alice, 100n);
 
     const collection = await helper.ft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'}, 0);
@@ -261,7 +261,7 @@
   });
 
   itEth('Can perform transferFromCross()', async ({helper, privateKey}) => {
-    const alice = await privateKey('//Alice');
+    const alice = privateKey('//Alice');
     const sender = await helper.eth.createAccountWithBalance(alice, 100n);
 
     const collection = await helper.ft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'}, 0);
@@ -455,7 +455,7 @@
   });
 
   itEth('Events emitted for transferFromCross()', async ({helper, privateKey}) => {
-    const alice = await privateKey('//Alice');
+    const alice = privateKey('//Alice');
     const sender = await helper.eth.createAccountWithBalance(alice, 100n);
 
     const collection = await helper.ft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'}, 0);
modifiedtests/src/eth/nonFungible.test.tsdiffbeforeafterboth
--- a/tests/src/eth/nonFungible.test.ts
+++ b/tests/src/eth/nonFungible.test.ts
@@ -247,10 +247,10 @@
   });
 
   itEth('Can perform burnFromCross()', async ({helper, privateKey}) => {
-    const alice = await privateKey('//Alice');
+    const alice = privateKey('//Alice');
     const collection = await helper.nft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'});
 
-    const owner = await privateKey('//Bob');
+    const owner = privateKey('//Bob');
     const spender = await helper.eth.createAccountWithBalance(alice, 100n);
 
     const token = await collection.mintToken(alice, {Substrate: owner.address});
@@ -277,11 +277,11 @@
   });
 
   itEth('Can perform approveCross()', async ({helper, privateKey}) => {
-    const alice = await privateKey('//Alice');
+    const alice = privateKey('//Alice');
     const collection = await helper.nft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'});
 
     const owner = await helper.eth.createAccountWithBalance(alice, 100n);
-    const receiver = await privateKey('//Charlie');
+    const receiver = privateKey('//Charlie');
 
     const token = await collection.mintToken(alice, {Ethereum: owner});
 
@@ -410,12 +410,12 @@
   });
 
   itEth('Can perform transferFromCross()', async ({helper, privateKey}) => {
-    const alice = await privateKey('//Alice');
+    const alice = privateKey('//Alice');
     const collection = await helper.nft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'});
 
-    const owner = await privateKey('//Bob');
+    const owner = privateKey('//Bob');
     const spender = await helper.eth.createAccountWithBalance(alice, 100n);
-    const receiver = await privateKey('//Charlie');
+    const receiver = privateKey('//Charlie');
 
     const token = await collection.mintToken(alice, {Substrate: owner.address});
 
modifiedtests/src/eth/reFungible.test.tsdiffbeforeafterboth
--- a/tests/src/eth/reFungible.test.ts
+++ b/tests/src/eth/reFungible.test.ts
@@ -228,7 +228,7 @@
   });
 
   itEth('Can perform burnFrom()', async ({helper, privateKey}) => {
-    const alice = await privateKey('//Alice');
+    const alice = privateKey('//Alice');
     const collection = await helper.rft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'});
 
     const owner = await helper.eth.createAccountWithBalance(alice, 100n);
@@ -262,10 +262,10 @@
   });
 
   itEth('Can perform burnFromCross()', async ({helper, privateKey}) => {
-    const alice = await privateKey('//Alice');
+    const alice = privateKey('//Alice');
     const collection = await helper.rft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'});
 
-    const owner = await privateKey('//Bob');
+    const owner = privateKey('//Bob');
     const spender = await helper.eth.createAccountWithBalance(alice, 100n);
 
     const token = await collection.mintToken(alice, 100n, {Substrate: owner.address});
@@ -295,12 +295,12 @@
   });
 
   itEth('Can perform transferFromCross()', async ({helper, privateKey}) => {
-    const alice = await privateKey('//Alice');
+    const alice = privateKey('//Alice');
     const collection = await helper.rft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'});
 
-    const owner = await privateKey('//Bob');
+    const owner = privateKey('//Bob');
     const spender = await helper.eth.createAccountWithBalance(alice, 100n);
-    const receiver = await privateKey('//Charlie');
+    const receiver = privateKey('//Charlie');
 
     const token = await collection.mintToken(alice, 100n, {Substrate: owner.address});
 
modifiedtests/src/eth/util/playgrounds/unique.dev.tsdiffbeforeafterboth
361}361}
362export type EthUniqueHelperConstructor = new (...args: any[]) => EthUniqueHelper;362export type EthUniqueHelperConstructor = new (...args: any[]) => EthUniqueHelper;
363
364export class EthCrossAccountGroup extends EthGroupBase {
365 fromAddress(address: TEthereumAccount): TEthCrossAccount {
366 return {
367 0: address,
368 1: '0',
369 field_0: address,
370 field_1: '0',
371 };
372 }
373
374 fromKeyringPair(keyring: IKeyringPair): TEthCrossAccount {
375 return {
376 0: '0x0000000000000000000000000000000000000000',
377 1: keyring.addressRaw,
378 field_0: '0x0000000000000000000000000000000000000000',
379 field_1: keyring.addressRaw,
380 };
381 }
382}
383
384export class EthCrossAccountGroup extends EthGroupBase {
385 fromAddress(address: TEthereumAccount): TEthCrossAccount {
386 return {
387 0: address,
388 1: '0',
389 field_0: address,
390 field_1: '0',
391 };
392 }
393
394 fromKeyringPair(keyring: IKeyringPair): TEthCrossAccount {
395 return {
396 0: '0x0000000000000000000000000000000000000000',
397 1: keyring.addressRaw,
398 field_0: '0x0000000000000000000000000000000000000000',
399 field_1: keyring.addressRaw,
400 };
401 }
402}
363403
364export class EthCrossAccountGroup extends EthGroupBase {404export class EthCrossAccountGroup extends EthGroupBase {
365 fromAddress(address: TEthereumAccount): TEthCrossAccount {405 fromAddress(address: TEthereumAccount): TEthCrossAccount {