Assessment reports>Avon>Discussion>Inconsistency between comments and implementation

Inconsistency between comments and implementation

The comment for the function setFlatMatchingFee states that flatMatchingFee is the flat fee amount in loan token.

/// @notice Sets the flat matching fee amount
! /// @param _flatMatchingFee The flat fee amount in loan token
/// @dev Only the owner can set the flat matching fee
function setFlatMatchingFee(uint256 _flatMatchingFee) external onlyOwner {
    flatMatchingFee = _flatMatchingFee;
    emit EventsLib.FlatMatchingFeeSet(_flatMatchingFee);
}

However, in actual usage, the flat fee amount charged is in collateral token. This is inconsistent and should be aligned.

function matchMarketBorrowOrder(uint256 amount, uint256 minAmountExpected, uint256 collateralBuffer, uint64 ltv, uint64 rate)
    external
    nonReentrant
    whenNotPaused
{
    // [...]

    if (matchedOrder.totalMatched > 0) {
        // [...]

        // 4. Collect matching fee
        if (flatMatchingFee > 0 && feeRecipient != address(0)) {
!            collateralToken.safeTransferFrom(msg.sender, feeRecipient, flatMatchingFee);
            emit EventsLib.MatchingFeeCollected(msg.sender, feeRecipient, flatMatchingFee);
        }

        // [...]
    }
}

This issue has been acknowledged by AVON TECH LTD, and a fix was implemented in commit 4726222c.

Zellic © 2025Back to top ↑