Skip to content
Business logic Audit finding Intermediate

Gamers will not receive rewards for allocating to Aave and Beta vaults, while the vaults do generate yield

The Aave and Beta provider contracts return incorrect exchange rates (always 1 and 0 respectively), so the reward calculation for gamers who allocate funds to these protocols always yields zero. As a result, gamers receive no rewards even though the vaults generate yield that is distributed only to depositors.

Ch_301 Follow with Jeiwan, c7e7eff and 3 others

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2023-01-derby-judging/issues/313

Found by

Ch_301, Jeiwan, c7e7eff, cergyk, hyh, psy4n0n

Summary

Since AaveProvider and BetaProvider don't track the exchange rate of respective protocol tokens, gamer rewards will always be 0 for these protocols. The protocols, however, will generate yield that will be distributed only to depositors.

Vulnerability Detail

Gamers are participants who allocate funds to yield generating protocols; as a reward, they receive a share of the yield. Depositing and withdrawing of funds, as well as accruing of rewards, happens during rebalancing of vaults. Vaults can be rebalanced once in two weeks, and, between rebalancings, funds generate yield in third-party protocols.

The yield generated by protocols is tracked during rebalnacings using the exchange rate of a protocol: since protocol generate yield, the exchange rate always increases, and the difference in exchange rates between two rebalancings is used to calculated to amount of yield generated between the rebalancings.

However, AaveProvider.exchangeRate and BetaProvider.exchangeRate return wrong exchange rates:

  1. AaveProvider always returns 1;
  2. BetaProvider always returns 0.

If the exchange rate is always 1, then the numerator of the gamer rewards calculation formula will always be 0, and gamer rewards will always be 0. If the exchange rate is 0, gamer rewards won't be calculated at all.

Impact

Gamers who allocate tokens to Aave and Beta vaults (while these vaults may generate high yield, compared to other protocols) will not receive rewards. The entire yield generated by the vaults will be distributed only among vault depositors.

Code Snippet

  1. The change in protocol token price determines gamer rewards:

https://github.com/sherlock-audit/2023-01-derby/blob/main/derby-yield-optimiser/contracts/Vault.sol#L233-L236

  1. AaveProvider always return the exchange rate of 1:

https://github.com/sherlock-audit/2023-01-derby/blob/main/derby-yield-optimiser/contracts/Providers/AaveProvider.sol#L112

  1. BetaProvider always returns the exchange rate of 0:

https://github.com/sherlock-audit/2023-01-derby/blob/main/derby-yield-optimiser/contracts/Providers/BetaProvider.sol#L118

Tool used

Manual Review

Recommendation

Consider correctly tracking the exchange rate of Aave and Beta tokens in the respective providers.

The original report as published on Sherlock, by Ch_301. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

What the attacker needed

Gamer allocates to Aave or Beta vault

The fix

The providers should correctly track and return the exchange rate of Aave and Beta tokens.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

In this system, 'gamers' are people who choose which investment protocols receive funds and earn a share of the profit. The profit is calculated by comparing the value of a protocol token before and after a period. Two of the protocol adapters always report the same value (1 or 0), so the profit calculation gives zero and gamers get nothing, while the actual profit goes only to those who deposited money.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by Ch_301

View all

39 more disclosed reports, best first.

More from Derby

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.