sherlock-audit / 2024-04-titles-judging

6 stars 6 forks source link

0xShiki - Lack of event in `FeeManager` contract when protocol fees are changed #300

Closed sherlock-admin3 closed 2 months ago

sherlock-admin3 commented 3 months ago

0xShiki

medium

Lack of event in FeeManager contract when protocol fees are changed

0xShiki

medium

Summary

The FeeManager contract is responsible for calculating and collecting fees throughout the TITLES protocol. However, there is no event emitted when the protocol fees are changed. This can make it difficult to track changes in the protocol fees.

Vulnerability Detail

In setProtocolFees function in FeeManager contract, important parameters are set and changed.

    function setProtocolFees(
        uint64 protocolCreationFee_,
        uint64 protocolFlatFee_,
        uint16 protocolFeeShareBps_,
        uint16 mintReferrerRevshareBps_,
        uint16 collectionReferrerRevshareBps_
    ) external onlyOwnerOrRoles(ADMIN_ROLE) {
        if (
            protocolCreationFee_ > MAX_PROTOCOL_FEE || protocolFlatFee_ > MAX_PROTOCOL_FEE
                || protocolFeeShareBps_ > MAX_PROTOCOL_FEE_BPS
                || (mintReferrerRevshareBps_ + collectionReferrerRevshareBps_) > MAX_BPS
        ) {
            revert InvalidFee();
        }
@>      protocolCreationFee = protocolCreationFee_;
@>      protocolFlatFee = protocolFlatFee_;
@>      protocolFeeshareBps = protocolFeeShareBps_;
@>      mintReferrerRevshareBps = mintReferrerRevshareBps_;
@>      collectionReferrerRevshareBps = collectionReferrerRevshareBps_;
    }

However, there is no event emitted when the protocol fees are changed, which makes it difficult to track these changes off-chain.

Impact

There is a possibility that users would not be aware of protocol fee changes.

Code Snippet

https://github.com/sherlock-audit/2024-04-titles/blob/main/wallflower-contract-v2/src/fees/FeeManager.sol#L298

Tool used

Manual Review

Recommendation

Consider adding an event to setProtocolFees function in the FeeManager contract. The ProtocolFeesChanged event can be emitted with the new protocol fees as parameters.