Skip to content
This repository has been archived by the owner on Oct 1, 2023. It is now read-only.

0x52 - Emissions sent to vault with null epoch will be lost forever #510

Closed
sherlock-admin opened this issue Mar 28, 2023 · 0 comments
Closed
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Medium A valid Medium severity issue Reward A payout will be made for this issue

Comments

@sherlock-admin
Copy link
Contributor

sherlock-admin commented Mar 28, 2023

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

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

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

@github-actions github-actions bot closed this as completed Apr 3, 2023
@github-actions github-actions bot added Medium A valid Medium severity issue Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label labels Apr 3, 2023
@sherlock-admin sherlock-admin added the Reward A payout will be made for this issue label Apr 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Medium A valid Medium severity issue Reward A payout will be made for this issue
Projects
None yet
Development

No branches or pull requests

1 participant