Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
DynamicRewardEndpoint.getExpectedValidatorRewards request & response …
Browse files Browse the repository at this point in the history
…schema (#9016)

Updates DynamicRewardEndpoint.getExpectedValidatorRewards request and response schema
  • Loading branch information
has5aan authored Sep 20, 2023
1 parent c315013 commit 5e6cf7c
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 7 deletions.
14 changes: 7 additions & 7 deletions framework/src/modules/dynamic_reward/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ import {
} from '../../state_machine';
import { DynamicRewardMethod } from './method';
import { DynamicRewardEndpoint } from './endpoint';
import { configSchema } from './schemas';
import {
configSchema,
getExpectedValidatorRewardsRequestSchema,
getExpectedValidatorRewardsResponseSchema,
} from './schemas';
import { RewardMintedEvent } from '../reward/events/reward_minted';
import { EndOfRoundTimestampStore } from './stores/end_of_round_timestamp';
import {
Expand All @@ -61,10 +65,6 @@ import {
getAnnualInflationRequestSchema,
} from '../reward/schemas';
import { getMinimalRewardActiveValidators, getStakeRewardActiveValidators } from './utils';
import {
getExpectedSharedRewardsRequestSchema,
getExpectedSharedRewardsResponseSchema,
} from '../pos/schemas';

export class DynamicRewardModule extends BaseModule {
public method = new DynamicRewardMethod(this.stores, this.events);
Expand Down Expand Up @@ -116,8 +116,8 @@ export class DynamicRewardModule extends BaseModule {
},
{
name: this.endpoint.getExpectedValidatorRewards.name,
request: getExpectedSharedRewardsRequestSchema,
response: getExpectedSharedRewardsResponseSchema,
request: getExpectedValidatorRewardsRequestSchema,
response: getExpectedValidatorRewardsResponseSchema,
},
],
};
Expand Down
32 changes: 32 additions & 0 deletions framework/src/modules/dynamic_reward/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,35 @@ export const configSchema = {
},
required: [...rewardConfigSchema.required, 'factorMinimumRewardActiveValidators'],
};

export const getExpectedValidatorRewardsRequestSchema = {
$id: '/dynamicReward/endpoint/getExpectedValidatorRewardsRequestSchema',
type: 'object',
required: ['validatorAddress'],
properties: {
validatorAddress: {
type: 'string',
format: 'lisk32',
},
},
};

export const getExpectedValidatorRewardsResponseSchema = {
$id: '/dynamicReward/endpoint/getExpectedValidatorRewardsResponseSchema',
type: 'object',
required: ['blockReward', 'dailyReward', 'monthlyReward', 'yearlyReward'],
properties: {
blockReward: {
type: 'string',
},
dailyReward: {
type: 'string',
},
monthlyReward: {
type: 'string',
},
yearlyReward: {
type: 'string',
},
},
};

0 comments on commit 5e6cf7c

Please sign in to comment.