Skip to content

Comments

Flash Loan Contract for Arbitrage#98

Open
floxxih wants to merge 1 commit intoMindFlowInteractive:mainfrom
floxxih:feat/flash-loan-contract
Open

Flash Loan Contract for Arbitrage#98
floxxih wants to merge 1 commit intoMindFlowInteractive:mainfrom
floxxih:feat/flash-loan-contract

Conversation

@floxxih
Copy link

@floxxih floxxih commented Feb 20, 2026

Summary

Implements a flash loan contract enabling users to borrow tokens without collateral for single-transaction arbitrage and liquidations, as requested in issue #91.

Changes

  • Created contracts/flash_loan/ with full contract implementation
  • Added flash_loan to workspace Cargo.toml

Features Implemented

  • Flash loan pool structure design
  • Borrow function with callback mechanism
  • Repayment verification in same transaction
  • Fee calculation (0.1-0.3% configurable)
  • Pool liquidity management (add/remove liquidity)
  • Reentrancy protection
  • Flash loan analytics tracking
  • Comprehensive test suite
  • Maximum loan limits (configurable ratio of pool)
  • Emergency pause functionality

Acceptance Criteria

  • Loans issued without collateral
  • Repayment verified in same transaction
  • Fees collected correctly
  • Reentrancy prevented
  • Analytics track usage
  • Contract deployed to testnet (to be done separately)

Tests

All 17 tests passing:

  • Initialization and configuration tests
  • Liquidity management tests (add/remove)
  • Fee calculation tests
  • Admin functions tests
  • Pause/unpause functionality tests
  • Access control tests

Closes #91

Implements flash loan functionality enabling users to borrow tokens without collateral for single-transaction arbitrage and liquidations.

Features:
- Liquidity pool management with add/remove liquidity functions
- Flash loan with callback mechanism for same-transaction repayment
- Fee calculation (0.1-0.3% configurable)
- Maximum loan limits based on pool liquidity
- Reentrancy protection guard
- Emergency pause functionality
- Analytics tracking for loans, volume, and fees
- Admin functions for fee rates and pool management
- Comprehensive test suite
@floxxih floxxih force-pushed the feat/flash-loan-contract branch from c74b476 to b664505 Compare February 20, 2026 05:23
@Mkalbani
Copy link
Contributor

@floxxih please resolve conflict

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flash Loan Contract for Arbitrage

2 participants