DeFi Saver
Action that gets and receives a flash loan from the dYdX protocol. The action is implemented as a standard DFS flash loan action.
Inputs are not parsed as the FL action is always the first action and there are no return values before this action. Inputs are the following:


  • uint256 amount - Amount of tokens being flash loaned.
  • address token - Address of the token being flash loaned (dYdX supports WETH, DAI and USDC).
  • address flParamGetterAddr - Address of an on-chain contract that can change (amount, token) while calling the action. If it's an empty address it will not be called.
  • bytes flParamGetterData - Data that will be supplied to flParamGetter contract
  • {} - An extra empty parameter (explained why it's needed in the Flash loans section)
The return value of this action is amount + fee.
There is no flash loan fee in dYdX, but due to calculation issues you need to return 2 wei more of the tokens that you borrowed. We use a special FLFeeFaucet that provides those 2 wei so they aren't taken from the user.
Last modified 8mo ago
Copy link