Emissions sent to vault with null epoch will be lost forever
Summary
When the emissions of the vault are set for a specific epoch they are immediately sent to the contract. When an epoch is null it never reclaims the emissions causing them to be lost.
function createEpochWithEmissions(
uint256 _marketId,
uint40 _epochBegin,
uint40 _epochEnd,
uint16 _withdrawalFee,
uint256 _permiumEmissions,
uint256 _collatEmissions
) public returns (uint256 epochId, address[2] memory vaults) {
// no need for onlyOwner modifier as createEpoch already has modifier
(epochId, vaults) = createEpoch(
_marketId,
_epochBegin,
_epochEnd,
_withdrawalFee
);
emissionsToken.safeTransferFrom(treasury, vaults[0], _permiumEmissions);
ICarousel(vaults[0]).setEmissions(epochId, _permiumEmissions);
emissionsToken.safeTransferFrom(treasury, vaults[1], _collatEmissions);
ICarousel(vaults[1]).setEmissions(epochId, _collatEmissions);
}
Here we see the tokens are taken when emissions are created. If there is a null epoch there is no on not claim the tokens so they are lost forever because they aren't transferred back during setting of the null epoch
0x52
high
Emissions sent to vault with null epoch will be lost forever
Summary
When the emissions of the vault are set for a specific epoch they are immediately sent to the contract. When an epoch is null it never reclaims the emissions causing them to be lost.
Vulnerability Detail
https://github.com/sherlock-audit/2023-03-Y2K/blob/main/Earthquake/src/v2/Carousel/CarouselFactory.sol#L132-L153
Here we see the tokens are taken when emissions are created. If there is a null epoch there is no on not claim the tokens so they are lost forever because they aren't transferred back during setting of the null epoch
Impact
Emissions are lost when there is a null epoch
Code Snippet
CarouselFactory.sol#L132-L153
Tool used
Manual Review
Recommendation
Reclaim emissions on null epoch
Duplicate of #122