The Standard

The Standard
DeFiHardhat
20,000 USDC
View results
Submission Details
Severity: low
Invalid

Protocol do not work with rebasing token

Summary

Protocol do not work with rebasing token, holders might not able to claim rewards due to token balance is rebased

Vulnerability Details

In the distributeAssets() function, reward is constant and saved on rewards mapping:

                    uint256 _portion = asset.amount * _positionStake / stakeTotal;   // <---
                    uint256 costInEuros = _portion * 10 ** (18 - asset.token.dec) * uint256(assetPriceUsd) / uint256(priceEurUsd)
                        * _hundredPC / _collateralRate;
                    if (costInEuros > _position.EUROs) {
                        _portion = _portion * _position.EUROs / costInEuros;  // <----
                        costInEuros = _position.EUROs;
                    }
                    _position.EUROs -= costInEuros;
                    rewards[abi.encodePacked(_position.holder, asset.token.symbol)] += _portion; // <--- save total rewards of the token

Rewards is claimed by calling claimRewards() function:

function claimRewards() external {
    ITokenManager.Token[] memory _tokens = ITokenManager(tokenManager).getAcceptedTokens();
    for (uint256 i = 0; i < _tokens.length; i++) {
        ITokenManager.Token memory _token = _tokens[i];
        uint256 _rewardAmount = rewards[abi.encodePacked(msg.sender, _token.symbol)];    // <-- get rewards amount
        if (_rewardAmount > 0) {
            delete rewards[abi.encodePacked(msg.sender, _token.symbol)];
            if (_token.addr == address(0)) {
                (bool _sent,) = payable(msg.sender).call{value: _rewardAmount}("");
                require(_sent);
            } else {
                IERC20(_token.addr).transfer(msg.sender, _rewardAmount);  // <-- transfer reward to user
            }   
        }
    }
}

If input token is rebasing token, holders might not able to withdraw token due to lack of avaiable balance in the contract

Impact

Holder's reward can be locked in the contract due to rebasing

Tools Used

Manual review

Recommendations

Reward should be transfered to holders directly instead of saving at the contract.

Updates

Lead Judging Commences

hrishibhat Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Out of scope
Assigned finding tags:

informational/invalid

hrishibhat Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Out of scope
Assigned finding tags:

informational/invalid

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.