State Transitions
The x/feesplit
module allows for three types of state transitions: RegisterFeeSplit
, UpdateFeeSplit
and CancelFeeSplit
. The logic for distributing transaction fees is handled through Hooks.
Register Fee Split
A developer registers a contract for receiving transaction fees, defining the contract address, an array of nonces for address deriviation and an optional withdraw address for receiving fees. If the withdraw address is not set, the fees are sent to the deployer address by default.
User submits a
RegisterFeeSplit
to register a contract address, along with a withdraw address that they would like to receive the fees toCheck if the following conditions pass:
x/feesplit
module is enabledthe contract was not previously registered
deployer has a valid account (it has done at least one transaction) and is not a smart contract
an account corresponding to the contract address exists, with a non-empty bytecode
contract address can be derived from the deployer’s address and provided nonces using the
CREATE
operationcontract is already deployed
Store an instance of the provided fee.
All transactions sent to the registered contract occurring after registration will have their fees distributed to the developer, according to the global DeveloperShares
parameter.
Update Fee Split
A developer updates the withdraw address for a registered contract, defining the contract address and the new withdraw address.
User submits a
UpdateFeeSplit
Check if the following conditions pass:
x/feesplit
module is enabledthe contract is registered
the signer of the transaction is the same as the contract deployer
Update the fee with the new withdraw address. Note that if withdraw address is empty or the same as deployer address, then the withdraw address is set to
""
.
After this update, the developer receives the fees on the new withdraw address.
Cancel Fee Split
A developer cancels receiving fees for a registered contract, defining the contract address.
User submits a
CancelFeeSplit
Check if the following conditions pass:
x/feesplit
module is enabledthe contract is registered
the signer of the transaction is the same as the contract deployer
Remove fee from storage
The developer no longer receives fees from transactions sent to this contract.
Last updated