Skip to content

feat(FIAT-311): config-driven fiat coins and index 12 new currencies#8559

Merged
feng-bitgo merged 2 commits into
masterfrom
drew/fiat-311-index-new-currencies
Apr 21, 2026
Merged

feat(FIAT-311): config-driven fiat coins and index 12 new currencies#8559
feng-bitgo merged 2 commits into
masterfrom
drew/fiat-311-index-new-currencies

Conversation

@drew-bitgo
Copy link
Copy Markdown
Contributor

@drew-bitgo drew-bitgo commented Apr 18, 2026

Summary

  • Refactors fiat coin registration from per-currency class files to a single config-driven Fiat class. Replaces 36 boilerplate files (~700 LOC) with one config array (~130 LOC). Adding a new fiat currency now requires a single config line instead of ~6 files.
  • Indexes 12 new fiat currencies: CAD, AUD, HKD, CHF, SEK, NOK, JPY, CNY, NZD, IDR, KRW, ZAR across UnderlyingAsset, allCoinsAndTokens, and ofcCoins.
  • JPY and KRW use decimalPlaces=0 / baseFactor=1; all others use decimalPlaces=2 / baseFactor=100.
  • 3 testnet OFC entries use ofct:{code} naming (ofct:cad, ofct:aud, ofct:hkd) to avoid collisions with existing ERC20 tokens (TrueCAD, TrueAUD, TrueHKD).

Modules touched

Module What changed
@bitgo/sdk-core New Fiat class + fiatCoins config array; deleted 36 individual class files
bitgo coinFactory.ts uses dynamic loop; coins/index.ts re-exports generic Fiat
@bitgo/statics 12 UnderlyingAsset entries, 24 fiat() entries, 24 ofc()/tofc() entries

Test plan

  • tsc --noEmit passes for sdk-core, bitgo, and statics
  • Fiat unit tests pass (36 tests — 18 currencies × mainnet/testnet)
  • Verify no downstream breakage in wallet-platform (already config-driven, should pick up new currencies via statics bump)
  • Verify fiat-transfer-types and prime-microservices changes in separate PRs

FIAT-311

🤖 Generated with Claude Code

@linear
Copy link
Copy Markdown

linear Bot commented Apr 18, 2026

@drew-bitgo drew-bitgo force-pushed the drew/fiat-311-index-new-currencies branch 3 times, most recently from 7dac34e to 4eff7de Compare April 18, 2026 03:53
drew-bitgo and others added 2 commits April 18, 2026 00:07
…ig-driven Fiat class

Replace 36 individual fiat coin class files with a single generic Fiat class
that takes a config object (chain, fullName, baseFactor). All currencies are
defined in a config array and registration is automatic via a loop in
coinFactory. Testnet variants are derived automatically from mainnet configs.

This reduces the effort to add a new fiat currency from ~6 files and 150+
lines of boilerplate to a single config line.

FIAT-311

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add CAD, AUD, HKD, CHF, SEK, NOK, JPY, CNY, NZD, IDR, KRW, ZAR to:
- fiatCoins config array in sdk-core (12 entries)
- UnderlyingAsset enum (12 entries)
- allCoinsAndTokens fiat() entries (24: 12 mainnet + 12 testnet)
- ofcCoins ofc/tofc entries (12 mainnet + 12 testnet)

JPY and KRW use decimalPlaces=0; all others use 2.

3 testnet OFC entries use ofct:{code} naming (ofct:cad, ofct:aud, ofct:hkd)
to avoid collisions with existing ERC20 tokens (TrueCAD, TrueAUD, TrueHKD).

FIAT-311

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@drew-bitgo drew-bitgo force-pushed the drew/fiat-311-index-new-currencies branch from 4eff7de to a10c635 Compare April 18, 2026 04:08
Copy link
Copy Markdown
Contributor

@zahin-mohammad zahin-mohammad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. Is there plans to move FIAT into its own sdk-module like all other coins?

Copy link
Copy Markdown
Contributor Author

Thats the plan. I wanted to condense things first

Copy link
Copy Markdown
Contributor

@Schultzer Schultzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me, nice with the simplicity.

@feng-bitgo feng-bitgo merged commit 304f5dd into master Apr 21, 2026
22 checks passed
Copy link
Copy Markdown
Contributor

@dszheng92 dszheng92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants