From c2a9b611cd610e87b0b039fc39bc2a623a0f3cde Mon Sep 17 00:00:00 2001 From: 170210 Date: Wed, 24 Apr 2024 14:10:31 +0900 Subject: [PATCH] fix: change total_supply name to swappableNewCoinAmount Signed-off-by: 170210 --- x/ERRORS.md | 2 +- x/fswap/keeper/fswap.go | 14 +++++++------- x/fswap/types/errors.go | 6 +++--- x/fswap/types/genesis.go | 2 -- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/x/ERRORS.md b/x/ERRORS.md index 8d5f0b1111..8da74ceb3c 100644 --- a/x/ERRORS.md +++ b/x/ERRORS.md @@ -179,7 +179,7 @@ |:-|:-|:-|:-| |ErrParamsNotFound|fswap|1100|params does not exist| |ErrSwappedNotFound|fswap|1101|swapped does not exist| -|ErrTotalSupplyNotFound|fswap|1102|swappable new coin amount does not exist| +|ErrSwappableNewCoinAmountNotFound|fswap|1102|swappable new coin amount does not exist| >You can also find detailed information in the following Errors.go files: * [fswap/types/errors.go](fswap/types/errors.go) diff --git a/x/fswap/keeper/fswap.go b/x/fswap/keeper/fswap.go index 5ad8af4452..3e102ea89b 100644 --- a/x/fswap/keeper/fswap.go +++ b/x/fswap/keeper/fswap.go @@ -29,20 +29,20 @@ func (k Keeper) SetSwapped(ctx sdk.Context, swapped types.Swapped) error { return nil } -func (k Keeper) GetTotalSupply(ctx sdk.Context) sdk.Coin { +func (k Keeper) GetSwappableNewCoinAmount(ctx sdk.Context) sdk.Coin { store := ctx.KVStore(k.storeKey) bz := store.Get([]byte{types.SwappableNewCoinAmountKey}) - var totalSupply sdk.Coin + var SwappableNewCoinAmount sdk.Coin if bz == nil { - panic(types.ErrTotalSupplyNotFound) + panic(types.ErrSwappableNewCoinAmountNotFound) } - k.cdc.MustUnmarshal(bz, &totalSupply) - return totalSupply + k.cdc.MustUnmarshal(bz, &SwappableNewCoinAmount) + return SwappableNewCoinAmount } -func (k Keeper) SetTotalSupply(ctx sdk.Context, totalSupply sdk.Coin) error { +func (k Keeper) SetSwappableNewCoinAmount(ctx sdk.Context, SwappableNewCoinAmount sdk.Coin) error { store := ctx.KVStore(k.storeKey) - bz, err := k.cdc.Marshal(&totalSupply) + bz, err := k.cdc.Marshal(&SwappableNewCoinAmount) if err != nil { return err } diff --git a/x/fswap/types/errors.go b/x/fswap/types/errors.go index 34514fdde4..90a43d2bb3 100644 --- a/x/fswap/types/errors.go +++ b/x/fswap/types/errors.go @@ -8,7 +8,7 @@ import ( // x/fswap module sentinel errors var ( - ErrParamsNotFound = sdkerrors.Register(ModuleName, 1100, "params does not exist") - ErrSwappedNotFound = sdkerrors.Register(ModuleName, 1101, "swapped does not exist") - ErrTotalSupplyNotFound = sdkerrors.Register(ModuleName, 1102, "swappable new coin amount does not exist") + ErrParamsNotFound = sdkerrors.Register(ModuleName, 1100, "params does not exist") + ErrSwappedNotFound = sdkerrors.Register(ModuleName, 1101, "swapped does not exist") + ErrSwappableNewCoinAmountNotFound = sdkerrors.Register(ModuleName, 1102, "swappable new coin amount does not exist") ) diff --git a/x/fswap/types/genesis.go b/x/fswap/types/genesis.go index edbe4b1d6c..8d1c13c061 100644 --- a/x/fswap/types/genesis.go +++ b/x/fswap/types/genesis.go @@ -2,8 +2,6 @@ package types import sdk "github.com/Finschia/finschia-sdk/types" -var DefaultTotalSupply = sdk.NewCoin(DefaultConfig().NewCoinDenom, sdk.NewInt(100000)) - // NewGenesis creates a new genesis state func NewGenesisState(config Config, swappable sdk.Coin) *GenesisState { return &GenesisState{