From ac620c19ae88c9d8697190664f709931f33b007d Mon Sep 17 00:00:00 2001 From: Aleksandr Pismenskiy Date: Tue, 20 Aug 2024 12:23:07 +0300 Subject: [PATCH] add SetTotalBurnedNeutronsAmount method to feeburner --- x/feeburner/genesis.go | 2 +- x/feeburner/keeper/keeper.go | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/x/feeburner/genesis.go b/x/feeburner/genesis.go index 205523f72..2e698cf9d 100644 --- a/x/feeburner/genesis.go +++ b/x/feeburner/genesis.go @@ -10,7 +10,7 @@ import ( // InitGenesis initializes the module's state from a provided genesis state. func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { // this line is used by starport scaffolding # genesis/module/init - k.RecordBurnedFees(ctx, genState.TotalBurnedNeutronsAmount.Coin) + k.SetTotalBurnedNeutronsAmount(ctx, genState.TotalBurnedNeutronsAmount) err := k.SetParams(ctx, genState.Params) if err != nil { diff --git a/x/feeburner/keeper/keeper.go b/x/feeburner/keeper/keeper.go index 8660a4710..0eb798ce8 100644 --- a/x/feeburner/keeper/keeper.go +++ b/x/feeburner/keeper/keeper.go @@ -81,6 +81,13 @@ func (k Keeper) GetTotalBurnedNeutronsAmount(ctx sdk.Context) types.TotalBurnedN return totalBurnedNeutronsAmount } +// SetTotalBurnedNeutronsAmount sets the total burned amount of NTRN tokens +func (k Keeper) SetTotalBurnedNeutronsAmount(ctx sdk.Context, totalBurnedNeutronsAmount types.TotalBurnedNeutronsAmount) { + store := ctx.KVStore(k.storeKey) + + store.Set(KeyBurnedFees, k.cdc.MustMarshal(&totalBurnedNeutronsAmount)) +} + // BurnAndDistribute is an important part of tokenomics. It does few things: // 1. Burns NTRN fee coins distributed to consumertypes.ConsumerRedistributeName in ICS (https://github.com/cosmos/interchain-security/blob/86046926502f7b0ba795bebcdd1fdc97ac776573/x/ccv/consumer/keeper/distribution.go#L67) // 2. Updates total amount of burned NTRN coins