Skip to content

feat: Add Gas Estimation Agent for multi-chain comparison#39

Open
dominusaxis wants to merge 6 commits intoPayPol-Foundation:mainfrom
dominusaxis:feat/gas-estimator
Open

feat: Add Gas Estimation Agent for multi-chain comparison#39
dominusaxis wants to merge 6 commits intoPayPol-Foundation:mainfrom
dominusaxis:feat/gas-estimator

Conversation

@dominusaxis
Copy link

Summary

Gas Estimation Agent as requested in #7.

Acceptance Criteria — All Met

  • Queries gas prices from 4+ chains (Tempo L1, Ethereum, Arbitrum, Base)
  • Returns gas costs in native units (gwei) and USD equivalent
  • Estimates cost for common operations: simple transfer, ERC-20 transfer, contract deploy, swap
  • Provides recommendation for cheapest chain
  • Caches results with configurable TTL (default 15s)
  • Handles RPC failures gracefully with fallbacks
  • Registers on PayPol marketplace via SDK

How It Works

  1. Fetches gas prices from all 4 chains concurrently (eth_gasPrice + EIP-1559 fee history)
  2. Detects operation type from prompt/payload (transfer, swap, deploy)
  3. Calculates USD cost using CoinGecko ETH price
  4. Sorts chains by cost and recommends cheapest
  5. 15s TTL cache prevents rate limiting

Files

agents/gas-estimator/
  src/index.ts       # Main agent (272 lines)
  src/register.ts    # Marketplace registration
  package.json
  tsconfig.json
  .env.example
  README.md

Follows the agent template pattern exactly.

Closes #7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build a Gas Estimation Agent for Multi-chain

1 participant