The x/feeshare
module allows for three types of state transitions: RegisterFeeShare
, UpdateFeeShare
and CancelFeeShare
. The logic for distributing transaction fees is handled through the Ante handler.
A developer registers a contract for receiving transaction fees by defining the contract address and the withdrawal address for fees to be paid too. If this is not set, the developer can not get income from the contract. This is opt-in for tax purposes. When registering for fees to be paid, you MUST be the admin of said wasm contract. The withdrawal address can be the same as the contract's address if you so choose.
- User submits a
RegisterFeeShare
to register a contract address, along with a withdrawal address that they would like to receive the fees to - Check if the following conditions pass:
x/feeshare
module is enabled via Governance- the contract was not previously registered
- deployer has a valid account (it has done at least one transaction)
- the contract address exists
- the deployer signing the transaction is the admin of the contract
- the contract is already deployed
- Store an instance of the provided share.
All transactions sent to the registered contract occurring after registration will have their fees distributed to the developer, according to the global DeveloperShares
parameter in governance.
A developer updates the withdraw address for a registered contract, defining the contract address and the new withdraw address.
- The user submits a
UpdateFeeShare
- Check if the following conditions pass:
x/feeshare
module is enabled- the contract is registered
- the signer of the transaction is the same as the contract admin per the WasmVM
- Update the fee with the new withdrawal address.
After this update, the developer receives the fees on the new withdrawal address.
A developer cancels receiving fees for a registered contract, defining the contract address.
- The user submits a
CancelFeeShare
- Check if the following conditions pass:
x/feeshare
module is enabled- the contract is registered
- the signer of the transaction is the same as the contract admin per the WasmVM
- Remove share from storage
The developer no longer receives fees from transactions sent to this contract. All fees go to the community.