Skip to content

Commit

Permalink
add check hostzone ante handler
Browse files Browse the repository at this point in the history
  • Loading branch information
GNaD13 committed Oct 30, 2023
1 parent 5681fc7 commit 8beefb9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions x/feeabs/ante/decorate.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,11 @@ func (famfd FeeAbstrationMempoolFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk
hasHostChainConfig := famfd.feeabsKeeper.HasHostZoneConfig(ctx, feeDenom)
if hasHostChainConfig {
hostChainConfig, _ := famfd.feeabsKeeper.GetHostZoneConfig(ctx, feeDenom)
// check if hostzone if frozen
if hostChainConfig.Frozen {
return ctx, feeabstypes.ErrHostZoneFrozen
}

nativeCoinsFees, err := famfd.feeabsKeeper.CalculateNativeFromIBCCoins(ctx, feeCoins, hostChainConfig)
if err != nil {
return ctx, sdkerrors.Wrapf(errorstypes.ErrInsufficientFee, "insufficient fees")
Expand Down
1 change: 1 addition & 0 deletions x/feeabs/types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ var (
ErrInvalidIBCFees = sdkerrors.Register(ModuleName, 2, "invalid ibc fees")
ErrHostZoneConfigNotFound = sdkerrors.Register(ModuleName, 3, "host chain config not found")
ErrDuplicateHostZoneConfig = sdkerrors.Register(ModuleName, 4, "duplicate config")
ErrHostZoneFrozen = sdkerrors.Register(ModuleName, 5, "hostzone frozen")
ErrNotEnoughFundInModuleAddress = sdkerrors.Register(ModuleName, 6, "not have funding yet")
)

0 comments on commit 8beefb9

Please sign in to comment.