Skip to content

Commit

Permalink
resolve unit test and unhandled errors
Browse files Browse the repository at this point in the history
  • Loading branch information
kiragpg committed Jul 2, 2024
1 parent cb16365 commit cb6dca4
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 11 deletions.
13 changes: 7 additions & 6 deletions app/ante/ante_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"errors"
"fmt"

"cosmossdk.io/math"
customante "github.com/KiraCore/sekai/app/ante"
"github.com/KiraCore/sekai/types"
govtypes "github.com/KiraCore/sekai/x/gov/types"
Expand Down Expand Up @@ -557,17 +558,17 @@ func (suite *AnteTestSuite) TestPoorNetworkManagementDecorator() {
msgs := []sdk.Msg{
tokenstypes.NewMsgUpsertTokenInfo(
accounts[4].acc.GetAddress(),
"adr20",
"foo",
sdk.NewDec(1),
true,
sdk.ZeroDec(),
sdk.ZeroInt(),
false,
false,
sdk.NewDec(1), true,
sdk.ZeroInt(), sdk.ZeroInt(),
sdk.ZeroDec(), sdk.ZeroInt(),
false, false,
"FOO",
"Foo",
"",
6,
"", "", "", 0, math.ZeroInt(), "", false, "", "",
),
}
return msgs, privs[0:1], accNums[0:1], []uint64{1}, sdk.NewCoins(sdk.NewInt64Coin("ukex", 100))
Expand Down
1 change: 1 addition & 0 deletions x/layer2/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func NewKeeper(storeKey storetypes.StoreKey, cdc codec.BinaryCodec,
sk: sk,
gk: gk,
spk: spk,
tk: tk,
}
}

Expand Down
10 changes: 5 additions & 5 deletions x/layer2/keeper/lp_swap_redeem_convert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,14 @@ func (suite *KeeperTestSuite) TestRedeemDappPoolTx() {

lpToken := dapp.LpToken()
lpCoins := sdk.Coins{sdk.NewInt64Coin(lpToken, 10000)}
err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, lpCoins)
err := suite.app.TokensKeeper.MintCoins(suite.ctx, minttypes.ModuleName, lpCoins)
suite.Require().NoError(err)

addr := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes())
err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, addr, lpCoins)
suite.Require().NoError(err)

err = suite.app.BankKeeper.MintCoins(suite.ctx, types.ModuleName, sdk.Coins{dapp.TotalBond})
err = suite.app.TokensKeeper.MintCoins(suite.ctx, types.ModuleName, sdk.Coins{dapp.TotalBond})
suite.Require().NoError(err)

price := suite.app.Layer2Keeper.LpTokenPrice(suite.ctx, dapp)
Expand Down Expand Up @@ -262,17 +262,17 @@ func (suite *KeeperTestSuite) TestConvertDappPoolTx() {

lpToken1 := dapp1.LpToken()
lpCoins1 := sdk.Coins{sdk.NewInt64Coin(lpToken1, 10000)}
err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, lpCoins1)
err := suite.app.TokensKeeper.MintCoins(suite.ctx, minttypes.ModuleName, lpCoins1)
suite.Require().NoError(err)
err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, addr, lpCoins1)
suite.Require().NoError(err)

lpToken2 := dapp2.LpToken()
lpCoins2 := sdk.Coins{sdk.NewInt64Coin(lpToken2, 10000)}
err = suite.app.BankKeeper.MintCoins(suite.ctx, types.ModuleName, lpCoins2)
err = suite.app.TokensKeeper.MintCoins(suite.ctx, types.ModuleName, lpCoins2)
suite.Require().NoError(err)

err = suite.app.BankKeeper.MintCoins(suite.ctx, types.ModuleName, sdk.Coins{dapp1.TotalBond})
err = suite.app.TokensKeeper.MintCoins(suite.ctx, types.ModuleName, sdk.Coins{dapp1.TotalBond})
suite.Require().NoError(err)

price := suite.app.Layer2Keeper.LpTokenPrice(suite.ctx, dapp1)
Expand Down
7 changes: 7 additions & 0 deletions x/tokens/client/cli/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,12 @@ func (s *IntegrationTestSuite) TestUpsertTokenInfoAndQuery() {
cmd := cli.GetTxUpsertTokenInfoCmd()
_, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, []string{
fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()),
fmt.Sprintf("--%s=%s", cli.FlagDescription, "some desc"),
fmt.Sprintf("--%s=%s", cli.FlagDenom, "ubtc"),
fmt.Sprintf("--%s=%s", cli.FlagSupply, "0"),
fmt.Sprintf("--%s=%s", cli.FlagSupplyCap, "0"),
fmt.Sprintf("--%s=%f", cli.FlagFeeRate, 0.00001),
fmt.Sprintf("--%s=%d", cli.FlagMintingFee, 2),
fmt.Sprintf("--%s=%s", cli.FlagFeeEnabled, "true"),
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync),
Expand Down Expand Up @@ -126,6 +128,11 @@ func (s IntegrationTestSuite) TestCreateProposalUpsertTokenInfo() {
fmt.Sprintf("--%s=%s", cli.FlagDescription, "some desc"),
fmt.Sprintf("--%s=%s", cli.FlagFeeEnabled, "true"),
fmt.Sprintf("--%s=%s", cli.FlagDecimals, "6"),
fmt.Sprintf("--%s=%s", cli.FlagStakeCap, "0.3"),
fmt.Sprintf("--%s=%s", cli.FlagTokenRate, "1"),
fmt.Sprintf("--%s=%s", cli.FlagSupply, "0"),
fmt.Sprintf("--%s=%s", cli.FlagSupplyCap, "0"),
fmt.Sprintf("--%s=%s", cli.FlagMintingFee, "1"),
fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()),
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync),
Expand Down
4 changes: 4 additions & 0 deletions x/tokens/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,9 @@ func GetTxUpsertTokenInfoCmd() *cobra.Command {
Short: "Upsert token rate",
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}

denom, err := cmd.Flags().GetString(FlagDenom)
if err != nil {
Expand Down Expand Up @@ -513,6 +516,7 @@ func GetTxUpsertTokenInfoCmd() *cobra.Command {
cmd.Flags().String(FlagNftMetadata, "", "Nft metadata")
cmd.Flags().String(FlagNftHash, "", "Nft hash")
cmd.Flags().String(FlagTokenType, "", "Token type")
cmd.Flags().String(FlagDescription, "", "Token description")
cmd.Flags().String(FlagTokenRate, "", "Token rate")

flags.AddTxFlagsToCmd(cmd)
Expand Down

0 comments on commit cb6dca4

Please sign in to comment.