Flashloans
Flashloans allows any smart contract to execute any arbitrary code after borrowing as long as the funds are returned to the lending protocol within the scope of the same transaction.
Last updated
Flashloans allows any smart contract to execute any arbitrary code after borrowing as long as the funds are returned to the lending protocol within the scope of the same transaction.
Last updated
In Fuji's case, we have integrated three different Flashloan providers:
DyDx flashloans are free of charge but more complex to implement, you cannot use it while having collateral and debt on the protocol itself.
Fuji uses flashloans very often to save users money by choosing the lowest-interest protocol in the market. When the Controller identifies (off-chain) that an interest is lower in another protocol i.e. Aave vs Compound, then the Controller will call the flasher and execute a switch by taking all the collateral and debt from one protocol to the next.
Fuji's Flasher.sol
is a smart contract that uses SafeMath and UniERC20 (audited contracts by Open Zeppelin) to handle all the parameters that are going to be needed to execute the protocol switch.
When the flasher is called by the Controller, it will contain the parameter (0, 1, 2) to identify which flashloan to use.
After the Flasher borrows the needed amount to pay for all debt and withdraw the collateral, it will then deposit it in the right protocol that is offering the lowest-interest rate. To keep count of all the tokens flowing through Fuji we have Fuji1155.
Provider
% Charged per Tx
Aave
0.09%
DyDx
no fee*
Cream Finance
0.03%