salvorio / salvor-contracts

0 stars 0 forks source link

[AMR-02M] Non-Linear Reduction of Commission Percentage #17

Open HKskn opened 4 months ago

HKskn commented 4 months ago

AMR-02M: Non-Linear Reduction of Commission Percentage

Type Severity Location
Mathematical Operations AssetManager.sol:L312-L316

Description:

The AssetManager::_calculateFee function will decay the commission percentage based on the user's veArt token ownership percentage if the commissionDiscountEnabled flag is true, however, it will decay it non-linearly with a significant jump from a 0.99% to 1% ownership percentage of the veArt supply.

Impact:

This mechanism may be desirable behaviour and as such has been classified of unknown severity.

Example:

uint256 userShare =  10000 * userBalance / totalSupply;
if (userShare >= 100) {
    _commissionPercentage = 0;
} else if (userShare >= 10) {
    _commissionPercentage -= uint96(_getPortionOfBid(_commissionPercentage, ((userShare - 10) * 6000 / 90) + 1000));
}

Recommendation:

We advise this trait to be re-evaluated and the mechanism to potentially linearly decay until it reaches 0, ensuring a fair balance between a user's veArt supply ownership and the commission they have to pay for.

HKskn commented 4 months ago

Fixed. We have removed the calculateFee(deprecated).