> For the complete documentation index, see [llms.txt](https://docs.peapods.finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.peapods.finance/flash-loans.md).

# Flash Loans

The tokens from any pod can be used to execute a flash loan for any amount for a small fee of 10 DAI at any point in time. It's simple to create a flash loan programmatically by implementing a small interface on a receiving contract to use the funds and return them all in the same block.

## Fees

Anywhere you execute `flash` make sure you approve 10 DAI against the pod token you're executing a flash loan against on this wallet/contract which will be transferred to the pod contract. This DAI is used to buy [PEAS](/peas-tokenomics.md) and paid to LPs for this pod.

## Execute Flash Loan

All pods implement the following interface you can call from your smart contract to borrow liquidity from the pod.

<pre><code>/**
 * @notice execute a flash loan from an index fund contract
 * @param recipient, address of the wallet/contract to receive borrowed funds
 * @param token, token in the index fund to borrow
 * @param amount, amount of tokens to borrow
 * @param data, any arbitrary data to send to the callback, use abi.encode()
 */
<strong>function flash(
</strong><strong>  address recipient,
</strong>  address token,
  uint256 amount,
  bytes calldata data
) external;
</code></pre>

## Flash Loan Receiver Interface

Implement the following interface from your receiver to execute a flash loan. Just make sure to return any borrowed funds in the callback and do whatever you need!

<pre><code>/**
 * @notice callback logic for a receiver to use borrowed funds from a flash loan 
 * @param data, arbitrary data to use in the callback, use abi.decode()
 */
<strong>interface IFlashLoanRecipient {
</strong>  function callback(bytes calldata data) external;
<strong>}
</strong></code></pre>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.peapods.finance/flash-loans.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
