From e5ca5c918ed8624c0a679bb57417aed1b271f535 Mon Sep 17 00:00:00 2001 From: 170210 Date: Fri, 14 Jun 2024 16:42:01 +0900 Subject: [PATCH] fix: fix for comment Signed-off-by: 170210 --- x/fswap/spec/01_concepts.md | 21 ++++++++++++++++++--- x/fswap/spec/02_state.md | 2 ++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/x/fswap/spec/01_concepts.md b/x/fswap/spec/01_concepts.md index 9be3e1b286..8ce22aab71 100644 --- a/x/fswap/spec/01_concepts.md +++ b/x/fswap/spec/01_concepts.md @@ -8,6 +8,7 @@ order: 1 The `x/fswap` module defines a `Swap` type in which a coin is allowed to be swapped into another coin on the chain. +You could find detailed information in the [Protobuf reference](../../../proto/lbm/fswap/v1/fswap.proto#L9-L16) ```go type Swap struct { @@ -18,6 +19,19 @@ type Swap struct { } ``` +Anyone could use one of the following two transcations to swap `FromDedenom` to `ToDenom`. +1. `simd tx fswap swap [from] [from_coin_amount] [to_denom]` + - this transcation could swap a specified amount of `from_denom` via [`MsgSwap`](../../../proto/lbm/fswap/v1/tx.proto#L17-L24) +2. `simd tx fswap swap-all [from_address] [from_denom] [to_denom]` + - this transcation could swap all of `from_denom` under `from_address` via [`MsgSwapAll`](../../../proto/lbm/fswap/v1/tx.proto#L28-L33) + +When the swap is triggered, the following event will occur: +1. `from_denom` will be sent from `from_address` to `x/fswap` module +2. `x/fswap` module will burn `from_denom` +3. `x/fswap` module will mint `to_denom` of equivalent value +4. these `to_denom` will sent to `from_address` +5. `EventSwapCoins` will be emitted + ## Config The `x/fswap` module defines a `Config` type for managing the maximum number of Swaps allowed on chain through `MaxSwaps`. Additionally, `UpdateAllowed` specifies whether `Swap` can be modified. @@ -29,10 +43,11 @@ type Config struct { } ``` -## Proposal +## MsgSetSwap -Typically, a `Swap` is proposed and submitted through foundation via a `MsgSetSwap`. -This proposal prescribes to the standard foundation process. If the proposal passes, the `Swap` can be used on chain. +Typically, a `Swap` is proposed and submitted through `x/foundation` via a `MsgSetSwap`. +Other modules (`x/gov`, `x/foundation`) will include this message in their proposals. If the proposal passes, the `Swap` can be used on chain. +`ToDenomMetadata` is [`Metadata`](../../bank/types/bank.pb.go#L325) in `x/bank` module, and it MUST meet these [limitations](../../bank/types/metadata.go#L11). ```go type MsgSetSwap struct { diff --git a/x/fswap/spec/02_state.md b/x/fswap/spec/02_state.md index ec8b753b55..12d44e3faf 100644 --- a/x/fswap/spec/02_state.md +++ b/x/fswap/spec/02_state.md @@ -4,6 +4,8 @@ order: 2 # State +The `x/fswap` module keeps state of three primary objects, Swap, SwapStats and Swapped. + ## Swap - Swap: `0x01 + (lengthPrefixed+)fromDenom + (lengthPrefixed+)toDenom`