mirror of https://github.com/certusone/wasmd.git
Minor fixes
This commit is contained in:
parent
f1977a0775
commit
42f544f5c8
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue