Skip to content

Commit

Permalink
feat(logic): add wasm keeper interface
Browse files Browse the repository at this point in the history
  • Loading branch information
bdeneux committed Mar 2, 2023
1 parent 7330922 commit 4ccc32b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ func New(
app.AccountKeeper,
app.BankKeeper,
)
logicModule := logicmodule.NewAppModule(appCodec, app.LogicKeeper, app.AccountKeeper, app.BankKeeper)
logicModule := logicmodule.NewAppModule(appCodec, app.LogicKeeper, app.AccountKeeper, app.BankKeeper, app.WasmKeeper)

wasmDir := filepath.Join(homePath, "wasm")
wasmConfig, err := wasm.ReadWasmConfig(appOpts)
Expand Down
17 changes: 10 additions & 7 deletions x/logic/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,22 +94,25 @@ func (AppModuleBasic) GetQueryCmd() *cobra.Command {
type AppModule struct {
AppModuleBasic

keeper keeper.Keeper
accountKeeper types.AccountKeeper
bankKeeper types.BankKeeper
keeper keeper.Keeper
accountKeeper types.AccountKeeper
bankKeeper types.BankKeeper
wasmVMQueryHandler types.WasmKeeper
}

func NewAppModule(
cdc codec.Codec,
keeper keeper.Keeper,
accountKeeper types.AccountKeeper,
bankKeeper types.BankKeeper,
wasmVMQueryHandler types.WasmKeeper,
) AppModule {
return AppModule{
AppModuleBasic: NewAppModuleBasic(cdc),
keeper: keeper,
accountKeeper: accountKeeper,
bankKeeper: bankKeeper,
AppModuleBasic: NewAppModuleBasic(cdc),
keeper: keeper,
accountKeeper: accountKeeper,
bankKeeper: bankKeeper,
wasmVMQueryHandler: wasmVMQueryHandler,
}
}

Expand Down
5 changes: 5 additions & 0 deletions x/logic/types/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,8 @@ type BankKeeper interface {
SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
LockedCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
}

// WasmKeeper defines the expected interface needed to request smart contracts.
type WasmKeeper interface {
QuerySmart(ctx sdk.Context, contractAddr sdk.AccAddress, req []byte) ([]byte, error)
}

0 comments on commit 4ccc32b

Please sign in to comment.