-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from novasamatech/feature/add_polimec
Add polimec and manta staking
- Loading branch information
Showing
8 changed files
with
183 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
QmVxvbGE8TeMh4M6eYDZTiMXnbDDmaZjDpcnQdqXvyPtkF | ||
QmWS7DE27CzG4SUTjpKhb7eeNbYBm4jL39udBPCrtRBoD7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
specVersion: 1.0.0 | ||
name: nova-wallet-staking | ||
version: 0.0.1 | ||
runner: | ||
node: | ||
name: "@subql/node" | ||
version: ">=1.0.0" | ||
query: | ||
name: "@subql/query" | ||
version: "*" | ||
description: >- | ||
Project that provides up-to-date information about on-chain staking APY | ||
repository: "[email protected]:nova-wallet/subquery-staking.git" | ||
schema: | ||
file: ./schema.graphql | ||
network: | ||
chainId: "0xf3c7ad88f6a80f366c4be216691411ef0622e8b809b1046ea297ef106058d4eb" | ||
endpoint: "wss://ws.manta.systems" | ||
dataSources: | ||
- kind: substrate/Runtime | ||
startBlock: 2192400 | ||
mapping: | ||
file: ./dist/index.js | ||
handlers: | ||
- handler: handleMantaNewEra | ||
kind: substrate/EventHandler | ||
filter: | ||
module: parachainStaking | ||
method: NewRound | ||
|
||
- handler: handleMantaStakingReward | ||
kind: substrate/EventHandler | ||
filter: | ||
module: parachainStaking | ||
method: Rewarded |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
specVersion: 1.0.0 | ||
name: nova-wallet-staking | ||
version: 0.0.1 | ||
runner: | ||
node: | ||
name: "@subql/node" | ||
version: ">=1.0.0" | ||
query: | ||
name: "@subql/query" | ||
version: "*" | ||
description: >- | ||
Project that provides up-to-date information about on-chain staking APY | ||
repository: "[email protected]:nova-wallet/subquery-staking.git" | ||
schema: | ||
file: ./schema.graphql | ||
network: | ||
chainId: "0x7eb9354488318e7549c722669dcbdcdc526f1fef1420e7944667212f3601fdbd" | ||
endpoint: "wss://rpc.polimec.org" | ||
dataSources: | ||
- kind: substrate/Runtime | ||
startBlock: 1 | ||
mapping: | ||
file: ./dist/index.js | ||
handlers: | ||
- handler: handlePolimecNewEra | ||
kind: substrate/EventHandler | ||
filter: | ||
module: parachainStaking | ||
method: NewRound | ||
|
||
- handler: handlePolimecStakingReward | ||
kind: substrate/EventHandler | ||
filter: | ||
module: parachainStaking | ||
method: Rewarded |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import {SubstrateEvent} from "@subql/types"; | ||
import {handleNewEra} from "./common"; | ||
import {ParachainRewardCalculator} from "./rewards/Parachain"; | ||
import {CollatorEraInfoDataSource} from "./era/CollatorEraInfoDataSource"; | ||
import {Codec} from "@polkadot/types/types"; | ||
import {INumber} from "@polkadot/types-codec/types/interfaces"; | ||
import {handleParachainStakingReward} from "./rewards/history/parachain"; | ||
|
||
const MANTA_GENESIS = "0xf3c7ad88f6a80f366c4be216691411ef0622e8b809b1046ea297ef106058d4eb" | ||
const STAKING_TYPE = "parachain" | ||
|
||
export async function handleMantaNewEra(event: SubstrateEvent): Promise<void> { | ||
let eraInfoDataSource = new CollatorEraInfoDataSource(); | ||
|
||
await handleNewEra( | ||
eraInfoDataSource, | ||
await ParachainRewardCalculator(eraInfoDataSource), | ||
MANTA_GENESIS, | ||
STAKING_TYPE | ||
) | ||
} | ||
|
||
export async function handleMantaStakingReward( | ||
event: SubstrateEvent<[accountId: Codec, reward: INumber]>, | ||
): Promise<void> { | ||
await handleParachainStakingReward(event, MANTA_GENESIS, STAKING_TYPE) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import {SubstrateEvent} from "@subql/types"; | ||
import {handleNewEra} from "./common"; | ||
import {ParachainRewardCalculator} from "./rewards/Parachain"; | ||
import {CollatorEraInfoDataSource} from "./era/CollatorEraInfoDataSource"; | ||
import {Codec} from "@polkadot/types/types"; | ||
import {INumber} from "@polkadot/types-codec/types/interfaces"; | ||
import {handleParachainStakingReward} from "./rewards/history/parachain"; | ||
|
||
const POLIMEC_GENESIS = "0x7eb9354488318e7549c722669dcbdcdc526f1fef1420e7944667212f3601fdbd" | ||
const STAKING_TYPE = "parachain" | ||
|
||
export async function handlePolimecNewEra(event: SubstrateEvent): Promise<void> { | ||
let eraInfoDataSource = new CollatorEraInfoDataSource(); | ||
|
||
await handleNewEra( | ||
eraInfoDataSource, | ||
await ParachainRewardCalculator(eraInfoDataSource), | ||
POLIMEC_GENESIS, | ||
STAKING_TYPE | ||
) | ||
} | ||
|
||
export async function handlePolimecStakingReward( | ||
event: SubstrateEvent<[accountId: Codec, reward: INumber]>, | ||
): Promise<void> { | ||
await handleParachainStakingReward(event, POLIMEC_GENESIS, STAKING_TYPE) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters