Function: investWithToken(address account, IOrigamiInvestment.InvestQuoteData quoteData)
This function is called by the oToken contract during the investing process.
Inputs
accountConstraints: If the global variable
allowAllis true, theaccountis not validated. Otherwise, if the address is not a contract, theallowedAccountsshould contain theaccountaddress oraccountshould be equal to theovTokenaddress.Impact: The address of the caller of the
OToken:investWithTokenfunction who initiated investing process.
quoteData.fromTokenConstraints: Should be equal to
asset.Impact: The address of the token that will be invested.
quoteData.fromTokenAmountConstraints: No constraints.
Impact: The invested token amount.
Branches and code coverage
Intended branches
The
investWithTokenwas executed properly
Negative behavior
fromTokenis not approved.accountis not allowed._paused.investmentsPausedis true.
Function call analysis
this.lendingClerk.deposit(quoteData.fromTokenAmount)What is controllable?
quoteData.fromTokenAmountIf the return value is controllable, how is it used and how can it go wrong? N/A.
What happens if it reverts, reenters or does other unusual control flow? The function transfers
assettokens (should be equal to thefromToken, otherwise it reverts) from this contract to thelendingClerkand allocates them to the IdleStrategyManager contract and mints debt tokens for strategy.