Files
mev-beta/scripts/DeployFlashLoanSecure.s.sol
Krypto Kajun c7142ef671 fix(critical): fix empty token graph + aggressive settings for 24h execution
CRITICAL BUG FIX:
- MultiHopScanner.updateTokenGraph() was EMPTY - adding no pools!
- Result: Token graph had 0 pools, found 0 arbitrage paths
- All opportunities showed estimatedProfitETH: 0.000000

FIX APPLIED:
- Populated token graph with 8 high-liquidity Arbitrum pools:
  * WETH/USDC (0.05% and 0.3% fees)
  * USDC/USDC.e (0.01% - common arbitrage)
  * ARB/USDC, WETH/ARB, WETH/USDT
  * WBTC/WETH, LINK/WETH
- These are REAL verified pool addresses with high volume

AGGRESSIVE THRESHOLD CHANGES:
- Min profit: 0.0001 ETH → 0.00001 ETH (10x lower, ~$0.02)
- Min ROI: 0.05% → 0.01% (5x lower)
- Gas multiplier: 5x → 1.5x (3.3x lower safety margin)
- Max slippage: 3% → 5% (67% higher tolerance)
- Max paths: 100 → 200 (more thorough scanning)
- Cache expiry: 2min → 30sec (fresher opportunities)

EXPECTED RESULTS (24h):
- 20-50 opportunities with profit > $0.02 (was 0)
- 5-15 execution attempts (was 0)
- 1-2 successful executions (was 0)
- $0.02-$0.20 net profit (was $0)

WARNING: Aggressive settings may result in some losses
Monitor closely for first 6 hours and adjust if needed

Target: First profitable execution within 24 hours

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-29 04:18:27 -05:00

84 lines
3.4 KiB
Solidity

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "forge-std/Script.sol";
import "../contracts/balancer/FlashLoanReceiverSecure.sol";
/// @title Deploy FlashLoanReceiverSecure to Fork
/// @notice Deployment script for testing flash loan contract on forked Arbitrum
contract DeployFlashLoanSecure is Script {
// Balancer Vault on Arbitrum mainnet
address constant BALANCER_VAULT = 0xBA12222222228d8Ba445958a75a0704d566BF2C8;
// Arbitrum token addresses for testing
address constant WETH = 0x82aF49447D8a07e3bd95BD0d56f35241523fBab1;
address constant USDC = 0xaf88d065e77c8cC2239327C5EDb3A432268e5831;
address constant USDT = 0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9;
address constant ARB = 0x912CE59144191C1204E64559FE8253a0e49E6548;
// Uniswap V3 Router
address constant UNISWAP_V3_ROUTER = 0xE592427A0AEce92De3Edee1F18E0157C05861564;
function run() external {
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
vm.startBroadcast(deployerPrivateKey);
console.log("========================================");
console.log("Deploying FlashLoanReceiverSecure");
console.log("========================================");
console.log("Deployer:", vm.addr(deployerPrivateKey));
console.log("Balancer Vault:", BALANCER_VAULT);
console.log("");
// Deploy FlashLoanReceiverSecure
FlashLoanReceiverSecure flashLoanReceiver = new FlashLoanReceiverSecure(
BALANCER_VAULT
);
console.log("========================================");
console.log("Deployment Successful!");
console.log("========================================");
console.log("Contract Address:", address(flashLoanReceiver));
console.log("Owner:", flashLoanReceiver.owner());
console.log("Max Slippage:", flashLoanReceiver.MAX_SLIPPAGE_BPS(), "bps (0.5%)");
console.log("Max Path Length:", flashLoanReceiver.MAX_PATH_LENGTH());
console.log("");
console.log("========================================");
console.log("Test Token Addresses (Arbitrum)");
console.log("========================================");
console.log("WETH:", WETH);
console.log("USDC:", USDC);
console.log("USDT:", USDT);
console.log("ARB:", ARB);
console.log("");
console.log("========================================");
console.log("DEX Router Addresses");
console.log("========================================");
console.log("Uniswap V3:", UNISWAP_V3_ROUTER);
console.log("");
console.log("========================================");
console.log("Next Steps");
console.log("========================================");
console.log("1. Fund contract with test ETH for gas");
console.log("2. Test flash loan with small amount");
console.log("3. Verify slippage protection works");
console.log("4. Test reentrancy protection");
console.log("5. Execute real arbitrage path");
console.log("");
console.log("Example: Flash loan 1 WETH");
console.log(" cast send", address(flashLoanReceiver));
console.log(" 'executeArbitrage(address[],uint256[],bytes)'");
console.log(" '[", WETH, "]'");
console.log(" '[1000000000000000000]' # 1 WETH");
console.log(" '<encoded-path>'");
console.log("");
vm.stopBroadcast();
}
}