Be friends with time.
When a user already has a Total Value Locked (TVL) and pending rewards, any new deposit will trigger the reinvestment mechanism. At this point, the unredeemed rewards will be calculated into the principal.
Compound Example:
After the user deposits 200 USDC, the new total value will be calculated as follows: Total Value = 10,000 USDC (current TVL) + 200 (deposit) + 250 (pending rewards). The user will now earn a maximum daily return of 0.5% on the basis of 10,450 USDC.
TVL = Total Value Locked, which is 10,000 USDC in this case. New Deposit = The additional deposit, which is 200 USDC. Pending Rewards = The rewards waiting to be claimed, which is 250 USDC. New Total Value = The updated total value of the investment.
The formula for calculating the new total value is: