Function _createMarket(_createMarket(MarketParams memory params_) internal returns (uint256)
Intended behavior.
Creates a new bond market.
Negative behavior.
add a check that
vesting <= MAX_FIXED_TERMforBondFixedTermTellerShouldn’t allow creating markets when
allowNewMarketsis set to false.When a market is created, its
idmust be unique (this is ensured inaggregator’screateMarketfunction)
Preconditions.
assumes markets can be created (
allowNewMarkets)assumes the MarketParams are properly checked
assumes
quoteTokensandpayoutTokensare not something sketchy (since anyone can create a market)disallow registering a callback if a user is not whitelisted to do so. also, what if the status of a user changes? it’s not reflected in the market the user owns, as they could still call the callback.
Postconditions.
The new market will be stored in a mapping
market [id] -> MarketParamsobject.The new market will have its own new market terms, market metadata and market params created.
Inputs.
The input is basically a set of
marketparamsthat’s used to store the info of a new market.
Examine all function calls the function makes.
a.
uint256 marketId = aggregator.registerMarket(params.payoutToken, params_.quoteToken);What is controllable? (callee, params, return value): the parameters are controllable (supplied as function params to function where this is called); something to note is the fact that anyone can create a market for whatever
payoutTokenorquoteToken(even dummy ones); haven’t yet found a way to exploit the protocol through this.If return value controllable, how is it used and how can it go wrong: the return value is really important, so it must always increase (e.g. to not overwrite a previous market’s details); this is ensured in the
registerMarket. Hence it will always increase.What happens if it reverts or tries to reenter: n/a