This guide explains how to deploy FlashBank.net contracts to Arbitrum mainnet and testnet networks.
Repository layout note. Since the repo was split into self-contained features, the flash-loan contracts and scripts referenced below live under
flashloans/. Run thenpx hardhat …commands from inside that directory (e.g.cd flashloans && npx hardhat run scripts/deploy-router.js --network sepolia). The P2P term-loan equivalents live underloans/. The repository-root.envis shared by both.
NEVER commit private keys or sensitive data to version control!
Use environment variables and .env files (which are gitignored) for all sensitive configuration.
- Node.js v18+ (v21.7.3+ works with warnings)
- npm or yarn
- Git
- A code editor (VS Code recommended)
- Ethereum Wallet with private key (for deployment)
- Arbiscan API Key (for contract verification)
- Alchemy/Infura API key (optional, for custom RPC)
- ETH on Arbitrum for gas fees (~0.01 ETH minimum)
git clone https://github.com/flashbank-net/flashbank
cd flashbank
npm installCreate a .env file in the project root:
cp env.example .envEdit .env with your configuration:
# ============ RPC ENDPOINTS ============
ARBITRUM_HTTP_URL=https://arb1.arbitrum.io/rpc
# Or use Alchemy/Infura:
# ARBITRUM_HTTP_URL=https://arb-mainnet.g.alchemy.com/v2/YOUR_KEY
# ============ PRIVATE KEYS ============
# Your wallet private key (KEEP SECRET!)
PRIVATE_KEY=0x1234567890abcdef...
# ============ API KEYS ============
ARBISCAN_API_KEY=YOUR_ARBISCAN_API_KEY
COINMARKETCAP_API_KEY=YOUR_CMC_KEY_FOR_GAS_REPORTING
# ============ FLASH LOAN CONFIG ============
FLASH_LOAN_FEE_RATE=5 # 0.05% (5 basis points)
MIN_FLASH_LOAN_AMOUNT=0.1 # 0.1 ETH minimum
MAX_FLASH_LOAN_AMOUNT=1000 # 1000 ETH maximum (adjustable later)# Verify .env is in .gitignore
cat .gitignore | grep .env
# Test configuration (without exposing keys)
npm run compile# Compile contracts
npm run compile
# Run tests
npm test
# Deploy to testnet
npx hardhat run scripts/deploy-immutable.js --network arbitrumGoerli
# Verify contracts on testnet
npx hardhat verify --network arbitrumGoerli DEPLOYED_CONTRACT_ADDRESS "CONSTRUCTOR_ARG1" "CONSTRUCTOR_ARG2"# Test basic functionality
npx hardhat run scripts/test-deployment.js --network arbitrumGoerli
# Run integration tests
npm run test:integration- All tests pass (
npm test) - Security review completed
- Gas costs estimated and acceptable
- Backup wallet private key securely
- Sufficient ETH for deployment (~0.01-0.05 ETH)
- Arbiscan API key configured for verification
# Run complete test suite
npm test
# Run security tests specifically
npx hardhat test test/SecurityTests.test.js
# Check gas costs
REPORT_GAS=true npm test# Deploy immutable contracts
npx hardhat run scripts/deploy-immutable.js --network arbitrum
# SAVE THE OUTPUT! You'll need the contract addressesExpected output:
🎉 IMMUTABLE Deployment complete!
📋 DEPLOYMENT SUMMARY:
🔒 L2FlashPoolImmutable: 0x1234...
🤖 MEVFlashLoanReceiver: 0x5678...
👤 Owner: 0xabcd...
💸 Flash loan fee: 0.05%# Verify main contract
npx hardhat verify --network arbitrum 0x1234... "OWNER_ADDRESS" 5
# Verify MEV receiver
npx hardhat verify --network arbitrum 0x5678... "FLASH_POOL_ADDRESS" "0x0000000000000000000000000000000000000000" "10000000000000000"# Basic functionality test
npx hardhat run scripts/test-mainnet-deployment.js --network arbitrum
# Check contract on Arbiscan
# https://arbiscan.io/address/YOUR_CONTRACT_ADDRESSEdit website/src/pages/index.tsx:
const FLASHBANK_ADDRESS = "0xYOUR_DEPLOYED_CONTRACT_ADDRESS";cd website
npm install
npm run buildChoose your hosting platform:
npm install -g vercel
vercel --prodnpm install -g netlify-cli
netlify deploy --prod --dir out# Build static export
npm run build
# Deploy to gh-pages branch
npm install -g gh-pages
gh-pages -d outCreate deployment record:
# Create deployment record
echo "Deployment $(date):" >> DEPLOYMENT_LOG.md
echo " - L2FlashPoolImmutable: 0x1234..." >> DEPLOYMENT_LOG.md
echo " - MEVFlashLoanReceiver: 0x5678..." >> DEPLOYMENT_LOG.md
echo " - Network: Arbitrum Mainnet" >> DEPLOYMENT_LOG.md
echo " - Block: $(cast block-number --rpc-url $ARBITRUM_HTTP_URL)" >> DEPLOYMENT_LOG.md- Update README.md with contract addresses
- Update website with live contract address
- Create announcement for community
- Update social media profiles
# Verify immutability
npx hardhat run scripts/verify-immutability.js --network arbitrum
# Check security info
npx hardhat run scripts/security-check.js --network arbitrum# Make initial deposit to show working system
npx hardhat run scripts/initial-deposit.js --network arbitrum- Solution: Add more ETH to your deployment wallet
- Solution: Check constructor arguments match exactly
- Use
--constructor-args arguments.jsfor complex args
- Solution: Increase gas price in hardhat.config.js
- Or set
gasPrice: ethers.utils.parseUnits('10', 'gwei')
- Solution: Reset account nonce or wait for pending transactions
# Check contract sizes
npx hardhat size-contracts
# Optimize if needed
# Contracts must be under 24KB for deployment# Check transaction status
npx hardhat run scripts/check-tx.js --network arbitrum TRANSACTION_HASH
# Get detailed logs
npx hardhat verify --network arbitrum --show-stack-traces# Deploy immutable contracts
npm run deploy:arbitrum
# Deploy to testnet
npm run deploy:testnet
# Verify contracts
npm run verify
# Test deployment
npm run test:deployment
# Check contract sizes
npm run sizeCreate custom deployment script:
// scripts/deploy-custom.js
const { ethers } = require("hardhat");
async function main() {
const [deployer] = await ethers.getSigners();
// Custom deployment logic here
const L2FlashPoolImmutable = await ethers.getContractFactory("L2FlashPoolImmutable");
const flashPool = await L2FlashPoolImmutable.deploy(
deployer.address, // owner
5 // fee rate (0.05%)
);
console.log("FlashPool deployed to:", flashPool.address);
}
main().catch(console.error);- Never commit
.envfiles - Use hardware wallet for large deployments
- Test thoroughly on testnets first
- Have deployment process reviewed
- Backup all important addresses and keys
- Verify contracts on block explorer
- Test with small amounts first
- Monitor for any issues
- Document everything
- Announce to community
If you encounter issues during deployment:
- Check Documentation: Review this guide and README
- Search Issues: Check GitHub issues for solutions
- Community Help: Ask on Discord or Telegram
- Contact Team: Email team@flashbank.net for critical issues
- No Liability: Deployers assume all risks
- Due Diligence: Verify all code before deployment
- Regulatory Compliance: Ensure compliance with local laws
- Financial Risk: Never deploy with funds you can't afford to lose
Deploy responsibly and help make FlashBank.net the most secure flash loan protocol! 🚀