Skip to content

Commit

Permalink
feat: initialize fswap module (#1336)
Browse files Browse the repository at this point in the history
* feat: initial fswap module

Signed-off-by: 170210 <[email protected]>

* chore: correct dependencies

Signed-off-by: 170210 <[email protected]>

* chore: remove unuse files

Signed-off-by: 170210 <[email protected]>

* feat: add proto files

Signed-off-by: 170210 <[email protected]>

* chore: make proto-gen

Signed-off-by: 170210 <[email protected]>

* chore: fix compile error

Signed-off-by: 170210 <[email protected]>

* chore: add new field in params proto

Signed-off-by: 170210 <[email protected]>

* fix: fix lint

Signed-off-by: 170210 <[email protected]>

* feat: add query&tx commands of fswap module

Signed-off-by: 170210 <[email protected]>

* fix: fix for comment

Signed-off-by: 170210 <[email protected]>

* docs: update CHANGLOG.md

Signed-off-by: 170210 <[email protected]>

* docs: fix error docs

Signed-off-by: 170210 <[email protected]>

* fix: fix consensusversion

Signed-off-by: 170210 <[email protected]>

* fix: remove route,type&getSignBytes in msgs.go

Signed-off-by: 170210 <[email protected]>

* fix: update proto files

Signed-off-by: 170210 <[email protected]>

* fix: fix NewKeeper

Signed-off-by: 170210 <[email protected]>

* fix: fix for comment

Signed-off-by: 170210 <[email protected]>

---------

Signed-off-by: 170210 <[email protected]>
  • Loading branch information
170210 authored Apr 18, 2024
1 parent 55b6566 commit 6afe633
Show file tree
Hide file tree
Showing 42 changed files with 4,689 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Features
* (consensus) [\#1178](https://github.com/Finschia/finschia-sdk/pull/1178) change the consensus from Ostracon to Tendermint v0.34.24
* (x/fswap) [\#1336](https://github.com/Finschia/finschia-sdk/pull/1336) Initialize fswap module

### Improvements
* (docs) [\#1120](https://github.com/Finschia/finschia-sdk/pull/1120) Update links in x/foundation README.md
Expand Down
311 changes: 311 additions & 0 deletions docs/core/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,34 @@

- [Msg](#lbm.foundation.v1.Msg)

- [lbm/fswap/v1/event.proto](#lbm/fswap/v1/event.proto)
- [EventSwapCoins](#lbm.fswap.v1.EventSwapCoins)

- [lbm/fswap/v1/fswap.proto](#lbm/fswap/v1/fswap.proto)
- [Swapped](#lbm.fswap.v1.Swapped)

- [lbm/fswap/v1/params.proto](#lbm/fswap/v1/params.proto)
- [Params](#lbm.fswap.v1.Params)

- [lbm/fswap/v1/genesis.proto](#lbm/fswap/v1/genesis.proto)
- [GenesisState](#lbm.fswap.v1.GenesisState)

- [lbm/fswap/v1/query.proto](#lbm/fswap/v1/query.proto)
- [QuerySwappedRequest](#lbm.fswap.v1.QuerySwappedRequest)
- [QuerySwappedResponse](#lbm.fswap.v1.QuerySwappedResponse)
- [QueryTotalSwappableAmountRequest](#lbm.fswap.v1.QueryTotalSwappableAmountRequest)
- [QueryTotalSwappableAmountResponse](#lbm.fswap.v1.QueryTotalSwappableAmountResponse)

- [Query](#lbm.fswap.v1.Query)

- [lbm/fswap/v1/tx.proto](#lbm/fswap/v1/tx.proto)
- [MsgSwapAllRequest](#lbm.fswap.v1.MsgSwapAllRequest)
- [MsgSwapAllResponse](#lbm.fswap.v1.MsgSwapAllResponse)
- [MsgSwapRequest](#lbm.fswap.v1.MsgSwapRequest)
- [MsgSwapResponse](#lbm.fswap.v1.MsgSwapResponse)

- [Msg](#lbm.fswap.v1.Msg)

- [lbm/stakingplus/v1/authz.proto](#lbm/stakingplus/v1/authz.proto)
- [CreateValidatorAuthorization](#lbm.stakingplus.v1.CreateValidatorAuthorization)

Expand Down Expand Up @@ -12683,6 +12711,289 @@ Msg defines the foundation Msg service.



<a name="lbm/fswap/v1/event.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## lbm/fswap/v1/event.proto



<a name="lbm.fswap.v1.EventSwapCoins"></a>

### EventSwapCoins



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `address` | [string](#string) | | holder's address |
| `old_coin_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | amount of the old currency |
| `new_coin_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | amount of the new currency |





<!-- end messages -->

<!-- end enums -->

<!-- end HasExtensions -->

<!-- end services -->



<a name="lbm/fswap/v1/fswap.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## lbm/fswap/v1/fswap.proto



<a name="lbm.fswap.v1.Swapped"></a>

### Swapped



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `old_coin_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | |
| `new_coin_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | |





<!-- end messages -->

<!-- end enums -->

<!-- end HasExtensions -->

<!-- end services -->



<a name="lbm/fswap/v1/params.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## lbm/fswap/v1/params.proto



<a name="lbm.fswap.v1.Params"></a>

### Params
Params defines the parameters for the module.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `new_coin_denom` | [string](#string) | | new denomination for new coin after swap |





<!-- end messages -->

<!-- end enums -->

<!-- end HasExtensions -->

<!-- end services -->



<a name="lbm/fswap/v1/genesis.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## lbm/fswap/v1/genesis.proto



<a name="lbm.fswap.v1.GenesisState"></a>

### GenesisState
GenesisState defines the fswap module's genesis state.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `params` | [Params](#lbm.fswap.v1.Params) | | |
| `swapped` | [Swapped](#lbm.fswap.v1.Swapped) | | |





<!-- end messages -->

<!-- end enums -->

<!-- end HasExtensions -->

<!-- end services -->



<a name="lbm/fswap/v1/query.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## lbm/fswap/v1/query.proto



<a name="lbm.fswap.v1.QuerySwappedRequest"></a>

### QuerySwappedRequest







<a name="lbm.fswap.v1.QuerySwappedResponse"></a>

### QuerySwappedResponse



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `swapped` | [Swapped](#lbm.fswap.v1.Swapped) | | |






<a name="lbm.fswap.v1.QueryTotalSwappableAmountRequest"></a>

### QueryTotalSwappableAmountRequest







<a name="lbm.fswap.v1.QueryTotalSwappableAmountResponse"></a>

### QueryTotalSwappableAmountResponse



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `swappable_new_coin_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | |





<!-- end messages -->

<!-- end enums -->

<!-- end HasExtensions -->


<a name="lbm.fswap.v1.Query"></a>

### Query


| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint |
| ----------- | ------------ | ------------- | ------------| ------- | -------- |
| `Swapped` | [QuerySwappedRequest](#lbm.fswap.v1.QuerySwappedRequest) | [QuerySwappedResponse](#lbm.fswap.v1.QuerySwappedResponse) | | GET|/lbm/fswap/v1/swapped|
| `TotalNewCurrencySwapLimit` | [QueryTotalSwappableAmountRequest](#lbm.fswap.v1.QueryTotalSwappableAmountRequest) | [QueryTotalSwappableAmountResponse](#lbm.fswap.v1.QueryTotalSwappableAmountResponse) | | GET|/lbm/fswap/v1/swappable_new_coin_amount|

<!-- end services -->



<a name="lbm/fswap/v1/tx.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## lbm/fswap/v1/tx.proto



<a name="lbm.fswap.v1.MsgSwapAllRequest"></a>

### MsgSwapAllRequest



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `from_address` | [string](#string) | | holder's address |






<a name="lbm.fswap.v1.MsgSwapAllResponse"></a>

### MsgSwapAllResponse







<a name="lbm.fswap.v1.MsgSwapRequest"></a>

### MsgSwapRequest



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `from_address` | [string](#string) | | holder's address |
| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | amount of old currency |






<a name="lbm.fswap.v1.MsgSwapResponse"></a>

### MsgSwapResponse






<!-- end messages -->

<!-- end enums -->

<!-- end HasExtensions -->


<a name="lbm.fswap.v1.Msg"></a>

### Msg


| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint |
| ----------- | ------------ | ------------- | ------------| ------- | -------- |
| `Swap` | [MsgSwapRequest](#lbm.fswap.v1.MsgSwapRequest) | [MsgSwapResponse](#lbm.fswap.v1.MsgSwapResponse) | | |
| `SwapAll` | [MsgSwapAllRequest](#lbm.fswap.v1.MsgSwapAllRequest) | [MsgSwapAllResponse](#lbm.fswap.v1.MsgSwapAllResponse) | | |

<!-- end services -->



<a name="lbm/stakingplus/v1/authz.proto"></a>
<p align="right"><a href="#top">Top</a></p>

Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,6 @@ github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY
github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw=
github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4Y=
github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw=
github.com/cosmos/iavl v0.19.0 h1:sgyrjqOkycXiN7Tuupuo4QAldKFg7Sipyfeg/IL7cps=
github.com/cosmos/iavl v0.19.0/go.mod h1:l5h9pAB3m5fihB3pXVgwYqdY8aBsMagqz7T0MUjxZeA=
github.com/cosmos/iavl v0.19.4 h1:t82sN+Y0WeqxDLJRSpNd8YFX5URIrT+p8n6oJbJ2Dok=
github.com/cosmos/iavl v0.19.4/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw=
github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76 h1:DdzS1m6o/pCqeZ8VOAit/gyATedRgjvkVI+UCrLpyuU=
Expand Down
18 changes: 18 additions & 0 deletions proto/lbm/fswap/v1/event.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
syntax = "proto3";
package lbm.fswap.v1;

option go_package = "github.com/Finschia/finschia-sdk/x/fswap/types";

import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";

message EventSwapCoins {
// holder's address
string address = 1;
// amount of the old currency
cosmos.base.v1beta1.Coin old_coin_amount = 2
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/Finschia/finschia-sdk/types.Coin"];
// amount of the new currency
cosmos.base.v1beta1.Coin new_coin_amount = 3
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/Finschia/finschia-sdk/types.Coin"];
}
14 changes: 14 additions & 0 deletions proto/lbm/fswap/v1/fswap.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
syntax = "proto3";
package lbm.fswap.v1;

option go_package = "github.com/Finschia/finschia-sdk/x/fswap/types";

import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";

message Swapped{
cosmos.base.v1beta1.Coin old_coin_amount = 1
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/Finschia/finschia-sdk/types.Coin"];
cosmos.base.v1beta1.Coin new_coin_amount = 2
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/Finschia/finschia-sdk/types.Coin"];
}
14 changes: 14 additions & 0 deletions proto/lbm/fswap/v1/genesis.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
syntax = "proto3";
package lbm.fswap.v1;

option go_package = "github.com/Finschia/finschia-sdk/x/fswap/types";

import "gogoproto/gogo.proto";
import "lbm/fswap/v1/params.proto";
import "lbm/fswap/v1/fswap.proto";

// GenesisState defines the fswap module's genesis state.
message GenesisState {
Params params = 1 [(gogoproto.nullable) = false];
Swapped swapped =2 [(gogoproto.nullable) = false];
}
Loading

0 comments on commit 6afe633

Please sign in to comment.