Skip to content

Commit e10e5af

Browse files
committed
simplify + working manual e2e
1 parent e056393 commit e10e5af

File tree

7 files changed

+45
-235
lines changed

7 files changed

+45
-235
lines changed

app/ante.go

-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
package app
22

33
import (
4-
"context"
54
"errors"
65

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

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

2724
IBCKeeper *keeper.Keeper
2825
CircuitKeeper *circuitkeeper.Keeper
29-
30-
ManifestKeeper *manifestkeeper.Keeper
31-
IsSudoAdminFunc func(ctx context.Context, fromAddr string) bool
3226
}
3327

3428
func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
@@ -65,7 +59,6 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
6559
ante.NewIncrementSequenceDecorator(options.AccountKeeper),
6660
poaante.NewPOADisableStakingDecorator(),
6761
poaante.NewCommissionLimitDecorator(doGenTxRateValidation, rateFloor, rateCeil),
68-
decorators.NewMsgManualMintFilterDecorator(options.ManifestKeeper, options.IsSudoAdminFunc),
6962
ibcante.NewRedundantRelayDecorator(options.IBCKeeper),
7063
}
7164

app/app.go

-4
Original file line numberDiff line numberDiff line change
@@ -904,10 +904,6 @@ func (app *ManifestApp) setAnteHandler(txConfig client.TxConfig) {
904904
},
905905
IBCKeeper: app.IBCKeeper,
906906
CircuitKeeper: &app.CircuitKeeper,
907-
908-
// Manifest specific logic for inflation disabled manual minting / disabled if inflation is on.
909-
ManifestKeeper: &app.ManifestKeeper,
910-
IsSudoAdminFunc: app.POAKeeper.IsAdmin,
911907
},
912908
)
913909
if err != nil {

app/decorators/inflation_disable_minting.go

-60
This file was deleted.

app/decorators/inflation_disable_test.go

-135
This file was deleted.

app/decorators/mock_tx.go

-29
This file was deleted.

x/manifest/client/cli/tx.go

+36
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ func NewTxCmd() *cobra.Command {
2828

2929
txCmd.AddCommand(
3030
MsgUpdateParams(),
31+
MsgDeployStakeholderPayout(),
3132
)
3233
return txCmd
3334
}
@@ -79,6 +80,41 @@ func MsgUpdateParams() *cobra.Command {
7980
return cmd
8081
}
8182

83+
func MsgDeployStakeholderPayout() *cobra.Command {
84+
cmd := &cobra.Command{
85+
Use: "stakeholder-payout [coin_amount]",
86+
Short: "Payout current stakeholders (from authority)",
87+
Example: `stakeholder-payout 50000umfx`,
88+
Args: cobra.ExactArgs(1),
89+
RunE: func(cmd *cobra.Command, args []string) error {
90+
cliCtx, err := client.GetClientTxContext(cmd)
91+
if err != nil {
92+
return err
93+
}
94+
senderAddress := cliCtx.GetFromAddress()
95+
96+
coin, err := sdk.ParseCoinNormalized(args[0])
97+
if err != nil {
98+
return err
99+
}
100+
101+
msg := &types.MsgPayoutStakeholders{
102+
Authority: senderAddress.String(),
103+
Payout: coin,
104+
}
105+
106+
if err := msg.Validate(); err != nil {
107+
return err
108+
}
109+
110+
return tx.GenerateOrBroadcastTxCLI(cliCtx, cmd.Flags(), msg)
111+
},
112+
}
113+
114+
flags.AddTxFlagsToCmd(cmd)
115+
return cmd
116+
}
117+
82118
// address:1_000_000,address2:99_000_000
83119
func fromStrToStakeholders(s string) ([]*types.StakeHolders, error) {
84120
stakeHolders := make([]*types.StakeHolders, 0)

x/manifest/keeper/msg_server.go

+9
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,14 @@ func (ms msgServer) PayoutStakeholders(ctx context.Context, req *types.MsgPayout
3636
return nil, fmt.Errorf("invalid authority; expected %s, got %s", ms.k.authority, req.Authority)
3737
}
3838

39+
params, err := ms.k.Params.Get(ctx)
40+
if err != nil {
41+
return nil, err
42+
}
43+
44+
if params.Inflation.AutomaticEnabled {
45+
return nil, types.ErrManualMintingDisabled
46+
}
47+
3948
return nil, ms.k.PayoutStakeholders(ctx, req.Payout)
4049
}

0 commit comments

Comments
 (0)