func (w *Wasmer) Instantiate(
	code CodeID,
	env types.Env,
	initMsg []byte,
	store KVStore,
	goapi GoAPI,
	querier Querier,
	gasMeter GasMeter,
	gasLimit uint64,
) (*types.InitResponse, []byte, uint64, error) {
	paramBin, err := json.Marshal(env)
	if err != nil {
		return nil, nil, 0, err
	}
	data, gasUsed, err := api.Instantiate(w.cache, code, paramBin, initMsg, &gasMeter, store, &goapi, &querier, gasLimit)
	if err != nil {
		return nil, nil, gasUsed, err
	}

	key := data[0:64]
	var resp types.InitResult
	err = json.Unmarshal(data[64:], &resp)
	if err != nil {
		return nil, nil, gasUsed, err
	}

	if resp.Err != nil {
		return nil, nil, gasUsed, fmt.Errorf("%v", resp.Err)
	}
	return resp.Ok, key, gasUsed, nil
}
// Instantiate will create a new contract based on the given codeID.
// We can set the initMsg (contract "genesis") here, and it then receives
// an account and address and can be invoked (Execute) many times.
//
// Storage should be set with a PrefixedKVStore that this code can safely access.
//
// Under the hood, we may recompile the wasm, use a cached native compile, or even use a cached instance
// for performance.
Instantiate will create a new contract based on the given codeID.
We can set the initMsg (contract "genesis") here, and it then receives
an account and address and can be invoked (Execute) many times.

Storage should be set with a PrefixedKVStore that this code can safely access.

Under the hood, we may recompile the wasm, use a cached native compile, or even use a cached instance
for performance.
// Instantiate will create a new contract based on the given codeID . // We can set the initMsg ( contract " genesis " ) here and it then receives // an account and address and can be invoked ( Execute ) many times . // // Storage should be set with a PrefixedKVStore that this code can safely access . // // Under the hood we may recompile the wasm use a cached native compile or even use a cached instance // for performance .
func (w *Wasmer) Instantiate(
	code CodeID,
	env types.Env,
	initMsg []byte,
	store KVStore,
	goapi GoAPI,
	querier Querier,
	gasMeter GasMeter,
	gasLimit uint64,
) (*types.InitResponse, []byte, uint64, error) {
	paramBin, err := json.Marshal(env)
	if err != nil {
		return nil, nil, 0, err
	}
	data, gasUsed, err := api.Instantiate(w.cache, code, paramBin, initMsg, &gasMeter, store, &goapi, &querier, gasLimit)
	if err != nil {
		return nil, nil, gasUsed, err
	}
	key := data[0:64]
	var resp types.InitResult
	err = json.Unmarshal(data[64:], &resp)
	if err != nil {
		return nil, nil, gasUsed, err
	}
	if resp.Err != nil {
		return nil, nil, gasUsed, fmt.Errorf("%v", resp.Err)
	}
	return resp.Ok, key, gasUsed, nil
}
func ( w * Wasmer ) Instantiate ( code CodeID , env types . Env , initMsg [ ] byte , store KVStore , goapi GoAPI , querier Querier , gasMeter GasMeter , gasLimit uint64 , ) ( * types . InitResponse , [ ] byte , uint64 , error ) { paramBin , err := json . Marshal ( env ) if err != nil { return nil , nil , 0 , err } data , gasUsed , err := api . Instantiate ( w . cache , code , paramBin , initMsg , & gasMeter , store , & goapi , & querier , gasLimit ) if err != nil { return nil , nil , gasUsed , err } key := data [ 0 : 64 ] var resp types . InitResult err = json . Unmarshal ( data [ 64 : ] , & resp ) if err != nil { return nil , nil , gasUsed , err } if resp . Err != nil { return nil , nil , gasUsed , fmt . Errorf ( " " , resp . Err ) } return resp . Ok , key , gasUsed , nil }
Instantiate will create a new contract based on the given codeID.
Instantiate will create a new contract based on the given codeID .