governance improvements (#209)

This commit is contained in:
Dmitry
2023-11-15 13:13:41 +03:00
committed by GitHub
parent a8c60271e5
commit 186c29342b
10 changed files with 8 additions and 116 deletions

View File

@@ -10,10 +10,6 @@ import {
userEarnedSchema,
type PairStatusEnum,
pairStatusSchema,
governanceContractsSchema,
governancePoolsSchema,
governancePoolSchema,
governanceChainsInfoSchema,
pricesWithQuoteAssetSchema,
} from './schemas/index.js';
import type redeemOrderSchema from '../Aggregator/schemas/redeemOrderSchema.js';
@@ -113,10 +109,6 @@ class BlockchainService {
this.getBlockNumber = this.getBlockNumber.bind(this);
this.getRedeemOrderBySecretHash = this.getRedeemOrderBySecretHash.bind(this);
this.claimOrder = this.claimOrder.bind(this);
this.getGovernanceContracts = this.getGovernanceContracts.bind(this);
this.getGovernancePools = this.getGovernancePools.bind(this);
this.getGovernancePool = this.getGovernancePool.bind(this);
this.getGovernanceChainsInfo = this.getGovernanceChainsInfo.bind(this);
}
get basicAuthHeaders() {
@@ -484,30 +476,6 @@ class BlockchainService {
body: JSON.stringify(secretHashes),
},
);
getGovernanceContracts = () => fetchWithValidation(
`${this.apiUrl}/api/governance/info`,
governanceContractsSchema,
{ headers: this.basicAuthHeaders },
);
getGovernancePools = () => fetchWithValidation(
`${this.apiUrl}/api/governance/pools`,
governancePoolsSchema,
{ headers: this.basicAuthHeaders },
);
getGovernancePool = (address: string) => fetchWithValidation(
`${this.apiUrl}/api/governance/pools/${address}`,
governancePoolSchema,
{ headers: this.basicAuthHeaders },
);
getGovernanceChainsInfo = () => fetchWithValidation(
`${this.apiUrl}/api/governance/chains-info`,
governanceChainsInfoSchema,
{ headers: this.basicAuthHeaders },
);
}
export * as schemas from './schemas/index.js';

View File

@@ -1,7 +0,0 @@
import { z } from 'zod';
const governanceChainsInfoSchema = z.object({
isChainSupported: z.boolean(),
});
export default governanceChainsInfoSchema;

View File

@@ -1,19 +0,0 @@
import { z } from 'zod';
const governanceContractsSchema = z.object({
controllerAddress: z.string(),
veTOKENAddress: z.string(),
veTOKENYieldDistributorV4Address: z.string(),
time_total: z.string(),
absolute_ve_token_in_voting: z.string(),
info: z.record(
z.string(),
z.object({
gaugeAddress: z.string(),
gaugeType: z.number(),
gaugeName: z.string(),
})
),
});
export default governanceContractsSchema;

View File

@@ -1,18 +0,0 @@
import { z } from 'zod';
const governancePoolSchema = z.object({
min_apr: z.string(),
max_apr: z.string(),
tvl: z.string(),
lp_supply: z.string(),
lp_staked: z.string(),
lp_staked_with_boost: z.string(),
lp_price_in_usd: z.string(),
reward_per_period: z.string(),
lock_time_for_max_multiplier: z.string(),
lock_max_multiplier: z.string(),
veorn_max_multiplier: z.string(),
veorn_boost_scale_factor: z.string(),
});
export default governancePoolSchema;

View File

@@ -1,28 +0,0 @@
import { z } from 'zod';
const governancePoolsSchema = z.array(
z.object({
slug: z.string(),
identifier: z.string(),
chain: z.string(),
platform: z.string(),
logo: z.string(),
pair: z.string(),
lp_address: z.string(),
lp_staked: z.string(),
lp_staked_with_boost: z.string(),
lp_supply: z.string(),
lp_price_in_usd: z.string(),
farm_address: z.string(),
pool_tokens: z.tuple([z.string(), z.string()]),
pool_rewards: z.array(z.string()),
tvl: z.string(),
min_apr: z.string(),
max_apr: z.string(),
reward_per_period: z.array(z.string()),
weight: z.string(),
liquidity: z.string(),
})
);
export default governancePoolsSchema;

View File

@@ -12,9 +12,5 @@ export { default as atomicSummarySchema } from './atomicSummarySchema.js';
export { default as poolsLpAndStakedSchema } from './poolsLpAndStakedSchema.js';
export { default as userVotesSchema } from './userVotesSchema.js';
export { default as userEarnedSchema } from './userEarnedSchema.js';
export { default as governanceContractsSchema } from './governanceContractsSchema.js';
export { default as governancePoolsSchema } from './governancePoolsSchema.js';
export { default as governancePoolSchema } from './governancePoolSchema.js';
export { default as governanceChainsInfoSchema } from './governanceChainsInfoSchema.js';
export { default as poolsV3InfoSchema } from './poolsV3InfoSchema.js';
export { pricesWithQuoteAssetSchema } from './pricesWithQuoteAssetSchema.js';