callback( uint256 id_, uint256 inputAmount_, uint256 outputAmount_ ) external
Intended behavior.
Depending on the implementation of the
_callback
function,callback
is supposed to send thepayoutTokens
back to the teller.
Negative behavior.
Shouldn’t send the
payoutToken
to someone else other than theteller
.Shouldn’t allow a teller with a different
aggregator
to call the function
Preconditions.
Assumes
msg.sender
is approved.Assumes that a market for that
id
exists within theaggregators'
marketsAssumes that the whitelist is the same as the aggregator’s; OTHERWISE, it could theoretically be called by a malicious
msg.sender
since there are two different whitelists. Thatmsg.sender
could then exploit the contract and drain allpayoutToken
; they should use the Aggregator’s whitelist just as they do with getting the markets
Postconditions.
quoteToken.balanceOf(address(this)) += inputAmount
,payoutToken_.balanceOf(address(this)) -= outputAmount
quoteToken.balanceOf(msg.sender) -= inputAmount
,payoutToken_.balanceOf(msg.sender) += outputAmount
priorBalances
mapping should be updated properly (for both tokens)
Inputs.
uint256 id_ - controlled
uint256 inputAmount_ - controlled, but there is a check that the balance was increased by the corresponding value of the
quoteToken
tokens.uint256 outputAmount* - controlled, there are no checks on the
outputAmount*
value, that is, any amount ofpayoutToken
tokens can be sent to themsg.sender
. Therefore, the market owner must be very careful with the whitelist of trusted callers.
Examine all function calls the function makes.
Call to
_callback(id, quoteToken, inputAmount_, payoutToken, outputAmount_)
: any logic implemented by the owner of the market (it’s implementation agnostic); seems like the responsibility is shifted towards market owner.