From a15deeda8bd0f4ef680b9a7d027d1ce7e1316206 Mon Sep 17 00:00:00 2001 From: Youngtaek Yoon Date: Thu, 20 Apr 2023 17:43:54 +0900 Subject: [PATCH 1/2] Do SendCoins() even if the coins is empty --- client/grpc/tmservice/service_test.go | 2 +- x/foundation/keeper/internal/treasury.go | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/client/grpc/tmservice/service_test.go b/client/grpc/tmservice/service_test.go index 4af768ef83..27e386c139 100644 --- a/client/grpc/tmservice/service_test.go +++ b/client/grpc/tmservice/service_test.go @@ -152,7 +152,7 @@ func (s IntegrationTestSuite) TestQueryBlockResultsByHeight() { s.Require().Equal(0, len(txResult)) beginBlock := blockResultsRes.GetResBeginBlock() - s.Require().Equal(7, len(beginBlock.Events)) // coinbase event (6) + transfer mintModule to feeCollectorName(5) - foundation abci (4) + s.Require().Equal(11, len(beginBlock.Events)) // coinbase event (6) + transfer mintModule to feeCollectorName(5) endBlock := blockResultsRes.GetResEndBlock() s.Require().Equal(0, len(endBlock.Events)) diff --git a/x/foundation/keeper/internal/treasury.go b/x/foundation/keeper/internal/treasury.go index 43f8c20cff..95a26828fb 100644 --- a/x/foundation/keeper/internal/treasury.go +++ b/x/foundation/keeper/internal/treasury.go @@ -9,17 +9,11 @@ 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 { From 843603f4d5fe42b2a9dc0bc2ff962099f8cdf736 Mon Sep 17 00:00:00 2001 From: Youngtaek Yoon Date: Thu, 20 Apr 2023 18:32:37 +0900 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 59895ed32d..2a26a105ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,6 +64,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/collection) [\#961](https://github.com/Finschia/finschia-sdk/pull/961) Do not loop enum in x/collection * (x/collection,token) [\#957](https://github.com/Finschia/finschia-sdk/pull/957) Refactor queries of x/collection and x/token * (x/auth) [\#982](https://github.com/Finschia/finschia-sdk/pull/957) Fix not to emit error when no txs in block while querying `GetBlockWithTxs` +* (x/foundation) [\#984](https://github.com/Finschia/finschia-sdk/pull/984) Revert #952 ### Removed * (x/collection,token) [\#966](https://github.com/Finschia/finschia-sdk/pull/966) Remove legacy events on x/collection and x/token