diff --git a/x/manifest/client/cli/tx.go b/x/manifest/client/cli/tx.go index 2a44e05..97597aa 100644 --- a/x/manifest/client/cli/tx.go +++ b/x/manifest/client/cli/tx.go @@ -33,8 +33,7 @@ func NewTxCmd() *cobra.Command { return txCmd } -// Returns a CLI command handler for registering a -// contract for the module. +// Returns a CLI command handler for updating the params. func MsgUpdateParams() *cobra.Command { cmd := &cobra.Command{ Use: "update-params [address_pairs] [automatic_inflation_enabled] [inflation_per_year]", @@ -81,6 +80,7 @@ func MsgUpdateParams() *cobra.Command { return cmd } +// Returns a CLI command handler for deploying a stakeholder payout (where stakeholders are set in the current params). func MsgDeployStakeholderPayout() *cobra.Command { cmd := &cobra.Command{ Use: "stakeholder-payout [coin_amount]", @@ -117,7 +117,8 @@ func MsgDeployStakeholderPayout() *cobra.Command { return cmd } -// address:1_000_000,address2:99_000_000 +// fromStrToStakeholders converts a string to a slice of StakeHolders. +// ex: address:1_000_000,address2:99_000_000 func fromStrToStakeholders(s string) ([]*types.StakeHolders, error) { stakeHolders := make([]*types.StakeHolders, 0) diff --git a/x/manifest/keeper/abci_test.go b/x/manifest/keeper/abci_test.go index f7710bb..0fe81b1 100644 --- a/x/manifest/keeper/abci_test.go +++ b/x/manifest/keeper/abci_test.go @@ -4,9 +4,11 @@ import ( "fmt" "testing" + sdkmath "cosmossdk.io/math" "github.com/stretchr/testify/require" "github.com/cosmos/cosmos-sdk/testutil/testdata" + sdk "github.com/cosmos/cosmos-sdk/types" manifest "github.com/liftedinit/manifest-ledger/x/manifest" "github.com/liftedinit/manifest-ledger/x/manifest/keeper" @@ -42,11 +44,19 @@ func TestStakeholderAutoMint(t *testing.T) { balance := f.App.BankKeeper.GetBalance(f.Ctx, acc, MintDenom) require.EqualValues(t, 0, balance.Amount.Int64()) + fmt.Println("before balance", balance.Amount.Int64()) err = manifest.BeginBlocker(f.Ctx, k, f.App.MintKeeper) require.NoError(t, err) balance = f.App.BankKeeper.GetBalance(f.Ctx, acc, MintDenom) require.True(t, balance.Amount.Int64() > 0) - fmt.Println("balance", balance.Amount.Int64()) + fmt.Println("after balance", balance.Amount.Int64()) + + // try to perform a manual mint (fails due to auto-inflation being enable) + _, err = ms.PayoutStakeholders(f.Ctx, &types.MsgPayoutStakeholders{ + Authority: authority.String(), + Payout: sdk.NewCoin(MintDenom, sdkmath.NewInt(100_000_000)), + }) + require.Error(t, err) } diff --git a/x/manifest/keeper/keeper_test.go b/x/manifest/keeper/keeper_test.go index c99f3b7..572a51f 100644 --- a/x/manifest/keeper/keeper_test.go +++ b/x/manifest/keeper/keeper_test.go @@ -14,6 +14,8 @@ import ( appparams "github.com/liftedinit/manifest-ledger/app/params" ) +// Sets up the keeper test suite. + type testFixture struct { suite.Suite