lambdaclass / lambdaclass/eth-agent

Stablecoin limit parsing assumes all tokens have same decimals

Open
#39 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug medium-priority
Dominant language
TypeScript
Stars
10
Forks
1
PR merge metrics
No merged PRs in 30d

Description

Problem

The limit parsing logic may assume all stablecoins have the same decimal places (6). Tokens like FRAX have 18 decimals.

Location

src/agent/limits.ts:144

Impact

  • Limits could be off by orders of magnitude for 18-decimal tokens
  • A $100 limit could become $100,000,000,000 for wrong decimal handling

Recommendation

  1. Always use the token's actual decimal count from StablecoinInfo
  2. Add validation that decimals match expected values
  3. Add tests for tokens with different decimal counts
private parseAmount(amount: string, stablecoin: StablecoinInfo): bigint {
  const decimals = stablecoin.decimals; // Use actual decimals, not hardcoded
  return parseUnits(amount, decimals);
}

Priority

Medium - Financial correctness

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at src/agent/limits.ts:144 and inspect how parseAmount uses StablecoinInfo.decimals. Add coverage for stablecoins with different decimal counts, including an 18-decimal token such as FRAX, and verify that parsed limits preserve the intended dollar amounts.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
blockchain
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.