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 2 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,157 @@ | ||
| --- | ||
| title: XATP | ||
| weight: 200 | ||
| --- | ||
|
|
||
| The XATP(XPLA Alternative Transaction Protocol) module supports accept cw20 fee payment. | ||
|
|
||
| ## Concepts | ||
|
|
||
| The XATP module is allows for the use of tokens other than XPLA to pay transaction fees on the XPLA Chain. This makes it easier for users who do not hold XPLA to participate in the network, easier in the onboarding of new projects. | ||
psy2848048 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| The XATP is used through the following steps: | ||
|
|
||
| - Token to be used as XATP is registered through a proposal | ||
psy2848048 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - The XATP module owns XPLA to paid as fees | ||
psy2848048 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - When a user generates a transaction, they pay a fee using XATP that is higher than the original fee by `TaxRate` | ||
psy2848048 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - The paid XATP fee is sent by the XATP module and the module paid the fee using XPLA it owns to the network | ||
psy2848048 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - The remaining fee, equal to Tax, is distributed according to [parameters]({{< ref "xatp#parameters" >}}) to the `community pool`, `reserve account`, and `reward pool`. | ||
|
|
||
| ## State | ||
|
|
||
| ### XATP | ||
|
|
||
| XATPs objects should be primarily 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 recommends using a prefix that matches the number of decimal places. For example, if the decimal point of CTXT is 6, use uCTXT. | ||
psy2848048 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| #### Token | ||
|
|
||
| - type: `string` | ||
|
|
||
| Token is the contract address of cw20. | ||
|
|
||
| #### Pair | ||
|
|
||
| - type: `string` | ||
|
|
||
| AMM's pair contract address must be a pair that can query the ratio with a pool including XPLA. | ||
|
|
||
| #### 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 allow XATP to be used as a Tx fee. | ||
|
|
||
| {{< alert context="warning" >}} | ||
| Note: If XATP of the same denom is registered, it 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 prevent XATP to be used as a Tx fee. | ||
|
|
||
|
|
||
| ## Transitions | ||
|
|
||
| ### InitGenesis | ||
|
|
||
| `InitGenesis` initializes the XATP module genesis state by setting the `GenesisState` fields to the store. In particular, it sets the parameters and XATPs. | ||
psy2848048 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### 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: | ||
psy2848048 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### 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` | ||
|
|
||
| Ratio of paying more when paying with XATP than when paying with default denom. | ||
psy2848048 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### FeePoolRate | ||
|
|
||
| - type: `sdk.Dec` | ||
| - default: `1` | ||
|
|
||
| Ratio of fees sent to the fee pool when fees are received with XATP | ||
psy2848048 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### CommunityPoolRate | ||
|
|
||
| - type: `sdk.Dec` | ||
| - default: `0.158` | ||
|
|
||
| Ratio of fees sent to the community pool when fees are received with XATP | ||
psy2848048 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### ReserveRate | ||
|
|
||
| - type: `sdk.Dec` | ||
| - default: `0.04` | ||
|
|
||
| Ratio of fees sent to the reserve account when fees are received with XATP | ||
psy2848048 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### RewardPoolRate | ||
|
|
||
| - type: `sdk.Dec` | ||
| - default: `0.002` | ||
|
|
||
| Ratio of fees sent to the reward pool when fees are received with XATP | ||
psy2848048 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### ReserveAccount | ||
|
|
||
| - type: `string` | ||
| - default: `` | ||
|
|
||
| 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.