scallop-flash-loanlisted
Install: claude install-skill scallop-io/scallop-skills
# Flash Loans
Execute uncollateralized flash loans on Scallop for arbitrage, liquidations, and collateral swaps.
## Overview
Flash loans allow borrowing without collateral, as long as the loan is repaid within the same transaction. If not repaid, the entire transaction reverts.
## Key Properties
- **No Collateral Required**: Borrow any available amount
- **Same-Transaction Repay**: Must repay before transaction ends
- **Fee**: Small fee added to repay amount
- **Atomic**: All-or-nothing execution
## Return Type
`borrow_flash_loan()` returns `tuple[TxResult, TxResult]` — nested PTB result handles for the borrowed coin and flash loan receipt:
```python
coin_result, receipt_result = tx.borrow_flash_loan(amount, coin_name)
# coin_result: TxResult handle for the borrowed coin
# receipt_result: TxResult handle for the flash loan receipt
```
These `TxResult` handles can be passed directly to subsequent calls like `repay_flash_loan()`, `supply()`, and `liquidate()`.
## Basic Flash Loan
### Python
```python
tx = builder.create_tx_block()
# Borrow 1000 USDC via flash loan
# Returns tuple[TxResult, TxResult]: (coin, receipt)
usdc_coin, flash_receipt = tx.borrow_flash_loan(
amount=1_000_000_000, # 1000 USDC (6 decimals)
coin_name="usdc"
)
# === Use the borrowed funds here ===
# Example: swap, liquidate, arbitrage, etc.
# Repay flash loan (amount + fee)
tx.repay_flash_loan(usdc_coin, flash_receipt, "usdc")
result = builder.sign_and_send_tx_block(tx)
print(f"Flash