fix+feat: unbreak CI + Arbitrum AgentAccount primitives#4
Merged
Conversation
CI root cause ------------- `cargo clippy -- -D warnings` surfaced 7 lint failures that had accumulated: unused imports (`SwapParams`, `Address`, `U256`), an unread `chain` field on `UniswapV3Router`, a manual `Default` impl on `AgentBuilder`, a `type_complexity` violation on the alloy filled-provider, and `WalletManager::next` shadowing `Iterator::next`. CI was red for 16 days. Fixes ----- - Drop the stale imports. - Expose the router chain via `UniswapV3Router::chain()` instead of suppressing. - `#[derive(Default)]` for `AgentBuilder`. - Alias the alloy provider type as `DefaultFilledProvider` and expose `provider()` on `ChainConnector` (enables contract-typed calls downstream). - Rename `WalletManager::next` -> `next_wallet`. - `cargo fmt` normalized a handful of unrelated formatting drifts. Feature ------- Arbitrum agent-economy primitives aligned with the AI-agent thesis: - `src/agent/account.rs` — new `AgentAccount` trait (deposit / balance / withdraw / execute_task) matching the shape of AgentDeposit-style registries, ERC-4337 smart accounts, and x402 escrows. Ships with `InMemoryAgentAccount`, a working (not stubbed) registry for tests and local simulation. - `src/chains/arbitrum.rs` — `ArbitrumContracts` (native USDC, USDC.e, USDT, WETH, Uniswap V3 router + quoter) and `AgentDepositClient`, a typed calldata builder for an `IAgentAccount` Solidity interface. Builds `deposit(uint256)`, `balanceOf(address)`, `withdraw(uint256)`, and `executeTask(bytes32,bytes)` calldata via `alloy::sol!`. - `examples/agent_account.rs` — demonstrates the in-memory flow end-to-end and builds the Arbitrum deposit calldata an agent would broadcast. - Prelude re-exports the new types so `use arka::prelude::*;` covers the full agent-account surface. Tests ----- 14 unit tests, all green locally: - `chains::arbitrum` — selector bytes (`0xb6b55f25` deposit, `0x70a08231` balanceOf), calldata lengths, USDC wiring, chain-id alignment, custom settlement-token override, executeTask layout. - `agent::account` — deposit/balance roundtrip, withdraw math, overdraw rejection, fee-charging + receipt emission, and registered-agent counting. Why this matters ---------------- arka is the SDK layer that sits under agent-registry interactions. The first agent-economy deployments target Arbitrum with USDC settlement, so first-class Arbitrum primitives and an `AgentAccount` abstraction are on-path: an agent registers, deposits USDC, earns fees, executes paid tasks — all through one chain-agnostic trait, with a working Arbitrum client as the first concrete implementation. On-chain implementations of other registries (Base, Optimism, Tempo) plug in behind the same trait. — [kcolbchain](https://kcolbchain.com) / [Abhishek Krishna](https://abhishekkrishna.com) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This was referenced Apr 21, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CI root cause
cargo clippy -- -D warningshas been red for 16 days due to 7 accumulated lint errors:SwapParamsindex/router.rs,Addressindex/types.rs,U256inoracle/mod.rs)chainfield onUniswapV3Routernever readimpl Default for AgentBuilderwhen#[derive(Default)]sufficestype_complexityon the alloy filled-provider inChainConnectorWalletManager::nextshadowingIterator::nextFixes
UniswapV3Router::chain()(now the field is read, also useful surface).#[derive(Default)]forAgentBuilder.DefaultFilledProvider; addChainConnector::provider()so downstream modules can call contracts against it.WalletManager::next->next_wallet.cargo fmtnormalized a few pre-existing formatting drifts.Feature: Arbitrum AgentAccount primitives
Why this matters (agent-economy thesis)
arka is the Rust SDK layer that sits under agent-registry interactions. The first agent-economy deployments target Arbitrum with USDC settlement — that substrate needs first-class support in the SDK.
An agent's lifecycle on chain looks like: register -> deposit USDC -> earn fees -> execute paid tasks -> withdraw. This PR turns that lifecycle into a chain-agnostic trait (
AgentAccount) with a working Arbitrum client as the first concrete implementation. Future registries (Base, Optimism, Tempo) plug in behind the same trait without the agent logic needing to know.What's new
src/agent/account.rs—AgentAccounttrait:deposit,balance,withdraw,execute_task. Shape matches AgentDeposit-style registries, ERC-4337 smart accounts, and x402 escrows. Ships withInMemoryAgentAccount, a working (not stubbed) registry for tests and local simulation.TaskReceiptcarries task id, agent, fee, and success.src/chains/arbitrum.rs—ArbitrumContractsstatic addresses (native USDC, USDC.e, USDT, WETH, Uniswap V3 router + quoter) +AgentDepositClient. The client builds calldata for anIAgentAccountSolidity interface viaalloy::sol!—deposit(uint256),balanceOf(address),withdraw(uint256),executeTask(bytes32,bytes). Calldata-only by design: callers feed it into their signing/broadcast pipeline, so the client is testable without an RPC.examples/agent_account.rs— runs the in-memory flow end to end and prints real Arbitrum deposit calldata ready for submission.AgentAccount,InMemoryAgentAccount,TaskReceipt,AgentDepositClient,ArbitrumContractsare now inarka::prelude::*.Tests
14 unit tests, all green locally:
chains::arbitrum::*— exact selector bytes (0xb6b55f25deposit,0x70a08231balanceOf), calldata lengths, USDC wiring, chain-id alignment, custom settlement-token override,executeTasklayout.agent::account::*— deposit/balance roundtrip, withdraw math, overdraw rejection, fee-charging + receipt emission, registered-agent counting.Test plan
cargo check --all-features(clean)cargo clippy --all-targets -- -D warnings(clean)cargo fmt -- --check(clean)cargo test --lib— 14/14 pass-- kcolbchain / Abhishek Krishna