Part 2

Zaros
PerpetualsDEXFoundrySolidity
70,000 USDC
View results
Submission Details
Severity: high
Valid

Incorrect WETH Reward Calculation in Market::getVaultAccumulatedValues

Summary

The function getVaultAccumulatedValues incorrectly calculates the wethRewardChangeX18 by subtracting lastVaultDistributedWethRewardPerShareX18 from self.wethRewardPerVaultShare, without multiplying by the vault's credit share (vaultCreditShareX18). This results in the vault receiving more WETH rewards than it should. This could drain the markets as vaults are rewarded more than they are entitled to.


Vulnerability Details

The wethRewardChangeX18 is currenty calculated by following:

wethRewardChangeX18 = ud60x18(self.wethRewardPerVaultShare).sub(lastVaultDistributedWethRewardPerShareX18);

This value is returned Vault::recalculateVaultsCreditCapacity, where the weth distribution is updated:

self.wethRewardDistribution.distributeValue(vaultTotalWethRewardChangeSD59X18);

Here vaultTotalWethRewardChangeSD59X18 contains all the shares of all vault. As a result, if users of one vault claims reward, there will be shortage of WETH for other vault's WETH reward.

The change in WETH rewards should be multiplied by vaultCreditShareX18 (which represents the vault's proportion of the total delegated credit). Otherwise it is returning the whole reward. It will cause draining of WETH reward.


Impact

Vaults are receiving more rewards than they are entitled to, leading to unintended reward allocations and loss of funds from the vault

Recommendation

Multiply wethRewardChangeX18 by vaultCreditShareX18

Update the WETH reward calculation to:

wethRewardChangeX18 = (ud60x18(self.wethRewardPerVaultShare).sub(lastVaultDistributedWethRewardPerShareX18)).mul(vaultCreditShareX18);
Updates

Lead Judging Commences

inallhonesty Lead Judge 10 months ago
Submission Judgement Published
Validated
Assigned finding tags:

`wethRewardPerVaultShare` is incremented by `receivedVaultWethReward` amount which is not divided by number of shares.

Support

FAQs

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

Give us feedback!