From 56575de5acb6ae05fad7c7ebfc834d32ac0428f3 Mon Sep 17 00:00:00 2001 From: Trubnikov Sergey Date: Fri, 02 Sep 2022 13:33:52 +0000 Subject: [PATCH] refactor: Rename module in extrinsic --- --- a/primitives/app_promotion_rpc/src/lib.rs +++ b/primitives/app_promotion_rpc/src/lib.rs @@ -16,11 +16,6 @@ #![cfg_attr(not(feature = "std"), no_std)] -use up_data_structs::{ - CollectionId, TokenId, RpcCollection, CollectionStats, CollectionLimits, Property, - PropertyKeyPermission, TokenData, TokenChild, -}; - use sp_std::vec::Vec; use codec::Decode; use sp_runtime::{ --- a/runtime/common/construct_runtime/mod.rs +++ b/runtime/common/construct_runtime/mod.rs @@ -78,7 +78,7 @@ RmrkEquip: pallet_proxy_rmrk_equip::{Pallet, Call, Storage, Event} = 72, #[runtimes(opal)] - Promotion: pallet_app_promotion::{Pallet, Call, Storage, Event} = 73, + AppPromotion: pallet_app_promotion::{Pallet, Call, Storage, Event} = 73, // Frontier EVM: pallet_evm::{Pallet, Config, Call, Storage, Event} = 100, --- a/tests/src/app-promotion.test.ts +++ b/tests/src/app-promotion.test.ts @@ -38,29 +38,20 @@ const palletAddress = calculatePalleteAddress('appstake'); let accounts: IKeyringPair[] = []; -before(async function () { - await usingPlaygrounds(async (helper, privateKeyWrapper) => { - if (!getModuleNames(helper.api!).includes(Pallets.AppPromotion)) this.skip(); - alice = privateKeyWrapper('//Alice'); - palletAdmin = privateKeyWrapper('//Charlie'); // TODO use custom address - await helper.signTransaction(alice, helper.api!.tx.sudo.sudo(helper.api!.tx.promotion.setAdminAddress({Substrate: palletAdmin.address}))); - nominal = helper.balance.getOneTokenNominal(); - await helper.balance.transferToSubstrate(alice, palletAdmin.address, 1000n * nominal); - await helper.balance.transferToSubstrate(alice, palletAddress, 1000n * nominal); - if (!promotionStartBlock) { - promotionStartBlock = (await helper.api!.query.parachainSystem.lastRelayChainBlockNumber()).toNumber(); - } - await helper.signTransaction(alice, helper.api!.tx.sudo.sudo(helper.api!.tx.promotion.startAppPromotion(promotionStartBlock!))); - accounts = await helper.arrange.createCrowd(100, 1000n, alice); // create accounts-pool to speed up tests - }); -}); - -after(async function () { - await usingPlaygrounds(async (helper) => { +describe('app-promotions.stake extrinsic', () => { + before(async function () { + await usingPlaygrounds(async (helper, privateKeyWrapper) => { + if (!getModuleNames(helper.api!).includes(Pallets.AppPromotion)) this.skip(); + alice = privateKeyWrapper('//Alice'); + palletAdmin = privateKeyWrapper('//Charlie'); // TODO use custom address + await helper.signTransaction(alice, helper.api!.tx.sudo.sudo(helper.api!.tx.appPromotion.setAdminAddress({Substrate: palletAdmin.address}))); + nominal = helper.balance.getOneTokenNominal(); + await helper.balance.transferToSubstrate(alice, palletAdmin.address, 1000n * nominal); + await helper.balance.transferToSubstrate(alice, palletAddress, 1000n * nominal); + accounts = await helper.arrange.createCrowd(100, 1000n, alice); // create accounts-pool to speed up tests + }); }); -}); -describe('app-promotions.stake extrinsic', () => { it('should "lock" staking balance, add it to "staked" map, and increase "totalStaked" amount', async () => { await usingPlaygrounds(async (helper) => { const [staker, recepient] = [accounts.pop()!, accounts.pop()!]; @@ -264,11 +255,11 @@ await usingPlaygrounds(async (helper) => { const nonAdmin = accounts.pop()!; // nonAdmin can not set admin not from himself nor as a sudo - await expect(helper.signTransaction(nonAdmin, helper.api!.tx.promotion.setAdminAddress({Substrate: nonAdmin.address}))).to.be.eventually.rejected; - await expect(helper.signTransaction(nonAdmin, helper.api!.tx.sudo.sudo(helper.api!.tx.promotion.setAdminAddress({Substrate: nonAdmin.address})))).to.be.eventually.rejected; + await expect(helper.signTransaction(nonAdmin, helper.api!.tx.appPromotion.setAdminAddress({Substrate: nonAdmin.address}))).to.be.eventually.rejected; + await expect(helper.signTransaction(nonAdmin, helper.api!.tx.sudo.sudo(helper.api!.tx.appPromotion.setAdminAddress({Substrate: nonAdmin.address})))).to.be.eventually.rejected; // Alice can - await expect(helper.signTransaction(alice, helper.api!.tx.sudo.sudo(helper.api!.tx.promotion.setAdminAddress({Substrate: palletAdmin.address})))).to.be.eventually.fulfilled; + await expect(helper.signTransaction(alice, helper.api!.tx.sudo.sudo(helper.api!.tx.appPromotion.setAdminAddress({Substrate: palletAdmin.address})))).to.be.eventually.fulfilled; }); }); @@ -279,12 +270,12 @@ const account = accounts.pop()!; const ethAccount = helper.address.substrateToEth(account.address); // Alice sets Ethereum address as a sudo. Then Substrate address back... - await expect(helper.signTransaction(alice, helper.api!.tx.sudo.sudo(helper.api!.tx.promotion.setAdminAddress({Ethereum: ethAccount})))).to.be.eventually.fulfilled; - await expect(helper.signTransaction(alice, helper.api!.tx.sudo.sudo(helper.api!.tx.promotion.setAdminAddress({Substrate: palletAdmin.address})))).to.be.eventually.fulfilled; + await expect(helper.signTransaction(alice, helper.api!.tx.sudo.sudo(helper.api!.tx.appPromotion.setAdminAddress({Ethereum: ethAccount})))).to.be.eventually.fulfilled; + await expect(helper.signTransaction(alice, helper.api!.tx.sudo.sudo(helper.api!.tx.appPromotion.setAdminAddress({Substrate: palletAdmin.address})))).to.be.eventually.fulfilled; // ...It doesn't break anything; const collection = await helper.nft.mintCollection(account, {name: 'New', description: 'New Collection', tokenPrefix: 'Promotion'}); - await expect(helper.signTransaction(account, helper.api!.tx.promotion.sponsorCollection(collection.collectionId))).to.be.eventually.rejected; + await expect(helper.signTransaction(account, helper.api!.tx.appPromotion.sponsorCollection(collection.collectionId))).to.be.eventually.rejected; }); }); @@ -293,11 +284,11 @@ const [oldAdmin, newAdmin, collectionOwner] = [accounts.pop()!, accounts.pop()!, accounts.pop()!]; const collection = await helper.nft.mintCollection(collectionOwner, {name: 'New', description: 'New Collection', tokenPrefix: 'Promotion'}); - await expect(helper.signTransaction(alice, helper.api!.tx.sudo.sudo(helper.api!.tx.promotion.setAdminAddress(normalizeAccountId(oldAdmin))))).to.be.eventually.fulfilled; - await expect(helper.signTransaction(alice, helper.api!.tx.sudo.sudo(helper.api!.tx.promotion.setAdminAddress(normalizeAccountId(newAdmin))))).to.be.eventually.fulfilled; - await expect(helper.signTransaction(oldAdmin, helper.api!.tx.promotion.sponsorCollection(collection.collectionId))).to.be.eventually.rejected; + await expect(helper.signTransaction(alice, helper.api!.tx.sudo.sudo(helper.api!.tx.appPromotion.setAdminAddress(normalizeAccountId(oldAdmin))))).to.be.eventually.fulfilled; + await expect(helper.signTransaction(alice, helper.api!.tx.sudo.sudo(helper.api!.tx.appPromotion.setAdminAddress(normalizeAccountId(newAdmin))))).to.be.eventually.fulfilled; + await expect(helper.signTransaction(oldAdmin, helper.api!.tx.appPromotion.sponsorCollection(collection.collectionId))).to.be.eventually.rejected; - await expect(helper.signTransaction(newAdmin, helper.api!.tx.promotion.sponsorCollection(collection.collectionId))).to.be.eventually.fulfilled; + await expect(helper.signTransaction(newAdmin, helper.api!.tx.appPromotion.sponsorCollection(collection.collectionId))).to.be.eventually.fulfilled; }); }); }); @@ -305,7 +296,7 @@ describe('App-promotion collection sponsoring', () => { before(async function () { await usingPlaygrounds(async (helper) => { - const tx = helper.api!.tx.sudo.sudo(helper.api!.tx.promotion.setAdminAddress({Substrate: palletAdmin.address})); + const tx = helper.api!.tx.sudo.sudo(helper.api!.tx.appPromotion.setAdminAddress({Substrate: palletAdmin.address})); await helper.signTransaction(alice, tx); }); }); @@ -315,7 +306,7 @@ const [collectionOwner, tokenSender, receiver] = [accounts.pop()!, accounts.pop()!, accounts.pop()!]; const collection = await helper.nft.mintCollection(collectionOwner, {name: 'Name', description: 'Description', tokenPrefix: 'Prefix', limits: {sponsorTransferTimeout: 0}}); const token = await collection.mintToken(collectionOwner, {Substrate: tokenSender.address}); - await helper.signTransaction(palletAdmin, helper.api!.tx.promotion.sponsorCollection(collection.collectionId)); + await helper.signTransaction(palletAdmin, helper.api!.tx.appPromotion.sponsorCollection(collection.collectionId)); const palletBalanceBefore = await helper.balance.getSubstrate(palletAddress); await token.transfer(tokenSender, {Substrate: receiver.address}); @@ -334,7 +325,7 @@ const collection = await helper.nft.mintCollection(collectionOwner, {name: 'New', description: 'New Collection', tokenPrefix: 'Promotion'}); - await expect(helper.signTransaction(nonAdmin, helper.api!.tx.promotion.sponsorCollection(collection.collectionId))).to.be.eventually.rejected; + await expect(helper.signTransaction(nonAdmin, helper.api!.tx.appPromotion.sponsorCollection(collection.collectionId))).to.be.eventually.rejected; expect((await collection.getData())?.raw.sponsorship).to.equal('Disabled'); }); }); @@ -345,19 +336,19 @@ // Can set sponsoring for collection without sponsor const collectionWithoutSponsor = await helper.nft.mintCollection(collectionOwner, {name: 'No-sponsor', description: 'New Collection', tokenPrefix: 'Promotion'}); - await expect(helper.signTransaction(palletAdmin, helper.api!.tx.promotion.sponsorCollection(collectionWithoutSponsor.collectionId))).to.be.eventually.fulfilled; + await expect(helper.signTransaction(palletAdmin, helper.api!.tx.appPromotion.sponsorCollection(collectionWithoutSponsor.collectionId))).to.be.eventually.fulfilled; expect((await collectionWithoutSponsor.getData())?.raw.sponsorship).to.be.deep.equal({Confirmed: palletAddress}); // Can set sponsoring for collection with unconfirmed sponsor const collectionWithUnconfirmedSponsor = await helper.nft.mintCollection(collectionOwner, {name: 'Unconfirmed', description: 'New Collection', tokenPrefix: 'Promotion', pendingSponsor: oldSponsor.address}); expect((await collectionWithUnconfirmedSponsor.getData())?.raw.sponsorship).to.be.deep.equal({Unconfirmed: oldSponsor.address}); - await expect(helper.signTransaction(palletAdmin, helper.api!.tx.promotion.sponsorCollection(collectionWithUnconfirmedSponsor.collectionId))).to.be.eventually.fulfilled; + await expect(helper.signTransaction(palletAdmin, helper.api!.tx.appPromotion.sponsorCollection(collectionWithUnconfirmedSponsor.collectionId))).to.be.eventually.fulfilled; expect((await collectionWithUnconfirmedSponsor.getData())?.raw.sponsorship).to.be.deep.equal({Confirmed: palletAddress}); // Can set sponsoring for collection with confirmed sponsor const collectionWithConfirmedSponsor = await helper.nft.mintCollection(collectionOwner, {name: 'Confirmed', description: 'New Collection', tokenPrefix: 'Promotion', pendingSponsor: oldSponsor.address}); await collectionWithConfirmedSponsor.confirmSponsorship(oldSponsor); - await expect(helper.signTransaction(palletAdmin, helper.api!.tx.promotion.sponsorCollection(collectionWithConfirmedSponsor.collectionId))).to.be.eventually.fulfilled; + await expect(helper.signTransaction(palletAdmin, helper.api!.tx.appPromotion.sponsorCollection(collectionWithConfirmedSponsor.collectionId))).to.be.eventually.fulfilled; expect((await collectionWithConfirmedSponsor.getData())?.raw.sponsorship).to.be.deep.equal({Confirmed: palletAddress}); }); }); @@ -368,7 +359,7 @@ const collection = await helper.nft.mintCollection(collectionOwner, {name: 'New', description: 'New Collection', tokenPrefix: 'Promotion'}); const collectionId = collection.collectionId; - await expect(helper.signTransaction(palletAdmin, helper.api!.tx.promotion.sponsorCollection(collectionId))).to.be.eventually.fulfilled; + await expect(helper.signTransaction(palletAdmin, helper.api!.tx.appPromotion.sponsorCollection(collectionId))).to.be.eventually.fulfilled; // Collection limits still can be changed by the owner expect(await collection.setLimits(collectionOwner, {sponsorTransferTimeout: 0})).to.be.true; @@ -386,7 +377,7 @@ const limits = {ownerCanDestroy: true, ownerCanTransfer: true, sponsorTransferTimeout: 0}; const collectionWithLimits = await helper.nft.mintCollection(alice, {name: 'New', description: 'New Collection', tokenPrefix: 'Promotion', limits}); - await expect(helper.signTransaction(palletAdmin, helper.api!.tx.promotion.sponsorCollection(collectionWithLimits.collectionId))).to.be.eventually.fulfilled; + await expect(helper.signTransaction(palletAdmin, helper.api!.tx.appPromotion.sponsorCollection(collectionWithLimits.collectionId))).to.be.eventually.fulfilled; expect((await collectionWithLimits.getData())?.raw.limits).to.be.deep.contain(limits); }); }); @@ -396,12 +387,12 @@ const collectionOwner = accounts.pop()!; // collection has never existed - await expect(helper.signTransaction(palletAdmin, helper.api!.tx.promotion.sponsorCollection(999999999))).to.be.eventually.rejected; + await expect(helper.signTransaction(palletAdmin, helper.api!.tx.appPromotion.sponsorCollection(999999999))).to.be.eventually.rejected; // collection has been burned const collection = await helper.nft.mintCollection(collectionOwner, {name: 'New', description: 'New Collection', tokenPrefix: 'Promotion'}); await collection.burn(collectionOwner); - await expect(helper.signTransaction(palletAdmin, helper.api!.tx.promotion.sponsorCollection(collection.collectionId))).to.be.eventually.rejected; + await expect(helper.signTransaction(palletAdmin, helper.api!.tx.appPromotion.sponsorCollection(collection.collectionId))).to.be.eventually.rejected; }); }); }); @@ -412,9 +403,9 @@ const [collectionOwner, nonAdmin] = [accounts.pop()!, accounts.pop()!]; const collection = await helper.nft.mintCollection(collectionOwner, {name: 'New', description: 'New Collection', tokenPrefix: 'Promotion'}); - await expect(helper.signTransaction(palletAdmin, helper.api!.tx.promotion.sponsorCollection(collection.collectionId))).to.be.eventually.fulfilled; + await expect(helper.signTransaction(palletAdmin, helper.api!.tx.appPromotion.sponsorCollection(collection.collectionId))).to.be.eventually.fulfilled; - await expect(helper.signTransaction(nonAdmin, helper.api!.tx.promotion.stopSponsoringCollection(collection.collectionId))).to.be.eventually.rejected; + await expect(helper.signTransaction(nonAdmin, helper.api!.tx.appPromotion.stopSponsoringCollection(collection.collectionId))).to.be.eventually.rejected; expect((await collection.getData())?.raw.sponsorship).to.be.deep.equal({Confirmed: palletAddress}); }); }); @@ -425,8 +416,8 @@ const collection = await helper.nft.mintCollection(collectionOwner, {name: 'New', description: 'New Collection', tokenPrefix: 'Promotion', limits: {sponsorTransferTimeout: 0}}); const token = await collection.mintToken(collectionOwner, {Substrate: collectionOwner.address}); - await helper.signTransaction(palletAdmin, helper.api!.tx.promotion.sponsorCollection(collection.collectionId)); - await helper.signTransaction(palletAdmin, helper.api!.tx.promotion.stopSponsoringCollection(collection.collectionId)); + await helper.signTransaction(palletAdmin, helper.api!.tx.appPromotion.sponsorCollection(collection.collectionId)); + await helper.signTransaction(palletAdmin, helper.api!.tx.appPromotion.stopSponsoringCollection(collection.collectionId)); expect((await collection.getData())?.raw.sponsorship).to.be.equal('Disabled'); @@ -444,7 +435,7 @@ const collection = await helper.nft.mintCollection(collectionOwner, {name: 'New', description: 'New Collection', tokenPrefix: 'Promotion', pendingSponsor: collectionOwner.address}); await collection.confirmSponsorship(collectionOwner); - await expect(helper.signTransaction(palletAdmin, helper.api!.tx.promotion.stopSponsoringCollection(collection.collectionId))).to.be.eventually.rejected; + await expect(helper.signTransaction(palletAdmin, helper.api!.tx.appPromotion.stopSponsoringCollection(collection.collectionId))).to.be.eventually.rejected; expect((await collection.getData())?.raw.sponsorship).to.be.deep.equal({Confirmed: collectionOwner.address}); }); @@ -456,8 +447,8 @@ const collection = await helper.nft.mintCollection(collectionOwner, {name: 'New', description: 'New Collection', tokenPrefix: 'Promotion'}); await collection.burn(collectionOwner); - await expect(helper.signTransaction(palletAdmin, helper.api!.tx.promotion.stopSponsoringCollection(collection.collectionId))).to.be.eventually.rejected; - await expect(helper.signTransaction(palletAdmin, helper.api!.tx.promotion.stopSponsoringCollection(999999999))).to.be.eventually.rejected; + await expect(helper.signTransaction(palletAdmin, helper.api!.tx.appPromotion.stopSponsoringCollection(collection.collectionId))).to.be.eventually.rejected; + await expect(helper.signTransaction(palletAdmin, helper.api!.tx.appPromotion.stopSponsoringCollection(999999999))).to.be.eventually.rejected; }); }); }); @@ -469,7 +460,7 @@ const flipper = await deployFlipper(web3, contractOwner); const contractMethods = contractHelpers(web3, contractOwner); - await helper.signTransaction(palletAdmin, api.tx.promotion.sponsorConract(flipper.options.address)); + await helper.signTransaction(palletAdmin, api.tx.appPromotion.sponsorConract(flipper.options.address)); expect(await contractMethods.methods.hasSponsor(flipper.options.address).call()).to.be.true; expect((await api.query.evmContractHelpers.owner(flipper.options.address)).toJSON()).to.be.equal(contractOwner); @@ -497,7 +488,7 @@ }); // set promotion sponsoring - await helper.signTransaction(palletAdmin, api.tx.promotion.sponsorConract(flipper.options.address)); + await helper.signTransaction(palletAdmin, api.tx.appPromotion.sponsorConract(flipper.options.address)); // new sponsor is pallet address expect(await contractMethods.methods.hasSponsor(flipper.options.address).call()).to.be.true; @@ -517,7 +508,7 @@ const contractMethods = contractHelpers(web3, contractOwner); // contract sponsored by pallet - await helper.signTransaction(palletAdmin, api.tx.promotion.sponsorConract(flipper.options.address)); + await helper.signTransaction(palletAdmin, api.tx.appPromotion.sponsorConract(flipper.options.address)); // owner sets self sponsoring await expect(contractMethods.methods.selfSponsoredEnable(flipper.options.address).send()).to.be.not.rejected; @@ -542,7 +533,7 @@ await expect(contractMethods.methods.selfSponsoredEnable(flipper.options.address).send()).to.be.not.rejected; // nonAdmin calls sponsorConract - await expect(helper.signTransaction(nonAdmin, api.tx.promotion.sponsorConract(flipper.options.address))).to.be.rejected; + await expect(helper.signTransaction(nonAdmin, api.tx.appPromotion.sponsorConract(flipper.options.address))).to.be.rejected; // contract still self-sponsored expect((await api.query.evmContractHelpers.sponsoring(flipper.options.address)).toJSON()).to.deep.equal({ @@ -569,7 +560,7 @@ await contractHelper.methods.setSponsoringMode(flipper.options.address, SponsoringMode.Generous).send({from: contractOwner}); await transferBalanceToEth(api, alice, flipper.options.address, 1000n); - await helper.signTransaction(palletAdmin, api.tx.promotion.sponsorConract(flipper.options.address)); + await helper.signTransaction(palletAdmin, api.tx.appPromotion.sponsorConract(flipper.options.address)); await flipper.methods.flip().send({from: caller}); expect(await flipper.methods.getValue().call()).to.be.true; @@ -591,8 +582,8 @@ await transferBalanceToEth(api, alice, flipper.options.address); const contractHelper = contractHelpers(web3, contractOwner); await contractHelper.methods.setSponsoringMode(flipper.options.address, SponsoringMode.Generous).send({from: contractOwner}); - await helper.signTransaction(palletAdmin, api.tx.promotion.sponsorConract(flipper.options.address)); - await helper.signTransaction(palletAdmin, api.tx.promotion.stopSponsoringContract(flipper.options.address)); + await helper.signTransaction(palletAdmin, api.tx.appPromotion.sponsorConract(flipper.options.address)); + await helper.signTransaction(palletAdmin, api.tx.appPromotion.stopSponsoringContract(flipper.options.address)); expect(await contractHelper.methods.hasSponsor(flipper.options.address).call()).to.be.false; expect((await api.query.evmContractHelpers.owner(flipper.options.address)).toJSON()).to.be.equal(contractOwner); @@ -618,8 +609,8 @@ const contractOwner = (await createEthAccountWithBalance(api, web3, privateKeyWrapper)).toLowerCase(); const flipper = await deployFlipper(web3, contractOwner); - await helper.signTransaction(palletAdmin, api.tx.promotion.sponsorConract(flipper.options.address)); - await expect(helper.signTransaction(nonAdmin, api.tx.promotion.stopSponsoringContract(flipper.options.address))).to.be.rejected; + await helper.signTransaction(palletAdmin, api.tx.appPromotion.sponsorConract(flipper.options.address)); + await expect(helper.signTransaction(nonAdmin, api.tx.appPromotion.stopSponsoringContract(flipper.options.address))).to.be.rejected; }); }); @@ -631,7 +622,7 @@ const contractHelper = contractHelpers(web3, contractOwner); await expect(contractHelper.methods.selfSponsoredEnable(flipper.options.address).send()).to.be.not.rejected; - await expect(helper.signTransaction(nonAdmin, api.tx.promotion.stopSponsoringContract(flipper.options.address))).to.be.rejected; + await expect(helper.signTransaction(nonAdmin, api.tx.appPromotion.stopSponsoringContract(flipper.options.address))).to.be.rejected; }); }); }); @@ -640,7 +631,7 @@ it('can not be called by non admin', async () => { await usingPlaygrounds(async (helper) => { const nonAdmin = accounts.pop()!; - await expect(helper.signTransaction(nonAdmin, helper.api!.tx.promotion.payoutStakers(100))).to.be.rejected; + await expect(helper.signTransaction(nonAdmin, helper.api!.tx.appPromotion.payoutStakers(100))).to.be.rejected; }); }); @@ -652,7 +643,7 @@ await helper.staking.stake(staker, 100n * nominal); await helper.staking.stake(staker, 200n * nominal); await waitForRelayBlock(helper.api!, 30); - await helper.signTransaction(palletAdmin, helper.api!.tx.promotion.payoutStakers(100)); + await helper.signTransaction(palletAdmin, helper.api!.tx.appPromotion.payoutStakers(100)); const totalStakedPerBlock = (await helper.staking.getTotalStakedPerBlock({Substrate: staker.address})).map(s => s[1]); expect(totalStakedPerBlock).to.be.deep.equal([calculateIncome(100n * nominal, 10n), calculateIncome(200n * nominal, 10n)]); @@ -668,7 +659,7 @@ await helper.staking.stake(staker, 200n * nominal); await waitForRelayBlock(helper.api!, 55); - await helper.signTransaction(palletAdmin, helper.api!.tx.promotion.payoutStakers(100)); + await helper.signTransaction(palletAdmin, helper.api!.tx.appPromotion.payoutStakers(100)); const stakedPerBlock = await helper.staking.getTotalStakedPerBlock({Substrate: staker.address}); expect(stakedPerBlock[0][1]).to.be.equal(calculateIncome(100n * nominal, 10n, 2)); expect(stakedPerBlock[1][1]).to.be.equal(calculateIncome(200n * nominal, 10n, 2)); @@ -707,12 +698,12 @@ await helper.staking.stake(staker, 300n * nominal); await waitForRelayBlock(helper.api!, 34); - await helper.signTransaction(palletAdmin, helper.api!.tx.promotion.payoutStakers(100)); + await helper.signTransaction(palletAdmin, helper.api!.tx.appPromotion.payoutStakers(100)); let totalStakedPerBlock = (await helper.staking.getTotalStakedPerBlock({Substrate: staker.address})).map(s => s[1]); expect(totalStakedPerBlock).to.deep.equal([calculateIncome(100n * nominal, 10n), calculateIncome(200n * nominal, 10n), calculateIncome(300n * nominal, 10n)]); await waitForRelayBlock(helper.api!, 20); - await helper.signTransaction(palletAdmin, helper.api!.tx.promotion.payoutStakers(100)); + await helper.signTransaction(palletAdmin, helper.api!.tx.appPromotion.payoutStakers(100)); totalStakedPerBlock = (await helper.staking.getTotalStakedPerBlock({Substrate: staker.address})).map(s => s[1]); expect(totalStakedPerBlock).to.deep.equal([calculateIncome(100n * nominal, 10n, 2), calculateIncome(200n * nominal, 10n, 2), calculateIncome(300n * nominal, 10n, 2)]); }); --- a/tests/src/interfaces/augment-api-consts.ts +++ b/tests/src/interfaces/augment-api-consts.ts @@ -15,6 +15,30 @@ declare module '@polkadot/api-base/types/consts' { interface AugmentedConsts { + appPromotion: { + /** + * In chain blocks. + **/ + day: u32 & AugmentedConst; + intervalIncome: Perbill & AugmentedConst; + nominal: u128 & AugmentedConst; + /** + * The app's pallet id, used for deriving its sovereign account ID. + **/ + palletId: FrameSupportPalletId & AugmentedConst; + /** + * In relay blocks. + **/ + pendingInterval: u32 & AugmentedConst; + /** + * In relay blocks. + **/ + recalculationInterval: u32 & AugmentedConst; + /** + * Generic const + **/ + [key: string]: Codec; + }; balances: { /** * The minimum amount required to keep an account open. @@ -61,30 +85,6 @@ * Number of blocks that pass between treasury balance updates due to inflation **/ inflationBlockInterval: u32 & AugmentedConst; - /** - * Generic const - **/ - [key: string]: Codec; - }; - promotion: { - /** - * In chain blocks. - **/ - day: u32 & AugmentedConst; - intervalIncome: Perbill & AugmentedConst; - nominal: u128 & AugmentedConst; - /** - * The app's pallet id, used for deriving its sovereign account ID. - **/ - palletId: FrameSupportPalletId & AugmentedConst; - /** - * In relay blocks. - **/ - pendingInterval: u32 & AugmentedConst; - /** - * In relay blocks. - **/ - recalculationInterval: u32 & AugmentedConst; /** * Generic const **/ --- a/tests/src/interfaces/augment-api-errors.ts +++ b/tests/src/interfaces/augment-api-errors.ts @@ -11,6 +11,29 @@ declare module '@polkadot/api-base/types/errors' { interface AugmentedErrors { + appPromotion: { + /** + * Error due to action requiring admin to be set + **/ + AdminNotSet: AugmentedError; + /** + * An error related to the fact that an invalid argument was passed to perform an action + **/ + InvalidArgument: AugmentedError; + /** + * No permission to perform an action + **/ + NoPermission: AugmentedError; + /** + * Insufficient funds to perform an action + **/ + NotSufficientFounds: AugmentedError; + PendingForBlockOverflow: AugmentedError; + /** + * Generic error + **/ + [key: string]: AugmentedError; + }; balances: { /** * Beneficiary account must pre-exist @@ -430,28 +453,6 @@ * The message's weight could not be determined. **/ UnweighableMessage: AugmentedError; - /** - * Generic error - **/ - [key: string]: AugmentedError; - }; - promotion: { - /** - * Error due to action requiring admin to be set - **/ - AdminNotSet: AugmentedError; - /** - * An error related to the fact that an invalid argument was passed to perform an action - **/ - InvalidArgument: AugmentedError; - /** - * No permission to perform an action - **/ - NoPermission: AugmentedError; - /** - * Insufficient funds to perform an action - **/ - NotSufficientFounds: AugmentedError; /** * Generic error **/ --- a/tests/src/interfaces/augment-api-events.ts +++ b/tests/src/interfaces/augment-api-events.ts @@ -15,6 +15,13 @@ declare module '@polkadot/api-base/types/events' { interface AugmentedEvents { + appPromotion: { + StakingRecalculation: AugmentedEvent; + /** + * Generic event + **/ + [key: string]: AugmentedEvent; + }; balances: { /** * A balance was set by root. @@ -355,13 +362,6 @@ * \[ destination, result \] **/ VersionChangeNotified: AugmentedEvent; - /** - * Generic event - **/ - [key: string]: AugmentedEvent; - }; - promotion: { - StakingRecalculation: AugmentedEvent; /** * Generic event **/ --- a/tests/src/interfaces/augment-api-query.ts +++ b/tests/src/interfaces/augment-api-query.ts @@ -17,6 +17,35 @@ declare module '@polkadot/api-base/types/storage' { interface AugmentedQueries { + appPromotion: { + admin: AugmentedQuery Observable>, []> & QueryableStorageEntry; + /** + * Stores hash a record for which the last revenue recalculation was performed. + * If `None`, then recalculation has not yet been performed or calculations have been completed for all stakers. + **/ + nextCalculatedRecord: AugmentedQuery Observable>>, []> & QueryableStorageEntry; + /** + * Amount of tokens pending unstake per user per block. + **/ + pendingUnstake: AugmentedQuery Observable>>, [u32]> & QueryableStorageEntry; + /** + * Amount of tokens staked by account in the blocknumber. + **/ + staked: AugmentedQuery Observable>, [AccountId32, u32]> & QueryableStorageEntry; + /** + * Amount of stakes for an Account + **/ + stakesPerAccount: AugmentedQuery Observable, [AccountId32]> & QueryableStorageEntry; + /** + * A block when app-promotion has started .I think this is redundant, because we only need `NextInterestBlock`. + **/ + startBlock: AugmentedQuery Observable, []> & QueryableStorageEntry; + totalStaked: AugmentedQuery Observable, []> & QueryableStorageEntry; + /** + * Generic query + **/ + [key: string]: QueryableStorageEntry; + }; balances: { /** * The Balances pallet example of storing the balance of an account. @@ -505,39 +534,6 @@ * in the trie. **/ validationData: AugmentedQuery Observable>, []> & QueryableStorageEntry; - /** - * Generic query - **/ - [key: string]: QueryableStorageEntry; - }; - promotion: { - admin: AugmentedQuery Observable>, []> & QueryableStorageEntry; - /** - * Stores hash a record for which the last revenue recalculation was performed. - * If `None`, then recalculation has not yet been performed or calculations have been completed for all stakers. - **/ - nextCalculatedRecord: AugmentedQuery Observable>>, []> & QueryableStorageEntry; - /** - * Next target block when interest is recalculated - **/ - nextInterestBlock: AugmentedQuery Observable, []> & QueryableStorageEntry; - /** - * Amount of tokens pending unstake per user per block. - **/ - pendingUnstake: AugmentedQuery Observable, [AccountId32, u32]> & QueryableStorageEntry; - /** - * Amount of tokens staked by account in the blocknumber. - **/ - staked: AugmentedQuery Observable>, [AccountId32, u32]> & QueryableStorageEntry; - /** - * Amount of stakes for an Account - **/ - stakesPerAccount: AugmentedQuery Observable, [AccountId32]> & QueryableStorageEntry; - /** - * A block when app-promotion has started .I think this is redundant, because we only need `NextInterestBlock`. - **/ - startBlock: AugmentedQuery Observable, []> & QueryableStorageEntry; - totalStaked: AugmentedQuery Observable, []> & QueryableStorageEntry; /** * Generic query **/ --- a/tests/src/interfaces/augment-api-tx.ts +++ b/tests/src/interfaces/augment-api-tx.ts @@ -17,6 +17,20 @@ declare module '@polkadot/api-base/types/submittable' { interface AugmentedSubmittables { + appPromotion: { + payoutStakers: AugmentedSubmittable<(stakersNumber: Option | null | Uint8Array | u8 | AnyNumber) => SubmittableExtrinsic, [Option]>; + setAdminAddress: AugmentedSubmittable<(admin: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => SubmittableExtrinsic, [PalletEvmAccountBasicCrossAccountIdRepr]>; + sponsorCollection: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u32]>; + sponsorConract: AugmentedSubmittable<(contractId: H160 | string | Uint8Array) => SubmittableExtrinsic, [H160]>; + stake: AugmentedSubmittable<(amount: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u128]>; + stopSponsoringCollection: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u32]>; + stopSponsoringContract: AugmentedSubmittable<(contractId: H160 | string | Uint8Array) => SubmittableExtrinsic, [H160]>; + unstake: AugmentedSubmittable<() => SubmittableExtrinsic, []>; + /** + * Generic tx + **/ + [key: string]: SubmittableExtrinsicFunction; + }; balances: { /** * Exactly as `transfer`, except the origin must be root and the source account may be @@ -370,22 +384,6 @@ * fees. **/ teleportAssets: AugmentedSubmittable<(dest: XcmVersionedMultiLocation | { V0: any } | { V1: any } | string | Uint8Array, beneficiary: XcmVersionedMultiLocation | { V0: any } | { V1: any } | string | Uint8Array, assets: XcmVersionedMultiAssets | { V0: any } | { V1: any } | string | Uint8Array, feeAssetItem: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [XcmVersionedMultiLocation, XcmVersionedMultiLocation, XcmVersionedMultiAssets, u32]>; - /** - * Generic tx - **/ - [key: string]: SubmittableExtrinsicFunction; - }; - promotion: { - payoutStakers: AugmentedSubmittable<(stakersNumber: Option | null | Uint8Array | u8 | AnyNumber) => SubmittableExtrinsic, [Option]>; - setAdminAddress: AugmentedSubmittable<(admin: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => SubmittableExtrinsic, [PalletEvmAccountBasicCrossAccountIdRepr]>; - sponsorCollection: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u32]>; - sponsorConract: AugmentedSubmittable<(contractId: H160 | string | Uint8Array) => SubmittableExtrinsic, [H160]>; - stake: AugmentedSubmittable<(amount: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u128]>; - startAppPromotion: AugmentedSubmittable<(promotionStartRelayBlock: Option | null | Uint8Array | u32 | AnyNumber) => SubmittableExtrinsic, [Option]>; - stopAppPromotion: AugmentedSubmittable<() => SubmittableExtrinsic, []>; - stopSponsoringCollection: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic, [u32]>; - stopSponsoringContract: AugmentedSubmittable<(contractId: H160 | string | Uint8Array) => SubmittableExtrinsic, [H160]>; - unstake: AugmentedSubmittable<() => SubmittableExtrinsic, []>; /** * Generic tx **/ --- a/tests/src/interfaces/default/types.ts +++ b/tests/src/interfaces/default/types.ts @@ -812,11 +812,6 @@ readonly asSetAdminAddress: { readonly admin: PalletEvmAccountBasicCrossAccountIdRepr; } & Struct; - readonly isStartAppPromotion: boolean; - readonly asStartAppPromotion: { - readonly promotionStartRelayBlock: Option; - } & Struct; - readonly isStopAppPromotion: boolean; readonly isStake: boolean; readonly asStake: { readonly amount: u128; @@ -842,7 +837,7 @@ readonly asPayoutStakers: { readonly stakersNumber: Option; } & Struct; - readonly type: 'SetAdminAddress' | 'StartAppPromotion' | 'StopAppPromotion' | 'Stake' | 'Unstake' | 'SponsorCollection' | 'StopSponsoringCollection' | 'SponsorConract' | 'StopSponsoringContract' | 'PayoutStakers'; + readonly type: 'SetAdminAddress' | 'Stake' | 'Unstake' | 'SponsorCollection' | 'StopSponsoringCollection' | 'SponsorConract' | 'StopSponsoringContract' | 'PayoutStakers'; } /** @name PalletAppPromotionError */ @@ -850,8 +845,9 @@ readonly isAdminNotSet: boolean; readonly isNoPermission: boolean; readonly isNotSufficientFounds: boolean; + readonly isPendingForBlockOverflow: boolean; readonly isInvalidArgument: boolean; - readonly type: 'AdminNotSet' | 'NoPermission' | 'NotSufficientFounds' | 'InvalidArgument'; + readonly type: 'AdminNotSet' | 'NoPermission' | 'NotSufficientFounds' | 'PendingForBlockOverflow' | 'InvalidArgument'; } /** @name PalletAppPromotionEvent */ --- a/tests/src/interfaces/lookup.ts +++ b/tests/src/interfaces/lookup.ts @@ -2460,10 +2460,6 @@ set_admin_address: { admin: 'PalletEvmAccountBasicCrossAccountIdRepr', }, - start_app_promotion: { - promotionStartRelayBlock: 'Option', - }, - stop_app_promotion: 'Null', stake: { amount: 'u128', }, @@ -3103,19 +3099,19 @@ _enum: ['PermissionError', 'NoAvailableBaseId', 'NoAvailablePartId', 'BaseDoesntExist', 'NeedsDefaultThemeFirst', 'PartDoesntExist', 'NoEquippableOnFixedPart'] }, /** - * Lookup412: pallet_app_promotion::pallet::Error + * Lookup415: pallet_app_promotion::pallet::Error **/ PalletAppPromotionError: { - _enum: ['AdminNotSet', 'NoPermission', 'NotSufficientFounds', 'InvalidArgument'] + _enum: ['AdminNotSet', 'NoPermission', 'NotSufficientFounds', 'PendingForBlockOverflow', 'InvalidArgument'] }, /** - * Lookup415: pallet_evm::pallet::Error + * Lookup418: pallet_evm::pallet::Error **/ PalletEvmError: { _enum: ['BalanceLow', 'FeeOverflow', 'PaymentOverflow', 'WithdrawFailed', 'GasPriceTooLow', 'InvalidNonce'] }, /** - * Lookup418: fp_rpc::TransactionStatus + * Lookup421: fp_rpc::TransactionStatus **/ FpRpcTransactionStatus: { transactionHash: 'H256', @@ -3127,11 +3123,11 @@ logsBloom: 'EthbloomBloom' }, /** - * Lookup420: ethbloom::Bloom + * Lookup423: ethbloom::Bloom **/ EthbloomBloom: '[u8;256]', /** - * Lookup422: ethereum::receipt::ReceiptV3 + * Lookup425: ethereum::receipt::ReceiptV3 **/ EthereumReceiptReceiptV3: { _enum: { @@ -3141,7 +3137,7 @@ } }, /** - * Lookup423: ethereum::receipt::EIP658ReceiptData + * Lookup426: ethereum::receipt::EIP658ReceiptData **/ EthereumReceiptEip658ReceiptData: { statusCode: 'u8', @@ -3150,7 +3146,7 @@ logs: 'Vec' }, /** - * Lookup424: ethereum::block::Block + * Lookup427: ethereum::block::Block **/ EthereumBlock: { header: 'EthereumHeader', @@ -3158,7 +3154,7 @@ ommers: 'Vec' }, /** - * Lookup425: ethereum::header::Header + * Lookup428: ethereum::header::Header **/ EthereumHeader: { parentHash: 'H256', @@ -3178,23 +3174,23 @@ nonce: 'EthereumTypesHashH64' }, /** - * Lookup426: ethereum_types::hash::H64 + * Lookup429: ethereum_types::hash::H64 **/ EthereumTypesHashH64: '[u8;8]', /** - * Lookup431: pallet_ethereum::pallet::Error + * Lookup434: pallet_ethereum::pallet::Error **/ PalletEthereumError: { _enum: ['InvalidSignature', 'PreLogExists'] }, /** - * Lookup432: pallet_evm_coder_substrate::pallet::Error + * Lookup435: pallet_evm_coder_substrate::pallet::Error **/ PalletEvmCoderSubstrateError: { _enum: ['OutOfGas', 'OutOfFund'] }, /** - * Lookup433: up_data_structs::SponsorshipState> + * Lookup436: up_data_structs::SponsorshipState> **/ UpDataStructsSponsorshipStateBasicCrossAccountIdRepr: { _enum: { @@ -3204,25 +3200,25 @@ } }, /** - * Lookup434: pallet_evm_contract_helpers::SponsoringModeT + * Lookup437: pallet_evm_contract_helpers::SponsoringModeT **/ PalletEvmContractHelpersSponsoringModeT: { _enum: ['Disabled', 'Allowlisted', 'Generous'] }, /** - * Lookup436: pallet_evm_contract_helpers::pallet::Error + * Lookup439: pallet_evm_contract_helpers::pallet::Error **/ PalletEvmContractHelpersError: { _enum: ['NoPermission', 'NoPendingSponsor'] }, /** - * Lookup437: pallet_evm_migration::pallet::Error + * Lookup440: pallet_evm_migration::pallet::Error **/ PalletEvmMigrationError: { _enum: ['AccountNotEmpty', 'AccountIsNotMigrating'] }, /** - * Lookup439: sp_runtime::MultiSignature + * Lookup442: sp_runtime::MultiSignature **/ SpRuntimeMultiSignature: { _enum: { @@ -3232,43 +3228,43 @@ } }, /** - * Lookup440: sp_core::ed25519::Signature + * Lookup443: sp_core::ed25519::Signature **/ SpCoreEd25519Signature: '[u8;64]', /** - * Lookup442: sp_core::sr25519::Signature + * Lookup445: sp_core::sr25519::Signature **/ SpCoreSr25519Signature: '[u8;64]', /** - * Lookup443: sp_core::ecdsa::Signature + * Lookup446: sp_core::ecdsa::Signature **/ SpCoreEcdsaSignature: '[u8;65]', /** - * Lookup446: frame_system::extensions::check_spec_version::CheckSpecVersion + * Lookup449: frame_system::extensions::check_spec_version::CheckSpecVersion **/ FrameSystemExtensionsCheckSpecVersion: 'Null', /** - * Lookup447: frame_system::extensions::check_genesis::CheckGenesis + * Lookup450: frame_system::extensions::check_genesis::CheckGenesis **/ FrameSystemExtensionsCheckGenesis: 'Null', /** - * Lookup450: frame_system::extensions::check_nonce::CheckNonce + * Lookup453: frame_system::extensions::check_nonce::CheckNonce **/ FrameSystemExtensionsCheckNonce: 'Compact', /** - * Lookup451: frame_system::extensions::check_weight::CheckWeight + * Lookup454: frame_system::extensions::check_weight::CheckWeight **/ FrameSystemExtensionsCheckWeight: 'Null', /** - * Lookup452: pallet_template_transaction_payment::ChargeTransactionPayment + * Lookup455: pallet_template_transaction_payment::ChargeTransactionPayment **/ PalletTemplateTransactionPaymentChargeTransactionPayment: 'Compact', /** - * Lookup453: opal_runtime::Runtime + * Lookup456: opal_runtime::Runtime **/ OpalRuntimeRuntime: 'Null', /** - * Lookup454: pallet_ethereum::FakeTransactionFinalizer + * Lookup457: pallet_ethereum::FakeTransactionFinalizer **/ PalletEthereumFakeTransactionFinalizer: 'Null' }; --- a/tests/src/interfaces/types-lookup.ts +++ b/tests/src/interfaces/types-lookup.ts @@ -2665,11 +2665,6 @@ readonly asSetAdminAddress: { readonly admin: PalletEvmAccountBasicCrossAccountIdRepr; } & Struct; - readonly isStartAppPromotion: boolean; - readonly asStartAppPromotion: { - readonly promotionStartRelayBlock: Option; - } & Struct; - readonly isStopAppPromotion: boolean; readonly isStake: boolean; readonly asStake: { readonly amount: u128; @@ -2695,7 +2690,7 @@ readonly asPayoutStakers: { readonly stakersNumber: Option; } & Struct; - readonly type: 'SetAdminAddress' | 'StartAppPromotion' | 'StopAppPromotion' | 'Stake' | 'Unstake' | 'SponsorCollection' | 'StopSponsoringCollection' | 'SponsorConract' | 'StopSponsoringContract' | 'PayoutStakers'; + readonly type: 'SetAdminAddress' | 'Stake' | 'Unstake' | 'SponsorCollection' | 'StopSponsoringCollection' | 'SponsorConract' | 'StopSponsoringContract' | 'PayoutStakers'; } /** @name PalletEvmCall (306) */ @@ -3291,16 +3286,17 @@ readonly type: 'PermissionError' | 'NoAvailableBaseId' | 'NoAvailablePartId' | 'BaseDoesntExist' | 'NeedsDefaultThemeFirst' | 'PartDoesntExist' | 'NoEquippableOnFixedPart'; } - /** @name PalletAppPromotionError (412) */ + /** @name PalletAppPromotionError (415) */ interface PalletAppPromotionError extends Enum { readonly isAdminNotSet: boolean; readonly isNoPermission: boolean; readonly isNotSufficientFounds: boolean; + readonly isPendingForBlockOverflow: boolean; readonly isInvalidArgument: boolean; - readonly type: 'AdminNotSet' | 'NoPermission' | 'NotSufficientFounds' | 'InvalidArgument'; + readonly type: 'AdminNotSet' | 'NoPermission' | 'NotSufficientFounds' | 'PendingForBlockOverflow' | 'InvalidArgument'; } - /** @name PalletEvmError (415) */ + /** @name PalletEvmError (418) */ interface PalletEvmError extends Enum { readonly isBalanceLow: boolean; readonly isFeeOverflow: boolean; @@ -3311,7 +3307,7 @@ readonly type: 'BalanceLow' | 'FeeOverflow' | 'PaymentOverflow' | 'WithdrawFailed' | 'GasPriceTooLow' | 'InvalidNonce'; } - /** @name FpRpcTransactionStatus (418) */ + /** @name FpRpcTransactionStatus (421) */ interface FpRpcTransactionStatus extends Struct { readonly transactionHash: H256; readonly transactionIndex: u32; @@ -3322,10 +3318,10 @@ readonly logsBloom: EthbloomBloom; } - /** @name EthbloomBloom (420) */ + /** @name EthbloomBloom (423) */ interface EthbloomBloom extends U8aFixed {} - /** @name EthereumReceiptReceiptV3 (422) */ + /** @name EthereumReceiptReceiptV3 (425) */ interface EthereumReceiptReceiptV3 extends Enum { readonly isLegacy: boolean; readonly asLegacy: EthereumReceiptEip658ReceiptData; @@ -3336,7 +3332,7 @@ readonly type: 'Legacy' | 'Eip2930' | 'Eip1559'; } - /** @name EthereumReceiptEip658ReceiptData (423) */ + /** @name EthereumReceiptEip658ReceiptData (426) */ interface EthereumReceiptEip658ReceiptData extends Struct { readonly statusCode: u8; readonly usedGas: U256; @@ -3344,14 +3340,14 @@ readonly logs: Vec; } - /** @name EthereumBlock (424) */ + /** @name EthereumBlock (427) */ interface EthereumBlock extends Struct { readonly header: EthereumHeader; readonly transactions: Vec; readonly ommers: Vec; } - /** @name EthereumHeader (425) */ + /** @name EthereumHeader (428) */ interface EthereumHeader extends Struct { readonly parentHash: H256; readonly ommersHash: H256; @@ -3370,24 +3366,24 @@ readonly nonce: EthereumTypesHashH64; } - /** @name EthereumTypesHashH64 (426) */ + /** @name EthereumTypesHashH64 (429) */ interface EthereumTypesHashH64 extends U8aFixed {} - /** @name PalletEthereumError (431) */ + /** @name PalletEthereumError (434) */ interface PalletEthereumError extends Enum { readonly isInvalidSignature: boolean; readonly isPreLogExists: boolean; readonly type: 'InvalidSignature' | 'PreLogExists'; } - /** @name PalletEvmCoderSubstrateError (432) */ + /** @name PalletEvmCoderSubstrateError (435) */ interface PalletEvmCoderSubstrateError extends Enum { readonly isOutOfGas: boolean; readonly isOutOfFund: boolean; readonly type: 'OutOfGas' | 'OutOfFund'; } - /** @name UpDataStructsSponsorshipStateBasicCrossAccountIdRepr (433) */ + /** @name UpDataStructsSponsorshipStateBasicCrossAccountIdRepr (436) */ interface UpDataStructsSponsorshipStateBasicCrossAccountIdRepr extends Enum { readonly isDisabled: boolean; readonly isUnconfirmed: boolean; @@ -3397,7 +3393,7 @@ readonly type: 'Disabled' | 'Unconfirmed' | 'Confirmed'; } - /** @name PalletEvmContractHelpersSponsoringModeT (434) */ + /** @name PalletEvmContractHelpersSponsoringModeT (437) */ interface PalletEvmContractHelpersSponsoringModeT extends Enum { readonly isDisabled: boolean; readonly isAllowlisted: boolean; @@ -3405,21 +3401,21 @@ readonly type: 'Disabled' | 'Allowlisted' | 'Generous'; } - /** @name PalletEvmContractHelpersError (436) */ + /** @name PalletEvmContractHelpersError (439) */ interface PalletEvmContractHelpersError extends Enum { readonly isNoPermission: boolean; readonly isNoPendingSponsor: boolean; readonly type: 'NoPermission' | 'NoPendingSponsor'; } - /** @name PalletEvmMigrationError (437) */ + /** @name PalletEvmMigrationError (440) */ interface PalletEvmMigrationError extends Enum { readonly isAccountNotEmpty: boolean; readonly isAccountIsNotMigrating: boolean; readonly type: 'AccountNotEmpty' | 'AccountIsNotMigrating'; } - /** @name SpRuntimeMultiSignature (439) */ + /** @name SpRuntimeMultiSignature (442) */ interface SpRuntimeMultiSignature extends Enum { readonly isEd25519: boolean; readonly asEd25519: SpCoreEd25519Signature; @@ -3430,34 +3426,34 @@ readonly type: 'Ed25519' | 'Sr25519' | 'Ecdsa'; } - /** @name SpCoreEd25519Signature (440) */ + /** @name SpCoreEd25519Signature (443) */ interface SpCoreEd25519Signature extends U8aFixed {} - /** @name SpCoreSr25519Signature (442) */ + /** @name SpCoreSr25519Signature (445) */ interface SpCoreSr25519Signature extends U8aFixed {} - /** @name SpCoreEcdsaSignature (443) */ + /** @name SpCoreEcdsaSignature (446) */ interface SpCoreEcdsaSignature extends U8aFixed {} - /** @name FrameSystemExtensionsCheckSpecVersion (446) */ + /** @name FrameSystemExtensionsCheckSpecVersion (449) */ type FrameSystemExtensionsCheckSpecVersion = Null; - /** @name FrameSystemExtensionsCheckGenesis (447) */ + /** @name FrameSystemExtensionsCheckGenesis (450) */ type FrameSystemExtensionsCheckGenesis = Null; - /** @name FrameSystemExtensionsCheckNonce (450) */ + /** @name FrameSystemExtensionsCheckNonce (453) */ interface FrameSystemExtensionsCheckNonce extends Compact {} - /** @name FrameSystemExtensionsCheckWeight (451) */ + /** @name FrameSystemExtensionsCheckWeight (454) */ type FrameSystemExtensionsCheckWeight = Null; - /** @name PalletTemplateTransactionPaymentChargeTransactionPayment (452) */ + /** @name PalletTemplateTransactionPaymentChargeTransactionPayment (455) */ interface PalletTemplateTransactionPaymentChargeTransactionPayment extends Compact {} - /** @name OpalRuntimeRuntime (453) */ + /** @name OpalRuntimeRuntime (456) */ type OpalRuntimeRuntime = Null; - /** @name PalletEthereumFakeTransactionFinalizer (454) */ + /** @name PalletEthereumFakeTransactionFinalizer (457) */ type PalletEthereumFakeTransactionFinalizer = Null; } // declare module --- a/tests/src/util/helpers.ts +++ b/tests/src/util/helpers.ts @@ -48,7 +48,7 @@ Fungible = 'fungible', NFT = 'nonfungible', Scheduler = 'scheduler', - AppPromotion = 'promotion', + AppPromotion = 'apppromotion', } export async function isUnique(): Promise { --- a/tests/src/util/playgrounds/unique.ts +++ b/tests/src/util/playgrounds/unique.ts @@ -2008,7 +2008,7 @@ if(typeof label === 'undefined') label = `${signer.address} amount: ${amountToStake}`; const stakeResult = await this.helper.executeExtrinsic( signer, - 'api.tx.promotion.stake', [amountToStake], + 'api.tx.appPromotion.stake', [amountToStake], true, `stake failed for ${label}`, ); // TODO extract info from stakeResult @@ -2026,7 +2026,7 @@ if(typeof label === 'undefined') label = `${signer.address}`; const unstakeResult = await this.helper.executeExtrinsic( signer, - 'api.tx.promotion.unstake', [], + 'api.tx.appPromotion.unstake', [], true, `unstake failed for ${label}`, ); // TODO extract info from unstakeResult -- gitstuff