Skip to content

feat: migration script for USDC grants to ACT grants #2715

@baktun14

Description

@baktun14

Context

Part of AEP-76 BME migration. After the chain upgrade enables BME and the funding wallet receives pre-minted ACT, existing managed wallet users need their USDC authz grants converted to ACT authz grants.

Tasks

  • Create apps/api/src/billing/scripts/migrate-to-bme.ts
  • Script should:
    1. Query all user wallets with non-zero deploymentAllowance
    2. For each wallet:
      • Read current USDC authz DepositAuthorization grant amount
      • Revoke USDC DepositAuthorization grant
      • Create new ACT DepositAuthorization grant with equivalent amount
      • Update deploymentAllowance in DB
    3. Verify fee allowance grants (uakt) are still valid
    4. Log progress and handle errors gracefully
    5. Support dry-run mode for testing

Cutover Sequence

Step 1: DEPLOYMENT_GRANT_DENOM=uusdc                    ← current state
Step 2: Chain upgrade (BME enabled, funding wallet gets ACT)
Step 3: Run this migration script
Step 4: DEPLOYMENT_GRANT_DENOM=uact, NEXT_PUBLIC_MANAGED_WALLET_DENOM=uact

Acceptance Criteria

  • All managed wallets have valid ACT authz grants after migration
  • USDC authz grants are revoked
  • DB deploymentAllowance values match new ACT grant amounts
  • Fee allowance grants (uakt) are preserved
  • Dry-run mode works for testing on sandbox/testnet
  • Script is idempotent (safe to re-run)

Milestone

AEP-76: BME Migration — Phase 7 (Migration)

Reference

  • docs/aep-76-bme-migration-plan.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions