Skip to content

Commit

Permalink
cherry pick: bd4b458
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderbez committed Dec 18, 2023
1 parent a5c5f11 commit 0bd8045
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions x/feegrant/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,3 +347,23 @@ func (k Keeper) RemoveExpiredAllowances(ctx context.Context, limit int32) error
}
return nil
}

// CheckGrantedFee is the check part of UseGrantedFees. It's used to assert whether a grant covers the fees.
// No state is persisted.
func (k Keeper) CheckGrantedFee(ctx sdk.Context, granter, grantee sdk.AccAddress, fee sdk.Coins, msgs []sdk.Msg) error {
f, err := k.getGrant(ctx, granter, grantee)
if err != nil {
return err
}

grant, err := f.GetGrant()
if err != nil {
return err
}

if _, err := grant.Accept(ctx, fee, msgs); err != nil {
return err
}

return nil
}

0 comments on commit 0bd8045

Please sign in to comment.