Skip to content
Closed
2 changes: 1 addition & 1 deletion tests/network-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"test": "tap --files src/nicaea/tests/proposals/*Test.ts --files src/nicaea/tests/workingGroup/*Test.ts -T",
"test-migration-constantinople": "tap --files src/rome/tests/romeRuntimeUpgradeTest.ts --files src/constantinople/tests/electingCouncilTest.ts -T",
"test-migration-nicaea": "tap --files src/constantinople/tests/proposals/updateRuntimeTest.ts --files src/nicaea/tests/electingCouncilTest.ts -T",
"debug": "tap --files src/nicaea/tests/workingGroup/*Test.ts -T",
"debug": "tap --files src/iznik/tests/workingGroup/*Test.ts -T",
"lint": "eslint . --quiet --ext .ts",
"checks": "yarn lint && tsc --noEmit --pretty && prettier ./ --check",
"format": "prettier ./ --write "
Expand Down
85 changes: 85 additions & 0 deletions tests/network-tests/src/iznik/dto/fillOpeningParameters.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import BN from 'bn.js'

export class FillOpeningParameters {
private amountPerPayout!: BN
private nextPaymentAtBlock!: BN
private payoutInterval!: BN
private openingId!: BN
private successfulApplicationId!: BN
private workingGroup!: string

public getAmountPerPayout(): BN {
return this.amountPerPayout
}

public getNextPaymentAtBlock(): BN {
return this.nextPaymentAtBlock
}

public getPayoutInterval(): BN {
return this.payoutInterval
}

public getOpeningId(): BN {
return this.openingId
}

public getSuccessfulApplicationId(): BN {
return this.successfulApplicationId
}

public getWorkingGroup(): string {
return this.workingGroup
}

public setAmountPerPayout(value: BN): FillOpeningParameters {
this.amountPerPayout = value
return this
}

public setNextPaymentAtBlock(value: BN): FillOpeningParameters {
this.nextPaymentAtBlock = value
return this
}

public setPayoutInterval(value: BN): FillOpeningParameters {
this.payoutInterval = value
return this
}

public setOpeningId(value: BN): FillOpeningParameters {
this.openingId = value
return this
}

public setSuccessfulApplicationId(value: BN): FillOpeningParameters {
this.successfulApplicationId = value
return this
}

public setWorkingGroup(value: string): FillOpeningParameters {
this.workingGroup = value
return this
}

constructor() {
return
}

public getRewardPolicy() {
return {
amount_per_payout: this.amountPerPayout,
next_payment_at_block: this.nextPaymentAtBlock,
payout_interval: this.payoutInterval,
}
}

public getFillOpeningParameters() {
return {
opening_id: this.openingId,
successful_application_id: this.successfulApplicationId,
reward_policy: this.getRewardPolicy(),
working_group: this.workingGroup,
}
}
}
255 changes: 255 additions & 0 deletions tests/network-tests/src/iznik/dto/workingGroupOpening.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,255 @@
import BN from 'bn.js'

export class WorkingGroupOpening {
private activateAtBlock: BN | undefined
private maxActiveApplicants!: BN
private maxReviewPeriodLength!: BN
private applicationStakingPolicyAmount!: BN
private applicationCrowdedOutUnstakingPeriodLength!: BN
private applicationExpiredUnstakingPeriodLength!: BN
private roleStakingPolicyAmount!: BN
private roleCrowdedOutUnstakingPeriodLength!: BN
private roleExpiredUnstakingPeriodLength!: BN
private slashableMaxCount!: BN
private slashableMaxPercentPtsPerTime!: BN
private successfulApplicantApplicationStakeUnstakingPeriod!: BN
private failedApplicantApplicationStakeUnstakingPeriod!: BN
private failedApplicantRoleStakeUnstakingPeriod!: BN
private terminateApplicationStakeUnstakingPeriod!: BN
private terminateRoleStakeUnstakingPeriod!: BN
private exitRoleApplicationStakeUnstakingPeriod!: BN
private exitRoleStakeUnstakingPeriod!: BN
private text!: string
private openingType!: string

public getActivateAtBlock(): BN | undefined {
return this.activateAtBlock
}

public getMaxActiveApplicants(): BN {
return this.maxActiveApplicants
}

public getMaxReviewPeriodLength(): BN {
return this.maxReviewPeriodLength
}

public getApplicationStakingPolicyAmount(): BN {
return this.applicationStakingPolicyAmount
}

public getApplicationCrowdedOutUnstakingPeriodLength(): BN {
return this.applicationCrowdedOutUnstakingPeriodLength
}

public getApplicationExpiredUnstakingPeriodLength(): BN {
return this.applicationExpiredUnstakingPeriodLength
}

public getRoleStakingPolicyAmount(): BN {
return this.roleStakingPolicyAmount
}

public getRoleCrowdedOutUnstakingPeriodLength(): BN {
return this.roleCrowdedOutUnstakingPeriodLength
}

public getRoleExpiredUnstakingPeriodLength(): BN {
return this.roleExpiredUnstakingPeriodLength
}

public getSlashableMaxCount(): BN {
return this.slashableMaxCount
}

public getSlashableMaxPercentPtsPerTime(): BN {
return this.slashableMaxPercentPtsPerTime
}

public getSuccessfulApplicantApplicationStakeUnstakingPeriod(): BN {
return this.successfulApplicantApplicationStakeUnstakingPeriod
}

public getFailedApplicantApplicationStakeUnstakingPeriod(): BN {
return this.failedApplicantApplicationStakeUnstakingPeriod
}

public getFailedApplicantRoleStakeUnstakingPeriod(): BN {
return this.failedApplicantRoleStakeUnstakingPeriod
}

public getTerminateApplicationStakeUnstakingPeriod(): BN {
return this.terminateApplicationStakeUnstakingPeriod
}

public getTerminateRoleStakeUnstakingPeriod(): BN {
return this.terminateRoleStakeUnstakingPeriod
}

public getExitRoleApplicationStakeUnstakingPeriod(): BN {
return this.exitRoleApplicationStakeUnstakingPeriod
}

public getExitRoleStakeUnstakingPeriod(): BN {
return this.exitRoleStakeUnstakingPeriod
}

public getText(): string {
return this.text
}

public getOpeningType(): string {
return this.openingType
}

public setActivateAtBlock(value: BN | undefined): WorkingGroupOpening {
this.activateAtBlock = value
return this
}

public setMaxActiveApplicants(value: BN): WorkingGroupOpening {
this.maxActiveApplicants = value
return this
}

public setMaxReviewPeriodLength(value: BN): WorkingGroupOpening {
this.maxReviewPeriodLength = value
return this
}

public setApplicationStakingPolicyAmount(value: BN): WorkingGroupOpening {
this.applicationStakingPolicyAmount = value
return this
}

public setApplicationCrowdedOutUnstakingPeriodLength(value: BN): WorkingGroupOpening {
this.applicationCrowdedOutUnstakingPeriodLength = value
return this
}

public setApplicationExpiredUnstakingPeriodLength(value: BN): WorkingGroupOpening {
this.applicationExpiredUnstakingPeriodLength = value
return this
}

public setRoleStakingPolicyAmount(value: BN): WorkingGroupOpening {
this.roleStakingPolicyAmount = value
return this
}

public setRoleCrowdedOutUnstakingPeriodLength(value: BN): WorkingGroupOpening {
this.roleCrowdedOutUnstakingPeriodLength = value
return this
}

public setRoleExpiredUnstakingPeriodLength(value: BN): WorkingGroupOpening {
this.roleExpiredUnstakingPeriodLength = value
return this
}

public setSlashableMaxCount(value: BN): WorkingGroupOpening {
this.slashableMaxCount = value
return this
}

public setSlashableMaxPercentPtsPerTime(value: BN): WorkingGroupOpening {
this.slashableMaxPercentPtsPerTime = value
return this
}

public setSuccessfulApplicantApplicationStakeUnstakingPeriod(value: BN): WorkingGroupOpening {
this.successfulApplicantApplicationStakeUnstakingPeriod = value
return this
}

public setFailedApplicantApplicationStakeUnstakingPeriod(value: BN): WorkingGroupOpening {
this.failedApplicantApplicationStakeUnstakingPeriod = value
return this
}

public setFailedApplicantRoleStakeUnstakingPeriod(value: BN): WorkingGroupOpening {
this.failedApplicantRoleStakeUnstakingPeriod = value
return this
}

public setTerminateApplicationStakeUnstakingPeriod(value: BN): WorkingGroupOpening {
this.terminateApplicationStakeUnstakingPeriod = value
return this
}

public setTerminateRoleStakeUnstakingPeriod(value: BN): WorkingGroupOpening {
this.terminateRoleStakeUnstakingPeriod = value
return this
}

public setExitRoleApplicationStakeUnstakingPeriod(value: BN): WorkingGroupOpening {
this.exitRoleApplicationStakeUnstakingPeriod = value
return this
}

public setExitRoleStakeUnstakingPeriod(value: BN): WorkingGroupOpening {
this.exitRoleStakeUnstakingPeriod = value
return this
}

public setText(value: string): WorkingGroupOpening {
this.text = value
return this
}

public setOpeningType(value: string): WorkingGroupOpening {
this.openingType = value
return this
}

constructor() {
return
}

public getActivateAt() {
return this.activateAtBlock === undefined ? 'CurrentBlock' : { ExactBlock: this.activateAtBlock }
}

public getCommitment() {
return {
'application_rationing_policy': { 'max_active_applicants': this.maxActiveApplicants },
'max_review_period_length': this.maxReviewPeriodLength,
'application_staking_policy': {
'amount': this.applicationStakingPolicyAmount,
'amount_mode': 'AtLeast',
'crowded_out_unstaking_period_length': this.applicationCrowdedOutUnstakingPeriodLength,
'review_period_expired_unstaking_period_length': this.applicationExpiredUnstakingPeriodLength,
},
'role_staking_policy': {
'amount': this.roleStakingPolicyAmount,
'amount_mode': 'AtLeast',
'crowded_out_unstaking_period_length': this.roleCrowdedOutUnstakingPeriodLength,
'review_period_expired_unstaking_period_length': this.roleExpiredUnstakingPeriodLength,
},
'role_slashing_terms': {
'Slashable': {
'max_count': this.slashableMaxCount,
'max_percent_pts_per_time': this.slashableMaxPercentPtsPerTime,
},
},
'fill_opening_successful_applicant_application_stake_unstaking_period': this
.successfulApplicantApplicationStakeUnstakingPeriod,
'fill_opening_failed_applicant_application_stake_unstaking_period': this
.failedApplicantApplicationStakeUnstakingPeriod,
'fill_opening_failed_applicant_role_stake_unstaking_period': this.failedApplicantRoleStakeUnstakingPeriod,
'terminate_application_stake_unstaking_period': this.terminateApplicationStakeUnstakingPeriod,
'terminate_role_stake_unstaking_period': this.terminateRoleStakeUnstakingPeriod,
'exit_role_application_stake_unstaking_period': this.exitRoleApplicationStakeUnstakingPeriod,
'exit_role_stake_unstaking_period': this.exitRoleStakeUnstakingPeriod,
}
}

public getAddOpeningParameters(workingGroup: string) {
return {
activate_at: this.getActivateAt(),
commitment: this.getCommitment(),
human_readable_text: this.getText(),
working_group: workingGroup,
}
}
}
Empty file.
Loading