Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bsc_zoo.js incorrectly calculating the rewards (share of pool) #1650

Open
iamrob84 opened this issue Sep 8, 2021 · 4 comments
Open

bsc_zoo.js incorrectly calculating the rewards (share of pool) #1650

iamrob84 opened this issue Sep 8, 2021 · 4 comments

Comments

@iamrob84
Copy link

iamrob84 commented Sep 8, 2021

Current % of the pool is calculated as ( your stake $ / total staked $ ).
Zoo % of pool should be calculated as ( your stake $ / tvl $ )

I downloaded the repo and couldn't seem to find where this calculation is done in bsc_zoo.js.
I couldn't find the printChefPool function which may perform this- I assume this is a database function.

Side note - the reward key contract looks to be wrong in the repo (should be https://poocoin.app/tokens/0x6652462466dcee5cb1dda95379fae3c3e57f6719) however it was mystically working for 5 mins yesterday and the repo didn't seem to be altered, however it's not working again this morning.

@vfat0
Copy link
Member

vfat0 commented Sep 9, 2021

printChefPool is in ethers_helpers

@iamrob84
Copy link
Author

iamrob84 commented Sep 9, 2021

Many thanks. I'm not sure why I failed to find that in a search- too much noise in the results!
It looks like it's not calculating the const staked_tvl correctly which implies perhaps what parsed poolInfo or poolPrices has got something missing.
Back to the investigation...

@vfat0
Copy link
Member

vfat0 commented Sep 9, 2021

this happens usually if there is too much of the coin on the contract, e.g. if its in 2 different pools, or if its a pool token and a reward token at the same time. we generally use balanceOf to get the staked amount

@iamrob84
Copy link
Author

iamrob84 commented Sep 9, 2021

Sorry I'm all new to this.
So the KEY chef address was correct however the ABI on bscscan is very light and doesn't represent what's in the bsc_zoo.js.
Looking at something like bsc_apeswap.js if you view the chef address then the ABI's match.
Sorry to be a pain but could you enlighten me out how the KEY_CHEF_ABI got a whole lot of extra content?
When I searched for 'balanceOf' it seemed to frequently appear in the _CHEF_ABI const but not in the case of bsc_zoo.js

Noted the actual KEY contract wasn't in the bsc_tokens array in bsc_helpers, which led to predicted APR and reward amount not being populated. Although now populated these seem a fraction of what is expected. Is this a by-product of what you mentioned before or have I created another issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants