# Sources, provenance and licences

MoonMoney ships no third-party source code. Its only data is the ISO 4217
currency table in `currency_table.mbt`, which is generated from two public data
sets. This file records what was used, under which terms, and what was changed.

Retrieved **2026-10-16**; generated by `node tools/generate_currency_table.mjs`.

## 1. ISO 4217 currency codes, numeric codes, minor units and names

- Source: <https://github.com/datasets/currency-codes>, file `data/codes-all.csv`
  (branch `main`).
- Upstream of that file: the ISO 4217 currency code lists published by SIX Group,
  the ISO 4217 maintenance agency,
  <https://www.six-group.com/en/products-services/financial-information/market-reference-data/data-standards.html>.
- Licence of the compilation: **ODC-PDDL-1.0** (<https://opendatacommons.org/licenses/pddl/1.0/>),
  which the data package applies "only to the maintainers' own selection and
  formatting of the data".
- **Open point, recorded rather than glossed over:** the data set's own
  `ATTRIBUTION.txt` states that the underlying ISO 4217 lists carry no stated
  licence and that their reuse terms are unclear. What MoonMoney takes from this
  source is factual identifiers and numeric facts (alphabetic code, numeric code,
  minor unit) plus the ISO English name; the source file itself is neither
  redistributed nor copied into this repository, and the generator can be
  re-pointed at the official SIX list without changing the output format. A
  reviewer who needs a single unambiguous licence should treat this item as the
  one to confirm.
- **How to remove that uncertainty:** the generator reads this source only through the
  `SOURCES.codes` constant at the top of `tools/generate_currency_table.mjs`, and it
  accepts any CSV with the same six columns. Exporting the official SIX Group list
  (List One) to that shape and pointing the constant at the local file therefore
  replaces the compilation without touching a line of MoonBit; the generated table
  is the same shape either way.
- Fields taken: `AlphabeticCode`, `NumericCode`, `MinorUnit`, `Currency`.
- Fields not taken: `Entity`, `WithdrawalDate` (used only to select the current
  entries).
- Changes: rows for one code are de-duplicated; entries with a withdrawal date
  are dropped; entries whose minor unit is empty or not a number are dropped
  because they define no fixed scale; the table is sorted by code.

## 2. Display digits, cash rules and symbols

- Source: <https://github.com/unicode-org/cldr-json> (branch `main`), the JSON
  distribution of Unicode CLDR:
  - `cldr-json/cldr-numbers-full/main/en/currencies.json`
    (`displayName`, `symbol`)
  - `cldr-json/cldr-core/supplemental/currencyData.json`
    (`fractions`: `digits`, `cashDigits`, `cashRounding`)
- Licence: **Unicode License v3** (`LICENSE` in that repository), an
  OSI-approved permissive licence.
- Fields taken: `displayName`, `symbol`, and the `fractions` entries.
- Changes: CLDR lists a currency in `fractions` only when its digits differ from
  two, so a missing entry is read as `digits = 2` and `rounding = 0`; a missing
  `cashRounding` is read as a step of one minor unit. The English `displayName`
  replaces the ISO name where CLDR has one, so the table reads the way a UI reads.

## 3. What is generated

`currency_table.mbt` holds one row per currency and the struct that builds it. It
is deterministic: running the generator twice produces a byte-identical file,
which is checked in the project's self-review. The file carries this provenance
in its header so that anyone reading the data can find this document.

## 4. Third-party code, test data and samples

- No third-party source code is vendored or adapted.
- The only dependencies are toolchain packages: `moonbitlang/core/bigint`,
  `moonbitlang/core/debug`, `moonbitlang/core/env`, `moonbitlang/core/int64`
  and `moonbitlang/core/string`, all Apache-2.0.
- The example inputs and test fixtures are written for this project and contain
  no real personal or financial data.

## 5. This project

Apache-2.0; see `LICENSE`.
