Moonwell redeem fails on Base Sepolia and uses 18 decimals for cbBTC
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 85/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- backend
Research direction
Start in typescript/agentkit/src/action-providers/moonwell/moonwellActionProvider.ts and trace how redeem selects the network-specific address map and resolves underlying token decimals. Then read typescript/agentkit/src/action-providers/moonwell/constants.ts for the cbBTC and USDBC decimal entries. Update the mappings so redeem works on both networks and cbBTC mint and redeem use 8 decimals; verify the repro amounts encode correctly.
Written by the indexing model from the issue text.
Description
What happens
-
On Base Sepolia,
MoonwellActionProvider.redeemalways returnsError: Unsupported token address <mToken>. The redeem path picks the right address map for the network when validating the mToken, but then looks up the underlying decimals with the mainnet map:const decimals = MTOKENS_UNDERLYING_DECIMALS[MOONWELL_BASE_ADDRESSES[args.mTokenAddress]];Sepolia mToken addresses are not in
MOONWELL_BASE_ADDRESSES, sodecimalsisundefined.MOONWELL_USDBCis also missing fromMTOKENS_UNDERLYING_DECIMALS. -
MTOKENS_UNDERLYING_DECIMALS.MOONWELL_cbBTCis18, but cbBTC (0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf) has 8 decimals. Redeeming0.5cbBTC encodesredeemUnderlying(500000000000000000), which is 5,000,000,000 cbBTC, instead ofredeemUnderlying(50000000). The transaction reverts. -
TOKEN_DECIMALShas no entry for cbBTC, somintinto the Moonwell cbBTC market returnsError: Unsupported token address 0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf.
What should happen
Redeem works on both supported networks and uses the underlying token's real decimals. cbBTC can be supplied and redeemed with 8 decimals.
Minimal repro
// wallet on base-sepolia
await moonwell.redeem(wallet, {
mTokenAddress: "0x876852425331a113d8E432eFFB3aC5BEf38f033a", // Sepolia mUSDBC
assets: "1.5",
});
// => "Error: Unsupported token address 0x876852425331a113d8E432eFFB3aC5BEf38f033a. ..."
// wallet on base-mainnet
await moonwell.redeem(wallet, {
mTokenAddress: "0xF877ACaFA28c19b96727966690b2f44d35aD5976", // Moonwell cbBTC
assets: "0.5",
});
// sends redeemUnderlying(500000000000000000) instead of redeemUnderlying(50000000)
Onchain check of the underlying tokens (underlying() then decimals()):
Base Sepolia 0x876852425331a113d8E432eFFB3aC5BEf38f033a -> USDBC 6
Base 0xF877ACaFA28c19b96727966690b2f44d35aD5976 -> cbBTC 8
Root cause
typescript/agentkit/src/action-providers/moonwell/moonwellActionProvider.ts uses MOONWELL_BASE_ADDRESSES instead of the network specific networkObject when resolving decimals in redeem, and typescript/agentkit/src/action-providers/moonwell/constants.ts has the wrong decimals for cbBTC, no entry for MOONWELL_USDBC, and no cbBTC entry in TOKEN_DECIMALS.
- Dominant language
- TypeScript
- Stars
- 1.3k
- Forks
- 871
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from coinbase/agentkit
-
Python: Permit2 approval in CdpSmartWalletActionProvider.swap always reports failure (integer vs string receipt status)Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
ERC20 transfer reports "Transferred" when the transaction reverts (receipt status ignored)Possibly taken @AgenticFinanceGraph claimed this 12 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
coinbase/agentkit#1558 · 1 comment ·
Maintainers usually reply within 1 day
-
[TypeScript] `ViemWalletProvider` rejects a wallet client from a newer viem than the exactly pinned one (TS2345, `tokens` missing on `Client`)Possibly taken @PrabalParihar claimed this 3 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
coinbase/agentkit#1532 · 3 comments ·
Maintainers usually reply within 1 day
-
coinbase-agentkit 0.7.x fails on fresh install: imports solana.rpc.api, which solana>=0.37 removedPossibly taken @JulienKervarrec claimed this 30 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 53/100
Maintainers usually reply within 1 day
All issues in coinbase/agentkit
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
braintrustdata/braintrust-sdk-javascript#2659 ·
Maintainers usually reply within 1 day
-
body-parser 2.3.0 in the published ai-dial-chat-bff image is vulnerable (CVE-2026-111181, HIGH)Possibly taken @illya-havsiyevych claimed this today. Openbug
Difficulty 1/5 1-3 hours Newbie friendliness 87/100
epam/ai-dial-chat#9566 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day
-
はさみアイコンを修正するOpenbug
Difficulty 1/5 Under an hour Newbie friendliness 68/100
-
area: core
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day