🔰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.


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 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.

 * @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()
function flash(
  address recipient,
  address token,
  uint256 amount,
  bytes calldata data
) external;

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!

 * @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()
interface IFlashLoanRecipient {
  function callback(bytes calldata data) external;

Last updated