Function: investWithToken(InvestQuoteData quoteData)
Allows to invest in accepted ERC-20 tokens and receive oTokens in return. Firstly, the quoteData.fromToken will be transferred to the _manager account. Then, _manager will process these tokens and determine the amount of oToken to be received in exchange. Finally, this calculated amount of oToken will be minted to the caller's account.
Inputs
quoteData.fromTokenAmountConstraints: Should not be zero.
Impact: The number of
quoteData.fromTokentransferred to the_manageraccount.
quoteData.fromTokenConstraints: There is no verification, but the
manager.investWithToken()function verifies thatquoteData.fromTokenis equal to theassetaddress; otherwise, it reverts.Impact: The address of the token that will be invested in exchange for oToken. So it should be only an approved ERC-20 token address.
Branches and code coverage
Intended branches
Successful investment
Negative behavior
fromTokenis not approved.quoteData.fromTokenAmountis zeroThe caller owns fewer than the
quoteData.fromTokenAmountofquoteData.fromToken.