Skip to content

Commit

Permalink
simplify + working manual e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
Reecepbcups committed Feb 27, 2024
1 parent e056393 commit e10e5af
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 235 deletions.
7 changes: 0 additions & 7 deletions app/ante.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
package app

import (
"context"
"errors"

"github.com/liftedinit/manifest-ledger/app/decorators"
manifestkeeper "github.com/liftedinit/manifest-ledger/x/manifest/keeper"
poaante "github.com/strangelove-ventures/poa/ante"

ibcante "github.com/cosmos/ibc-go/v8/modules/core/ante"
Expand All @@ -26,9 +23,6 @@ type HandlerOptions struct {

IBCKeeper *keeper.Keeper
CircuitKeeper *circuitkeeper.Keeper

ManifestKeeper *manifestkeeper.Keeper
IsSudoAdminFunc func(ctx context.Context, fromAddr string) bool
}

func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
Expand Down Expand Up @@ -65,7 +59,6 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
ante.NewIncrementSequenceDecorator(options.AccountKeeper),
poaante.NewPOADisableStakingDecorator(),
poaante.NewCommissionLimitDecorator(doGenTxRateValidation, rateFloor, rateCeil),
decorators.NewMsgManualMintFilterDecorator(options.ManifestKeeper, options.IsSudoAdminFunc),
ibcante.NewRedundantRelayDecorator(options.IBCKeeper),
}

Expand Down
4 changes: 0 additions & 4 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -904,10 +904,6 @@ func (app *ManifestApp) setAnteHandler(txConfig client.TxConfig) {
},
IBCKeeper: app.IBCKeeper,
CircuitKeeper: &app.CircuitKeeper,

// Manifest specific logic for inflation disabled manual minting / disabled if inflation is on.
ManifestKeeper: &app.ManifestKeeper,
IsSudoAdminFunc: app.POAKeeper.IsAdmin,
},
)
if err != nil {
Expand Down
60 changes: 0 additions & 60 deletions app/decorators/inflation_disable_minting.go

This file was deleted.

135 changes: 0 additions & 135 deletions app/decorators/inflation_disable_test.go

This file was deleted.

29 changes: 0 additions & 29 deletions app/decorators/mock_tx.go

This file was deleted.

36 changes: 36 additions & 0 deletions x/manifest/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func NewTxCmd() *cobra.Command {

txCmd.AddCommand(
MsgUpdateParams(),
MsgDeployStakeholderPayout(),
)
return txCmd
}
Expand Down Expand Up @@ -79,6 +80,41 @@ func MsgUpdateParams() *cobra.Command {
return cmd
}

func MsgDeployStakeholderPayout() *cobra.Command {
cmd := &cobra.Command{
Use: "stakeholder-payout [coin_amount]",
Short: "Payout current stakeholders (from authority)",
Example: `stakeholder-payout 50000umfx`,
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
cliCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
senderAddress := cliCtx.GetFromAddress()

coin, err := sdk.ParseCoinNormalized(args[0])
if err != nil {
return err
}

msg := &types.MsgPayoutStakeholders{
Authority: senderAddress.String(),
Payout: coin,
}

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

return tx.GenerateOrBroadcastTxCLI(cliCtx, cmd.Flags(), msg)
},
}

flags.AddTxFlagsToCmd(cmd)
return cmd
}

// address:1_000_000,address2:99_000_000
func fromStrToStakeholders(s string) ([]*types.StakeHolders, error) {
stakeHolders := make([]*types.StakeHolders, 0)
Expand Down
9 changes: 9 additions & 0 deletions x/manifest/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,14 @@ func (ms msgServer) PayoutStakeholders(ctx context.Context, req *types.MsgPayout
return nil, fmt.Errorf("invalid authority; expected %s, got %s", ms.k.authority, req.Authority)
}

params, err := ms.k.Params.Get(ctx)
if err != nil {
return nil, err
}

if params.Inflation.AutomaticEnabled {
return nil, types.ErrManualMintingDisabled
}

return nil, ms.k.PayoutStakeholders(ctx, req.Payout)
}

0 comments on commit e10e5af

Please sign in to comment.