Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support instantiate delcall #3239

Merged
merged 1 commit into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions x/wasm/keeper/cross_contract_call.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/json"
wasmvm "github.com/CosmWasm/wasmvm"
sdk "github.com/okex/exchain/libs/cosmos-sdk/types"
"github.com/okex/exchain/x/wasm/types"
)

var (
Expand Down Expand Up @@ -47,10 +48,7 @@ func getCallerInfo(ctx sdk.Context, keeper Keeper, contractAddress, storeAddress
if err != nil {
return nil, nil, nil, nil, err
}
_, _, prefixStore, err = keeper.contractInstance(ctx, sAddr)
if err != nil {
return nil, nil, nil, nil, err
}
prefixStore = types.NewStoreAdapter(keeper.getStorageStore(ctx, sAddr))
queryHandler := keeper.newQueryHandler(ctx, sAddr)
return codeInfo.CodeHash, prefixStore, queryHandler, keeper.gasMeter(ctx), nil
}
Expand Down
6 changes: 6 additions & 0 deletions x/wasm/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -994,6 +994,12 @@ func (k Keeper) contractInstance(ctx sdk.Context, contractAddress sdk.WasmAddres
return contractInfo, codeInfo, types.NewStoreAdapter(prefixStore), nil
}

func (k Keeper) getStorageStore(ctx sdk.Context, acc sdk.WasmAddress) sdk.KVStore {
store := k.ada.NewStore(ctx, k.storeKey, nil)
prefixStoreKey := types.GetContractStorePrefix(acc)
return prefix.NewStore(store, prefixStoreKey)
}

func (k Keeper) GetContractInfo(ctx sdk.Context, contractAddress sdk.WasmAddress) *types.ContractInfo {
store := k.ada.NewStore(ctx, k.storeKey, nil)
var contract types.ContractInfo
Expand Down