Skip to content

Commit

Permalink
fix: change total_supply name to swappableNewCoinAmount
Browse files Browse the repository at this point in the history
Signed-off-by: 170210 <[email protected]>
  • Loading branch information
170210 committed Apr 24, 2024
1 parent 3cd7acb commit c2a9b61
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion x/ERRORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
14 changes: 7 additions & 7 deletions x/fswap/keeper/fswap.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Check warning on line 37 in x/fswap/keeper/fswap.go

View check run for this annotation

Codecov / codecov/patch

x/fswap/keeper/fswap.go#L32-L37

Added lines #L32 - L37 were not covered by tests
}
k.cdc.MustUnmarshal(bz, &totalSupply)
return totalSupply
k.cdc.MustUnmarshal(bz, &SwappableNewCoinAmount)
return SwappableNewCoinAmount

Check warning on line 40 in x/fswap/keeper/fswap.go

View check run for this annotation

Codecov / codecov/patch

x/fswap/keeper/fswap.go#L39-L40

Added lines #L39 - L40 were not covered by tests
}

func (k Keeper) SetTotalSupply(ctx sdk.Context, totalSupply sdk.Coin) error {
func (k Keeper) SetSwappableNewCoinAmount(ctx sdk.Context, SwappableNewCoinAmount sdk.Coin) error {

Check failure on line 43 in x/fswap/keeper/fswap.go

View workflow job for this annotation

GitHub Actions / golangci-lint

captLocal: `SwappableNewCoinAmount' should not be capitalized (gocritic)
store := ctx.KVStore(k.storeKey)
bz, err := k.cdc.Marshal(&totalSupply)
bz, err := k.cdc.Marshal(&SwappableNewCoinAmount)
if err != nil {
return err

Check warning on line 47 in x/fswap/keeper/fswap.go

View check run for this annotation

Codecov / codecov/patch

x/fswap/keeper/fswap.go#L43-L47

Added lines #L43 - L47 were not covered by tests
}
Expand Down
6 changes: 3 additions & 3 deletions x/fswap/types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
)
2 changes: 0 additions & 2 deletions x/fswap/types/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit c2a9b61

Please sign in to comment.