From 91d66277e560ce38d40ceafb04c5356c164b254a Mon Sep 17 00:00:00 2001 From: JordiParraCrespo Date: Mon, 8 Jun 2026 11:10:44 +0000 Subject: [PATCH 1/3] fix(config): make account bech32 prefix configurable via CHAIN_PREFIX MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AccountAddressPrefix now reads the CHAIN_PREFIX env var at process start, falling back to the Ethermint-conventional "ethm" when unset. Production sets CHAIN_PREFIX=hnl for the HNL CBDC (hnl1… addresses); tests and local runs keep the "ethm" default, so existing fixtures and the integration suite prefix assertion stay green. Only affects the Cosmos bech32 form — the EVM 0x address is unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) --- app/config.go | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/app/config.go b/app/config.go index 76e4de5..9601769 100644 --- a/app/config.go +++ b/app/config.go @@ -1,11 +1,22 @@ package app +import "os" + type EVMOptionsFn func(uint64) error +// AccountAddressPrefix is the Bech32 prefix for account addresses. It reads +// CHAIN_PREFIX at process start (e.g. "hnl" for the HNL CBDC deployment) and +// falls back to the Ethermint-conventional "ethm" when unset (tests, local). +var AccountAddressPrefix = func() string { + if v := os.Getenv("CHAIN_PREFIX"); v != "" { + return v + } + return "ethm" +}() + const ( - AccountAddressPrefix = "ethm" - Bip44CoinType = 60 - Name = "cbdc" + Bip44CoinType = 60 + Name = "cbdc" // BaseDenom defines to the default denomination used in EVM BaseDenom = "acbdc" Denom = "CBDC" From 08ee3c383aa06f6bad7fd61a7bb50c9c95a4ba38 Mon Sep 17 00:00:00 2001 From: JordiParraCrespo Date: Tue, 9 Jun 2026 08:41:44 +0000 Subject: [PATCH 2/3] fix(config): set CBDC base denom to hnl BaseDenom is wired to the x/cbdc keeper as the only mint/burnable denom and to the EVM/bank defaults. Setting it to hnl makes the module mint/burn the HNL CBDC token (matching the deployment) instead of the placeholder acbdc. Like the address prefix, this is deployment-specific and a candidate to make env-driven later; kept as a constant here to match what is deployed. Co-Authored-By: Claude Opus 4.8 (1M context) --- app/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/config.go b/app/config.go index 9601769..2581f10 100644 --- a/app/config.go +++ b/app/config.go @@ -18,7 +18,7 @@ const ( Bip44CoinType = 60 Name = "cbdc" // BaseDenom defines to the default denomination used in EVM - BaseDenom = "acbdc" + BaseDenom = "hnl" Denom = "CBDC" DenomDescription = "CBDC is the digital central bank currency." DenomName = "CBDC" From 76cc4f6e931a651cd62f59d262c42a8f23179566 Mon Sep 17 00:00:00 2001 From: JordiParraCrespo Date: Tue, 9 Jun 2026 11:36:25 +0200 Subject: [PATCH 3/3] refactor(config): env-driven prefix + base denom via cmp.Or Replace the IIFE with cmp.Or for AccountAddressPrefix, and make BaseDenom configurable the same way (CHAIN_DENOM, default acbdc) so the node stays generic and the same binary serves any deployment. Production sets CHAIN_PREFIX=hnl and CHAIN_DENOM=hnl; tests/local keep the ethm/acbdc defaults, so existing fixtures and the integration suite stay green. Co-Authored-By: Claude Opus 4.8 (1M context) --- app/config.go | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/app/config.go b/app/config.go index 2581f10..5b4555d 100644 --- a/app/config.go +++ b/app/config.go @@ -1,24 +1,26 @@ package app -import "os" +import ( + "cmp" + "os" +) type EVMOptionsFn func(uint64) error -// AccountAddressPrefix is the Bech32 prefix for account addresses. It reads -// CHAIN_PREFIX at process start (e.g. "hnl" for the HNL CBDC deployment) and -// falls back to the Ethermint-conventional "ethm" when unset (tests, local). -var AccountAddressPrefix = func() string { - if v := os.Getenv("CHAIN_PREFIX"); v != "" { - return v - } - return "ethm" -}() +// AccountAddressPrefix (the Bech32 account prefix) and BaseDenom (the EVM / CBDC +// base denomination) are deployment-specific, so the same binary can serve any +// deployment. They are read from the environment at process start and fall back +// to the Ethermint-conventional defaults when unset (tests, local runs): +// +// CHAIN_PREFIX=hnl CHAIN_DENOM=hnl // HNL CBDC production +var ( + AccountAddressPrefix = cmp.Or(os.Getenv("CHAIN_PREFIX"), "ethm") + BaseDenom = cmp.Or(os.Getenv("CHAIN_DENOM"), "acbdc") +) const ( - Bip44CoinType = 60 - Name = "cbdc" - // BaseDenom defines to the default denomination used in EVM - BaseDenom = "hnl" + Bip44CoinType = 60 + Name = "cbdc" Denom = "CBDC" DenomDescription = "CBDC is the digital central bank currency." DenomName = "CBDC"