nation3 / citizen-app

Nation3 citizen app
https://app.nation3.org
GNU General Public License v3.0
39 stars 39 forks source link

Improve calculation of potential boost #19

Closed aahna-ashina closed 2 years ago

aahna-ashina commented 2 years ago

At https://app.nation3.org/liquidity, I can see this text:

You can boost your APY to 124.16%. To do so, claim your current rewards.

Screen Shot 2022-05-19 at 3 31 20 PM

But how can a reward of 0.0028 boost the APY from 66.61% to 124.15%?

Is there a bug with the way the potentialBoost variable is calculated?

https://github.com/nation3/app/blob/8213be5114dcce3e629a86c6bd07c8839d0d9d40/ui/pages/liquidity.js#L169

luisivan commented 2 years ago

Ha, so this is not a bug in the code, but more of an issue in explaining how this works. Basically by claiming/interacting with the contract, the contract recomputes the boosted APY of the user. So it's not like those 0.0028 $NATION will do anything for your APY, is that by claiming (interacting with the contract) your APY will be recalculated and boosted. Should we change the wording a little bit?

0xSagitario commented 2 years ago

I presume the statement "You can boost your APY to 124.16%. To do so, claim your current rewards." doesn't mean just claiming, but also restaking the claimed rewards? If that's the case I think it should also be made clear if the restaking is done automatically or if one needs to manually restake the claimed tokens. If restaking is done automatically then perhaps the above statement should be rewarded to something like "Boost your APY to up to 124.16% through compounding"? In which case the "claim" icon should be changed to "compound" since claiming and restaking is done automatically.

Also I think with automatic claim and restaking or compounding also comes the need for a simple " claim or harvest" function for people who would rather claim their staking rewards and use that for something else. So there might be a need to introduce a second button/function for a simple claim/harvest, if claiming and compounding is done automatically.

aahna-ashina commented 2 years ago

@sagitario9 You can see the smart contract's methods here: https://github.com/nation3/app/blob/main/contracts/src/distributors/BoostedLiquidityDistributor.sol

It has these options:


function deposit(uint256 amount)
function withdraw(uint256 amount)
function claimRewards()
function withdrawAndClaim()
0xSagitario commented 2 years ago

Which means restaking is not done automatically then? Then how is the APY boosted to x2.5 simply by claiming? If that's the case @luisivan I think it should be made clear how simply claiming (interacting with the smart contract) boosts your APY X2.5 like you stated above.

xPi2 commented 2 years ago

Hey @sagitario9, I will do my best to try to clarify your doubts.

Rewards are distributed over time to the depositors of LP tokens based on their weight (share) in the total deposit. When your deposit enters the pool receives a base weight that can be boosted until a factor of x2.5 using voting power.

Your boost is directly dependent on your boost capacity (your veNATION balance), your deposited amount vs. the total deposited amount, and the boost capacity of the other depositors. You can think of the boost over your base weight as a share of the total weight of the pool that is distributed based on your share of the total voting power used in the pool (the sum of all depositors voting power).

Your weight is computed every time you interact with the contract (deposit, withdraw, claim), but only when you interact with the contract. When other users interact with the contract, your boost is not recomputed. Suppose their actions change any parameters that influence the boosting (total deposit, total voting power, etc.). In that case, your weight in the pool could not match your potential weight.

When the UI says that you can boost your APY by claiming, what it means is that we simulated the weight you could have, and it is greater than the one you currently have. You can update it by doing any action that recomputes your weight, being the easier one claimRewards.

0xSagitario commented 2 years ago

Thanks for the clarification @xPi2