0

Looking at the contract from the CAKE auto-compounding pool (https://bscscan.com/address/0xa80240Eb5d7E05d3F250cF000eEc0891d00b51CC#code), it appears there is no direct call for calculating the current APY, as displayed in PancakeSwap (currently 107.11%).

I tried to calculate it retrieving the number of shares owned by a user (contract.userInfo(user_address)[2]/1e18), which gives the amount of cake staked by the user. However, I could not retrieve the expected APY.

Any help greatly appreciated.

1
  • Did you ever find a way?
    – Jak
    Jul 29, 2021 at 12:32

1 Answer 1

2

https://github.com/gaijinjoe/cake-liquidity/blob/7ae59f159d09dc3560b294ce8d19955a56f401e5/borrow-limit-status.js#L233

Here you go.

Call it like this:

 const autoAPY = compoundInterest(1, cakeSwapPoolAPR / 100, 365 * 288, 1);

where cakeSwapPoolAPR is the APR of the Manual CAKE pool. Look at the code to see how to calculate the Manual CAKE pool APR.

2
  • Thank you very much! Very hepful.
    – wisk
    Sep 3, 2021 at 17:23
  • the answer is actually related to the manual coumpounding Cake pool. Any chance there is also a formula for the auto-compounding cake pool?
    – wisk
    Sep 3, 2021 at 17:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.