diff --git a/app/ante.go b/app/ante.go index 7c0a9d7274..6aea9146a1 100644 --- a/app/ante.go +++ b/app/ante.go @@ -94,7 +94,7 @@ func NewAnteHandlerAndDepGenerator(options HandlerOptions) (sdk.AnteHandler, sdk sdk.CustomDepWrappedAnteDecorator(ante.NewIncrementSequenceDecorator(options.AccountKeeper), depdecorators.SignerDepDecorator{ReadOnly: false}), sdk.DefaultWrappedAnteDecorator(ibcante.NewAnteDecorator(options.IBCKeeper)), sdk.DefaultWrappedAnteDecorator(dex.NewTickSizeMultipleDecorator(*options.DexKeeper)), - sdk.DefaultWrappedAnteDecorator(dex.NewCheckDexGasDecorator(*options.DexKeeper, options.CheckTxMemState)), + dex.NewCheckDexGasDecorator(*options.DexKeeper, options.CheckTxMemState), antedecorators.NewACLWasmDependencyDecorator(*options.AccessControlKeeper, *options.WasmKeeper), } diff --git a/x/dex/ante.go b/x/dex/ante.go index 6539221512..844757e3eb 100644 --- a/x/dex/ante.go +++ b/x/dex/ante.go @@ -4,6 +4,7 @@ import ( "errors" sdk "github.com/cosmos/cosmos-sdk/types" + sdkacltypes "github.com/cosmos/cosmos-sdk/types/accesscontrol" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" dexcache "github.com/sei-protocol/sei-chain/x/dex/cache" "github.com/sei-protocol/sei-chain/x/dex/keeper" @@ -157,3 +158,24 @@ func (d CheckDexGasDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bo } return ctx, sdkerrors.ErrInsufficientFee } + +func (d CheckDexGasDecorator) AnteDeps(txDeps []sdkacltypes.AccessOperation, tx sdk.Tx, next sdk.AnteDepGenerator) (newTxDeps []sdkacltypes.AccessOperation, err error) { + deps := []sdkacltypes.AccessOperation{} + for _, msg := range tx.GetMsgs() { + // Error checking will be handled in AnteHandler + switch msg.(type) { + case *types.MsgPlaceOrders, *types.MsgCancelOrders: + deps = append(deps, []sdkacltypes.AccessOperation{ + // read the dex contract info + { + ResourceType: sdkacltypes.ResourceType_KV_DEX_CONTRACT, + AccessType: sdkacltypes.AccessType_READ, + IdentifierTemplate: "*", + }, + }...) + default: + continue + } + } + return next(append(txDeps, deps...), tx) +}