Function deploy(ERC20 underlying_, uinty48 expiry_)
Intended behavior.
Allow users to create a new ERC20 token and associate it with
underlyingandexpiry_values.
Negative behavior.
Disallow creating a pair of
underlyingandexpirythat would overwrite already existingbondToken.Disallow creating a pair with
expiryin the past ORexpirydifferent than0(they do have that condition inhandlePayout)Also there isn’t any functionality to remove a
bondToken
Preconditions.
That
underlyingexists (there’s no check, however, that it’s address 0)That no bond for the
underlying, expirypair already existsdecimals()are standardizedThat the
expiry_is at least in the future
Postconditions.
That a
bondTokenis successfully created(if one did not previously exist)That clone will be reverted in case of
bondTokenfor these parameters already exists.That the
bondToken[underlying_][expiry_]stores the newly created contract address.
Inputs.
ERC20 underlying_: validation check that the pair of underlying, expiry doesn’t already exist
uint48 expiry_: validation check that the pair of underlying, expiry doesn’t already exist; also there is no check that is in the past.
Examine all function calls the function makes.
a. Call to
underlying_.decimals()What is controllable? (callee, params, return value): there is no params value.
If return value controllable, how is it used and how can it go wrong: No problem.
What happens if it reverts or tries to reenter: deploy has nonReentrant modifier.
b. Call to
ERC20BondToken(address(bondTokenImplementation).clone(tokenData))What is controllable? (callee, params, return value): tokenData is partly controllable.
If return value controllable, how is it used and how can it go wrong: return the new bondToken address.
What happens if it reverts or tries to reenter: should revert in case of token already exists.