-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathternoa.ts
44 lines (37 loc) · 1.64 KB
/
ternoa.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 {SubstrateEvent} from "@subql/types";
import {handleNewEra, handleNewSession} from "./common";
import {RelaychainRewardCalculator} from "./rewards/Relaychain";
import {ValidatorEraInfoDataSource} from "./era/ValidatorEraInfoDataSource";
import {Codec} from "@polkadot/types/types";
import {INumber} from "@polkadot/types-codec/types/interfaces";
import {handleRelaychainStakingReward, handleRelaychainStakingSlash} from "./rewards/history/relaychain";
const TERNOA_GENESIS = "0x6859c81ca95ef624c9dfe4dc6e3381c33e5d6509e35e147092bfbc780f777c4e"
const STAKING_TYPE = "relaychain"
export async function handleTernoaNewEra(_: SubstrateEvent): Promise<void> {
let validatorEraInfoDataSource = new ValidatorEraInfoDataSource();
await handleNewEra(
validatorEraInfoDataSource,
await RelaychainRewardCalculator(validatorEraInfoDataSource),
TERNOA_GENESIS,
STAKING_TYPE
)
}
export async function handleTernoaNewSession(_: SubstrateEvent): Promise<void> {
let validatorEraInfoDataSource = new ValidatorEraInfoDataSource();
await handleNewSession(
validatorEraInfoDataSource,
await RelaychainRewardCalculator(validatorEraInfoDataSource),
TERNOA_GENESIS,
STAKING_TYPE
)
}
export async function handleTernoaStakingReward(
event: SubstrateEvent<[accountId: Codec, reward: INumber]>,
): Promise<void> {
await handleRelaychainStakingReward(event, TERNOA_GENESIS, STAKING_TYPE)
}
export async function handleTernoaStakingSlash(
event: SubstrateEvent<[account: Codec, slash: INumber]>,
): Promise<void> {
await handleRelaychainStakingSlash(event, TERNOA_GENESIS, STAKING_TYPE)
}