OKRW Module
Manages the creation and parameters of the native KRW-pegged stablecoin, OKRW.
The x/okrw module is a specialized Cosmos SDK module that governs the minting of the aokrw token — the native gas token of the Maroo network. (Staking is settled in a separate bond denom, amaroo.) Its design is intentionally simple and secure, centralizing the ability to create new tokens to a single, authorized 'minter' address. This address is a configurable parameter that can only be changed through on-chain governance, ensuring that control over the OKRW supply is decentralized and transparent.
Key Features
Controlled Minting
Only a single, pre-configured address (`minter_address`) has the authority to mint new OKRW tokens.
Simple and Secure
The module has a minimal API surface, focusing solely on minting and parameter management to reduce complexity and attack vectors.
Architecture
graph TD
subgraph Governance
A[Gov Proposal: UpdateParams] -->|sets| B(okrw/Params: minter_address)
end
subgraph Minting Process
C(Authorized Minter) -->|sends tx| D{MsgMint}
D -- recipient, amount --> E[x/okrw Module]
E -->|1. MintCoins| F[x/bank Module]
F -->|creates coins in| G[okrw Module Account]
E -->|2. SendCoinsFromModuleToAccount| F
F -->|sends coins to| H(Recipient Address)
end
style A fill:#f9f,stroke:#333,stroke-width:2px
style C fill:#ccf,stroke:#333,stroke-width:2px Architecture of the OKRW minting and parameter management process. Governance sets the authorized minter, who can then initiate the minting flow, which uses the bank module to create and distribute tokens.
Minting Mechanism
x/okrw module is to mint new tokens. This process is handled by the Mint message server. When a MsgMint transaction is received, the module performs a series of critical checks:1. It verifies that the transaction signer's address matches the
minter_address stored in the module's parameters.2. It ensures the requested amount is positive and that the token denomination matches the configured
mint_denom (typically aokrw).3. It validates that the recipient address is a valid Bech32 address.
If all checks pass, the module executes a two-step minting operation using the
x/bank module. First, it calls MintCoins, which creates the specified amount of tokens and places them in the x/okrw module's own account. Immediately after, it calls SendCoinsFromModuleToAccount to transfer these newly created tokens from the module account to the final recipient's address. This two-step process ensures a clear and auditable trail for token creation and distribution.Parameter Management
x/okrw module is controlled by a small set of parameters, primarily the minter_address and mint_denom. To maintain network security and stability, these parameters are not directly modifiable. Instead, any changes must be submitted as a governance proposal.The
UpdateParams message is restricted to the module's designated authority. By default, this authority is the x/gov module account, meaning only a successful governance vote can authorize a parameter update. This mechanism ensures that the community has full control over who is allowed to mint OKRW and what the fundamental unit of the currency is. When a proposal to update parameters passes, the x/okrw keeper validates the new parameters and persists them to the state.