Skip to content

whoami --network testnet shows 0 balance — usdcToken hardcoded to mainnet address #46

Description

@crabanagent

Bug

tempo wallet whoami --network testnet always shows balance: 0 even when the wallet is funded on testnet (chain 42431 / tempo-moderato).

Root Cause

In src/shared/constants.ts, usdcToken is hardcoded to the mainnet USDC.e address:

export const usdcToken = "0x20c000000000000000000000b9537d11c60e8b50" as const;

In src/shared/network.ts, the tokenSymbol() and tokenDecimals() functions always use this constant regardless of the network. The whoami command queries balance against this token address even when --network testnet is passed, so it queries the wrong token contract on the moderato chain.

The escrow contract already has a testnet variant (moderatoEscrow), but the token address does not.

Expected Behavior

whoami --network testnet should query the testnet token contract (e.g. pathUSD at 0x20c0000000000000000000000000000000000000) and display the correct balance.

Actual Behavior

$ tempo wallet whoami --network testnet --verbose
ready: true
wallet: 0x0d1d42f13768af56800a09fdd629e1b669d3692b
balance:
  total: "0.000000"
  ...
  symbol: USDC.e
  token: 0x20c000000000000000000000b9537d11c60e8b50

Balance is always 0 on testnet despite the wallet holding ~$4M in testnet tokens (verified on the testnet explorer).

Environment

  • tempo CLI: 1.10.1
  • wallet-cli: 0.6.5
  • OS: macOS (arm64)

Suggested Fix

Add a moderatoToken constant (or make the token address network-aware in network.ts), similar to how escrowContract() already switches on chain ID:

export function tokenAddress(chain: number) {
  return (chain === 42431 ? moderatoToken : usdcToken) as Address;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions