---
# System prepended metadata

title: UMint Module

---


# Mint

We will  overrides the cosmos mint module BeginBlocker with our own BeginBlocker


### UMint (Umee Inflation Calculator)
UMint will used for storing the InflationRate Params 

### UMint Genesis 
```go
Genesis {
    LastUpdatedBlock string 
    Params params ; 
}
```



### UMint Params
The UMint module utilizes the following parameters:

```go
Params {
    final_supply sdk.dec
    inflation_reduction_duration sdk.dec 
    inflation_reduction_rate sdk.dec 
}

```

1. `final_supply` - sdk.dec (Ex: 21B): This parameter represents the final desired supply of tokens.

2. `inflation_reduction_duration` - sdk.dec (0 to 1 or more): It determines the duration over which the inflation rate is gradually reduced. A value of 1 corresponds to a yearly change, while 0.5 represents a 6-month duration.

3. `inflation_reduction_rate` - sdk.dec (0 to 1): This parameter determines the rate at which the inflation rate is reduced. A value of 0 indicates no change, 0.1 corresponds to a 10% reduction rate, and 0.01 represents a 1% reduction rate.


### InflationCalFn

We will use below the inflation calculation function 

```go
func uMintInflationCalculationFn(_ context.Context, minter Minter, params Params, bondedRatio math.LegacyDec) math.LegacyDec {
    totalSupplyofStakingDenom = // get from bank

    if totalSupplyofStakingDenom >= umintStore.GetFinalSupply() {
        // total supply of staking denom reaches the final supply, so inflation will be zero
        // no more tokens will be minted
        return math.LegacyZeroDec()
    }

    lastInflationRateChangedBlock = umintStore.LastInflationRateChangedBlock(ctx)

    if lastInflationRateChangedBlock >= {
        params.min_inflation_rate = params.min_inflation_rate * (1 - uMint.GetInflationReductionRate())
        params.max_inflation_rate = params.max_inflation_rate * (1 - uMint.GetInflationReductionRate())

        // update the mint inflation rates
        updateMintParams(ctx, params)

        // update the inflation rate changed block in the store
        setLastInflationRateChangedBlock(ctx, ctx.CurrentBlockHeight())
    }

    return inflation
}
```

In this logic, the function checks if the total supply of the  denomination has reached the final supply. If so, inflation is set to zero, indicating that no more tokens will be minted. The function also checks if the last inflation rate change block is greater than or equal to a certain value. If it is, the inflation rates are updated based on the inflation reduction rate. Finally, the function returns the calculated inflation rate.

By following this logic, the UMint module provides inflation calculations based on the specified parameters.