Problem statement
Design the object model and core APIs for a multi-currency wallet that holds balances in several currencies, converts between them at pluggable rates, and records every movement as an immutable ledger entry.
Operating context. A single user's wallet holds a sub-balance per currency (for example USD, EUR, INR). Supported operations are deposit, withdraw, convert (debit one currency and credit another using a fetched rate minus a spread), and transfer to another wallet. Every operation is recorded as an immutable movement, and a currency's balance is the fold of its movements. Overdraft is never allowed. Exchange rates come from an injected rate provider. The service runs in one process and may see concurrent operations on the same wallet.
Out of scope. Real FX-market connectivity (the rate provider is a port), a persistence layer, KYC and compliance, interest accrual, card issuance, and cross-process distributed transactions.
What to produce. The class hierarchy (Wallet, per-currency Balance, Money value object, MovementEntry, the rate-provider port, a conversion policy), the public APIs each exposes, the invariant that no balance goes negative, and how conversion spread and rounding are pluggable. Be explicit about how a debit reserves atomically so concurrent withdrawals cannot overdraw, and how per-currency operations avoid one global lock.
Requirements
This assessment is a Premium feature.
The statement above is free to read. The functional and non-functional requirements, and the graded canvas that scores your design against them, come with Premium.
Topics
- System Design LLD
- Oop Solid
- Concurrency Locks
- Finance Forex
- Domain Money