From 49949e7885349089786b3f38ea89b786190a3896 Mon Sep 17 00:00:00 2001 From: Pham Anh Minh <1phamminh0811@gmail.com> Date: Tue, 13 Feb 2024 10:28:11 +0700 Subject: [PATCH] separate calculating tax --- tests/e2e/e2e_test.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go index 5e417f24c..afe3ef479 100644 --- a/tests/e2e/e2e_test.go +++ b/tests/e2e/e2e_test.go @@ -246,7 +246,8 @@ func (s *IntegrationTestSuite) TestFeeTaxWasm() { balance1, err := node.QuerySpecificBalance(testAddr, initialization.TerraDenom) s.Require().NoError(err) // 400000000 - 100000000 - 100000000 * TaxRate = 300000000 - 10000000 * TaxRate - s.Require().Equal(balance1.Amount, transferAmount.Mul(sdk.NewInt(3)).Sub(initialization.TaxRate.MulInt(transferAmount).TruncateInt())) + taxAmount := initialization.TaxRate.MulInt(transferAmount).TruncateInt() + s.Require().Equal(balance1.Amount, transferAmount.Mul(sdk.NewInt(3)).Sub(taxAmount)) stabilityFee := sdk.NewDecWithPrec(2, 2).MulInt(transferAmount) @@ -263,7 +264,8 @@ func (s *IntegrationTestSuite) TestFeeTaxWasm() { balance2, err := node.QuerySpecificBalance(testAddr, initialization.TerraDenom) s.Require().NoError(err) // balance1 - 100000000 - 100000000 * TaxRate - s.Require().Equal(balance2.Amount, balance1.Amount.Sub(transferAmount).Sub(initialization.TaxRate.MulInt(transferAmount).TruncateInt())) + taxAmount = initialization.TaxRate.MulInt(transferAmount).TruncateInt() + s.Require().Equal(balance2.Amount, balance1.Amount.Sub(transferAmount).Sub(taxAmount)) contractAddr := contracts[0] node.WasmExecute(contractAddr, `{"donate": {}}`, transferCoin.String(), fmt.Sprintf("%duluna", stabilityFee), "test") @@ -271,5 +273,6 @@ func (s *IntegrationTestSuite) TestFeeTaxWasm() { balance3, err := node.QuerySpecificBalance(testAddr, initialization.TerraDenom) s.Require().NoError(err) // balance2 - 100000000 - 100000000 * TaxRate - s.Require().Equal(balance3.Amount, balance2.Amount.Sub(transferAmount).Sub(initialization.TaxRate.MulInt(transferAmount).TruncateInt())) + taxAmount = initialization.TaxRate.MulInt(transferAmount).TruncateInt() + s.Require().Equal(balance3.Amount, balance2.Amount.Sub(transferAmount).Sub(taxAmount)) }