Design
The main design principle for x/mint module is to provide a predictable, epoch-based token minting mechanism with a
maximum supply cap, inspired by successful models like Osmosis's mint module but tailored for Dchain's requirements.
Design Principles
- Epoch-based rather than block-based: Minting occurs at epoch boundaries (e.g., weekly) rather than every block, providing predictability and reducing computational overhead
- Maximum supply enforcement: Hard cap on total token supply prevents unlimited inflation
- Geometric reduction schedule: Predictable reduction in minting over time
- Flexible distribution: Configurable allocation between staking rewards and community pool
Minting Flow
State Management
The mint module maintains several pieces of state:
Params
Configurable parameters that define the minting behavior:
mint_denom: The denomination to mint (e.g., "udt")genesis_epoch_provisions: Initial minting amount per epochepoch_identifier: Which epoch to use (e.g., "week")reduction_period_in_epochs: How often to reduce (e.g., 52 for yearly)reduction_factor: Multiplier for reduction (e.g., 0.8 for 20% reduction)distribution_proportions: How to split minted tokensminting_rewards_distribution_start_epoch: When to start mintingmax_supply: Maximum total supply cap
Minter
Runtime state tracking current provisions:
epoch_provisions: Current minting amount per epoch (reduces over time)
Historical Tracking
For transparency and auditability:
last_reduction_epoch: Last epoch when reduction was appliedreduction_epochs: Map of epoch number → reduction factor appliedepoch_provisions_history: Map of epoch number → provisions at that epoch
Reduction Logic
The reduction mechanism ensures decreasing token emission:
if currentEpoch >= lastReductionEpoch + reductionPeriodInEpochs:
oldProvisions = minter.EpochProvisions
newProvisions = oldProvisions * reductionFactor
// Store history
storeEpochProvisions(currentEpoch - 1, oldProvisions)
storeReductionEpoch(currentEpoch, reductionFactor)
// Update state
minter.EpochProvisions = newProvisions
lastReductionEpoch = currentEpoch
Max Supply Protection
The module ensures the maximum supply is never exceeded:
currentSupply = bank.GetSupply(mintDenom)
if currentSupply >= maxSupply:
// Stop minting
return
provisionedAmount = minter.EpochProvision(params)
if currentSupply + provisionedAmount > maxSupply:
// Mint only up to max supply
provisionedAmount = maxSupply - currentSupply
// Mint the adjusted amount
mintCoins(provisionedAmount)
Distribution Mechanism
Minted tokens are distributed proportionally:
stakingAmount = mintedCoin * distributionProportions.Staking
communityAmount = mintedCoin * distributionProportions.CommunityPool
// Note: stakingAmount + communityAmount must equal mintedCoin
// This is enforced by params validation (proportions must sum to 1.0)
sendToFeeCollector(stakingAmount) // For validator/delegator rewards
fundCommunityPool(communityAmount) // For community initiatives
Governance Integration
The mint parameters can be updated through governance via MsgUpdateParams. Only the governance module (or configured
authority) can modify parameters, ensuring community control over the minting schedule.