RACE #16 - Flash Loan

RACE #16
RACE #16 result

Note: All 8 questions in this RACE are based on the below contract. This is the same contract you will see for all the 8 questions in this RACE. The question is below the shown contract.

Question 1

Which of the following is an explanation of why flashLoan() could revert?

Question 2

If the FlashLoan contract were safe, which of the following invariants should hold at the end of any given transaction for some ERC20 token t? Note: old(expr) evaluates expr at the beginning of the transaction.

Comment:

For the flashloan to be safe, the contract's token balance must be maintained no matter which function is called. It must be (A) because flashloan will cause the token balance to either increase or stay the same (depending on fee) and all other functions should maintain token balances

Question 3

Which of the following tokens would be unsafe for the above contract to loan as doing so could result in theft?

Question 4

Which external call made by flashLoan() could result in theft if the token(s) identified in the previous question were to be used?

Question 5

What is the purpose of the fee in the FlashLoan contract as is?

Comment:

In the current FlashLoan contract, as it is, the sole purpose of the fee is to increase the available funds to loan.

Question 6

Which of the following describes the behavior of maxFlashLoan for a standard ERC20 token over time?

Question 7 - This one tricky

For some arbitrary ERC20 token t, which of the following accurately describes the FlashLoan contract’s balance of t after a successful (i.e. non-reverting) call to flashLoan() (where t is the token requested for the flashloan):

Comment:

flashLoan() can hypothetically finish successfully with any token that implements the ERC20 interface, even if it is a bogus implementation. Therefore, there are no guarantees on the output of IERC20(token).balanceOf(user).

Question 8

Which of the following are guaranteed to hold after a successful (i.e., non-reverting) execution of flashLoan(), assuming the token for which the flashloan is requested uses OpenZeppelin’s Standard ERC20 implementation?

Last updated

Was this helpful?