Skip to content

Commit

Permalink
Improve simulation handling for tax transactions (#504)
Browse files Browse the repository at this point in the history
  • Loading branch information
StrathCole authored Jul 30, 2024
1 parent 51a080f commit c8c04d9
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions custom/auth/ante/fee.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,24 @@ func (fd FeeDecorator) checkDeductFee(ctx sdk.Context, feeTx sdk.FeeTx, taxes sd
return sdkerrors.ErrUnknownAddress.Wrapf("fee payer address: %s does not exist", deductFeesFrom)
}

feesOrTax := fee

// deduct the fees
if !fee.IsZero() {
err := DeductFees(fd.bankKeeper, ctx, deductFeesFromAcc, fee)
if fee.IsZero() && simulate {
feesOrTax = taxes
}

if !feesOrTax.IsZero() {
err := DeductFees(fd.bankKeeper, ctx, deductFeesFromAcc, feesOrTax)
if err != nil {
return err
}

if !taxes.IsZero() && !simulate {
if !taxes.IsZero() {
err := fd.BurnTaxSplit(ctx, taxes)
if err != nil {
return err
}

// Record tax proceeds
fd.treasuryKeeper.RecordEpochTaxProceeds(ctx, taxes)
}
Expand Down

0 comments on commit c8c04d9

Please sign in to comment.