Skip to content

Latest commit

 

History

History
43 lines (28 loc) · 2.31 KB

File metadata and controls

43 lines (28 loc) · 2.31 KB

Ancient Neon Koala

Medium

Pausing inflates CGDA rewards and causes unfair claiming

Summary

The CGDAIncentive contract will report an inflated reward when the underlying token is paused, causing unfair loss of claims for some participants.

Vulnerability Detail

The specifications of the protocol state that Protocol should work with all native and ERC20 tokens that adhear to standard including weird tokens. This includes tokens which can be paused (such as BNB).

The CGDAIncentive contract linearly increases the claimable reward as time elapses:

    function currentReward() public view override returns (uint256) {
        uint256 timeSinceLastClaim = block.timestamp - cgdaParams.lastClaimTime;
        uint256 available = asset.balanceOf(address(this));


        // Calculate the current reward based on the time elapsed since the last claim
        // on a linear scale, with `1 * rewardBoost` added for each hour without a claim
        uint256 projectedReward = cgdaParams.currentReward + (timeSinceLastClaim * cgdaParams.rewardBoost) / 3600;
        return projectedReward > available ? available : projectedReward;
    }

However, it fails to account for the circumstance that the underlying token is paused, in which case the reward will continue to inflate as claims will not be possible during this time.

Impact

If tokens are paused for extended periods of time, the first claimers upon unpausing the token will earn an outsized reward. But the total balance of the incentive contract is divided upon a first-come first-serve basis, so the later participants will not have any remaining claimable balance.

This causes loss of funds for most ordinary users as the ones who respond most quickly to the unpausing of the token will be automated, putting normal users at a disadvantage.

Code Snippet

https://github.com/sherlock-audit/2024-06-boost-aa-wallet/blob/main/boost-protocol/packages/evm/contracts/incentives/CGDAIncentive.sol#L123-L131

Tool used

Manual Review

Recommendation

Consider including a push-pull model where claims can be acknowledged even when paused, with transfers claimed in a separate call. Alternatively consider including some means of checking if the contract is paused or having a mechanism for admin to forcefully pause the inflation of rewards during this time period.