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

immeas - emissions for null epochs are lost #285

Closed
sherlock-admin opened this issue Mar 27, 2023 · 0 comments
Closed

immeas - emissions for null epochs are lost #285

sherlock-admin opened this issue Mar 27, 2023 · 0 comments
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 27, 2023

immeas

high

emissions for null epochs are lost

Summary

Emissions are sent to the vaults upon epoch creation. If no one stakes in the vault during the epoch the emissions in that vault will be lost.

Vulnerability Detail

When creating an epoch for Carousel the owner has the choice to add emissions for that epoch, that are distributed to stakers:
https://github.com/sherlock-audit/2023-03-Y2K/blob/main/Earthquake/src/v2/Carousel/CarouselFactory.sol#L148-L152

These emissions are then locked to that epoch:
https://github.com/sherlock-audit/2023-03-Y2K/blob/main/Earthquake/src/v2/Carousel/Carousel.sol#L591-L597

If no one stakes in the vault during this epoch (null epoch) these emission tokens will be lost in the contract forever as there are no shares to split them with:
https://github.com/sherlock-audit/2023-03-Y2K/blob/main/Earthquake/src/v2/Carousel/Carousel.sol#L630-L636

Impact

All emission tokens for an epoch will be effectively burnt if there are no stakers during that epoch (null epoch).

Code Snippet

See above

Tool used

Manual Review

Recommendation

If finalTVL is 0 for an epoch (no stakers). Return all emissions for that epoch to treasury:
Add to Carousel.sol:

    function resolveEpoch(uint256 _id)
        external
        override(VaultV2)
    {
        super.resolveEpoch(_id);

        // null epoch, no stakers, hand back emissions
        if(finalTVL[_id] == 0) {
            emissionsToken.safeTransfer(treasury,emissions[_id]);
        }
    }

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