Skip to content

Commit

Permalink
Merge pull request #141 from CosmWasm/minor_fixes
Browse files Browse the repository at this point in the history
Minor fixes
  • Loading branch information
ethanfrey authored Jun 15, 2020
2 parents 03bebe0 + 42f544f commit ab5fdbb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
3 changes: 3 additions & 0 deletions lcd_test/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,9 @@ func CreateAddr(name string, kb crkeys.Keybase) (sdk.AccAddress, string, error)
seed string
)
info, seed, err = kb.CreateMnemonic(name, crkeys.English, keys.DefaultKeyPass, crkeys.Secp256k1)
if err != nil {
return nil, "", err
}
return sdk.AccAddress(info.GetPubKey().Address()), seed, err
}

Expand Down
4 changes: 2 additions & 2 deletions x/wasm/client/rest/new_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func registerNewTxRoutes(cliCtx context.CLIContext, r *mux.Router) {
type migrateContractReq struct {
BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
Admin sdk.AccAddress `json:"admin,omitempty" yaml:"admin"`
codeID uint64 `json:"code_id" yaml:"code_id"`
CodeID uint64 `json:"code_id" yaml:"code_id"`
MigrateMsg []byte `json:"migrate_msg,omitempty" yaml:"migrate_msg"`
}
type updateContractAdministrateReq struct {
Expand Down Expand Up @@ -84,7 +84,7 @@ func migrateContractHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {
msg := types.MsgMigrateContract{
Sender: cliCtx.GetFromAddress(),
Contract: contractAddress,
Code: req.codeID,
Code: req.CodeID,
MigrateMsg: req.MigrateMsg,
}
if err = msg.ValidateBasic(); err != nil {
Expand Down
10 changes: 4 additions & 6 deletions x/wasm/internal/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,6 @@ func (k Keeper) Create(ctx sdk.Context, creator sdk.AccAddress, wasmCode []byte,
return codeID, nil
}

// returns true when simulation mode used by gas=auto queries
func isSimulationMode(ctx sdk.Context) bool {
return ctx.GasMeter().Limit() == 0 && ctx.BlockHeight() != 0
}

// Instantiate creates an instance of a WASM contract
func (k Keeper) Instantiate(ctx sdk.Context, codeID uint64, creator, admin sdk.AccAddress, initMsg []byte, label string, deposit sdk.Coins) (sdk.AccAddress, error) {
// create contract address
Expand Down Expand Up @@ -371,7 +366,10 @@ func (k Keeper) setContractState(ctx sdk.Context, contractAddress sdk.AccAddress
prefixStoreKey := types.GetContractStorePrefixKey(contractAddress)
prefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), prefixStoreKey)
for _, model := range models {
prefixStore.Set([]byte(model.Key), []byte(model.Value))
if model.Value == nil {
model.Value = []byte{}
}
prefixStore.Set(model.Key, model.Value)
}
}

Expand Down

0 comments on commit ab5fdbb

Please sign in to comment.