Skip to content

Commit

Permalink
[Fixed] Pool estimated prize computation
Browse files Browse the repository at this point in the history
  • Loading branch information
greedyboi committed Jan 24, 2024
1 parent c26fe2a commit cc7b278
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/utils/lumClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { OfflineSigner } from '@cosmjs/proto-signing';
import { Dec, IntPretty } from '@keplr-wallet/unit';

import { LumApi } from 'api';
import { ApiConstants } from 'constant';
import { AggregatedDepositModel, DepositModel, LumWalletModel, PoolModel, PrizeModel } from 'models';
import { PoolsUtils } from 'utils';

Expand Down Expand Up @@ -332,7 +331,7 @@ class LumClient {
return null;
}

return Number((await this.lumQueryClient.lum.network.millions.params()).params?.feesStakers || '0') / ApiConstants.CLIENT_PRECISION;
return Number((await this.lumQueryClient.lum.network.millions.params()).params?.feesStakers || '0');
};

getMinDepositDelta = async () => {
Expand Down
12 changes: 8 additions & 4 deletions src/utils/walletClient.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { OfflineSigner } from '@cosmjs/proto-signing';
import { SigningStargateClient } from '@cosmjs/stargate';
import dayjs from 'dayjs';
import { I18n, WalletUtils } from 'utils';
import { I18n, NumbersUtils, WalletUtils } from 'utils';
import { showErrorToast } from './toast';
import { ApiConstants } from 'constant';
import { Coin } from '@keplr-wallet/types';
Expand Down Expand Up @@ -87,23 +87,27 @@ class WalletClient {
return null;
}

return Number((await this.queryClient.cosmos.staking.v1beta1.pool()).pool?.bondedTokens);
const bondedTokens = (await this.queryClient.cosmos.staking.v1beta1.pool()).pool?.bondedTokens;

return bondedTokens ? NumbersUtils.convertUnitNumber(bondedTokens) : null;
};

getSupply = async (denom: string) => {
if (this.queryClient === null) {
return null;
}

return Number((await this.queryClient.cosmos.bank.v1beta1.supplyOf({ denom }))?.amount?.amount);
const supply = (await this.queryClient.cosmos.bank.v1beta1.supplyOf({ denom }))?.amount?.amount;

return supply ? NumbersUtils.convertUnitNumber(supply) : null;
};

getCommunityTaxRate = async () => {
if (this.queryClient === null) {
return null;
}

return Number((await this.queryClient.cosmos.distribution.v1beta1.params()).params?.communityTax) / ApiConstants.CLIENT_PRECISION;
return Number((await this.queryClient.cosmos.distribution.v1beta1.params()).params?.communityTax);
};

getInflation = async () => {
Expand Down

0 comments on commit cc7b278

Please sign in to comment.