Skip to content

Commit

Permalink
revert: remove x/inflation burn method
Browse files Browse the repository at this point in the history
  • Loading branch information
k-yang committed Apr 3, 2024
1 parent b210bf4 commit 1ba22a7
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 521 deletions.
2 changes: 1 addition & 1 deletion app/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ func ModuleAccPerms() map[string][]string {
return map[string][]string{
authtypes.FeeCollectorName: nil,
distrtypes.ModuleName: nil,
inflationtypes.ModuleName: {authtypes.Minter, authtypes.Burner},
inflationtypes.ModuleName: {authtypes.Minter},
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
govtypes.ModuleName: {authtypes.Burner},
Expand Down
11 changes: 1 addition & 10 deletions proto/nibiru/inflation/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,4 @@ message MsgEditInflationParams {

message MsgToggleInflationResponse {}

message MsgEditInflationParamsResponse {}

// MsgBurn: allows burning of any token
message MsgBurn {
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
cosmos.base.v1beta1.Coin coin = 2
[ (gogoproto.moretags) = "yaml:\"coin\"", (gogoproto.nullable) = false ];
}

message MsgBurnResponse {}
message MsgEditInflationParamsResponse {}
10 changes: 0 additions & 10 deletions x/inflation/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,3 @@ func NewKeeper(
func (k Keeper) Logger(ctx sdk.Context) log.Logger {
return ctx.Logger().With("module", "x/"+types.ModuleName)
}

func (k Keeper) Burn(ctx sdk.Context, coins sdk.Coins, sender sdk.AccAddress) error {
if err := k.bankKeeper.SendCoinsFromAccountToModule(
ctx, sender, types.ModuleName, coins,
); err != nil {
return err
}

return k.bankKeeper.BurnCoins(ctx, types.ModuleName, coins)
}
71 changes: 0 additions & 71 deletions x/inflation/keeper/keeper_test.go

This file was deleted.

41 changes: 0 additions & 41 deletions x/inflation/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ import (
var (
_ legacytx.LegacyMsg = &MsgEditInflationParams{}
_ legacytx.LegacyMsg = &MsgToggleInflation{}
_ legacytx.LegacyMsg = &MsgBurn{}
)

// oracle message types
const (
TypeMsgEditInflationParams = "edit_inflation_params"
TypeMsgToggleInflation = "toggle_inflation"
TypeMsgBurn = "msg_burn"
)

// Route implements legacytx.LegacyMsg
Expand Down Expand Up @@ -105,42 +103,3 @@ func (m MsgToggleInflation) ValidateBasic() error {
}
return nil
}

// -------------------------------------------------
// MsgBurn
// Route implements legacytx.LegacyMsg
func (msg MsgBurn) Route() string { return RouterKey }

// Type implements legacytx.LegacyMsg
func (msg MsgBurn) Type() string { return TypeMsgBurn }

// GetSignBytes implements legacytx.LegacyMsg
func (msg MsgBurn) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg))
}

// GetSigners implements legacytx.LegacyMsg
func (msg MsgBurn) GetSigners() []sdk.AccAddress {
feeder, err := sdk.AccAddressFromBech32(msg.Sender)
if err != nil {
panic(err)
}

return []sdk.AccAddress{feeder}
}

func (m MsgBurn) ValidateBasic() error {
if _, err := sdk.AccAddressFromBech32(m.Sender); err != nil {
return err
}

if err := m.Coin.Validate(); err != nil {
return err
}

if m.Coin.Amount.IsZero() {
return fmt.Errorf("coin amount should not be zero")
}

return nil
}
Loading

0 comments on commit 1ba22a7

Please sign in to comment.