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.fromTokenAmount
Constraints: Should not be zero.
Impact: The number of
quoteData.fromToken
transferred to the_manager
account.
quoteData.fromToken
Constraints: There is no verification, but the
manager.investWithToken()
function verifies thatquoteData.fromToken
is equal to theasset
address; 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
fromToken
is not approved.quoteData.fromTokenAmount
is zeroThe caller owns fewer than the
quoteData.fromTokenAmount
ofquoteData.fromToken
.