Auto-Farming Bot Development

We design and develop full-cycle blockchain solutions: from smart contract architecture to launching DeFi protocols, NFT marketplaces and crypto exchanges. Security audits, tokenomics, integration with existing infrastructure.
Showing 1 of 1 servicesAll 1306 services
Auto-Farming Bot Development
Medium
~3-5 business days
FAQ
Blockchain Development Services
Blockchain Development Stages
Latest works
  • image_website-b2b-advance_0.png
    B2B ADVANCE company website development
    1214
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    852
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_logo-advance_0.png
    B2B Advance company logo design
    561
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    823

Development of Automated Farming Bot

Keeping money in one yield protocol and manually moving it when rates change — means constantly losing to automation. APY on Aave, Compound, Curve, Convex, Yearn changes every block. Manual monitoring gives reaction in hours. Bot — in minutes or seconds.

Task is not to "write script that moves money". Task is to build system where rotation cost (gas) doesn't eat profit from protocol switch, and switch logic doesn't break when protocol interfaces change.

Where money is lost with poor implementation

Blind APY chasing without gas accounting

Most common mistake: bot sees 2% APY difference between Aave and Compound and rotates. On Ethereum mainnet one withdraw + approve + deposit transaction costs $20-50 in gas. On $1000 position this is 2-5% of principal — rotation becomes unprofitable.

Rule: rotate only if (APY_new - APY_current) * position_size * time_horizon > gas_cost * safety_factor. time_horizon — expected time in new protocol, safety_factor — 2-3x for uncertainty. On L2 (Arbitrum, Optimism) threshold significantly lower due to cheap gas.

Unsynchronized yield data

APY in DeFi — not fixed rate. It's projection of current pool state to year. Compound supplyRatePerBlock calculated from utilization rate right now. Aave adds reward tokens (AAVE staking), which must be claimed separately. Convex shows boosted APY depending on your veCRV balance.

Bot comparing "APY" from different sources without normalization makes decisions on incomparable numbers. Need single methodology: base yield (from protocol) + reward yield (from emission, normalized to USD) + compound effect (reinvesting), all normalized to real 7-day moving average.

Bot architecture

System layers

Data layer: aggregating data from protocols. Per protocol — separate adapter. Aave V3 via IPool.getReserveData(), Compound V3 via CometSupply events + getSupplyRate(), Curve via get_virtual_price() and Convex rewardRate. Data written to Redis with 60-second TTL to avoid RPC on every calculation.

Strategy engine: decision-making logic. Evaluates current position, all rotation candidates, calculates net APY with gas, makes decision. Risk filters here: don't enter unaudited protocols, don't hold >X% in one protocol, exclude pools with TVL below threshold (liquidity risk on withdrawal).

Execution layer: assembling and sending transactions. Use viem for transaction building — gives typed contracts via ABI and proper gas estimation. For batching: Multicall3 allows approve + deposit in one transaction, reducing gas 30-40%.

Monitoring: Telegram notifications on each rotation (amount invested, where, expected APY), alerts on transaction errors, dashboard with position history via The Graph or own indexer.

On-chain vs off-chain logic

Two approaches:

Off-chain keeper (simpler, cheaper): bot runs on server, holds private key (or connects to Gnosis Safe via Safe Transaction Service API), sends transactions directly. Downside — server uptime dependency and trust in server.

On-chain vault with keeper (more complex, safer): smart contract vault holds funds, keeper (bot) only calls rebalance(). Strategy coded in contract — users can verify logic. Keeper bot's private key can only call rebalance(), not withdraw funds. This is standard for Yearn-style vault.

For personal bot with small amount — off-chain keeper sufficient. For protocol with others' funds — only on-chain vault with audit.

Working with multiple networks

Network Features Main protocols
Ethereum mainnet High gas, high TVL Aave V3, Compound V3, Curve, Convex
Arbitrum Cheap gas, rich DeFi Aave V3, GMX, Radiant, Camelot
Optimism Cheap gas, Velodrome Aave V3, Velodrome, Extra Finance
Base New, growing TVL Aave V3, Aerodrome, Moonwell

Multi-chain bot works with multiple RPC via ethers.js/viem providers. Bridge liquidity between chains — separate task with separate risks (bridge exploits), usually not in automation without manual confirmation.

Stack

TypeScript + viem for on-chain interactions. Node.js for keeper process. Redis for data caching. PostgreSQL for rotation history and analytics. Docker for deployment. PM2 or systemd for process monitoring.

Hardhat/Foundry for on-chain vault contracts if choosing this path. Tests on fork mainnet via Foundry vm.createFork — run rotation scenarios on real network state.

Timeline estimates

Off-chain keeper bot for 2-3 protocols on one network — 3-5 days. With APY normalization, gas accounting and Telegram monitoring — closer to 1 week. On-chain Yearn-style vault with separate strategies — 2-4 weeks including tests. Cost calculated after clarifying protocols and networks.