LogoLogo
1.0.0
1.0.0
  • About Saddle
  • Automated Market Makers
  • Saddle Pools
  • Community Pools
  • Layer 2 Guide
  • SDL Token
  • veSDL (vote escrowed) SDL
  • Cross Chain Gauges
  • Governance (SIPs)
  • Saddle Incentives
  • Saddle Protocol Stats
  • Yield Farming Tools
  • Build With Saddle
  • Smart Contract Security
  • Asset Specific Risks
  • Saddle FAQ
  • Glossary
  • How to Flash-loan Assets from Saddle
  • Contract Addresses
  • Solidity Docs
    • StakeableTokenWrapper
    • MathUtils
    • Swap
    • Allowlist
    • SwapUtils
    • OwnerPausable
    • LPToken
    • Interfaces
      • ISwap
      • IAllowlist
      • ISwapV1
      • ISwapGuarded
      • ISwapFlashLoan
      • IMetaSwap
      • IFlashLoanReceiver
    • Helper
      • Test
        • TestSwapReturnValues
      • GenericERC20
      • Multicall
      • Multicall2
      • FlashLoanBorrowerExample
    • Meta
      • MetaSwap
      • MetaSwapDeposit
      • MetaSwapUtils
    • Guarded
      • SwapGuarded
      • SwapUtilsGuarded
      • OwnerPausable
      • LPTokenGuarded
      • Allowlist
    • VirtualSwap
      • Bridge
      • Proxy
      • SynthSwapper
      • Target
Powered by GitBook
On this page
  • Flash-loan Supported Pools
  • Do you have any flashloan countermeasures implemented?

Was this helpful?

How to Flash-loan Assets from Saddle

PreviousGlossaryNextContract Addresses

Last updated 3 years ago

Was this helpful?

Some of our pools allow flash-loaning assets for a small fee.

function flashLoan(
    address receiver,
    IERC20 token,
    uint256 amount,
    bytes memory params
) external;

Caller must provide a valid receiver address that inherits .

function executeOperation(
    address pool,
    address token,
    uint256 amount,
    uint256 fee,
    bytes calldata params
) external;

Upon finishing executeOperation, the pool must have the initial liquidity back along with the associated fee. If the requirement is not met, then the transaction will fail.

We provide a .

Flash-loan Supported Pools

  • vETH2 pool (0xdec2157831D6ABC3Ec328291119cc91B337272b5)

  • alETH pool (0xa6018520EAACC06C30fF2e1B3ee2c7c22e64196a)

  • D4 pool (0xC69DDcd4DFeF25D8a793241834d4cc4b3668EAD6)

Do you have any flashloan countermeasures implemented?

For flashloan safety, we have 2 safety measures in place:

  • Prevent reentrancy into the same pool. You cant flashloan money out of a pool and use that fund to trade through the same pool.

  • Ensure the returned amount is always higher than borrowed amount. The transaction will revert if the borrower does not pay up by end of the transaction.

Our flash loan implementation is based on 's .

IFlashLoanReceiver interface
basic example of a flashloan borrower contract
Aave
IFlashLoanReceiver.sol