Assessment reports>Bond Protocol>Threat Models>registerMarket

Function registerMarket(ERC20 payoutToken_, ERC20 quoteToken_)

  1. Intended behavior.

    • Allows the whitelisted auctioneer contracts to register a new market.

    • Each market gets a unique marketId.

  2. Negative behavior.

    • shouldn’t allow to rewrite existing market - every new market will have new unique marketId, therefore, it is not possible to overwrite an existing one.

    • shouldn’t allow to untrusted contract to register the market - there is a check that msg.sender should be whitelisted contract address, however the market can be created by anyone(eg. BondFixedExpirySDA) so what’s the point of whitelisting in the first place? - markets can be created only using trusted SDA contacts.

    • The market counter should increase whenever a new market has been created, so that no two markets can be overwritten.

  3. Preconditions.

    • Assumes that msg.sender has been whitelisted beforehand (in this case that the aggregator calls)

    • Assumes that the payoutToken and quoteTokens are not 0 and are not equal (team said this is intended behavior)

  4. Postconditions.

    • the new market should get a new unique marketId value

    • corresponding IBondAuctioneer address should be saved for marketId inside marketsToAuctioneers mapping

  5. Inputs.

    • caller controls ERC20 payoutToken* and ERC20 quoteToken* addresses. Should check that addresses are not 0 and are not equal

  6. Examine all function calls the function makes.

    • There are no function calls here.

Zellic © 2024Back to top ↑