fix(compound-v3): v0.1.1 — correct Arbitrum base asset (USDC.e → native USDC) and Polygon RPC#241
Conversation
Two bugs fixed in compound-v3 v0.1.0: 1. Arbitrum base_asset was USDC.e (0xFF970A61...) but Compound V3 Arbitrum Comet baseToken() returns native USDC (0xaf88d065...). This caused arithmetic underflow on borrow and repay. 2. Polygon RPC was polygon-rpc.com (HTML landing page, not JSON-RPC). Replaced with polygon-bor-rpc.publicnode.com. Changes: - src/config.rs: correct Arbitrum base_asset to 0xaf88d065... - src/config.rs: correct Polygon rpc_url to polygon-bor-rpc.publicnode.com - api_calls: add arbitrum-one-rpc.publicnode.com, replace polygon-rpc.com - source_commit: bumped to a4565195 (fix branch on skylavis-sky/onchainos-plugins) Validated via live L4 transactions on Arbitrum (chain 42161): - L4-A3: borrow 0.01 USDC — no arithmetic underflow, tx confirmed - L4-A5: repay debt — ERC-20 approve + Comet.supply succeeded Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
📋 Phase 3: AI Code Review Report — Score: N/A/100
AI review did not produce output.Generated by Claude AI via Anthropic API — review the full report before approving. |
Phase 4: Summary + Pre-flight for
|
|
Closing — PR should target okx/plugin-store instead. |
🔨 Phase 2: Build Verification — ✅ PASSED
Build succeeded. Compiled artifact uploaded as workflow artifact. Source integrity: commit SHA |
Summary
Bug fix for compound-v3 v0.1.0. Two issues were causing failures on Arbitrum (borrow/repay broken) and Polygon (all reads broken).
Bug 1: Arbitrum base_asset was USDC.e instead of native USDC
Root cause:
src/config.rsline 40 had0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8(USDC.e bridged) as thebase_assetfor Arbitrum USDC market. However, the deployed Compound V3 Arbitrum Comet contract'sbaseToken()(selector0xc55dae63) returns0xaf88d065e77c8cC2239327C5EDb3A432268e5831(native USDC).Impact: Borrow calls
Comet.withdraw(USDC.e, amount)which the contract treats as collateral withdrawal, triggering arithmetic underflow. Repay's ERC-20approve(USDC.e, amount)fails because the user's USDC balance is native USDC, not USDC.e.Fix: Changed
base_assetto0xaf88d065e77c8cC2239327C5EDb3A432268e5831(native USDC).Bug 2: Polygon RPC was returning HTML instead of JSON-RPC
Root cause:
polygon-rpc.comis a landing page, not a JSON-RPC endpoint. All Polygonget-marketscalls failed with HTML parse errors.Fix: Replaced with
https://polygon-bor-rpc.publicnode.com.Validation
Live L4 transactions on Arbitrum (chain 42161):
compound-v3 --chain 42161 --market usdc borrow --amount 10000compound-v3 --chain 42161 --market usdc repaycompound-v3 --chain 42161 --market usdc get-marketscompound-v3 --chain 137 --market usdc get-marketsChanges
src/config.rs: Arbitrumbase_asset0xFF970A61...→0xaf88d065...src/config.rs: Polygonrpc_urlpolygon-rpc.com→polygon-bor-rpc.publicnode.comapi_calls: addedarbitrum-one-rpc.publicnode.com, replacedpolygon-rpc.comwithpolygon-bor-rpc.publicnode.comsource_commit: bumped toa4565195c3791a4787b53d943fbed706a24a848dChecklist
plugin-store lintpasses (0 errors, 3 warnings — same as v0.1.0)🤖 Generated with Claude Code