From 1429e28a858961dcc0f4cf6a95120e63bc3492aa Mon Sep 17 00:00:00 2001 From: Ivan S Date: Thu, 29 Feb 2024 20:33:49 +0800 Subject: [PATCH] Manta parachain network support --- main/src/loaders/polkadotapi.ts | 2 +- main/src/modules/BlockListener/controller.ts | 1 + main/src/modules/Monitoring/helpers/database.ts | 2 +- main/src/modules/Monitoring/service.ts | 2 +- main/src/modules/MoonbeamStakingProcessor/round-payout.ts | 4 ++-- main/src/modules/index.ts | 2 +- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/main/src/loaders/polkadotapi.ts b/main/src/loaders/polkadotapi.ts index 714e0206..dc01f276 100644 --- a/main/src/loaders/polkadotapi.ts +++ b/main/src/loaders/polkadotapi.ts @@ -11,7 +11,7 @@ export const PolkadotApi = (nodeUrl: string) => async (): Promise => let typesBundle = {} // extra types for moonbeam/moonriver - if (environment.NETWORK === 'moonbeam' || environment.NETWORK === 'moonriver') { + if (environment.NETWORK === 'moonbeam' || environment.NETWORK === 'moonriver' || environment.NETWORK === 'manta') { typesBundle = typesBundlePre900 } diff --git a/main/src/modules/BlockListener/controller.ts b/main/src/modules/BlockListener/controller.ts index 8a37c8ad..5730c189 100644 --- a/main/src/modules/BlockListener/controller.ts +++ b/main/src/modules/BlockListener/controller.ts @@ -35,6 +35,7 @@ export class BlockListenerController { this.listnerService.restartUnprocessedTasks(ENTITY.BLOCK) res.send('restarted unprocessed') }) + this.expressApp.get('/process-block/:blockId', async (req, res) => { if (isNaN(Number(req.params.blockId))) return res.json({ error: 'blockId must be a number' }) await this.listnerService.preloadOneBlock(Number(req.params.blockId)) diff --git a/main/src/modules/Monitoring/helpers/database.ts b/main/src/modules/Monitoring/helpers/database.ts index 665c0030..5ecf96f4 100644 --- a/main/src/modules/Monitoring/helpers/database.ts +++ b/main/src/modules/Monitoring/helpers/database.ts @@ -6,7 +6,7 @@ import { Logger } from 'pino' @Service() export class MonitoringDatabaseHelper { - constructor(@Inject('knex') private readonly knex: Knex, @Inject('logger') private readonly logger: Logger) {} + constructor(@Inject('knex') private readonly knex: Knex, @Inject('logger') private readonly logger: Logger) { } /* async roateOldRecords(): Promise { diff --git a/main/src/modules/Monitoring/service.ts b/main/src/modules/Monitoring/service.ts index 2a5d5db5..d2de84c3 100644 --- a/main/src/modules/Monitoring/service.ts +++ b/main/src/modules/Monitoring/service.ts @@ -152,7 +152,7 @@ export class MonitoringService { }) return } - if (environment.NETWORK === 'moonbeam' || environment.NETWORK === 'moonriver') { + if (environment.NETWORK === 'moonbeam' || environment.NETWORK === 'moonriver' || environment.NETWORK === 'manta') { const missedRounds = await this.databaseHelper.getMissedRounds(lastDBBlock.metadata.round_id) if (missedRounds && missedRounds.length) { this.slackHelper.sendMessage(`Detected missed rounds: ${JSON.stringify(missedRounds)}`) diff --git a/main/src/modules/MoonbeamStakingProcessor/round-payout.ts b/main/src/modules/MoonbeamStakingProcessor/round-payout.ts index c663cdcb..8586cdbc 100644 --- a/main/src/modules/MoonbeamStakingProcessor/round-payout.ts +++ b/main/src/modules/MoonbeamStakingProcessor/round-payout.ts @@ -216,7 +216,7 @@ export class MoonbeamStakingProcessorRoundPayout { value, ] of atStake) { //console.log("VALUE", value) - const { bond, total, delegations, nominators } = specVersion < 2600 ? value : value.unwrap() + const { bond, total, delegations, nominators } = specVersion >= 2600 && environment.NETWORK !== 'manta' ? value.unwrap : value console.log('BOND', bond) console.log('total', total) console.log('delegations', delegations.length) @@ -369,7 +369,7 @@ export class MoonbeamStakingProcessorRoundPayout { }) } - if (specVersion >= 2000) { + if (specVersion >= 2000 && environment.NETWORK !== 'manta') { // Now orbiters have their own event. To replicate previous behavior, // we take the collator associated and mark rewards as if they were // to the collator diff --git a/main/src/modules/index.ts b/main/src/modules/index.ts index 11279032..fb24d0c1 100644 --- a/main/src/modules/index.ts +++ b/main/src/modules/index.ts @@ -25,7 +25,7 @@ export const ModulesLoader = async (): Promise => { if (environment.MODE === MODE.STAKING_PROCESSOR) { if (environment.NETWORK === 'polkadot' || environment.NETWORK === 'kusama' || environment.NETWORK === 'vara') { PolkadotStakingProcessor() - } else if (environment.NETWORK === 'moonbeam' || environment.NETWORK === 'moonriver') { + } else if (environment.NETWORK === 'moonbeam' || environment.NETWORK === 'moonriver' || environment.NETWORK === 'manta') { MoonbeamStakingProcessor() //MoonbeamStakingProcessorRecalc() }