Assessment reports>Origami Finance>Threat Model>investWithToken

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 that quoteData.fromToken is equal to the asset 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 zero

  • The caller owns fewer than the quoteData.fromTokenAmount of quoteData.fromToken.

Zellic © 2025Back to top ↑