-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstaking-router.ts
44 lines (36 loc) · 1.3 KB
/
staking-router.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { BigNumberish } from "ethers";
import { assert } from "../../common/assert";
import { CheckContext } from "./checks";
export interface StakingModuleParams {
targetShare: bigint;
treasuryFee: bigint;
stakingModuleFee: bigint;
}
const checkStakingModule = async (
{ contracts }: CheckContext,
stakingModuleID: BigNumberish,
params: StakingModuleParams,
) => {
const stakingModule = await contracts.stakingRouter.getStakingModule(stakingModuleID);
assert.equal(stakingModule.targetShare, params.targetShare);
assert.equal(stakingModule.treasuryFee, params.treasuryFee);
assert.equal(stakingModule.stakingModuleFee, params.stakingModuleFee);
};
const checkNodeOperator = async (
{ contracts }: CheckContext,
nopID: BigNumberish,
name: string,
rewardAddress: `0x${string}`,
) => {
const nopInfo = await contracts.curatedStakingModule.getNodeOperator(nopID, false);
assert.equal(nopInfo.rewardAddress, rewardAddress, `Operator ${name} not found`);
};
const checkNodeOperatorsCount = async ({ contracts }: CheckContext, expectedCount: BigNumberish) => {
const nodeOperatorsCount = await contracts.curatedStakingModule.getNodeOperatorsCount();
assert.equal(nodeOperatorsCount, expectedCount);
};
export default {
checkStakingModule,
checkNodeOperator,
checkNodeOperatorsCount,
};