Peapods Finance
  • 🫛Peapods Overview
    • ❔What does Peapods do?
  • 🪙PEAS Tokenomics
    • 🗳️vlPEAS Governance
    • 💰Revenue Sharing
  • 🧑‍🌾Volatility Farming
  • 💹Leveraged Volatility Farming (LVF)
  • 🫛Pods
    • 📈Green Arrow Pods
  • 🫛LVF Pods
    • 🤝Self-Lending DCLP Pods
    • 🤖How Self-Lending Pods are Created
    • 🌊Dynamic Liquidity
    • 🧐Self-Lending Pods Example
  • 🏦Meta Vaults
  • 💹pOHM: The Pod Amplifier
  • 📗How To Guides
    • How to create a Pod
    • How to Wrap into a Pod
    • How to Farm Volatility
  • 🔗Links
    • Contract Addresses
    • Technical CAs
    • 🔍Audits
    • Socials
  • 📚Glossary
    • Common Terms
    • TKN Acronyms
Powered by GitBook
On this page
  • Fees
  • Execute Flash Loan
  • Flash Loan Receiver Interface

Flash Loans

Cheap, fixed fee flash loans leveraging liquidity from any pod

Last updated 11 months ago

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 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;
}
🔰
PEAS