generated from DELIGHT-LABS/hugo-theme-doks
-
Notifications
You must be signed in to change notification settings - Fork 4
feat: xatp module #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
nowooj
wants to merge
4
commits into
main
Choose a base branch
from
feature/xatp-mdoule
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,159 @@ | ||
| --- | ||
| title: XATP | ||
| weight: 200 | ||
| --- | ||
|
|
||
| The XATP(XPLA Alternative Transaction Protocol) module supports fee payment in CW20 tokens. | ||
|
|
||
| ## Concepts | ||
|
|
||
| The XATP module allows tokens other than XPLA to be paid as transaction fees on the XPLA Chain. This feature aims to help users who do not hold XPLA to participate in the network and new projects to get onboarded into the ecosystem more seamlessly. | ||
|
|
||
| The module works through the following steps: | ||
|
|
||
| 1. The token is registered through a proposal | ||
| 2. The XATP module owns an account(hereafter the module account) holding XPLA to pay fees | ||
| 3. When a user generates a transaction, the module pays its fee corresponding to the increased value by `TaxRate` with the registered token | ||
| 4. The paid fees are sent to the XATP module, which pays the fee in XPLA by the module account. | ||
| 5. After subtracting the fee transferred to the fee pool, the remainder is distributed to the `community pool`, `reserve account`, and `reward pool` according to the ratios in [parameters]({{< ref "xatp#parameters" >}}). | ||
|
|
||
| ## State | ||
|
|
||
| ### XATP | ||
|
|
||
| XATP objects are stored and accessed by the denom. | ||
|
|
||
| - Xatps: `0x11 | DenomLen (1 byte) | Denom -> ProtocolBuffer(XATP)` | ||
|
|
||
| ```go | ||
| type XATP struct { | ||
| Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` | ||
| Token string `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"` | ||
| Pair string `protobuf:"bytes,3,opt,name=pair,proto3" json:"pair,omitempty"` | ||
| Decimals int32 `protobuf:"varint,4,opt,name=decimals,proto3" json:"decimals,omitempty"` | ||
| } | ||
| ``` | ||
|
|
||
| #### Denom | ||
|
|
||
| - type: `string` | ||
|
|
||
| `Denom` is highly recommended using a prefix that matches the number of decimal places. e.g. CTXT, which decimal point is 6, is uCTXT. | ||
|
|
||
| #### Token | ||
|
|
||
| - type: `string` | ||
|
|
||
| `Token` is the contract address of CW20. | ||
|
|
||
| #### Pair | ||
|
|
||
| - type: `string` | ||
|
|
||
| AMMs(Automated Market Makers)' pair contract address should be a trading pair including XPLA and be able to query the ratio of its pool. | ||
nowooj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| #### Decimals | ||
|
|
||
| - type: `int32` | ||
|
|
||
| Indicates the number of decimal places and must be the same as the token information. | ||
|
|
||
| ## Proposals | ||
|
|
||
| ### RegisterXatpProposal | ||
| ```go | ||
| type RegisterXatpProposal struct { | ||
| Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` | ||
| Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` | ||
| Xatp *XATP `protobuf:"bytes,3,opt,name=xatp,proto3" json:"xatp,omitempty"` | ||
| } | ||
| ``` | ||
|
|
||
| Register XATP Proposal is a special type of proposal which, once passed, will automatically go into effect by allowing `Xatp` to be used as a transaction fee. | ||
|
|
||
| {{< alert context="warning" >}} | ||
| **Note** | ||
|
|
||
| The denom already registered to the module will be overwritten. | ||
| {{< /alert >}} | ||
|
|
||
|
|
||
| ### UnregisterXatpProposal | ||
| ```go | ||
| type UnregisterXatpProposal struct { | ||
| Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` | ||
| Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` | ||
| Denom string `protobuf:"bytes,3,opt,name=denom,proto3" json:"denom,omitempty"` | ||
| } | ||
| ``` | ||
|
|
||
| Unregister XATP Proposal is a special type of proposal which, once passed, will automatically go into effect by preventing the token that `Denom` represents to be used as a transaction fee. | ||
|
|
||
|
|
||
| ## Transitions | ||
|
|
||
| ### InitGenesis | ||
|
|
||
| `InitGenesis` initializes the XATP module genesis state by setting the `GenesisState` fields to the store. In particular, it sets the [parameters]({{< ref "xatp#parameters" >}}) and XATPs. | ||
|
|
||
| ### ExportGenesis | ||
|
|
||
| The `ExportGenesis` ABCI function exports the genesis state of the XATP module. In particular, it retrieves all the XATPs information. | ||
|
|
||
| ## Parameters | ||
|
|
||
| The XATP module contains the following parameters: | ||
|
|
||
| ### Params | ||
| ```go | ||
| type Params struct { | ||
| TaxRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=tax_rate,json=taxRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"tax_rate" yaml:"tax_rate"` | ||
| FeePoolRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=fee_pool_rate,json=feePoolRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"fee_pool_rate" yaml:"fee_pool_rate"` | ||
| CommunityPoolRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=community_pool_rate,json=communityPoolRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"community_pool_rate" yaml:"community_pool_rate"` | ||
| ReserveRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=reserve_rate,json=reserveRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"reserve_rate" yaml:"reserve_rate"` | ||
| RewardPoolRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=reward_pool_rate,json=rewardPoolRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"reward_pool_rate" yaml:"reward_pool_rate"` | ||
| ReserveAccount string `protobuf:"bytes,6,opt,name=reserve_account,json=reserveAccount,proto3" json:"reserve_account,omitempty"` | ||
| } | ||
| ``` | ||
|
|
||
| ### TaxRate | ||
|
|
||
| - type: `sdk.Dec` | ||
| - default: `0.2` | ||
|
|
||
| The ratio of tax charged when paying in XATP denom compared to the default denom. | ||
|
|
||
| ### FeePoolRate | ||
|
|
||
| - type: `sdk.Dec` | ||
| - default: `1` | ||
|
|
||
| The distribution ratio of received fees to be sent to the fee pool | ||
|
|
||
| ### CommunityPoolRate | ||
|
|
||
| - type: `sdk.Dec` | ||
| - default: `0.158` | ||
|
|
||
| The distribution ratio of received fees to be sent to the community pool | ||
|
|
||
| ### ReserveRate | ||
|
|
||
| - type: `sdk.Dec` | ||
| - default: `0.04` | ||
|
|
||
| The distribution ratio of received fees to be sent to the reserve account | ||
|
|
||
| ### RewardPoolRate | ||
|
|
||
| - type: `sdk.Dec` | ||
| - default: `0.002` | ||
|
|
||
| The distribution ratio of received fees to be sent to the reward pool | ||
|
|
||
| ### ReserveAccount | ||
|
|
||
| - type: `string` | ||
| - default: `` | ||
|
|
||
| The reserve account address | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.