The protocol fee earned by adding liquidity to uniswap through OCL_ZVE distributed to tranche token holders and DAO. But in some cases where the amount of pairAsset is increase in pool, excess rewards are given to tranche token holders.
Vulnerability Detail
Tranche token holders deposit stablecoins into tranches. The stablecoins are paired with ZVE from DAO and are used to provide liquity to uniswap through OCL_ZVE.
Any yield from uniswap protocol free is re-distributed to token holders and DAO. To account for the amount of yield added basis is being used. But the basis just accounts for the pairAsset change. So if new yield is added, the correponding LP tokens are calculated and burnt and the withdrawn pairAsset and ZVE are distributed.
So in this case, if the pairAsset amount increases than its considered new yield is added in the form of protocol fee. But there will be cases where the pairAsset will increase due to swaps which doesn't mean new yield is added. But in this cases also the yield is being distributed
Consider this scenario
Alice adds 100 USDC to tranche.
DAO deposits 100 USDC / 100 ZVE to uniswap
Now due to swaps amount in the pool changes to 150 USDC / 66.66 ZVE
Now the basis becomes 150 - 100 = 50 USDC
So the LP tokens = 50 * 100 / 150 = 33.33
So 33.33 Lp tokens are burned
You get 50 USDC and 21.9 ZVE are to be distributed
The token holders are being distributed 50 USDC even is no yield is generated. This is happening due to considering only pairAsset for basis
Impact
Tranche Tokens holders get distributed yield even if there is no yield. Loss for protocol.
0xvj
medium
Excess yield is granted to tranche token holders
Summary
The protocol fee earned by adding liquidity to uniswap through OCL_ZVE distributed to tranche token holders and DAO. But in some cases where the amount of pairAsset is increase in pool, excess rewards are given to tranche token holders.
Vulnerability Detail
Tranche token holders deposit stablecoins into tranches. The stablecoins are paired with ZVE from DAO and are used to provide liquity to uniswap through OCL_ZVE.
Any yield from uniswap protocol free is re-distributed to token holders and DAO. To account for the amount of yield added
basis
is being used. But the basis just accounts for the pairAsset change. So if new yield is added, the correponding LP tokens are calculated and burnt and the withdrawn pairAsset and ZVE are distributed.So in this case, if the pairAsset amount increases than its considered new yield is added in the form of protocol fee. But there will be cases where the pairAsset will increase due to swaps which doesn't mean new yield is added. But in this cases also the yield is being distributed
Consider this scenario
The token holders are being distributed 50 USDC even is no yield is generated. This is happening due to considering only pairAsset for
basis
Impact
Tranche Tokens holders get distributed yield even if there is no yield. Loss for protocol.
Code Snippet
https://github.com/sherlock-audit/2024-03-zivoe/blob/main/zivoe-core-foundry/src/lockers/OCL/OCL_ZVE.sol#L311 https://github.com/sherlock-audit/2024-03-zivoe/blob/main/zivoe-core-foundry/src/lockers/OCL/OCL_ZVE.sol#L336
Tool used
Manual Review
Recommendation
Yield should not be distributed only considering the pairAsset amount for basis