Skip to content

feat: agent-deposit command + GitHub Actions CI#2

Merged
abhicris merged 1 commit intomainfrom
feat/agent-deposit-and-ci
Apr 21, 2026
Merged

feat: agent-deposit command + GitHub Actions CI#2
abhicris merged 1 commit intomainfrom
feat/agent-deposit-and-ci

Conversation

@abhicris
Copy link
Copy Markdown
Contributor

What

Adds a first-class agent-deposit subcommand wrapping the Create Protocol AgentDeposit contract on Arbitrum, plus a GitHub Actions CI pipeline (fmt / check / clippy / test) since none existed.

# Read agent balance (USDC raw + decimal, chain resolved automatically)
arbitrum-cli agent-deposit 0xC750... --action balance

# Check Phase 1 registry membership
arbitrum-cli agent-deposit 0xC750... --action registered

# Prepare unsigned calldata for deposit / withdraw. The CLI is strictly
# key-less — agents sign via kcolbchain switchboard (or any wallet) and
# broadcast via `exec eth_sendRawTransaction`.
arbitrum-cli agent-deposit 0xC750... --action deposit  --amount 1000000
arbitrum-cli agent-deposit 0xC750... --action withdraw --amount 500000

# Override the contract for forks / staging deploys
arbitrum-cli agent-deposit 0xC750... --action balance --contract 0xabc...

Why

Create Protocol Phase 1 is an AI agent economy on Arbitrum: agents register, deposit USDC, execute tasks, earn fees. arbitrum-cli is positioned as the tool an LLM uses to drive the chain — an AgentDeposit verb closes the loop on the agent's own balance sheet without the agent having to hand-roll selectors or ABI calls.

Design choices worth flagging:

  • Chain-to-address resolver (agent_deposit_address) — placeholder addresses today, one-line swap when the Arbitrum One redeployment of AgentDeposit lands. No scattered constants.
  • Key-less by default — writes return unsigned calldata + metadata, not signed txs. The CLI never touches keys; callers compose with eth_sendRawTransaction.
  • USDC decimals stay honest — amounts go in as raw units (1 USDC = 1_000_000). No implicit scaling on the write path; reads emit both balance_raw and balance_usdc.
  • Chain id in the response — every response includes the chain it actually talked to, so an agent can't silently confuse testnet and mainnet.

CI

None existed before. Added .github/workflows/ci.yml covering:

  • cargo fmt --check
  • cargo check --all-targets
  • cargo clippy --all-targets -- -D warnings
  • cargo test --all-targets

With registry + build caching.

Tests

11 new unit tests in src/agent_deposit.rs covering:

  • balanceOf / isRegistered / deposit / withdraw calldata encoding
  • Action string parsing (balance | deposit | withdraw | registered, plus case + alias handling)
  • Bad-input rejection (short address, non-hex)
  • uint256 result decoding
  • Chain-id → contract-address resolution
  • Response JSON shape for both balance reads and unsigned-tx writes

All green locally (cargo test: 11 passed / 0 failed), clippy clean, fmt clean.

Manual verification

$ cargo run -- --rpc https://arb1.arbitrum.io/rpc \
    agent-deposit 0xC750...9664 --action deposit --amount 1000000 \
    --contract 0xdead...beef
{"action":"deposit","agent":"0xC750...9664","amount_raw":"1000000",
 "chain_id":42161,"contract":"0xdead...beef",
 "tx":{"data":"0xb6b55f25...f4240","from":"0xC750...","to":"0xdead...","value":"0x0"},
 "note":"Unsigned tx. Sign with your agent key ..."}

kcolbchain / Abhishek Krishna

Adds a first-class `agent-deposit` verb for Create Protocol AgentDeposit on
Arbitrum so an AI agent can introspect and fund itself from a single binary:

  arbitrum-cli agent-deposit <address> --action balance|deposit|withdraw|registered

Reads (balance, registered) go through eth_call. Writes return unsigned
calldata — the CLI is strictly key-less; agents sign via switchboard or any
wallet and broadcast with `exec eth_sendRawTransaction`. Contract address is
resolved per-chain (Arbitrum One / Sepolia) with a one-line swap when Phase 1
lands on mainnet.

Also wires up CI (fmt + check + clippy + test) since none existed. 11 unit
tests cover calldata encoding, action parsing, chain resolution, and response
shape.

See README "Create Protocol agent-deposit" section for usage.
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.

1 participant