difftreelog
refac: rename substrate methods to cross
in: master
16 files changed
pallets/common/src/erc.rsdiffbeforeafterboth656656657 /// Get collection owner.657 /// Get collection owner.658 ///658 ///659 /// @return Tuple with sponsor address and his substrate mirror.659 /// @return Tuble with sponsor address and his substrate mirror.660 /// If address is canonical then substrate mirror is zero and vice versa.660 /// If address is canonical then substrate mirror is zero and vice versa.661 fn collection_owner(&self) -> Result<(address, uint256)> {661 fn collection_owner(&self) -> Result<(address, uint256)> {662 Ok(convert_cross_account_to_tuple::<T>(662 Ok(convert_cross_account_to_tuple::<T>(pallets/fungible/src/stubs/UniqueFungible.rawdiffbeforeafterbothbinary blob — no preview
pallets/fungible/src/stubs/UniqueFungible.soldiffbeforeafterboth385385386 /// Get collection owner.386 /// Get collection owner.387 ///387 ///388 /// @return Tuple with sponsor address and his substrate mirror.388 /// @return Tuble with sponsor address and his substrate mirror.389 /// If address is canonical then substrate mirror is zero and vice versa.389 /// If address is canonical then substrate mirror is zero and vice versa.390 /// @dev EVM selector for this function is: 0xdf727d3b,390 /// @dev EVM selector for this function is: 0xdf727d3b,391 /// or in textual repr: collectionOwner()391 /// or in textual repr: collectionOwner()pallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterbothbinary blob — no preview
pallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth471471472 /// Get collection owner.472 /// Get collection owner.473 ///473 ///474 /// @return Tuple with sponsor address and his substrate mirror.474 /// @return Tuble with sponsor address and his substrate mirror.475 /// If address is canonical then substrate mirror is zero and vice versa.475 /// If address is canonical then substrate mirror is zero and vice versa.476 /// @dev EVM selector for this function is: 0xdf727d3b,476 /// @dev EVM selector for this function is: 0xdf727d3b,477 /// or in textual repr: collectionOwner()477 /// or in textual repr: collectionOwner()pallets/refungible/src/stubs/UniqueRefungible.rawdiffbeforeafterbothbinary blob — no preview
pallets/refungible/src/stubs/UniqueRefungible.soldiffbeforeafterboth471471472 /// Get collection owner.472 /// Get collection owner.473 ///473 ///474 /// @return Tuple with sponsor address and his substrate mirror.474 /// @return Tuble with sponsor address and his substrate mirror.475 /// If address is canonical then substrate mirror is zero and vice versa.475 /// If address is canonical then substrate mirror is zero and vice versa.476 /// @dev EVM selector for this function is: 0xdf727d3b,476 /// @dev EVM selector for this function is: 0xdf727d3b,477 /// or in textual repr: collectionOwner()477 /// or in textual repr: collectionOwner()tests/src/eth/allowlist.test.tsdiffbeforeafterboth89 expect(await collectionEvm.methods.allowed(user).call({from: owner})).to.be.false;89 expect(await collectionEvm.methods.allowed(user).call({from: owner})).to.be.false;90 });90 });919192 //itEth('Collection allowlist can be added and removed by [cross] address', async ({helper}) => {92 itEth('Collection allowlist can be added and removed by [cross] address', async ({helper}) => {93 // const owner = await helper.eth.createAccountWithBalance(donor);93 const owner = await helper.eth.createAccountWithBalance(donor);94 // const user = donor;94 const user = donor;95 // 95 96 // const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');96 const {collectionAddress, collectionId} = await helper.eth.createNonfungibleCollection(owner, 'A', 'B', 'C');97 // const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);97 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);98 // const userCross = helper.ethCrossAccount.fromKeyringPair(user);98 const userCross = helper.ethCrossAccount.fromKeyringPair(user);99 // 99 100 // expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;100 expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;101 // await collectionEvm.methods.addToCollectionAllowListCross(userCross).send({from: owner});101 await collectionEvm.methods.addToCollectionAllowListCross(userCross).send({from: owner});102 // expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.true;102 expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.true;103 // 103 104 // await collectionEvm.methods.removeFromCollectionAllowListCross(userCross).send({from: owner});104 await collectionEvm.methods.removeFromCollectionAllowListCross(userCross).send({from: owner});105 // expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;105 expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;106 //});106 });107107108 itEth('Collection allowlist can not be add and remove [eth] address by not owner', async ({helper}) => {108 itEth('Collection allowlist can not be add and remove [eth] address by not owner', async ({helper}) => {109 const owner = await helper.eth.createAccountWithBalance(donor);109 const owner = await helper.eth.createAccountWithBalance(donor);122 expect(await collectionEvm.methods.allowed(user).call({from: owner})).to.be.true;122 expect(await collectionEvm.methods.allowed(user).call({from: owner})).to.be.true;123 });123 });124124125 //itEth('Collection allowlist can not be add and remove [cross] address by not owner', async ({helper}) => {125 itEth('Collection allowlist can not be add and remove [cross] address by not owner', async ({helper}) => {126 // const owner = await helper.eth.createAccountWithBalance(donor);126 const owner = await helper.eth.createAccountWithBalance(donor);127 // const notOwner = await helper.eth.createAccountWithBalance(donor);127 const notOwner = await helper.eth.createAccountWithBalance(donor);128 // const user = donor;128 const user = donor;129 // 129 130 // const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');130 const {collectionAddress, collectionId} = await helper.eth.createNonfungibleCollection(owner, 'A', 'B', 'C');131 // const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);131 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);132 // 132 133 // expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;133 expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;134 // const userCross = helper.ethCrossAccount.fromKeyringPair(user);134 const userCross = helper.ethCrossAccount.fromKeyringPair(user);135 // await expect(collectionEvm.methods.addToCollectionAllowListCross(userCross).call({from: notOwner})).to.be.rejectedWith('NoPermission');135 await expect(collectionEvm.methods.addToCollectionAllowListCross(userCross).call({from: notOwner})).to.be.rejectedWith('NoPermission');136 // expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;136 expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.false;137 // await collectionEvm.methods.addToCollectionAllowListCross(userCross).send({from: owner});137 await collectionEvm.methods.addToCollectionAllowListCross(userCross).send({from: owner});138 // 138 139 // expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.true;139 expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.true;140 // await expect(collectionEvm.methods.removeFromCollectionAllowListCross(userCross).call({from: notOwner})).to.be.rejectedWith('NoPermission');140 await expect(collectionEvm.methods.removeFromCollectionAllowListCross(userCross).call({from: notOwner})).to.be.rejectedWith('NoPermission');141 // expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.true;141 expect(await helper.collection.allowed(collectionId, {Substrate: user.address})).to.be.true;142 //});142 });143});143});144144tests/src/eth/api/UniqueFungible.soldiffbeforeafterboth249249250 /// Get collection owner.250 /// Get collection owner.251 ///251 ///252 /// @return Tuple with sponsor address and his substrate mirror.252 /// @return Tuble with sponsor address and his substrate mirror.253 /// If address is canonical then substrate mirror is zero and vice versa.253 /// If address is canonical then substrate mirror is zero and vice versa.254 /// @dev EVM selector for this function is: 0xdf727d3b,254 /// @dev EVM selector for this function is: 0xdf727d3b,255 /// or in textual repr: collectionOwner()255 /// or in textual repr: collectionOwner()tests/src/eth/api/UniqueNFT.soldiffbeforeafterboth306306307 /// Get collection owner.307 /// Get collection owner.308 ///308 ///309 /// @return Tuple with sponsor address and his substrate mirror.309 /// @return Tuble with sponsor address and his substrate mirror.310 /// If address is canonical then substrate mirror is zero and vice versa.310 /// If address is canonical then substrate mirror is zero and vice versa.311 /// @dev EVM selector for this function is: 0xdf727d3b,311 /// @dev EVM selector for this function is: 0xdf727d3b,312 /// or in textual repr: collectionOwner()312 /// or in textual repr: collectionOwner()tests/src/eth/api/UniqueRefungible.soldiffbeforeafterboth306306307 /// Get collection owner.307 /// Get collection owner.308 ///308 ///309 /// @return Tuple with sponsor address and his substrate mirror.309 /// @return Tuble with sponsor address and his substrate mirror.310 /// If address is canonical then substrate mirror is zero and vice versa.310 /// If address is canonical then substrate mirror is zero and vice versa.311 /// @dev EVM selector for this function is: 0xdf727d3b,311 /// @dev EVM selector for this function is: 0xdf727d3b,312 /// or in textual repr: collectionOwner()312 /// or in textual repr: collectionOwner()tests/src/eth/collectionAdmin.test.tsdiffbeforeafterboth53 itEth('Add cross account admin by owner', async ({helper, privateKey}) => {53 itEth('Add cross account admin by owner', async ({helper, privateKey}) => {54 const owner = await helper.eth.createAccountWithBalance(donor);54 const owner = await helper.eth.createAccountWithBalance(donor);55 55 56 const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');56 const {collectionAddress, collectionId} = await helper.eth.createNonfungibleCollection(owner, 'A', 'B', 'C');57 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);57 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);58 58 59 const newAdmin = await privateKey('//Bob');59 const newAdmin = privateKey('//Bob');60 const newAdminCross = helper.ethCrossAccount.fromKeyringPair(newAdmin);60 const newAdminCross = helper.ethCrossAccount.fromKeyringPair(newAdmin);61 await collectionEvm.methods.addCollectionAdminCross(newAdminCross).send();61 await collectionEvm.methods.addCollectionAdminCross(newAdminCross).send();6262tests/src/eth/fungible.test.tsdiffbeforeafterboth149 });149 });150150151 itEth('Can perform burnFromCross()', async ({helper, privateKey}) => {151 itEth('Can perform burnFromCross()', async ({helper, privateKey}) => {152 const alice = await privateKey('//Alice');152 const alice = privateKey('//Alice');153 const sender = await helper.eth.createAccountWithBalance(alice, 100n);153 const sender = await helper.eth.createAccountWithBalance(alice, 100n);154154155 const collection = await helper.ft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'}, 0);155 const collection = await helper.ft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'}, 0);261 });261 });262262263 itEth('Can perform transferFromCross()', async ({helper, privateKey}) => {263 itEth('Can perform transferFromCross()', async ({helper, privateKey}) => {264 const alice = await privateKey('//Alice');264 const alice = privateKey('//Alice');265 const sender = await helper.eth.createAccountWithBalance(alice, 100n);265 const sender = await helper.eth.createAccountWithBalance(alice, 100n);266266267 const collection = await helper.ft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'}, 0);267 const collection = await helper.ft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'}, 0);455 });455 });456456457 itEth('Events emitted for transferFromCross()', async ({helper, privateKey}) => {457 itEth('Events emitted for transferFromCross()', async ({helper, privateKey}) => {458 const alice = await privateKey('//Alice');458 const alice = privateKey('//Alice');459 const sender = await helper.eth.createAccountWithBalance(alice, 100n);459 const sender = await helper.eth.createAccountWithBalance(alice, 100n);460460461 const collection = await helper.ft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'}, 0);461 const collection = await helper.ft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'}, 0);tests/src/eth/nonFungible.test.tsdiffbeforeafterboth247 });247 });248248249 itEth('Can perform burnFromCross()', async ({helper, privateKey}) => {249 itEth('Can perform burnFromCross()', async ({helper, privateKey}) => {250 const alice = await privateKey('//Alice');250 const alice = privateKey('//Alice');251 const collection = await helper.nft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'});251 const collection = await helper.nft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'});252252253 const owner = await privateKey('//Bob');253 const owner = privateKey('//Bob');254 const spender = await helper.eth.createAccountWithBalance(alice, 100n);254 const spender = await helper.eth.createAccountWithBalance(alice, 100n);255255256 const token = await collection.mintToken(alice, {Substrate: owner.address});256 const token = await collection.mintToken(alice, {Substrate: owner.address});277 });277 });278278279 itEth('Can perform approveCross()', async ({helper, privateKey}) => {279 itEth('Can perform approveCross()', async ({helper, privateKey}) => {280 const alice = await privateKey('//Alice');280 const alice = privateKey('//Alice');281 const collection = await helper.nft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'});281 const collection = await helper.nft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'});282282283 const owner = await helper.eth.createAccountWithBalance(alice, 100n);283 const owner = await helper.eth.createAccountWithBalance(alice, 100n);284 const receiver = await privateKey('//Charlie');284 const receiver = privateKey('//Charlie');285285286 const token = await collection.mintToken(alice, {Ethereum: owner});286 const token = await collection.mintToken(alice, {Ethereum: owner});287287410 });410 });411411412 itEth('Can perform transferFromCross()', async ({helper, privateKey}) => {412 itEth('Can perform transferFromCross()', async ({helper, privateKey}) => {413 const alice = await privateKey('//Alice');413 const alice = privateKey('//Alice');414 const collection = await helper.nft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'});414 const collection = await helper.nft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'});415415416 const owner = await privateKey('//Bob');416 const owner = privateKey('//Bob');417 const spender = await helper.eth.createAccountWithBalance(alice, 100n);417 const spender = await helper.eth.createAccountWithBalance(alice, 100n);418 const receiver = await privateKey('//Charlie');418 const receiver = privateKey('//Charlie');419419420 const token = await collection.mintToken(alice, {Substrate: owner.address});420 const token = await collection.mintToken(alice, {Substrate: owner.address});421421tests/src/eth/reFungible.test.tsdiffbeforeafterboth228 });228 });229229230 itEth('Can perform burnFrom()', async ({helper, privateKey}) => {230 itEth('Can perform burnFrom()', async ({helper, privateKey}) => {231 const alice = await privateKey('//Alice');231 const alice = privateKey('//Alice');232 const collection = await helper.rft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'});232 const collection = await helper.rft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'});233233234 const owner = await helper.eth.createAccountWithBalance(alice, 100n);234 const owner = await helper.eth.createAccountWithBalance(alice, 100n);262 });262 });263263264 itEth('Can perform burnFromCross()', async ({helper, privateKey}) => {264 itEth('Can perform burnFromCross()', async ({helper, privateKey}) => {265 const alice = await privateKey('//Alice');265 const alice = privateKey('//Alice');266 const collection = await helper.rft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'});266 const collection = await helper.rft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'});267267268 const owner = await privateKey('//Bob');268 const owner = privateKey('//Bob');269 const spender = await helper.eth.createAccountWithBalance(alice, 100n);269 const spender = await helper.eth.createAccountWithBalance(alice, 100n);270270271 const token = await collection.mintToken(alice, 100n, {Substrate: owner.address});271 const token = await collection.mintToken(alice, 100n, {Substrate: owner.address});295 });295 });296296297 itEth('Can perform transferFromCross()', async ({helper, privateKey}) => {297 itEth('Can perform transferFromCross()', async ({helper, privateKey}) => {298 const alice = await privateKey('//Alice');298 const alice = privateKey('//Alice');299 const collection = await helper.rft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'});299 const collection = await helper.rft.mintCollection(alice, {name: 'A', description: 'B', tokenPrefix: 'C'});300300301 const owner = await privateKey('//Bob');301 const owner = privateKey('//Bob');302 const spender = await helper.eth.createAccountWithBalance(alice, 100n);302 const spender = await helper.eth.createAccountWithBalance(alice, 100n);303 const receiver = await privateKey('//Charlie');303 const receiver = privateKey('//Charlie');304304305 const token = await collection.mintToken(alice, 100n, {Substrate: owner.address});305 const token = await collection.mintToken(alice, 100n, {Substrate: owner.address});306306tests/src/eth/util/playgrounds/unique.dev.tsdiffbeforeafterboth361}361}362export type EthUniqueHelperConstructor = new (...args: any[]) => EthUniqueHelper;362export type EthUniqueHelperConstructor = new (...args: any[]) => EthUniqueHelper;363364export 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 }373374 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}383384export 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 }393394 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}363403364export class EthCrossAccountGroup extends EthGroupBase {404export class EthCrossAccountGroup extends EthGroupBase {365 fromAddress(address: TEthereumAccount): TEthCrossAccount {405 fromAddress(address: TEthereumAccount): TEthCrossAccount {