0% Flash Loans
Here we explain about how flash loans work and how ARTH is able to provide 0% flashloans
A flash-loan allows a user to borrow ARTH without the need of collateral. Since these loans are governed by smart contracts which forces a user to payback the loan, the transaction will fail if the principal is not paid back.
Flash loans allow users to borrow large sums of funds without having to have any collateral in hand.
Unlike protocols like Aave which charge a fees to borrowers when they take a flash-loan, ARTH's flash-loan mechanism charges 0% fees. Which means a user can borrow and repay a near infinite supply of ARTH as long as they are able to pay back the loan within the same transaction.

Why use ARTH's 0% flash loans?

There are many use cases with the 0% flash loans. A few of them have been listed below.
  • Perform arbitrage across various pairs without having any capital
  • Open leveraged long positions on cryptocurrencies using ARTH's lending mechanism

Governance

All flash loan contracts are controlled by the Governance contract which is governed by MAHA holders. Governance can decide to either:
  • Pause the flash loan contract
  • Change the fee that gets charged (which is currently set at 0%)
To learn more about governance visit the Governance section.

How to use ARTH flash loans?

Visit the Github repository to view an example flash-loan. Use the following lender addresses below for the appropriate network.
Deployed Lender Addresses:
View the FlashLoanExample.sol file for an example on how to create a flash-loan contract. The main logic to write where a user can use the flash-loan funds is in the onFlashLoan function in FlashLoanExample.sol#L28-L30.
1
function onFlashLoan(
2
address who,
3
uint256 amount,
4
uint256 fee,
5
bytes calldata data
6
) external override returns (bytes32) {
7
require(msg.sender == address(lender), "not lender");
8
require(who == address(this), "not contract");
9
10
// Write your logic here
11
// make sure that this contract has a balance of (amount + fee) once you're done
12
// the (amount + fee) is burnt off for the contract to succeed.
13
14
// Once done, make sure to return this hash to let the lender know it's gone succesfully else the
15
// tx will revert
16
return keccak256("FlashMinter.onFlashLoan");
17
}
18
Copied!