Skip to content

Commit

Permalink
Add mint another denom check
Browse files Browse the repository at this point in the history
  • Loading branch information
Mauro Lacy committed May 16, 2022
1 parent 46bb412 commit 5219712
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions app/wasm/test/custom_msg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,51 @@ func TestMintMsg(t *testing.T) {
queryCustom(t, ctx, osmosis, reflect, query, &resp)

require.Equal(t, resp.Denom, coin.Denom)

// now mint another amount / denom
amount = amount.SubRaw(1)
msg = wasmbindings.OsmosisMsg{MintTokens: &wasmbindings.MintTokens{
SubDenom: "MOON",
Amount: amount,
Recipient: lucky.String(),
}}
err = executeCustom(t, ctx, osmosis, reflect, lucky, msg, sdk.Coin{})
require.NoError(t, err)

balances = osmosis.BankKeeper.GetAllBalances(ctx, lucky)
require.Len(t, balances, 2)
coin = balances[0]
require.Equal(t, amount, coin.Amount)
require.Contains(t, coin.Denom, "factory/")

// query the denom and see if it matches
query = wasmbindings.OsmosisQuery{
FullDenom: &wasmbindings.FullDenom{
Contract: reflect.String(),
SubDenom: "MOON",
},
}
resp = wasmbindings.FullDenomResponse{}
queryCustom(t, ctx, osmosis, reflect, query, &resp)

require.Equal(t, resp.Denom, coin.Denom)

// and check the first denom is unchanged
coin = balances[1]
require.Equal(t, amount.AddRaw(1).MulRaw(2), coin.Amount)
require.Contains(t, coin.Denom, "factory/")

// query the denom and see if it matches
query = wasmbindings.OsmosisQuery{
FullDenom: &wasmbindings.FullDenom{
Contract: reflect.String(),
SubDenom: "SUN",
},
}
resp = wasmbindings.FullDenomResponse{}
queryCustom(t, ctx, osmosis, reflect, query, &resp)

require.Equal(t, resp.Denom, coin.Denom)
}

type BaseState struct {
Expand Down

0 comments on commit 5219712

Please sign in to comment.