core
core copied to clipboard
Implement a Reverse Charge tax approach
Summary of changes
This is an implementation as an alternative to tax2gas.
It solves similar issues as tax2gas does, but additionally shifts taxation to the recipient side.
Also it removes double-taxation of contracts, i.e. contract calls are no longer taxed, but sending funds from inside contracts to the final wallet destination is.
Copilot Summary
This pull request introduces the integration of a new Tax module into the Terra blockchain application. The changes primarily involve adding the TaxKeeper to various parts of the application and ensuring it is properly initialized and utilized in transaction handling. Below is a summary of the most important changes:
Integration of Tax Module
- Added
TaxKeeper
to theAppKeepers
structure and initialized it in theNewAppKeepers
function inapp/keepers/keepers.go
. [1] [2] - Included the Tax module in the module initialization and setup functions, such as
appModules
,simulationModules
,orderBeginBlockers
,orderEndBlockers
, andorderInitGenesis
inapp/modules.go
. [1] [2] [3] [4] [5]
Changes in AnteHandler
- Updated the
HandlerOptions
andNewAnteHandler
incustom/auth/ante/ante.go
to include and check forTaxKeeper
. [1] [2] - Modified the
FeeDecorator
to account for taxes and handle scenarios where fees are insufficient to cover both gas and taxes incustom/auth/ante/fee.go
. [1] [2] [3]
Import Statements
- Added necessary import statements for the Tax module in various files (
app/keepers/keepers.go
,app/modules.go
,custom/auth/ante/ante.go
, andcustom/auth/ante/fee.go
). [1] [2] [3] [4]
Initialization and Configuration
- Added the Tax module's store key and subspace initialization in
NewAppKeepers
andinitParamsKeeper
functions inapp/keepers/keepers.go
. [1] [2]
These changes collectively ensure that the new Tax module is fully integrated into the Terra blockchain application, with proper initialization, configuration, and handling within the transaction processing pipeline.