lambdaclass / lambdaclass/eth-agent
Stablecoin limit parsing assumes all tokens have same decimals
Open
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
- Always use the token's actual decimal count from
StablecoinInfo - Add validation that decimals match expected values
- 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
- 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.
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