You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 1, 2023. It is now read-only.
sherlock-admin opened this issue
Mar 27, 2023
· 0 comments
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
if NullEpoch, emissionsToken will remain in the contract.
Vulnerability Detail
When calling createEpochWithEmissions() to create an epoch, it will transfer the EmissionsToken to the vaults
The code is as follows:
function createEpochWithEmissions(
uint256_marketId,
uint40_epochBegin,
uint40_epochEnd,
uint16_withdrawalFee,
uint256_permiumEmissions,
uint256_collatEmissions
) publicreturns (uint256epochId, address[2] memoryvaults) {
// no need for onlyOwner modifier as createEpoch already has modifier
(epochId, vaults) =createEpoch(
_marketId,
_epochBegin,
_epochEnd,
_withdrawalFee
);
emissionsToken.safeTransferFrom(treasury, vaults[0], _permiumEmissions); //<-----transfer to vaults[0]ICarousel(vaults[0]).setEmissions(epochId, _permiumEmissions);
emissionsToken.safeTransferFrom(treasury, vaults[1], _collatEmissions); //<-----transfer to vaults[1]ICarousel(vaults[1]).setEmissions(epochId, _collatEmissions);
}
when the user withdraw() in vaults, the token will be transferred to the user in proportion to the shares.
but the consideration is missing here if no one makes a deposit for this epoch. It will be triggerNullEpoch()
In this case, no one can withdraw(), and the emissionsToken will remain in the contract.
recommended that if NullEpoch, return the emissionsToken to treasury
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
bin2chen
medium
emissionsToken may be remain in the contract
Summary
if
NullEpoch
, emissionsToken will remain in the contract.Vulnerability Detail
When calling
createEpochWithEmissions()
to create an epoch, it will transfer the EmissionsToken to the vaultsThe code is as follows:
when the user
withdraw()
in vaults, the token will be transferred to the user in proportion to the shares.but the consideration is missing here if no one makes a deposit for this epoch. It will be
triggerNullEpoch()
In this case, no one can
withdraw()
, and the emissionsToken will remain in the contract.recommended that if NullEpoch, return the emissionsToken to treasury
Impact
emissionsToken may be locked in the contract
Code Snippet
https://github.com/sherlock-audit/2023-03-Y2K/blob/main/Earthquake/src/v2/Carousel/CarouselFactory.sol#L132
Tool used
Manual Review
Recommendation
Duplicate of #122
The text was updated successfully, but these errors were encountered: