|
@@ -1,6 +1,6 @@
|
|
import BN from 'bn.js';
|
|
import BN from 'bn.js';
|
|
import { assert } from 'chai';
|
|
import { assert } from 'chai';
|
|
-import { ApiWrapper } from '../../../utils/apiWrapper';
|
|
|
|
|
|
+import { ApiWrapper, WorkingGroups } from '../../../utils/apiWrapper';
|
|
import { KeyringPair } from '@polkadot/keyring/types';
|
|
import { KeyringPair } from '@polkadot/keyring/types';
|
|
import { Keyring } from '@polkadot/api';
|
|
import { Keyring } from '@polkadot/api';
|
|
import { v4 as uuid } from 'uuid';
|
|
import { v4 as uuid } from 'uuid';
|
|
@@ -8,6 +8,7 @@ import { RewardRelationship } from '@nicaea/types/recurring-rewards';
|
|
import { Worker, ApplicationIdToWorkerIdMap, Application } from '@nicaea/types/working-group';
|
|
import { Worker, ApplicationIdToWorkerIdMap, Application } from '@nicaea/types/working-group';
|
|
import { Utils } from '../../../utils/utils';
|
|
import { Utils } from '../../../utils/utils';
|
|
import { Opening as HiringOpening } from '@nicaea/types/hiring';
|
|
import { Opening as HiringOpening } from '@nicaea/types/hiring';
|
|
|
|
+import { WorkingGroupOpening } from '../../../dto/workingGroupOpening';
|
|
|
|
|
|
export async function addWorkerOpening(
|
|
export async function addWorkerOpening(
|
|
apiWrapper: ApiWrapper,
|
|
apiWrapper: ApiWrapper,
|
|
@@ -16,59 +17,42 @@ export async function addWorkerOpening(
|
|
sudo: KeyringPair,
|
|
sudo: KeyringPair,
|
|
applicationStake: BN,
|
|
applicationStake: BN,
|
|
roleStake: BN,
|
|
roleStake: BN,
|
|
- activationDelay: BN
|
|
|
|
|
|
+ activationDelay: BN,
|
|
|
|
+ module: WorkingGroups
|
|
): Promise<BN> {
|
|
): Promise<BN> {
|
|
|
|
+ // Worker opening construction
|
|
|
|
+ let opening = new WorkingGroupOpening();
|
|
|
|
+ const activateAtBlock: BN | undefined = activationDelay.eqn(0)
|
|
|
|
+ ? undefined
|
|
|
|
+ : (await apiWrapper.getBestBlock()).add(activationDelay);
|
|
|
|
+ opening.setActivateAtBlock(activateAtBlock);
|
|
|
|
+ opening.setMaxActiveApplicants(new BN(membersKeyPairs.length));
|
|
|
|
+ opening.setMaxReviewPeriodLength(new BN(32));
|
|
|
|
+ opening.setApplicationStakingPolicyAmount(new BN(applicationStake));
|
|
|
|
+ opening.setApplicationCrowdedOutUnstakingPeriodLength(new BN(0));
|
|
|
|
+ opening.setApplicationExpiredUnstakingPeriodLength(new BN(0));
|
|
|
|
+ opening.setRoleStakingPolicyAmount(new BN(roleStake));
|
|
|
|
+ opening.setRoleCrowdedOutUnstakingPeriodLength(new BN(0));
|
|
|
|
+ opening.setRoleExpiredUnstakingPeriodLength(new BN(0));
|
|
|
|
+ opening.setSlashableMaxCount(new BN(1));
|
|
|
|
+ opening.setSlashableMaxPercentPtsPerTime(new BN(100));
|
|
|
|
+ opening.setSuccessfulApplicantApplicationStakeUnstakingPeriod(new BN(1));
|
|
|
|
+ opening.setFailedApplicantApplicationStakeUnstakingPeriod(new BN(1));
|
|
|
|
+ opening.setFailedApplicantRoleStakeUnstakingPeriod(new BN(1));
|
|
|
|
+ opening.setTerminateCuratorApplicationStakeUnstakingPeriod(new BN(1));
|
|
|
|
+ opening.setTerminateCuratorRoleStakeUnstakingPeriod(new BN(1));
|
|
|
|
+ opening.setExitCuratorRoleApplicationStakeUnstakingPeriod(new BN(1));
|
|
|
|
+ opening.setExitCuratorRoleStakeUnstakingPeriod(new BN(1));
|
|
|
|
+ opening.setText(uuid().substring(0, 8));
|
|
|
|
+ opening.setOpeningType('Worker');
|
|
|
|
+
|
|
// Fee estimation and transfer
|
|
// Fee estimation and transfer
|
|
- const addOpeningFee: BN = apiWrapper.estimateAddOpeningFee();
|
|
|
|
|
|
+ const addOpeningFee: BN = apiWrapper.estimateAddOpeningFee(opening, module);
|
|
await apiWrapper.transferBalance(sudo, lead.address, addOpeningFee);
|
|
await apiWrapper.transferBalance(sudo, lead.address, addOpeningFee);
|
|
|
|
|
|
// Worker opening creation
|
|
// Worker opening creation
|
|
- const maxActiveApplicants: BN = new BN(membersKeyPairs.length);
|
|
|
|
- const maxReviewPeriodLength: BN = new BN(32);
|
|
|
|
- const applicationStakingPolicyAmount: BN = new BN(applicationStake);
|
|
|
|
- const applicationCrowdedOutUnstakingPeriodLength: BN = new BN(0);
|
|
|
|
- const applicationExpiredUnstakingPeriodLength: BN = new BN(0);
|
|
|
|
- const roleStakingPolicyAmount: BN = new BN(roleStake);
|
|
|
|
- const roleCrowdedOutUnstakingPeriodLength: BN = new BN(0);
|
|
|
|
- const roleExpiredUnstakingPeriodLength: BN = new BN(0);
|
|
|
|
- const slashableMaxCount: BN = new BN(1);
|
|
|
|
- const slashableMaxPercentPtsPerTime: BN = new BN(100);
|
|
|
|
- const successfulApplicantApplicationStakeUnstakingPeriod: BN = new BN(1);
|
|
|
|
- const failedApplicantApplicationStakeUnstakingPeriod: BN = new BN(1);
|
|
|
|
- const failedApplicantRoleStakeUnstakingPeriod: BN = new BN(1);
|
|
|
|
- const terminateCuratorApplicationStakeUnstakingPeriod: BN = new BN(1);
|
|
|
|
- const terminateCuratorRoleStakeUnstakingPeriod: BN = new BN(1);
|
|
|
|
- const exitCuratorRoleApplicationStakeUnstakingPeriod: BN = new BN(1);
|
|
|
|
- const exitCuratorRoleStakeUnstakingPeriod: BN = new BN(1);
|
|
|
|
- const text: string = uuid().substring(0, 8);
|
|
|
|
- const openingType: string = 'Worker';
|
|
|
|
- const activateAtBlock: BN | undefined = activationDelay.eqn(0)
|
|
|
|
- ? undefined
|
|
|
|
- : (await apiWrapper.getBestBlock()).add(activationDelay);
|
|
|
|
const addOpeningPromise: Promise<BN> = apiWrapper.expectOpeningAdded();
|
|
const addOpeningPromise: Promise<BN> = apiWrapper.expectOpeningAdded();
|
|
- await apiWrapper.addOpening(
|
|
|
|
- activateAtBlock,
|
|
|
|
- lead,
|
|
|
|
- maxActiveApplicants,
|
|
|
|
- maxReviewPeriodLength,
|
|
|
|
- applicationStakingPolicyAmount,
|
|
|
|
- applicationCrowdedOutUnstakingPeriodLength,
|
|
|
|
- applicationExpiredUnstakingPeriodLength,
|
|
|
|
- roleStakingPolicyAmount,
|
|
|
|
- roleCrowdedOutUnstakingPeriodLength,
|
|
|
|
- roleExpiredUnstakingPeriodLength,
|
|
|
|
- slashableMaxCount,
|
|
|
|
- slashableMaxPercentPtsPerTime,
|
|
|
|
- successfulApplicantApplicationStakeUnstakingPeriod,
|
|
|
|
- failedApplicantApplicationStakeUnstakingPeriod,
|
|
|
|
- failedApplicantRoleStakeUnstakingPeriod,
|
|
|
|
- terminateCuratorApplicationStakeUnstakingPeriod,
|
|
|
|
- terminateCuratorRoleStakeUnstakingPeriod,
|
|
|
|
- exitCuratorRoleApplicationStakeUnstakingPeriod,
|
|
|
|
- exitCuratorRoleStakeUnstakingPeriod,
|
|
|
|
- text,
|
|
|
|
- openingType
|
|
|
|
- );
|
|
|
|
|
|
+ await apiWrapper.addOpening(lead, opening, module);
|
|
const openingId: BN = await addOpeningPromise;
|
|
const openingId: BN = await addOpeningPromise;
|
|
|
|
|
|
return openingId;
|
|
return openingId;
|
|
@@ -80,67 +64,55 @@ export async function addLeaderOpening(
|
|
sudo: KeyringPair,
|
|
sudo: KeyringPair,
|
|
applicationStake: BN,
|
|
applicationStake: BN,
|
|
roleStake: BN,
|
|
roleStake: BN,
|
|
- activationDelay: BN
|
|
|
|
|
|
+ activationDelay: BN,
|
|
|
|
+ module: WorkingGroups
|
|
): Promise<BN> {
|
|
): Promise<BN> {
|
|
// Leader opening creation
|
|
// Leader opening creation
|
|
- const maxActiveApplicants: BN = new BN(membersKeyPairs.length);
|
|
|
|
- const maxReviewPeriodLength: BN = new BN(32);
|
|
|
|
- const applicationStakingPolicyAmount: BN = new BN(applicationStake);
|
|
|
|
- const applicationCrowdedOutUnstakingPeriodLength: BN = new BN(0);
|
|
|
|
- const applicationExpiredUnstakingPeriodLength: BN = new BN(0);
|
|
|
|
- const roleStakingPolicyAmount: BN = new BN(roleStake);
|
|
|
|
- const roleCrowdedOutUnstakingPeriodLength: BN = new BN(0);
|
|
|
|
- const roleExpiredUnstakingPeriodLength: BN = new BN(0);
|
|
|
|
- const slashableMaxCount: BN = new BN(1);
|
|
|
|
- const slashableMaxPercentPtsPerTime: BN = new BN(100);
|
|
|
|
- const successfulApplicantApplicationStakeUnstakingPeriod: BN = new BN(1);
|
|
|
|
- const failedApplicantApplicationStakeUnstakingPeriod: BN = new BN(1);
|
|
|
|
- const failedApplicantRoleStakeUnstakingPeriod: BN = new BN(1);
|
|
|
|
- const terminateCuratorApplicationStakeUnstakingPeriod: BN = new BN(1);
|
|
|
|
- const terminateCuratorRoleStakeUnstakingPeriod: BN = new BN(1);
|
|
|
|
- const exitCuratorRoleApplicationStakeUnstakingPeriod: BN = new BN(1);
|
|
|
|
- const exitCuratorRoleStakeUnstakingPeriod: BN = new BN(1);
|
|
|
|
- const text: string = uuid().substring(0, 8);
|
|
|
|
- const openingType: string = 'leader';
|
|
|
|
const activateAtBlock: BN | undefined = activationDelay.eqn(0)
|
|
const activateAtBlock: BN | undefined = activationDelay.eqn(0)
|
|
? undefined
|
|
? undefined
|
|
: (await apiWrapper.getBestBlock()).add(activationDelay);
|
|
: (await apiWrapper.getBestBlock()).add(activationDelay);
|
|
|
|
+ let opening = new WorkingGroupOpening();
|
|
|
|
+ opening.setActivateAtBlock(activateAtBlock);
|
|
|
|
+ opening.setMaxActiveApplicants(new BN(membersKeyPairs.length));
|
|
|
|
+ opening.setMaxReviewPeriodLength(new BN(32));
|
|
|
|
+ opening.setApplicationStakingPolicyAmount(new BN(applicationStake));
|
|
|
|
+ opening.setApplicationCrowdedOutUnstakingPeriodLength(new BN(0));
|
|
|
|
+ opening.setApplicationExpiredUnstakingPeriodLength(new BN(0));
|
|
|
|
+ opening.setRoleStakingPolicyAmount(new BN(roleStake));
|
|
|
|
+ opening.setRoleCrowdedOutUnstakingPeriodLength(new BN(0));
|
|
|
|
+ opening.setRoleExpiredUnstakingPeriodLength(new BN(0));
|
|
|
|
+ opening.setSlashableMaxCount(new BN(1));
|
|
|
|
+ opening.setSlashableMaxPercentPtsPerTime(new BN(100));
|
|
|
|
+ opening.setSuccessfulApplicantApplicationStakeUnstakingPeriod(new BN(1));
|
|
|
|
+ opening.setFailedApplicantApplicationStakeUnstakingPeriod(new BN(1));
|
|
|
|
+ opening.setFailedApplicantRoleStakeUnstakingPeriod(new BN(1));
|
|
|
|
+ opening.setTerminateCuratorApplicationStakeUnstakingPeriod(new BN(1));
|
|
|
|
+ opening.setTerminateCuratorRoleStakeUnstakingPeriod(new BN(1));
|
|
|
|
+ opening.setExitCuratorRoleApplicationStakeUnstakingPeriod(new BN(1));
|
|
|
|
+ opening.setExitCuratorRoleStakeUnstakingPeriod(new BN(1));
|
|
|
|
+ opening.setText(uuid().substring(0, 8));
|
|
|
|
+ opening.setOpeningType('leader');
|
|
|
|
+
|
|
const addOpeningPromise: Promise<BN> = apiWrapper.expectOpeningAdded();
|
|
const addOpeningPromise: Promise<BN> = apiWrapper.expectOpeningAdded();
|
|
- await apiWrapper.sudoAddOpening(
|
|
|
|
- activateAtBlock,
|
|
|
|
- sudo,
|
|
|
|
- maxActiveApplicants,
|
|
|
|
- maxReviewPeriodLength,
|
|
|
|
- applicationStakingPolicyAmount,
|
|
|
|
- applicationCrowdedOutUnstakingPeriodLength,
|
|
|
|
- applicationExpiredUnstakingPeriodLength,
|
|
|
|
- roleStakingPolicyAmount,
|
|
|
|
- roleCrowdedOutUnstakingPeriodLength,
|
|
|
|
- roleExpiredUnstakingPeriodLength,
|
|
|
|
- slashableMaxCount,
|
|
|
|
- slashableMaxPercentPtsPerTime,
|
|
|
|
- successfulApplicantApplicationStakeUnstakingPeriod,
|
|
|
|
- failedApplicantApplicationStakeUnstakingPeriod,
|
|
|
|
- failedApplicantRoleStakeUnstakingPeriod,
|
|
|
|
- terminateCuratorApplicationStakeUnstakingPeriod,
|
|
|
|
- terminateCuratorRoleStakeUnstakingPeriod,
|
|
|
|
- exitCuratorRoleApplicationStakeUnstakingPeriod,
|
|
|
|
- exitCuratorRoleStakeUnstakingPeriod,
|
|
|
|
- text,
|
|
|
|
- openingType
|
|
|
|
- );
|
|
|
|
|
|
+ await apiWrapper.sudoAddOpening(sudo, opening, module);
|
|
const openingId: BN = await addOpeningPromise;
|
|
const openingId: BN = await addOpeningPromise;
|
|
|
|
|
|
return openingId;
|
|
return openingId;
|
|
}
|
|
}
|
|
|
|
|
|
-export async function acceptApplications(apiWrapper: ApiWrapper, lead: KeyringPair, sudo: KeyringPair, openingId: BN) {
|
|
|
|
|
|
+export async function acceptApplications(
|
|
|
|
+ apiWrapper: ApiWrapper,
|
|
|
|
+ lead: KeyringPair,
|
|
|
|
+ sudo: KeyringPair,
|
|
|
|
+ openingId: BN,
|
|
|
|
+ module: WorkingGroups
|
|
|
|
+) {
|
|
// Fee estimation and transfer
|
|
// Fee estimation and transfer
|
|
- const acceptApplicationsFee = apiWrapper.estimateAcceptApplicationsFee();
|
|
|
|
|
|
+ const acceptApplicationsFee = apiWrapper.estimateAcceptApplicationsFee(module);
|
|
await apiWrapper.transferBalance(sudo, lead.address, acceptApplicationsFee);
|
|
await apiWrapper.transferBalance(sudo, lead.address, acceptApplicationsFee);
|
|
|
|
|
|
// Begin accepting applications
|
|
// Begin accepting applications
|
|
- await apiWrapper.acceptApplications(lead, openingId);
|
|
|
|
|
|
+ await apiWrapper.acceptApplications(lead, openingId, module);
|
|
|
|
|
|
const opening: HiringOpening = await apiWrapper.getHiringOpening(openingId);
|
|
const opening: HiringOpening = await apiWrapper.getHiringOpening(openingId);
|
|
assert(opening.is_active, `Opening ${openingId} is not active`);
|
|
assert(opening.is_active, `Opening ${openingId} is not active`);
|
|
@@ -153,10 +125,11 @@ export async function applyForOpening(
|
|
applicationStake: BN,
|
|
applicationStake: BN,
|
|
roleStake: BN,
|
|
roleStake: BN,
|
|
openingId: BN,
|
|
openingId: BN,
|
|
|
|
+ module: WorkingGroups,
|
|
expectFailure: boolean
|
|
expectFailure: boolean
|
|
): Promise<void> {
|
|
): Promise<void> {
|
|
// Fee estimation and transfer
|
|
// Fee estimation and transfer
|
|
- const applyOnOpeningFee: BN = apiWrapper.estimateApplyOnOpeningFee(sudo).add(applicationStake).add(roleStake);
|
|
|
|
|
|
+ const applyOnOpeningFee: BN = apiWrapper.estimateApplyOnOpeningFee(sudo, module).add(applicationStake).add(roleStake);
|
|
await apiWrapper.transferBalanceToAccounts(sudo, membersKeyPairs, applyOnOpeningFee);
|
|
await apiWrapper.transferBalanceToAccounts(sudo, membersKeyPairs, applyOnOpeningFee);
|
|
|
|
|
|
// Applying for created worker opening
|
|
// Applying for created worker opening
|
|
@@ -166,21 +139,27 @@ export async function applyForOpening(
|
|
roleStake,
|
|
roleStake,
|
|
applicationStake,
|
|
applicationStake,
|
|
uuid().substring(0, 8),
|
|
uuid().substring(0, 8),
|
|
|
|
+ module,
|
|
expectFailure
|
|
expectFailure
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
-export async function withdrawApplicaiton(apiWrapper: ApiWrapper, membersKeyPairs: KeyringPair[], sudo: KeyringPair) {
|
|
|
|
|
|
+export async function withdrawApplicaiton(
|
|
|
|
+ apiWrapper: ApiWrapper,
|
|
|
|
+ membersKeyPairs: KeyringPair[],
|
|
|
|
+ sudo: KeyringPair,
|
|
|
|
+ module: WorkingGroups
|
|
|
|
+) {
|
|
// Fee estimation and transfer
|
|
// Fee estimation and transfer
|
|
- const withdrawApplicaitonFee: BN = apiWrapper.estimateWithdrawApplicationFee();
|
|
|
|
|
|
+ const withdrawApplicaitonFee: BN = apiWrapper.estimateWithdrawApplicationFee(module);
|
|
await apiWrapper.transferBalanceToAccounts(sudo, membersKeyPairs, withdrawApplicaitonFee);
|
|
await apiWrapper.transferBalanceToAccounts(sudo, membersKeyPairs, withdrawApplicaitonFee);
|
|
|
|
|
|
// Application withdrawal
|
|
// Application withdrawal
|
|
- await apiWrapper.batchWithdrawApplication(membersKeyPairs);
|
|
|
|
|
|
+ await apiWrapper.batchWithdrawApplication(membersKeyPairs, module);
|
|
|
|
|
|
// Assertions
|
|
// Assertions
|
|
membersKeyPairs.forEach(async keyPair => {
|
|
membersKeyPairs.forEach(async keyPair => {
|
|
- const activeApplications: BN[] = await apiWrapper.getActiveApplicationsIdsByRoleAccount(keyPair.address);
|
|
|
|
|
|
+ const activeApplications: BN[] = await apiWrapper.getActiveApplicationsIdsByRoleAccount(keyPair.address, module);
|
|
assert(activeApplications.length === 0, `Unexpected active application found for ${keyPair.address}`);
|
|
assert(activeApplications.length === 0, `Unexpected active application found for ${keyPair.address}`);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -189,21 +168,27 @@ export async function beginApplicationReview(
|
|
apiWrapper: ApiWrapper,
|
|
apiWrapper: ApiWrapper,
|
|
lead: KeyringPair,
|
|
lead: KeyringPair,
|
|
sudo: KeyringPair,
|
|
sudo: KeyringPair,
|
|
- openingId: BN
|
|
|
|
|
|
+ openingId: BN,
|
|
|
|
+ module: WorkingGroups
|
|
) {
|
|
) {
|
|
// Fee estimation and transfer
|
|
// Fee estimation and transfer
|
|
- const beginReviewFee: BN = apiWrapper.estimateBeginApplicantReviewFee();
|
|
|
|
|
|
+ const beginReviewFee: BN = apiWrapper.estimateBeginApplicantReviewFee(module);
|
|
await apiWrapper.transferBalance(sudo, lead.address, beginReviewFee);
|
|
await apiWrapper.transferBalance(sudo, lead.address, beginReviewFee);
|
|
|
|
|
|
// Begin application review
|
|
// Begin application review
|
|
const beginApplicantReviewPromise: Promise<void> = apiWrapper.expectApplicationReviewBegan();
|
|
const beginApplicantReviewPromise: Promise<void> = apiWrapper.expectApplicationReviewBegan();
|
|
- await apiWrapper.beginApplicantReview(lead, openingId);
|
|
|
|
|
|
+ await apiWrapper.beginApplicantReview(lead, openingId, module);
|
|
await beginApplicantReviewPromise;
|
|
await beginApplicantReviewPromise;
|
|
}
|
|
}
|
|
|
|
|
|
-export async function beginLeaderApplicationReview(apiWrapper: ApiWrapper, sudo: KeyringPair, openingId: BN) {
|
|
|
|
|
|
+export async function beginLeaderApplicationReview(
|
|
|
|
+ apiWrapper: ApiWrapper,
|
|
|
|
+ sudo: KeyringPair,
|
|
|
|
+ openingId: BN,
|
|
|
|
+ module: WorkingGroups
|
|
|
|
+) {
|
|
// Begin application review
|
|
// Begin application review
|
|
- await apiWrapper.sudoBeginApplicantReview(sudo, openingId);
|
|
|
|
|
|
+ await apiWrapper.sudoBeginApplicantReview(sudo, openingId, module);
|
|
}
|
|
}
|
|
|
|
|
|
export async function fillOpening(
|
|
export async function fillOpening(
|
|
@@ -214,14 +199,15 @@ export async function fillOpening(
|
|
openingId: BN,
|
|
openingId: BN,
|
|
firstPayoutInterval: BN,
|
|
firstPayoutInterval: BN,
|
|
payoutInterval: BN,
|
|
payoutInterval: BN,
|
|
- amountPerPayout: BN
|
|
|
|
|
|
+ amountPerPayout: BN,
|
|
|
|
+ module: WorkingGroups
|
|
) {
|
|
) {
|
|
// Fee estimation and transfer
|
|
// Fee estimation and transfer
|
|
- const beginReviewFee: BN = apiWrapper.estimateBeginApplicantReviewFee();
|
|
|
|
|
|
+ const beginReviewFee: BN = apiWrapper.estimateBeginApplicantReviewFee(module);
|
|
await apiWrapper.transferBalance(sudo, lead.address, beginReviewFee);
|
|
await apiWrapper.transferBalance(sudo, lead.address, beginReviewFee);
|
|
const applicationIds: BN[] = (
|
|
const applicationIds: BN[] = (
|
|
await Promise.all(
|
|
await Promise.all(
|
|
- membersKeyPairs.map(async keypair => apiWrapper.getActiveApplicationsIdsByRoleAccount(keypair.address))
|
|
|
|
|
|
+ membersKeyPairs.map(async keypair => apiWrapper.getActiveApplicationsIdsByRoleAccount(keypair.address, module))
|
|
)
|
|
)
|
|
).flat();
|
|
).flat();
|
|
|
|
|
|
@@ -234,12 +220,13 @@ export async function fillOpening(
|
|
applicationIds,
|
|
applicationIds,
|
|
amountPerPayout,
|
|
amountPerPayout,
|
|
now.add(firstPayoutInterval),
|
|
now.add(firstPayoutInterval),
|
|
- payoutInterval
|
|
|
|
|
|
+ payoutInterval,
|
|
|
|
+ module
|
|
);
|
|
);
|
|
const applicationIdToWorkerIdMap: ApplicationIdToWorkerIdMap = await fillOpeningPromise;
|
|
const applicationIdToWorkerIdMap: ApplicationIdToWorkerIdMap = await fillOpeningPromise;
|
|
applicationIdToWorkerIdMap.forEach(async (workerId, applicationId) => {
|
|
applicationIdToWorkerIdMap.forEach(async (workerId, applicationId) => {
|
|
- const worker: Worker = await apiWrapper.getWorkerById(workerId);
|
|
|
|
- const application: Application = await apiWrapper.getApplicationById(applicationId);
|
|
|
|
|
|
+ const worker: Worker = await apiWrapper.getWorkerById(workerId, module);
|
|
|
|
+ const application: Application = await apiWrapper.getApplicationById(applicationId, module);
|
|
assert(
|
|
assert(
|
|
worker.role_account_id.toString() === application.role_account_id.toString(),
|
|
worker.role_account_id.toString() === application.role_account_id.toString(),
|
|
`Role account ids does not match, worker account: ${worker.role_account_id}, application account ${application.role_account_id}`
|
|
`Role account ids does not match, worker account: ${worker.role_account_id}, application account ${application.role_account_id}`
|
|
@@ -247,7 +234,7 @@ export async function fillOpening(
|
|
});
|
|
});
|
|
|
|
|
|
// Assertions
|
|
// Assertions
|
|
- const openingWorkersAccounts: string[] = (await apiWrapper.getWorkers()).map(worker =>
|
|
|
|
|
|
+ const openingWorkersAccounts: string[] = (await apiWrapper.getWorkers(module)).map(worker =>
|
|
worker.role_account_id.toString()
|
|
worker.role_account_id.toString()
|
|
);
|
|
);
|
|
membersKeyPairs.forEach(keyPair =>
|
|
membersKeyPairs.forEach(keyPair =>
|
|
@@ -262,11 +249,12 @@ export async function fillLeaderOpening(
|
|
openingId: BN,
|
|
openingId: BN,
|
|
firstPayoutInterval: BN,
|
|
firstPayoutInterval: BN,
|
|
payoutInterval: BN,
|
|
payoutInterval: BN,
|
|
- amountPerPayout: BN
|
|
|
|
|
|
+ amountPerPayout: BN,
|
|
|
|
+ module: WorkingGroups
|
|
) {
|
|
) {
|
|
const applicationIds: BN[] = (
|
|
const applicationIds: BN[] = (
|
|
await Promise.all(
|
|
await Promise.all(
|
|
- membersKeyPairs.map(async keypair => apiWrapper.getActiveApplicationsIdsByRoleAccount(keypair.address))
|
|
|
|
|
|
+ membersKeyPairs.map(async keypair => apiWrapper.getActiveApplicationsIdsByRoleAccount(keypair.address, module))
|
|
)
|
|
)
|
|
).flat();
|
|
).flat();
|
|
|
|
|
|
@@ -279,12 +267,13 @@ export async function fillLeaderOpening(
|
|
applicationIds,
|
|
applicationIds,
|
|
amountPerPayout,
|
|
amountPerPayout,
|
|
now.add(firstPayoutInterval),
|
|
now.add(firstPayoutInterval),
|
|
- payoutInterval
|
|
|
|
|
|
+ payoutInterval,
|
|
|
|
+ module
|
|
);
|
|
);
|
|
const applicationIdToWorkerIdMap: ApplicationIdToWorkerIdMap = await fillOpeningPromise;
|
|
const applicationIdToWorkerIdMap: ApplicationIdToWorkerIdMap = await fillOpeningPromise;
|
|
applicationIdToWorkerIdMap.forEach(async (workerId, applicationId) => {
|
|
applicationIdToWorkerIdMap.forEach(async (workerId, applicationId) => {
|
|
- const worker: Worker = await apiWrapper.getWorkerById(workerId);
|
|
|
|
- const application: Application = await apiWrapper.getApplicationById(applicationId);
|
|
|
|
|
|
+ const worker: Worker = await apiWrapper.getWorkerById(workerId, module);
|
|
|
|
+ const application: Application = await apiWrapper.getApplicationById(applicationId, module);
|
|
assert(
|
|
assert(
|
|
worker.role_account_id.toString() === application.role_account_id.toString(),
|
|
worker.role_account_id.toString() === application.role_account_id.toString(),
|
|
`Role account ids does not match, worker account: ${worker.role_account_id}, application account ${application.role_account_id}`
|
|
`Role account ids does not match, worker account: ${worker.role_account_id}, application account ${application.role_account_id}`
|
|
@@ -292,7 +281,7 @@ export async function fillLeaderOpening(
|
|
});
|
|
});
|
|
|
|
|
|
// Assertions
|
|
// Assertions
|
|
- const openingWorkersAccounts: string[] = (await apiWrapper.getWorkers()).map(worker =>
|
|
|
|
|
|
+ const openingWorkersAccounts: string[] = (await apiWrapper.getWorkers(module)).map(worker =>
|
|
worker.role_account_id.toString()
|
|
worker.role_account_id.toString()
|
|
);
|
|
);
|
|
membersKeyPairs.forEach(keyPair =>
|
|
membersKeyPairs.forEach(keyPair =>
|
|
@@ -300,17 +289,22 @@ export async function fillLeaderOpening(
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
-export async function increaseStake(apiWrapper: ApiWrapper, membersKeyPairs: KeyringPair[], sudo: KeyringPair) {
|
|
|
|
|
|
+export async function increaseStake(
|
|
|
|
+ apiWrapper: ApiWrapper,
|
|
|
|
+ membersKeyPairs: KeyringPair[],
|
|
|
|
+ sudo: KeyringPair,
|
|
|
|
+ module: WorkingGroups
|
|
|
|
+) {
|
|
// Fee estimation and transfer
|
|
// Fee estimation and transfer
|
|
- const increaseStakeFee: BN = apiWrapper.estimateIncreaseStakeFee();
|
|
|
|
|
|
+ const increaseStakeFee: BN = apiWrapper.estimateIncreaseStakeFee(module);
|
|
const stakeIncrement: BN = new BN(1);
|
|
const stakeIncrement: BN = new BN(1);
|
|
await apiWrapper.transferBalance(sudo, membersKeyPairs[0].address, increaseStakeFee.add(stakeIncrement));
|
|
await apiWrapper.transferBalance(sudo, membersKeyPairs[0].address, increaseStakeFee.add(stakeIncrement));
|
|
- const workerId: BN = await apiWrapper.getWorkerIdByRoleAccount(membersKeyPairs[0].address);
|
|
|
|
|
|
+ const workerId: BN = await apiWrapper.getWorkerIdByRoleAccount(membersKeyPairs[0].address, module);
|
|
|
|
|
|
// Increase worker stake
|
|
// Increase worker stake
|
|
- const increasedWorkerStake: BN = (await apiWrapper.getWorkerStakeAmount(workerId)).add(stakeIncrement);
|
|
|
|
- await apiWrapper.increaseStake(membersKeyPairs[0], workerId, stakeIncrement);
|
|
|
|
- const newWorkerStake: BN = await apiWrapper.getWorkerStakeAmount(workerId);
|
|
|
|
|
|
+ const increasedWorkerStake: BN = (await apiWrapper.getWorkerStakeAmount(workerId, module)).add(stakeIncrement);
|
|
|
|
+ await apiWrapper.increaseStake(membersKeyPairs[0], workerId, stakeIncrement, module);
|
|
|
|
+ const newWorkerStake: BN = await apiWrapper.getWorkerStakeAmount(workerId, module);
|
|
assert(
|
|
assert(
|
|
increasedWorkerStake.eq(newWorkerStake),
|
|
increasedWorkerStake.eq(newWorkerStake),
|
|
`Unexpected worker stake ${newWorkerStake}, expected ${increasedWorkerStake}`
|
|
`Unexpected worker stake ${newWorkerStake}, expected ${increasedWorkerStake}`
|
|
@@ -321,17 +315,18 @@ export async function updateRewardAccount(
|
|
apiWrapper: ApiWrapper,
|
|
apiWrapper: ApiWrapper,
|
|
membersKeyPairs: KeyringPair[],
|
|
membersKeyPairs: KeyringPair[],
|
|
keyring: Keyring,
|
|
keyring: Keyring,
|
|
- sudo: KeyringPair
|
|
|
|
|
|
+ sudo: KeyringPair,
|
|
|
|
+ module: WorkingGroups
|
|
) {
|
|
) {
|
|
// Fee estimation and transfer
|
|
// Fee estimation and transfer
|
|
- const updateRewardAccountFee: BN = apiWrapper.estimateUpdateRewardAccountFee(sudo.address);
|
|
|
|
|
|
+ const updateRewardAccountFee: BN = apiWrapper.estimateUpdateRewardAccountFee(sudo.address, module);
|
|
await apiWrapper.transferBalance(sudo, membersKeyPairs[0].address, updateRewardAccountFee);
|
|
await apiWrapper.transferBalance(sudo, membersKeyPairs[0].address, updateRewardAccountFee);
|
|
- const workerId: BN = await apiWrapper.getWorkerIdByRoleAccount(membersKeyPairs[0].address);
|
|
|
|
|
|
+ const workerId: BN = await apiWrapper.getWorkerIdByRoleAccount(membersKeyPairs[0].address, module);
|
|
|
|
|
|
// Update reward account
|
|
// Update reward account
|
|
const createdAccount: KeyringPair = keyring.addFromUri(uuid().substring(0, 8));
|
|
const createdAccount: KeyringPair = keyring.addFromUri(uuid().substring(0, 8));
|
|
- await apiWrapper.updateRewardAccount(membersKeyPairs[0], workerId, createdAccount.address);
|
|
|
|
- const newRewardAccount: string = await apiWrapper.getWorkerRewardAccount(workerId);
|
|
|
|
|
|
+ await apiWrapper.updateRewardAccount(membersKeyPairs[0], workerId, createdAccount.address, module);
|
|
|
|
+ const newRewardAccount: string = await apiWrapper.getWorkerRewardAccount(workerId, module);
|
|
assert(
|
|
assert(
|
|
newRewardAccount === createdAccount.address,
|
|
newRewardAccount === createdAccount.address,
|
|
`Unexpected role account ${newRewardAccount}, expected ${createdAccount.address}`
|
|
`Unexpected role account ${newRewardAccount}, expected ${createdAccount.address}`
|
|
@@ -342,17 +337,18 @@ export async function updateRoleAccount(
|
|
apiWrapper: ApiWrapper,
|
|
apiWrapper: ApiWrapper,
|
|
membersKeyPairs: KeyringPair[],
|
|
membersKeyPairs: KeyringPair[],
|
|
keyring: Keyring,
|
|
keyring: Keyring,
|
|
- sudo: KeyringPair
|
|
|
|
|
|
+ sudo: KeyringPair,
|
|
|
|
+ module: WorkingGroups
|
|
) {
|
|
) {
|
|
// Fee estimation and transfer
|
|
// Fee estimation and transfer
|
|
- const updateRoleAccountFee: BN = apiWrapper.estimateUpdateRoleAccountFee(sudo.address);
|
|
|
|
|
|
+ const updateRoleAccountFee: BN = apiWrapper.estimateUpdateRoleAccountFee(sudo.address, module);
|
|
await apiWrapper.transferBalance(sudo, membersKeyPairs[0].address, updateRoleAccountFee);
|
|
await apiWrapper.transferBalance(sudo, membersKeyPairs[0].address, updateRoleAccountFee);
|
|
- const workerId: BN = await apiWrapper.getWorkerIdByRoleAccount(membersKeyPairs[0].address);
|
|
|
|
|
|
+ const workerId: BN = await apiWrapper.getWorkerIdByRoleAccount(membersKeyPairs[0].address, module);
|
|
|
|
|
|
// Update role account
|
|
// Update role account
|
|
const createdAccount: KeyringPair = keyring.addFromUri(uuid().substring(0, 8));
|
|
const createdAccount: KeyringPair = keyring.addFromUri(uuid().substring(0, 8));
|
|
- await apiWrapper.updateRoleAccount(membersKeyPairs[0], workerId, createdAccount.address);
|
|
|
|
- const newRoleAccount: string = (await apiWrapper.getWorkerById(workerId)).role_account_id.toString();
|
|
|
|
|
|
+ await apiWrapper.updateRoleAccount(membersKeyPairs[0], workerId, createdAccount.address, module);
|
|
|
|
+ const newRoleAccount: string = (await apiWrapper.getWorkerById(workerId, module)).role_account_id.toString();
|
|
assert(
|
|
assert(
|
|
newRoleAccount === createdAccount.address,
|
|
newRoleAccount === createdAccount.address,
|
|
`Unexpected role account ${newRoleAccount}, expected ${createdAccount.address}`
|
|
`Unexpected role account ${newRoleAccount}, expected ${createdAccount.address}`
|
|
@@ -365,16 +361,17 @@ export async function terminateApplications(
|
|
apiWrapper: ApiWrapper,
|
|
apiWrapper: ApiWrapper,
|
|
membersKeyPairs: KeyringPair[],
|
|
membersKeyPairs: KeyringPair[],
|
|
lead: KeyringPair,
|
|
lead: KeyringPair,
|
|
- sudo: KeyringPair
|
|
|
|
|
|
+ sudo: KeyringPair,
|
|
|
|
+ module: WorkingGroups
|
|
) {
|
|
) {
|
|
// Fee estimation and transfer
|
|
// Fee estimation and transfer
|
|
- const terminateApplicationFee = apiWrapper.estimateTerminateApplicationFee();
|
|
|
|
|
|
+ const terminateApplicationFee = apiWrapper.estimateTerminateApplicationFee(module);
|
|
await apiWrapper.transferBalance(sudo, lead.address, terminateApplicationFee.muln(membersKeyPairs.length));
|
|
await apiWrapper.transferBalance(sudo, lead.address, terminateApplicationFee.muln(membersKeyPairs.length));
|
|
|
|
|
|
// Terminate worker applications
|
|
// Terminate worker applications
|
|
- await apiWrapper.batchTerminateApplication(lead, membersKeyPairs);
|
|
|
|
|
|
+ await apiWrapper.batchTerminateApplication(lead, membersKeyPairs, module);
|
|
membersKeyPairs.forEach(async keyPair => {
|
|
membersKeyPairs.forEach(async keyPair => {
|
|
- const activeApplications = await apiWrapper.getActiveApplicationsIdsByRoleAccount(keyPair.address);
|
|
|
|
|
|
+ const activeApplications = await apiWrapper.getActiveApplicationsIdsByRoleAccount(keyPair.address, module);
|
|
assert(activeApplications.length === 0, `Account ${keyPair.address} has unexpected active applications`);
|
|
assert(activeApplications.length === 0, `Account ${keyPair.address} has unexpected active applications`);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -384,18 +381,19 @@ export async function decreaseStake(
|
|
membersKeyPairs: KeyringPair[],
|
|
membersKeyPairs: KeyringPair[],
|
|
lead: KeyringPair,
|
|
lead: KeyringPair,
|
|
sudo: KeyringPair,
|
|
sudo: KeyringPair,
|
|
|
|
+ module: WorkingGroups,
|
|
expectFailure: boolean
|
|
expectFailure: boolean
|
|
) {
|
|
) {
|
|
// Fee estimation and transfer
|
|
// Fee estimation and transfer
|
|
- const decreaseStakeFee = apiWrapper.estimateDecreaseStakeFee();
|
|
|
|
|
|
+ const decreaseStakeFee = apiWrapper.estimateDecreaseStakeFee(module);
|
|
await apiWrapper.transferBalance(sudo, lead.address, decreaseStakeFee);
|
|
await apiWrapper.transferBalance(sudo, lead.address, decreaseStakeFee);
|
|
const workerStakeDecrement = new BN(1);
|
|
const workerStakeDecrement = new BN(1);
|
|
- const workerId: BN = await apiWrapper.getWorkerIdByRoleAccount(membersKeyPairs[0].address);
|
|
|
|
|
|
+ const workerId: BN = await apiWrapper.getWorkerIdByRoleAccount(membersKeyPairs[0].address, module);
|
|
|
|
|
|
// Worker stake decrement
|
|
// Worker stake decrement
|
|
- const decreasedWorkerStake: BN = (await apiWrapper.getWorkerStakeAmount(workerId)).sub(workerStakeDecrement);
|
|
|
|
- await apiWrapper.decreaseStake(lead, workerId, workerStakeDecrement, expectFailure);
|
|
|
|
- const newWorkerStake: BN = await apiWrapper.getWorkerStakeAmount(workerId);
|
|
|
|
|
|
+ const decreasedWorkerStake: BN = (await apiWrapper.getWorkerStakeAmount(workerId, module)).sub(workerStakeDecrement);
|
|
|
|
+ await apiWrapper.decreaseStake(lead, workerId, workerStakeDecrement, module, expectFailure);
|
|
|
|
+ const newWorkerStake: BN = await apiWrapper.getWorkerStakeAmount(workerId, module);
|
|
|
|
|
|
// Assertions
|
|
// Assertions
|
|
if (!expectFailure) {
|
|
if (!expectFailure) {
|
|
@@ -411,18 +409,19 @@ export async function slash(
|
|
membersKeyPairs: KeyringPair[],
|
|
membersKeyPairs: KeyringPair[],
|
|
lead: KeyringPair,
|
|
lead: KeyringPair,
|
|
sudo: KeyringPair,
|
|
sudo: KeyringPair,
|
|
|
|
+ module: WorkingGroups,
|
|
expectFailure: boolean
|
|
expectFailure: boolean
|
|
) {
|
|
) {
|
|
// Fee estimation and transfer
|
|
// Fee estimation and transfer
|
|
- const slashStakeFee = apiWrapper.estimateSlashStakeFee();
|
|
|
|
|
|
+ const slashStakeFee = apiWrapper.estimateSlashStakeFee(module);
|
|
await apiWrapper.transferBalance(sudo, lead.address, slashStakeFee);
|
|
await apiWrapper.transferBalance(sudo, lead.address, slashStakeFee);
|
|
const slashAmount = new BN(1);
|
|
const slashAmount = new BN(1);
|
|
- const workerId: BN = await apiWrapper.getWorkerIdByRoleAccount(membersKeyPairs[0].address);
|
|
|
|
|
|
+ const workerId: BN = await apiWrapper.getWorkerIdByRoleAccount(membersKeyPairs[0].address, module);
|
|
|
|
|
|
// Slash worker
|
|
// Slash worker
|
|
- const slashedStake: BN = (await apiWrapper.getWorkerStakeAmount(workerId)).sub(slashAmount);
|
|
|
|
- await apiWrapper.slashStake(lead, workerId, slashAmount, expectFailure);
|
|
|
|
- const newStake: BN = await apiWrapper.getWorkerStakeAmount(workerId);
|
|
|
|
|
|
+ const slashedStake: BN = (await apiWrapper.getWorkerStakeAmount(workerId, module)).sub(slashAmount);
|
|
|
|
+ await apiWrapper.slashStake(lead, workerId, slashAmount, module, expectFailure);
|
|
|
|
+ const newStake: BN = await apiWrapper.getWorkerStakeAmount(workerId, module);
|
|
|
|
|
|
// Assertions
|
|
// Assertions
|
|
assert(slashedStake.eq(newStake), `Unexpected worker stake ${newStake}, expected ${slashedStake}`);
|
|
assert(slashedStake.eq(newStake), `Unexpected worker stake ${newStake}, expected ${slashedStake}`);
|
|
@@ -433,40 +432,46 @@ export async function terminateRole(
|
|
membersKeyPairs: KeyringPair[],
|
|
membersKeyPairs: KeyringPair[],
|
|
lead: KeyringPair,
|
|
lead: KeyringPair,
|
|
sudo: KeyringPair,
|
|
sudo: KeyringPair,
|
|
|
|
+ module: WorkingGroups,
|
|
expectFailure: boolean
|
|
expectFailure: boolean
|
|
) {
|
|
) {
|
|
// Fee estimation and transfer
|
|
// Fee estimation and transfer
|
|
- const terminateRoleFee = apiWrapper.estimateTerminateRoleFee();
|
|
|
|
|
|
+ const terminateRoleFee = apiWrapper.estimateTerminateRoleFee(module);
|
|
await apiWrapper.transferBalance(sudo, lead.address, terminateRoleFee);
|
|
await apiWrapper.transferBalance(sudo, lead.address, terminateRoleFee);
|
|
- const workerId: BN = await apiWrapper.getWorkerIdByRoleAccount(membersKeyPairs[0].address);
|
|
|
|
|
|
+ const workerId: BN = await apiWrapper.getWorkerIdByRoleAccount(membersKeyPairs[0].address, module);
|
|
|
|
|
|
// Slash worker
|
|
// Slash worker
|
|
- await apiWrapper.terminateRole(lead, workerId, uuid().substring(0, 8), expectFailure);
|
|
|
|
|
|
+ await apiWrapper.terminateRole(lead, workerId, uuid().substring(0, 8), module, expectFailure);
|
|
|
|
|
|
// Assertions
|
|
// Assertions
|
|
- apiWrapper.getWorkerIdByRoleAccount(membersKeyPairs[0].address);
|
|
|
|
- const newWorkerId = await apiWrapper.getWorkerIdByRoleAccount(membersKeyPairs[0].address);
|
|
|
|
|
|
+ apiWrapper.getWorkerIdByRoleAccount(membersKeyPairs[0].address, module);
|
|
|
|
+ const newWorkerId = await apiWrapper.getWorkerIdByRoleAccount(membersKeyPairs[0].address, module);
|
|
assert(newWorkerId === undefined, `Worker with account ${membersKeyPairs[0].address} is not terminated`);
|
|
assert(newWorkerId === undefined, `Worker with account ${membersKeyPairs[0].address} is not terminated`);
|
|
}
|
|
}
|
|
|
|
|
|
-export async function leaveRole(apiWrapper: ApiWrapper, membersKeyPairs: KeyringPair[], sudo: KeyringPair) {
|
|
|
|
|
|
+export async function leaveRole(
|
|
|
|
+ apiWrapper: ApiWrapper,
|
|
|
|
+ membersKeyPairs: KeyringPair[],
|
|
|
|
+ sudo: KeyringPair,
|
|
|
|
+ module: WorkingGroups
|
|
|
|
+) {
|
|
// Fee estimation and transfer
|
|
// Fee estimation and transfer
|
|
- const leaveRoleFee = apiWrapper.estimateLeaveRoleFee();
|
|
|
|
|
|
+ const leaveRoleFee = apiWrapper.estimateLeaveRoleFee(module);
|
|
await apiWrapper.transferBalanceToAccounts(sudo, membersKeyPairs, leaveRoleFee);
|
|
await apiWrapper.transferBalanceToAccounts(sudo, membersKeyPairs, leaveRoleFee);
|
|
|
|
|
|
- await apiWrapper.batchLeaveRole(membersKeyPairs, uuid().substring(0, 8), false);
|
|
|
|
|
|
+ await apiWrapper.batchLeaveRole(membersKeyPairs, uuid().substring(0, 8), false, module);
|
|
|
|
|
|
// Assertions
|
|
// Assertions
|
|
membersKeyPairs.forEach(async keyPair => {
|
|
membersKeyPairs.forEach(async keyPair => {
|
|
- apiWrapper.getWorkerIdByRoleAccount(keyPair.address);
|
|
|
|
- const newWorkerId = await apiWrapper.getWorkerIdByRoleAccount(keyPair.address);
|
|
|
|
|
|
+ apiWrapper.getWorkerIdByRoleAccount(keyPair.address, module);
|
|
|
|
+ const newWorkerId = await apiWrapper.getWorkerIdByRoleAccount(keyPair.address, module);
|
|
assert(newWorkerId === undefined, `Worker with account ${keyPair.address} is not terminated`);
|
|
assert(newWorkerId === undefined, `Worker with account ${keyPair.address} is not terminated`);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
-export async function awaitPayout(apiWrapper: ApiWrapper, membersKeyPairs: KeyringPair[]) {
|
|
|
|
- const workerId: BN = await apiWrapper.getWorkerIdByRoleAccount(membersKeyPairs[0].address);
|
|
|
|
- const worker: Worker = await apiWrapper.getWorkerById(workerId);
|
|
|
|
|
|
+export async function awaitPayout(apiWrapper: ApiWrapper, membersKeyPairs: KeyringPair[], module: WorkingGroups) {
|
|
|
|
+ const workerId: BN = await apiWrapper.getWorkerIdByRoleAccount(membersKeyPairs[0].address, module);
|
|
|
|
+ const worker: Worker = await apiWrapper.getWorkerById(workerId, module);
|
|
const reward: RewardRelationship = await apiWrapper.getRewardRelationship(worker.reward_relationship.unwrap());
|
|
const reward: RewardRelationship = await apiWrapper.getRewardRelationship(worker.reward_relationship.unwrap());
|
|
const now: BN = await apiWrapper.getBestBlock();
|
|
const now: BN = await apiWrapper.getBestBlock();
|
|
const nextPaymentBlock: BN = new BN(reward.getField('next_payment_at_block').toString());
|
|
const nextPaymentBlock: BN = new BN(reward.getField('next_payment_at_block').toString());
|
|
@@ -497,6 +502,6 @@ export async function awaitPayout(apiWrapper: ApiWrapper, membersKeyPairs: Keyri
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
-export async function setMintCapacity(apiWrapper: ApiWrapper, sudo: KeyringPair, capacity: BN) {
|
|
|
|
- await apiWrapper.sudoSetWorkingGroupMintCapacity(sudo, capacity);
|
|
|
|
|
|
+export async function setMintCapacity(apiWrapper: ApiWrapper, sudo: KeyringPair, capacity: BN, module: WorkingGroups) {
|
|
|
|
+ await apiWrapper.sudoSetWorkingGroupMintCapacity(sudo, capacity, module);
|
|
}
|
|
}
|