code-423n4 / 2022-05-rubicon-findings

5 stars 2 forks source link

QA Report #438

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Different pragmas

contracts under peripheral (bathbuddy)use pragma solidity >=0.6.0 <0.8.0; while in the core contracts we have pragma solidity =0.7.6;

Natspec incomplete

To make the contract clearer to users and avoid some misunderstandings, it is recommended to use natspec for any public/external functions/variables in the code and tools can use that to display it to end users

File: Bathhouse.sol line 388,

    /// @dev Low-level functionality to spawn a Bath Token using the OZ Transparent Upgradeable Proxy standard
    /// @param underlyingERC20 The underlying ERC-20 asset that underlies the newBathTokenAddress
    /// @param _feeAdmin Recipient of pool withdrawal fees, typically the pool itself
    function _createBathToken(ERC20 underlyingERC20, address _feeAdmin)
        internal
        returns (address newBathTokenAddress)
    {

Missing @return

File: Bathtoken.sol line 754

    /// @notice The best-guess total claim on assets the Bath Token has
    /// @dev returns the amount of underlying ERC20 tokens in this pool in addition to any tokens that are outstanding in the Rubicon order book seeking market-making yield (outstandingAmount)
    function underlyingBalance() public view returns (uint256) {
        uint256 _pool = IERC20(underlyingToken).balanceOf(address(this));
        return _pool.add(outstandingAmount);

missing @return

File: Bathpair.sol line 158

    /// @notice This function enforces that the Bath House reserveRatio (a % of underlying pool liquidity) is enforced across all pools
    /// @dev This function should ensure that reserveRatio % of the underlying liquidity always remains on the Bath Token. Utilization should be 1 - reserveRatio in practice assuming strategists use all available liquidity.
    function enforceReserveRatio(
        address underlyingAsset,
        address underlyingQuote
    )
        internal
        view
        returns (address bathAssetAddress, address bathQuoteAddress)

Missing @param and @return

File: BathPair.sol line 303

    /// @notice A function that returns the index of uid from array
    /// @dev uid must be in array for the purposes of this contract to enforce outstanding trades per strategist are tracked correctly
    function getIndexFromElement(uint256 uid, uint256[] storage array)
        internal
        view
        returns (uint256 _index)

Missing @param and @return

File: BathPair.sol line 629

    /// @notice The goal of this function is to enable a means to retrieve all outstanding orders a strategist has live in the books
    /// @dev This is helpful to manage orders as well as track all strategist orders (like their RAM of StratTrade IDs) and place any would-be constraints on strategists
    function getOutstandingStrategistTrades(
        address asset,
        address quote,
        address strategist
    ) public view returns (uint256[] memory) {
        return outOffersByStrategist[asset][quote][strategist];
    }
}

Missing @param and @return

Inconsistency with Natspec

In bathtoken.sol and most of the other contracts, natspec is used irregulary, some function have it some don't.