difftreelog
chore fix warnings
in: master
3 files changed
pallets/common/src/eth.rsdiffbeforeafterboth125/// Ethereum representation of Optional value with CrossAddress.125/// Ethereum representation of Optional value with CrossAddress.126#[derive(Debug, Default, AbiCoder)]126#[derive(Debug, Default, AbiCoder)]127pub struct OptionCrossAddress {127pub struct OptionCrossAddress {128 /// TODO: field description128 pub status: bool,129 pub status: bool,130 /// TODO: field description129 pub value: CrossAddress,131 pub value: CrossAddress,130}132}131133pallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth23 execution::Result,23 execution::Result,24 generate_stubgen, solidity_interface,24 generate_stubgen, solidity_interface,25 types::*,25 types::*,26 ToLog, AbiCoder,26 ToLog,27};27};28use pallet_common::eth;28use pallet_common::eth;29use pallet_evm::{29use pallet_evm::{tests/src/eth/collectionSponsoring.test.tsdiffbeforeafterboth351 expect(await helper.balance.getEthereum(minter)).to.equal(0n);351 expect(await helper.balance.getEthereum(minter)).to.equal(0n);352352353 const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);353 const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);354 const contract = helper.ethNativeContract.collection(collectionAddress, 'rft', minter, true);354 const contract = await helper.ethNativeContract.collection(collectionAddress, 'rft', minter, true);355355356 await collection.addToAllowList(alice, {Ethereum: minter});356 await collection.addToAllowList(alice, {Ethereum: minter});357 await collection.addAdmin(alice, {Ethereum: owner});357 await collection.addAdmin(alice, {Ethereum: owner});358 const collectionHelpers = helper.ethNativeContract.collectionHelpers(owner);358 const collectionHelpers = await helper.ethNativeContract.collectionHelpers(owner);359 await collectionHelpers.methods.makeCollectionERC721MetadataCompatible(collectionAddress, 'base/')359 await collectionHelpers.methods.makeCollectionERC721MetadataCompatible(collectionAddress, 'base/')360 .send();360 .send();361361390 ].map(testCase => 390 ].map(testCase =>391 itEth(`[${testCase}] can remove collection sponsor`, async ({helper}) => {391 itEth(`[${testCase}] can remove collection sponsor`, async ({helper}) => {392 const owner = await helper.eth.createAccountWithBalance(donor);392 const owner = await helper.eth.createAccountWithBalance(donor);393 const collectionHelpers = helper.ethNativeContract.collectionHelpers(owner);393 const collectionHelpers = await helper.ethNativeContract.collectionHelpers(owner);394 394395 let result = await collectionHelpers.methods.createRFTCollection('Sponsor collection', '1', '1').send({value: Number(2n * nominal)});395 let result = await collectionHelpers.methods.createRFTCollection('Sponsor collection', '1', '1').send({value: Number(2n * nominal)});396 const collectionIdAddress = helper.ethAddress.normalizeAddress(result.events.CollectionCreated.returnValues.collectionId);396 const collectionIdAddress = helper.ethAddress.normalizeAddress(result.events.CollectionCreated.returnValues.collectionId);397 const sponsor = await helper.eth.createAccountWithBalance(donor);397 const sponsor = await helper.eth.createAccountWithBalance(donor);398 const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);398 const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);399 const collectionEvm = helper.ethNativeContract.collection(collectionIdAddress, 'rft', owner, testCase === 'setCollectionSponsor');399 const collectionEvm = await helper.ethNativeContract.collection(collectionIdAddress, 'rft', owner, testCase === 'setCollectionSponsor');400 400401 expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.false;401 expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.false;402 result = await collectionEvm.methods[testCase](testCase === 'setCollectionSponsor' ? sponsor : sponsorCross).send({from: owner});402 result = await collectionEvm.methods[testCase](testCase === 'setCollectionSponsor' ? sponsor : sponsorCross).send({from: owner});423 const {collectionId, collectionAddress} = await helper.eth.createERC721MetadataCompatibleRFTCollection(owner, 'Sponsor collection', '1', '1', '');423 const {collectionId, collectionAddress} = await helper.eth.createERC721MetadataCompatibleRFTCollection(owner, 'Sponsor collection', '1', '1', '');424 424425 const collectionSub = helper.rft.getCollectionObject(collectionId);425 const collectionSub = helper.rft.getCollectionObject(collectionId);426 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'rft', owner, testCase === 'setCollectionSponsor');426 const collectionEvm = await helper.ethNativeContract.collection(collectionAddress, 'rft', owner, testCase === 'setCollectionSponsor');427 427428 // Set collection sponsor:428 // Set collection sponsor:429 await collectionEvm.methods[testCase](testCase === 'setCollectionSponsor' ? sponsorEth : sponsorCrossEth).send({from: owner});429 await collectionEvm.methods[testCase](testCase === 'setCollectionSponsor' ? sponsorEth : sponsorCrossEth).send({from: owner});498 const {collectionAddress, collectionId} = await helper.eth.createERC721MetadataCompatibleRFTCollection(owner,'Sponsor collection', '1', '1', '');498 const {collectionAddress, collectionId} = await helper.eth.createERC721MetadataCompatibleRFTCollection(owner,'Sponsor collection', '1', '1', '');499499500 const collectionSub = helper.rft.getCollectionObject(collectionId);500 const collectionSub = helper.rft.getCollectionObject(collectionId);501 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'rft', owner, testCase === 'setCollectionSponsor');501 const collectionEvm = await helper.ethNativeContract.collection(collectionAddress, 'rft', owner, testCase === 'setCollectionSponsor');502 // Set collection sponsor:502 // Set collection sponsor:503 expect(await collectionEvm.methods.hasCollectionPendingSponsor().call()).to.be.false;503 expect(await collectionEvm.methods.hasCollectionPendingSponsor().call()).to.be.false;504 await collectionEvm.methods[testCase](testCase === 'setCollectionSponsor' ? sponsor : sponsorCross).send();504 await collectionEvm.methods[testCase](testCase === 'setCollectionSponsor' ? sponsor : sponsorCross).send();555 const {collectionAddress, collectionId} = await helper.eth.createERC721MetadataCompatibleRFTCollection(owner,'Sponsor collection', '1', '1', '');555 const {collectionAddress, collectionId} = await helper.eth.createERC721MetadataCompatibleRFTCollection(owner,'Sponsor collection', '1', '1', '');556556557 const collectionSub = helper.rft.getCollectionObject(collectionId);557 const collectionSub = helper.rft.getCollectionObject(collectionId);558 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'rft', owner, false);558 const collectionEvm = await helper.ethNativeContract.collection(collectionAddress, 'rft', owner, false);559 // Set collection sponsor:559 // Set collection sponsor:560 expect(await collectionEvm.methods.hasCollectionPendingSponsor().call()).to.be.false;560 expect(await collectionEvm.methods.hasCollectionPendingSponsor().call()).to.be.false;561 await collectionEvm.methods.setCollectionSponsorCross(sponsorCross).send();561 await collectionEvm.methods.setCollectionSponsorCross(sponsorCross).send();608 const sponsorCross = helper.ethCrossAccount.fromKeyringPair(sponsor);608 const sponsorCross = helper.ethCrossAccount.fromKeyringPair(sponsor);609609610 const {collectionAddress, collectionId} = await helper.eth.createERC721MetadataCompatibleRFTCollection(owner,'Sponsor collection', '1', '1', '');610 const {collectionAddress, collectionId} = await helper.eth.createERC721MetadataCompatibleRFTCollection(owner,'Sponsor collection', '1', '1', '');611 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'rft', owner, false);611 const collectionEvm = await helper.ethNativeContract.collection(collectionAddress, 'rft', owner, false);612612613 await collectionEvm.methods.setCollectionSponsorCross(sponsorCross).send({from: owner});613 await collectionEvm.methods.setCollectionSponsorCross(sponsorCross).send({from: owner});614614668668669 const {collectionAddress, collectionId} = await helper.eth.createERC721MetadataCompatibleRFTCollection(owner,'Sponsor collection', '1', '1', '');669 const {collectionAddress, collectionId} = await helper.eth.createERC721MetadataCompatibleRFTCollection(owner,'Sponsor collection', '1', '1', '');670 const collectionSub = helper.rft.getCollectionObject(collectionId);670 const collectionSub = helper.rft.getCollectionObject(collectionId);671 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'rft', owner);671 const collectionEvm = await helper.ethNativeContract.collection(collectionAddress, 'rft', owner);672672673 // Set and confirm sponsor:673 // Set and confirm sponsor:674 await collectionEvm.methods.setCollectionSponsorCross(sponsorCrossEth).send({from: owner});674 await collectionEvm.methods.setCollectionSponsorCross(sponsorCrossEth).send({from: owner});693 const sponsor = await helper.eth.createAccountWithBalance(donor);693 const sponsor = await helper.eth.createAccountWithBalance(donor);694 const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);694 const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);695 const receiver = await helper.eth.createAccountWithBalance(donor);695 const receiver = await helper.eth.createAccountWithBalance(donor);696 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'rft', owner);696 const collectionEvm = await helper.ethNativeContract.collection(collectionAddress, 'rft', owner);697697698 await collectionEvm.methods.setCollectionSponsorCross(sponsorCross).send();698 await collectionEvm.methods.setCollectionSponsorCross(sponsorCross).send();699 await collectionEvm.methods.confirmCollectionSponsorship().send({from: sponsor});699 await collectionEvm.methods.confirmCollectionSponsorship().send({from: sponsor});756 const sponsor = await helper.eth.createAccountWithBalance(donor);756 const sponsor = await helper.eth.createAccountWithBalance(donor);757 const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);757 const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);758 const receiver = await helper.eth.createAccountWithBalance(donor);758 const receiver = await helper.eth.createAccountWithBalance(donor);759 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'rft', owner);759 const collectionEvm = await helper.ethNativeContract.collection(collectionAddress, 'rft', owner);760760761 await collectionEvm.methods.setCollectionSponsorCross(sponsorCross).send();761 await collectionEvm.methods.setCollectionSponsorCross(sponsorCross).send();762 await collectionEvm.methods.confirmCollectionSponsorship().send({from: sponsor});762 await collectionEvm.methods.confirmCollectionSponsorship().send({from: sponsor});768 const result = await collectionEvm.methods.mintWithTokenURI(user, 'Test URI').send({from: user});768 const result = await collectionEvm.methods.mintWithTokenURI(user, 'Test URI').send({from: user});769 const tokenId = result.events.Transfer.returnValues.tokenId;769 const tokenId = result.events.Transfer.returnValues.tokenId;770770771 const tokenContract = helper.ethNativeContract.rftTokenById(collectionId, tokenId, user); 771 const tokenContract = await helper.ethNativeContract.rftTokenById(collectionId, tokenId, user);772 await tokenContract.methods.repartition(2).send();772 await tokenContract.methods.repartition(2).send();773 773774 const ownerBalanceBefore = await helper.balance.getSubstrate(helper.address.ethToSubstrate(owner));774 const ownerBalanceBefore = await helper.balance.getSubstrate(helper.address.ethToSubstrate(owner));809 const sponsor = await helper.eth.createAccountWithBalance(donor);809 const sponsor = await helper.eth.createAccountWithBalance(donor);810 const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);810 const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);811 const receiver = await helper.eth.createAccountWithBalance(donor);811 const receiver = await helper.eth.createAccountWithBalance(donor);812 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'rft', owner);812 const collectionEvm = await helper.ethNativeContract.collection(collectionAddress, 'rft', owner);813813814 await collectionEvm.methods.setCollectionSponsorCross(sponsorCross).send();814 await collectionEvm.methods.setCollectionSponsorCross(sponsorCross).send();815 await collectionEvm.methods.confirmCollectionSponsorship().send({from: sponsor});815 await collectionEvm.methods.confirmCollectionSponsorship().send({from: sponsor});821 const result = await collectionEvm.methods.mintWithTokenURI(user, 'Test URI').send({from: user});821 const result = await collectionEvm.methods.mintWithTokenURI(user, 'Test URI').send({from: user});822 const tokenId = result.events.Transfer.returnValues.tokenId;822 const tokenId = result.events.Transfer.returnValues.tokenId;823823824 const tokenContract = helper.ethNativeContract.rftTokenById(collectionId, tokenId, user); 824 const tokenContract = await helper.ethNativeContract.rftTokenById(collectionId, tokenId, user);825 await tokenContract.methods.repartition(2).send();825 await tokenContract.methods.repartition(2).send();826 826827 const ownerBalanceBefore = await helper.balance.getSubstrate(helper.address.ethToSubstrate(owner));827 const ownerBalanceBefore = await helper.balance.getSubstrate(helper.address.ethToSubstrate(owner));