HardhatDeFi
15,000 USDC
View results
Submission Details
Severity: medium
Invalid

Unfair yield distribution in AaveDIVAWrapper due to non-rebasing wToken design

Summary

The AaveDIVAWrapper contract's non-rebasing wToken design leads to unfair yield distribution where depositors cannot benefit from the yield generated by their deposits. While the system remains fully collateralized and user principal is safe, the current implementation directs all yield to the contract owner.

Vulnerability Details

The issue stems from the fixed 1:1 minting ratio between collateral and wTokens, while the underlying aTokens appreciate in value. The yield can only be claimed by the contract owner through the difference between aToken balance and wToken supply.

Consider this scenario:

// Initial state
- Alice deposits 1000 USDC
- Contract receives 1000 aUSDC
- Alice receives 1000 wUSDC
- Total wToken supply = 1000
// After some time (10% yield accrued)
- Contract has 1100 aUSDC (1000 + 100 yield)
- Bob deposits 1000 USDC
- Contract receives 1000 aUSDC
- Bob receives 1000 wUSDC
- Total wToken supply = 2000
- Contract aUSDC = 2100
// Owner claims yield
yield = aTokenBalance - wTokenSupply
= 2100 - 2000
= 100 USDC claimed by owner
// Alice removes liquidity
- Burns 1000 wUSDC (minus DIVA fees)
- Receives ~990 USDC (after DIVA fees)
- Total wToken supply = 1000

Root cause in code:

// 1. Fixed 1:1 minting in _handleTokenOperations
function _handleTokenOperations(address _collateralToken, uint256 _collateralAmount, address _wToken) private {
// Deposits collateral to Aave
IAave(_aaveV3Pool).supply(_collateralToken, _collateralAmount, address(this), 0);
// Mints wTokens 1:1, ignoring appreciation
IWToken(_wToken).mint(address(this), _collateralAmount);
}
// 2. Yield calculation in _getAccruedYieldPrivate
function _getAccruedYieldPrivate(address _collateralToken) private view returns (uint256) {
uint256 aTokenBalance = IERC20Metadata(IAave(_aaveV3Pool).getReserveData(_collateralToken).aTokenAddress)
.balanceOf(address(this));
uint256 wTokenSupply = IERC20Metadata(_collateralTokenToWToken[_collateralToken]).totalSupply();
return aTokenBalance > wTokenSupply ? aTokenBalance - wTokenSupply : 0;
}

Impact

  • Users cannot benefit from yield generated by their deposits

  • Yield is unfairly distributed to contract owner

  • DIVA fees are calculated on non-appreciated amounts

  • Misaligned incentives for long-term deposits

Tools Used

Manual Analysis

Recommendations

Implement rebasing wTokens that track aToken value.

Updates

Lead Judging Commences

bube Lead Judge 6 months ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.