How It Works on Mainnet
When OPNet mainnet launches and DeFi contracts are deployed, OrangeFarmer transitions from simulation to live execution with no architectural changes. The bot's core loop remains the same — only the contract addresses change.
Transaction Flow
Every operation follows a strict sequence designed for safety and transparency:
Step 1 — Wallet Connection. The user connects their OP_WALLET browser extension. OrangeFarmer detects the wallet provider, reads the connected address, and queries on-chain balances for MOTO and other supported tokens. Private keys never leave the wallet — they are not accessible to the dApp at any point.
Step 2 — Pool Monitoring. Every 30 seconds, the bot scans all active pools. It reads current APR, TVL, and volume from on-chain data via OPNet JSON-RPC. It also queries the current Bitcoin fee rate and classifies it as low, normal, high, or extreme. This fee classification gates which operations are allowed — during extreme fees, only harvesting proceeds; expensive operations like LP rotation are deferred.
Step 3 — Strategy Execution. Based on the selected strategy (Conservative, Balanced, Aggressive, or Custom), the bot decides which actions to take. Conservative mode focuses on single-asset staking with auto-compound. Balanced mode adds LP farming. Aggressive mode enables frequent pool rotation to chase the highest APR. Each strategy defines a maximum risk level that filters which pools are accessible.
Step 4 — Transaction Simulation. Before any on-chain action, the bot simulates the transaction through OPNet's RPC. This catches reverts, insufficient balances, and contract errors before any real BTC is spent. The simulation uses the exact same contract call that will be broadcast — getContract() with the appropriate ABI, then calling the contract method.
Step 5 — Wallet Signing. If simulation succeeds, the transaction is sent to OP_WALLET for signing. The sendTransaction call uses signer: null and mldsaSigner: null because
on the frontend, the wallet handles all cryptographic operations. The user sees the transaction details in their wallet popup and approves or rejects.
Step 6 — On-Chain Execution. After wallet approval, the signed transaction is broadcast to the Bitcoin network. The bot monitors confirmation status and updates the UI accordingly. Fee parameters include maximumAllowedSatToSpend (capped at a safe threshold) and feeRate: 0 for automatic fee estimation.