Skip to content

Commit

Permalink
[cake] feat(cake): Minimum voting power (#3)
Browse files Browse the repository at this point in the history
* feat(cake): Minimum voting power

* Update index.ts

Co-authored-by: Fabien <[email protected]>
  • Loading branch information
hachiojidev and bonustrack authored Aug 3, 2021
1 parent 3fdec9c commit 5c960f8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/strategies/cake/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import fetch from 'cross-fetch';
import fetch from 'cross-fetch';
import { subgraphRequest } from '../../utils';
import examplesFile from './examples.json';
import aboutFile from './README.md';
Expand All @@ -19,6 +19,7 @@ type VotingResponse = {
total: string;
};

const MINIUM_VOTING_POWER = 0.01;
const SMART_CHEF_URL =
'https://api.bscgraph.org/subgraphs/name/pancakeswap/smartchef';
const VOTING_API_URL = 'https://voting-api.pancakeswap.info/api/power';
Expand Down Expand Up @@ -88,10 +89,11 @@ export async function strategy(
const calculatedPower = votingPowerResults.reduce(
(accum, response, index) => {
const address = addresses[index];
const total = parseFloat(response.total);

return {
...accum,
[address]: parseFloat(response.total)
[address]: total <= MINIUM_VOTING_POWER ? MINIUM_VOTING_POWER : total
};
},
{}
Expand Down

0 comments on commit 5c960f8

Please sign in to comment.