Skip to content

Commit

Permalink
fix sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
tubackkhoa committed Jul 31, 2024
1 parent 63028e4 commit ceb9b5f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions x/tokenfactory/bindings/custom_msg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func TestMintMsg(t *testing.T) {
require.NoError(t, err)
sunDenom := fmt.Sprintf("factory/%s/%s", reflect.String(), msg.CreateDenom.Subdenom)

amount, ok := sdk.NewIntFromString("808010808")
amount, ok := math.NewIntFromString("808010808")
require.True(t, ok)
msg = bindings.TokenMsg{MintTokens: &bindings.MintTokens{
Denom: sunDenom,
Expand Down Expand Up @@ -201,7 +201,7 @@ func TestForceTransfer(t *testing.T) {
require.NoError(t, err)
sunDenom := fmt.Sprintf("factory/%s/%s", reflect.String(), msg.CreateDenom.Subdenom)

amount, ok := sdk.NewIntFromString("808010808")
amount, ok := math.NewIntFromString("808010808")
require.True(t, ok)

// Mint new tokens to lucky
Expand Down Expand Up @@ -254,7 +254,7 @@ func TestBurnMsg(t *testing.T) {
require.NoError(t, err)
sunDenom := fmt.Sprintf("factory/%s/%s", reflect.String(), msg.CreateDenom.Subdenom)

amount, ok := sdk.NewIntFromString("808010809")
amount, ok := math.NewIntFromString("808010809")
require.True(t, ok)

msg = bindings.TokenMsg{MintTokens: &bindings.MintTokens{
Expand All @@ -266,7 +266,7 @@ func TestBurnMsg(t *testing.T) {
require.NoError(t, err)

// can burn from different address with burnFrom
amt, ok := sdk.NewIntFromString("1")
amt, ok := math.NewIntFromString("1")
require.True(t, ok)
msg = bindings.TokenMsg{BurnTokens: &bindings.BurnTokens{
Denom: sunDenom,
Expand Down Expand Up @@ -303,7 +303,7 @@ type ReflectSubMsgs struct {
Msgs []wasmvmtypes.SubMsg `json:"msgs"`
}

func executeCustom(t *testing.T, ctx sdk.Context, osmosis *app.TokenApp, contract sdk.AccAddress, sender sdk.AccAddress, msg bindings.TokenMsg, funds sdk.Coin) error {
func executeCustom(t *testing.T, ctx sdk.Context, osmosis *app.WasmApp, contract sdk.AccAddress, sender sdk.AccAddress, msg bindings.TokenMsg, funds sdk.Coin) error {
wrapped := bindings.TokenFactoryMsg{
Token: &msg,
}
Expand Down
2 changes: 1 addition & 1 deletion x/tokenfactory/bindings/custom_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ type ChainResponse struct {
Data []byte `json:"data"`
}

func queryCustom(t *testing.T, ctx sdk.Context, tokenz *app.TokenApp, contract sdk.AccAddress, request bindings.TokenQuery, response interface{}) {
func queryCustom(t *testing.T, ctx sdk.Context, tokenz *app.WasmApp, contract sdk.AccAddress, request bindings.TokenQuery, response interface{}) {
wrapped := bindings.TokenFactoryQuery{
Token: &request,
}
Expand Down
12 changes: 6 additions & 6 deletions x/tokenfactory/bindings/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ import (
"github.com/CosmWasm/wasmd/x/wasm/keeper"
)

func CreateTestInput() (*app.TokenApp, sdk.Context) {
func CreateTestInput() (*app.WasmApp, sdk.Context) {
osmosis := app.Setup(false)
ctx := osmosis.BaseApp.NewContext(false, tmproto.Header{Height: 1, ChainID: "osmosis-1", Time: time.Now().UTC()})
return osmosis, ctx
}

func FundAccount(t *testing.T, ctx sdk.Context, osmosis *app.TokenApp, acct sdk.AccAddress) {
func FundAccount(t *testing.T, ctx sdk.Context, osmosis *app.WasmApp, acct sdk.AccAddress) {
err := simapp.FundAccount(osmosis.BankKeeper, ctx, acct, sdk.NewCoins(
sdk.NewCoin("uosmo", math.NewInt(10000000000)),
))
Expand All @@ -49,7 +49,7 @@ func RandomBech32AccountAddress() string {
return RandomAccountAddress().String()
}

func storeReflectCode(t *testing.T, ctx sdk.Context, tokenz *app.TokenApp, addr sdk.AccAddress) uint64 {
func storeReflectCode(t *testing.T, ctx sdk.Context, tokenz *app.WasmApp, addr sdk.AccAddress) uint64 {
wasmCode, err := os.ReadFile("./testdata/token_reflect.wasm")
require.NoError(t, err)

Expand All @@ -60,7 +60,7 @@ func storeReflectCode(t *testing.T, ctx sdk.Context, tokenz *app.TokenApp, addr
return codeID
}

func instantiateReflectContract(t *testing.T, ctx sdk.Context, tokenz *app.TokenApp, funder sdk.AccAddress) sdk.AccAddress {
func instantiateReflectContract(t *testing.T, ctx sdk.Context, tokenz *app.WasmApp, funder sdk.AccAddress) sdk.AccAddress {
initMsgBz := []byte("{}")
contractKeeper := keeper.NewDefaultPermissionKeeper(tokenz.WasmKeeper)
codeID := uint64(1)
Expand All @@ -70,7 +70,7 @@ func instantiateReflectContract(t *testing.T, ctx sdk.Context, tokenz *app.Token
return addr
}

func fundAccount(t *testing.T, ctx sdk.Context, tokenz *app.TokenApp, addr sdk.AccAddress, coins sdk.Coins) {
func fundAccount(t *testing.T, ctx sdk.Context, tokenz *app.WasmApp, addr sdk.AccAddress, coins sdk.Coins) {
err := simapp.FundAccount(
tokenz.BankKeeper,
ctx,
Expand All @@ -80,7 +80,7 @@ func fundAccount(t *testing.T, ctx sdk.Context, tokenz *app.TokenApp, addr sdk.A
require.NoError(t, err)
}

func SetupCustomApp(t *testing.T, addr sdk.AccAddress) (*app.TokenApp, sdk.Context) {
func SetupCustomApp(t *testing.T, addr sdk.AccAddress) (*app.WasmApp, sdk.Context) {
tokenz, ctx := CreateTestInput()
wasmKeeper := tokenz.WasmKeeper

Expand Down
4 changes: 2 additions & 2 deletions x/tokenfactory/bindings/validate_msg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func TestMint(t *testing.T) {
balances := tokenz.BankKeeper.GetAllBalances(ctx, lucky)
require.Empty(t, balances)

amount, ok := sdk.NewIntFromString("8080")
amount, ok := math.NewIntFromString("8080")
require.True(t, ok)

specs := map[string]struct {
Expand Down Expand Up @@ -314,7 +314,7 @@ func TestBurn(t *testing.T) {

validDenomStr := fmt.Sprintf("factory/%s/%s", creator.String(), validDenom.Subdenom)
emptyDenomStr := fmt.Sprintf("factory/%s/%s", creator.String(), emptyDenom.Subdenom)
mintAmount, ok := sdk.NewIntFromString("8080")
mintAmount, ok := math.NewIntFromString("8080")
require.True(t, ok)

specs := map[string]struct {
Expand Down

0 comments on commit ceb9b5f

Please sign in to comment.