> 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

Cheap, fixed fee flash loans leveraging liquidity from any pod

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>
