mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-24 05:42:33 +03:00
17 lines
691 B
JavaScript
17 lines
691 B
JavaScript
import get from 'lodash/get';
|
|
import parseToken from './parseToken';
|
|
import { vestsToRshares } from './conversions';
|
|
|
|
export const getEstimatedAmount = (account, globalProps, value = 1) => {
|
|
const { fundRecentClaims, fundRewardBalance, base, quote } = globalProps;
|
|
const votingPower = account.voting_power;
|
|
const totalVests =
|
|
parseToken(get(account, 'vesting_shares')) +
|
|
parseToken(get(account, 'received_vesting_shares')) -
|
|
parseToken(get(account, 'delegated_vesting_shares'));
|
|
const votePct = value * 10000;
|
|
const rShares = vestsToRshares(totalVests, votingPower, votePct);
|
|
|
|
return ((rShares / fundRecentClaims) * fundRewardBalance * (base / quote)).toFixed(5);
|
|
};
|