Skip to content

Commit

Permalink
comments, extra test case
Browse files Browse the repository at this point in the history
  • Loading branch information
Reecepbcups committed Mar 2, 2024
1 parent bece673 commit a647f11
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
7 changes: 4 additions & 3 deletions x/manifest/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]",
Expand Down Expand Up @@ -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]",
Expand Down Expand Up @@ -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)

Expand Down
12 changes: 11 additions & 1 deletion x/manifest/keeper/abci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
}
2 changes: 2 additions & 0 deletions x/manifest/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import (
appparams "github.com/liftedinit/manifest-ledger/app/params"
)

// Sets up the keeper test suite.

type testFixture struct {
suite.Suite

Expand Down

0 comments on commit a647f11

Please sign in to comment.