# Flashloan

INIT offers a 0% fee flashloan for users to atomically use the available liquidity from lending pools to use elsewhere. The caller of `flash` function must be a contract that implements `flashCallback` function.&#x20;

During the flashloan, the caller receives flashloan from lending pools and can execute arbitrary logic from bytes `data` through `flashCallback` which is called to the caller by InitCore. At the end of the flashloan, the caller must return the loan to the borrowed lending pools.

{% hint style="info" %}
It is recommended to check that the sender is the InitCore in the `flashCallback` function to prevent unauthorized calls.
{% endhint %}

```solidity
// Example Flashloan contract
contract FlashloanContract {
    function flashCallback(address[] calldata lendingPools, uint256[] calldata amounts, bytes calldata data) external {
        // check that the caller is InitCore
        require(msg.sender == INIT_CORE, 'unauthorized'); 
        
        // do some logic 
        
        // transfer back amounts to corresponding lending pools
    }
    
    function flash(address[] calldata lendingPools, uint256[] calldata amounts, bytes calldata data) external {
        // initiate flash loan
        IInitCore(INIT_CORE).flash(lendingPools, amounts, data);
    }
}


```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dev.init.capital/guides/advanced-interaction/flashloan.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
