-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: fx0x55 <80245546+fx0x55@users.noreply.github.com>
- Loading branch information
1 parent
cc63f68
commit 8b6ff1d
Showing
30 changed files
with
1,993 additions
and
593 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package ante | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
ethante "github.com/evmos/ethermint/app/ante" | ||
) | ||
|
||
type DisableMsgDecorator struct { | ||
govKeeper Govkeeper | ||
// disabledMsgs is a set that contains type urls of unauthorized msgs. | ||
disabledMsgTypes []string | ||
} | ||
|
||
func NewDisableMsgDecorator(disabledMsgTypes []string, govKeeper Govkeeper) DisableMsgDecorator { | ||
return DisableMsgDecorator{disabledMsgTypes: disabledMsgTypes, govKeeper: govKeeper} | ||
} | ||
|
||
func (dms DisableMsgDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error) { | ||
disabledMsgs := dms.govKeeper.GetDisabledMsgs(ctx) | ||
disabledMsgs = append(disabledMsgs, dms.disabledMsgTypes...) | ||
if len(disabledMsgs) == 0 { | ||
return next(ctx, tx, simulate) | ||
} | ||
|
||
return ethante.NewAuthzLimiterDecorator(disabledMsgs).AnteHandle(ctx, tx, simulate, next) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.