Skip to content

Commit

Permalink
Revert "fix: revert Finschia#952 (Finschia#984)"
Browse files Browse the repository at this point in the history
This reverts commit ea50f75.
  • Loading branch information
0Tech committed Aug 9, 2023
1 parent 2d437b0 commit 170140a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion client/grpc/tmservice/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func (s IntegrationTestSuite) TestQueryBlockResultsByHeight() {
s.Require().Equal(0, len(txResult))

beginBlock := blockResultsRes.GetResBeginBlock()
s.Require().Equal(11, len(beginBlock.Events)) // coinbase event (6) + transfer mintModule to feeCollectorName(5)
s.Require().Equal(7, len(beginBlock.Events)) // coinbase event (6) + transfer mintModule to feeCollectorName(5) - foundation abci (4)

endBlock := blockResultsRes.GetResEndBlock()
s.Require().Equal(0, len(endBlock.Events))
Expand Down
6 changes: 6 additions & 0 deletions x/foundation/keeper/internal/treasury.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,17 @@ import (
func (k Keeper) CollectFoundationTax(ctx sdk.Context) error {
feeCollector := k.authKeeper.GetModuleAccount(ctx, k.feeCollectorName).GetAddress()
feesCollectedInt := k.bankKeeper.GetAllBalances(ctx, feeCollector)
if feesCollectedInt.Empty() {
return nil
}
feesCollected := sdk.NewDecCoinsFromCoins(feesCollectedInt...)

// calculate the tax
taxRatio := k.GetFoundationTax(ctx)
tax, _ := feesCollected.MulDecTruncate(taxRatio).TruncateDecimal()
if tax.Empty() {
return nil
}

// collect the tax
if err := k.FundTreasury(ctx, feeCollector, tax); err != nil {
Expand Down

0 comments on commit 170140a

Please sign in to comment.