Skip to content

Add 'revoke' and 'approve' subcommands to manage ERC-20 allowances from the CLI #31

Open

Description

@Learn57130

Problem

The awal CLI lets agents trade tokens but provides no way to manage the standing ERC-20 allowances those trades create. Every swap from an ERC-20 requires approve(router, amount), and the SDK appears to default to max-uint256 approvals. A one-time swap leaves a permanent unlimited allowance.

If the spender contract is later compromised — or the user wants to scope down the agent wallet's exposure after a session — there is currently no way to revoke the allowance from inside the agent runtime. Workarounds (revoke.cash, etc.) require the user to control the same address through a separate wallet client, which breaks the agentic model.

Proposal

Add two subcommands:

npx awal@x.y.z approve <token> <spender> <amount> [--chain base|polygon]
npx awal@x.y.z revoke <token> <spender> [--chain base|polygon]

revoke is sugar for approve <token> <spender> 0. Same validation rules as trade/send. Output should match the trade JSON shape (transactionHash + basescan link).

Why this belongs in the CLI

Agentic wallets that can trade but cannot revoke are strictly worse than human-operated wallets from a security standpoint. Closing this gap is a prerequisite for trusting agents with non-trivial balances or longer sessions.

Adjacent

A companion skill (approvals-management, PR #30) covers the list side by querying Approval events. Pairing that with revoke would give agents a complete approval lifecycle: list → audit → revoke.

Tested scenario that motivated this

Agent wallet performed trade 2.5 USDC → AERO then trade 4.9 AERO → USDC on Base. Two standing approvals remain (USDC→router and AERO→router). With current tooling, the agent cannot revoke either.

Activity

  1. stefangovedarov86-hash commented on Jul 1, 2026

    @stefangovedarov86-hash
    Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions