Skip to content

Commit

Permalink
Merge pull request #391 from curvefi/fix/fixed-userGaugeVotes
Browse files Browse the repository at this point in the history
Fix/fixed user gauge votes
  • Loading branch information
fedorovdg authored Sep 4, 2024
2 parents cbd848f + a7a6762 commit d24dc05
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@curvefi/api",
"version": "2.63.2",
"version": "2.63.3",
"description": "JavaScript library for curve.fi",
"main": "lib/index.js",
"author": "Macket",
Expand Down
16 changes: 8 additions & 8 deletions src/dao.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,11 @@ export const getVotingGaugeList = async (): Promise<IVotingGauge[]> => {
for (let i = 0; i < gaugeData.length; i++) {
if ((gaugeData[i].is_killed || gaugeData[i].hasNoCrv) && Number(gaugeData[i].gauge_controller.gauge_relative_weight) === 0) continue;
res.push({
poolUrl: gaugeData[i].poolUrls.swap[0],
network: _extractNetworkFromPoolUrl(gaugeData[i].poolUrls.swap[0]),
poolUrl: gaugeData[i].poolUrls?.swap[0] || '',
network: gaugeData[i].blockchainId,
gaugeAddress: gaugeData[i].gauge,
poolAddress: gaugeData[i].swap,
lpTokenAddress: gaugeData[i].swap_token,
poolAddress: gaugeData[i].swap || '',
lpTokenAddress: gaugeData[i].swap_token || '',
poolName: gaugeData[i].shortName,
totalVeCrv: curve.formatUnits(gaugeData[i].gauge_controller.get_gauge_weight, 18),
relativeWeight: curve.formatUnits(gaugeData[i].gauge_controller.gauge_relative_weight, 16),
Expand Down Expand Up @@ -267,11 +267,11 @@ export const userGaugeVotes = async (address = ""): Promise<{ gauges: IGaugeUser
userFutureVeCrv: curve.formatUnits(veCrvBalance * votes[i][1] / BigInt(10000), 18),
expired: dt === BigInt(0),
gaugeData: {
poolUrl: gaugeData[i].poolUrls.swap[0],
network: _extractNetworkFromPoolUrl(gaugeData[i].poolUrls.swap[0]),
poolUrl: gaugeData[i].poolUrls?.swap[0] || '',
network: gaugeData[i].blockchainId,
gaugeAddress: gaugeData[i].gauge,
poolAddress: gaugeData[i].swap,
lpTokenAddress: gaugeData[i].swap_token,
poolAddress: gaugeData[i].swap || '',
lpTokenAddress: gaugeData[i].swap_token || '',
poolName: gaugeData[i].shortName,
totalVeCrv: curve.formatUnits(gaugeData[i].gauge_controller.get_gauge_weight, 18),
relativeWeight: curve.formatUnits(gaugeData[i].gauge_controller.gauge_relative_weight, 16),
Expand Down
3 changes: 2 additions & 1 deletion src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ export interface IProfit {
}

export interface IGaugesDataFromApi {
blockchainId: string;
gauge: string,
swap: string,
swap_token: string,
Expand All @@ -184,7 +185,7 @@ export interface IGaugesDataFromApi {
gauge_relative_weight: string,
get_gauge_weight: string,
},
poolUrls: {
poolUrls?: {
swap: string[],
}
is_killed?: boolean,
Expand Down

0 comments on commit d24dc05

Please sign in to comment.