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

difftreelog

chore fix warnings

Grigoriy Simonov2022-12-23parent: #f918247.patch.diff
in: master

3 files changed

modifiedpallets/common/src/eth.rsdiffbeforeafterboth
125/// 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 description
128 pub status: bool,129 pub status: bool,
130 /// TODO: field description
129 pub value: CrossAddress,131 pub value: CrossAddress,
130}132}
131133
modifiedpallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth
23 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::{
modifiedtests/src/eth/collectionSponsoring.test.tsdiffbeforeafterboth
351 expect(await helper.balance.getEthereum(minter)).to.equal(0n);351 expect(await helper.balance.getEthereum(minter)).to.equal(0n);
352352
353 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);
355355
356 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();
361361
390 ].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 394
395 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 400
401 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 424
425 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 427
428 // 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', '');
499499
500 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', '');
556556
557 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);
609609
610 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);
612612
613 await collectionEvm.methods.setCollectionSponsorCross(sponsorCross).send({from: owner});613 await collectionEvm.methods.setCollectionSponsorCross(sponsorCross).send({from: owner});
614614
668668
669 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);
672672
673 // 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);
697697
698 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);
760760
761 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;
770770
771 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 773
774 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);
813813
814 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;
823823
824 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 826
827 const ownerBalanceBefore = await helper.balance.getSubstrate(helper.address.ethToSubstrate(owner));827 const ownerBalanceBefore = await helper.balance.getSubstrate(helper.address.ethToSubstrate(owner));