-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #217 from terra-money/feat/feeshare-spec
docs(v2.8): feeshare module specs
- Loading branch information
Showing
10 changed files
with
92 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<!-- | ||
order: 5 | ||
--> | ||
|
||
# Post | ||
|
||
The FeeShare module uses the post handler to distribute fees between developers and the community. | ||
|
||
## FeeShare | ||
|
||
The [Post Decorator](/x/feeshare/post/post.go) executes custom logic after each successful WasmExecuteMsg transaction. All fees paid by a user for transaction execution are sent to the `FeeShare` module account before being redistributed to the registered contracts. | ||
|
||
If the `x/feeshare` module is disabled or the Wasm Execute Msg transaction targets an unregistered contract, the handler returns `nil`, without performing any actions. In this case, 100% of the transaction fees remain in the `FeeCollector` module, to be distributed elsewhere. | ||
|
||
If the `x/feeshare` module is enabled and a Wasm Execute Msg transaction targets a registered contract, the handler sends a percentage of the transaction fees (paid by the user) to the withdraw address set for that contract, or splits the fee equally among any contract involved in the transaction. | ||
|
||
1. The user submits an Execute transaction (`MsgExecuteContract`) to a smart contract and the transaction is executed successfully | ||
2. Check if | ||
* fees module is enabled | ||
* the smart contract is registered to receive fee split | ||
|
||
3. Calculate developer fees according to the `DeveloperShares` parameter. | ||
4. Check which denominations governance allows fees to be paid in. | ||
5. Check which contracts the user executed that also have been registered. | ||
6. Calculate the total amount of fees to be paid to the developer(s). If multiple contracts are involved in a transaction, the 50% reward is split evenly between all registered withdrawal addresses. | ||
7. Distribute the remaining amount in the `FeeCollector` to validators according to the [SDK Distribution Scheme](https://docs.cosmos.network/main/modules/distribution/03_begin_block.html#the-distribution-scheme). | ||
|
||
|
||
## Custom Wasm | ||
|
||
In order to distribute an equal share of fees to all contrcts involved in a transaction, a [custom Wasm module](../../wasm/README.md) was developed. | ||
|
||
The custom Wasm module keeps track of all contracts involved in a transaction. When a contract is executed, the custom Wasm module keeps track of each participating contract address in a list. When the transaction is completed, the `PostHandler` from the FeeShare module distributes the rewards between the listed participants, and the `PostHandler` from the custom Wasm module removes the contract addresses from the store. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Custom WASM module | ||
|
||
This module is a wrapper for the official WASM module, used to extend the functionality of the FeeShare module. The original FeeShare module implementation only rewarded registered contracts that took part in the execution of a transaction. However, this approach has been modified using the Custom WASM module wrapper to reward all registered contracts that participate in a transaction. | ||
|
||
When a contract is executed, the custom WASM module keeps track of each participating contract address in a list. When the transaction is completed, the `PostHandler` from the FeeShare module distributes the rewards between the listed participants, and the `PostHandler` from the custom WASM module removes the contract addresses from the store. | ||
|
||
For more information on the FeeShare module, visit the [Feeshare spec](../feeshare/spec/README.md). |