Skip to content

Commit

Permalink
fix: types
Browse files Browse the repository at this point in the history
  • Loading branch information
grothem committed Dec 8, 2023
1 parent 1b37837 commit 91bcd5a
Showing 1 changed file with 21 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { providers } from 'ethers';
import {
GovernanceDataHelper as GovernanceDataHelperContract,
IGovernanceDataHelper,
} from '../typechain/GovernanceDataHelper';
import { GovernanceDataHelper as GovernanceDataHelperContract } from '../typechain/GovernanceDataHelper';
import { GovernanceDataHelper__factory } from '../typechain/factories/GovernanceDataHelper__factory';

export enum AccessLevel {
Expand Down Expand Up @@ -67,8 +64,8 @@ export type VotingConfig = {
config: {
coolDownBeforeVotingStart: string;
votingDuration: string;
yesThreshold: string;
yesNoDifferential: string;
quorum: string;
differential: string;
minPropositionPower: string;
};
};
Expand All @@ -92,10 +89,7 @@ export type Rpresented = {
};

export interface GovernanceDataHelperInterface {
getConstants: (
govCore: string,
accessLevels: number[],
) => Promise<IGovernanceDataHelper.ConstantsStruct>;
getConstants: (govCore: string, accessLevels: number[]) => Promise<Constants>;
getProposalsData: (
govCore: string,
from: number,
Expand Down Expand Up @@ -132,21 +126,24 @@ export class GovernanceDataHelperService
accessLevels: number[],
): Promise<Constants> {
const data = await this._contract.getConstants(govCore, accessLevels);

const votingConfigs = data.votingConfigs.map<VotingConfig>(votingConfig => {
return {
accessLevel: votingConfig.accessLevel,
config: {
coolDownBeforeVotingStart:
votingConfig.config.coolDownBeforeVotingStart.toString(),
votingDuration: votingConfig.config.votingDuration.toString(),
quorum: votingConfig.config.yesThreshold.toString(),
differential: votingConfig.config.yesNoDifferential.toString(),
minPropositionPower:
votingConfig.config.minPropositionPower.toString(),
},
};
});

return {
votingConfigs: data.votingConfigs.map<VotingConfig>(votingConfig => {
return {
accessLevel: votingConfig.accessLevel,
config: {
coolDownBeforeVotingStart:
votingConfig.config.coolDownBeforeVotingStart.toString(),
votingDuration: votingConfig.config.votingDuration.toString(),
yesThreshold: votingConfig.config.yesThreshold.toString(),
yesNoDifferential: votingConfig.config.yesNoDifferential.toString(),
minPropositionPower:
votingConfig.config.minPropositionPower.toString(),
},
};
}),
votingConfigs,
precisionDivider: data.precisionDivider.toString(),
cooldownPeriod: data.cooldownPeriod.toString(),
expirationTime: data.expirationTime.toString(),
Expand Down

0 comments on commit 91bcd5a

Please sign in to comment.