-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Description This PR adds a new x/tickers module. Closes: MILK-57 <!-- Add a description of the changes that this PR introduces and the files that are the most critical to review. --> --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added `!` to the type prefix if API or client breaking change - [ ] targeted the correct branch (see [PR Targeting](https://github.com/desmos-labs/desmos/blob/master/CONTRIBUTING.md#pr-targeting)) - [ ] provided a link to the relevant issue or specification - [ ] followed the guidelines for [building modules](https://docs.cosmos.network/v0.44/building-modules/intro.html) - [ ] included the necessary unit and integration [tests](https://github.com/desmos-labs/desmos/blob/master/CONTRIBUTING.md#testing) - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [ ] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable)
- Loading branch information
1 parent
4294a38
commit 18f3538
Showing
32 changed files
with
5,282 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package testutil | ||
|
||
import ( | ||
"time" | ||
|
||
"cosmossdk.io/core/header" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/stretchr/testify/suite" | ||
|
||
milkywayapp "github.com/milkyway-labs/milkyway/app" | ||
) | ||
|
||
type KeeperTestSuite struct { | ||
suite.Suite | ||
|
||
App *milkywayapp.MilkyWayApp | ||
Ctx sdk.Context | ||
} | ||
|
||
func (s *KeeperTestSuite) SetupTest() { | ||
s.App = milkywayapp.SetupWithGenesisAccounts(nil, nil) | ||
s.Ctx = s.App.NewContext(true).WithHeaderInfo(header.Info{ | ||
Height: s.App.LastBlockHeight(), | ||
Time: time.Time{}, | ||
}) | ||
} |
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,17 @@ | ||
syntax = "proto3"; | ||
package milkyway.tickers.v1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "milkyway/tickers/v1/params.proto"; | ||
|
||
option go_package = "github.com/milkyway-labs/milkyway/x/tickers/types"; | ||
|
||
// GenesisState defines the module's genesis state. | ||
message GenesisState { | ||
// Params defines the parameters of the module. | ||
Params params = 1 [ (gogoproto.nullable) = false ]; | ||
|
||
// Tickers defines the denom-ticker map. Key is a denom and value is its | ||
// ticker. | ||
map<string, string> tickers = 2; | ||
} |
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,88 @@ | ||
syntax = "proto3"; | ||
package milkyway.tickers.v1; | ||
|
||
import "amino/amino.proto"; | ||
import "cosmos_proto/cosmos.proto"; | ||
import "cosmos/msg/v1/msg.proto"; | ||
import "gogoproto/gogo.proto"; | ||
import "milkyway/tickers/v1/params.proto"; | ||
|
||
option go_package = "github.com/milkyway-labs/milkyway/x/tickers/types"; | ||
|
||
// Msg defines the services module's gRPC message service. | ||
service Msg { | ||
option (cosmos.msg.v1.service) = true; | ||
|
||
// RegisterTicker defines the operation for registering a ticker. | ||
rpc RegisterTicker(MsgRegisterTicker) returns (MsgRegisterTickerResponse); | ||
|
||
// DeregisterTicker defines the operation for de-registering a ticker with | ||
// the token denomination. | ||
rpc DeregisterTicker(MsgDeregisterTicker) | ||
returns (MsgDeregisterTickerResponse); | ||
|
||
// UpdateParams defines a (governance) operation for updating the module | ||
// parameters. | ||
// The authority defaults to the x/gov module account. | ||
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); | ||
} | ||
|
||
// MsgRegisterTicker defines the message structure for the RegisterTicker | ||
// gRPC service method. It allows the authority to register a ticker. | ||
message MsgRegisterTicker { | ||
option (cosmos.msg.v1.signer) = "authority"; | ||
option (amino.name) = "tickers/MsgRegisterTicker"; | ||
|
||
// Authority is the address that controls the module (defaults to x/gov unless | ||
// overwritten). | ||
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; | ||
|
||
// Denom represents the denomination of the token associated with the ticker. | ||
string denom = 2; | ||
|
||
// Ticker represents the ticker of the token denomination. | ||
string ticker = 3; | ||
} | ||
|
||
// MsgRegisterTickerResponse is the return value of MsgRegisterTicker. | ||
message MsgRegisterTickerResponse {} | ||
|
||
// MsgDeregisterTicker defines the message structure for the DeregisterTicker | ||
// gRPC service method. It allows the authority to de-register a ticker with | ||
// the token denomination. | ||
message MsgDeregisterTicker { | ||
option (cosmos.msg.v1.signer) = "authority"; | ||
option (amino.name) = "tickers/MsgDeregisterTicker"; | ||
|
||
// Authority is the address that controls the module (defaults to x/gov unless | ||
// overwritten). | ||
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; | ||
|
||
// Denom represents the denomination of the token associated with the ticker. | ||
string denom = 2; | ||
} | ||
|
||
// MsgRegisterTickerResponse is the return value of MsgDeregisterTicker. | ||
message MsgDeregisterTickerResponse {} | ||
|
||
// MsgUpdateParams defines the message structure for the UpdateParams gRPC | ||
// service method. It allows the authority to update the module parameters. | ||
message MsgUpdateParams { | ||
option (cosmos.msg.v1.signer) = "authority"; | ||
option (amino.name) = "tickers/MsgUpdateParams"; | ||
|
||
// Authority is the address that controls the module (defaults to x/gov unless | ||
// overwritten). | ||
string authority = 1 [ | ||
(gogoproto.moretags) = "yaml:\"authority\"", | ||
(cosmos_proto.scalar) = "cosmos.AddressString" | ||
]; | ||
|
||
// Params define the parameters to update. | ||
// | ||
// NOTE: All parameters must be supplied. | ||
Params params = 2 [ (gogoproto.nullable) = false ]; | ||
} | ||
|
||
// MsgUpdateParamsResponse is the return value of MsgUpdateParams. | ||
message MsgUpdateParamsResponse {} |
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,11 @@ | ||
syntax = "proto3"; | ||
package milkyway.tickers.v1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "cosmos_proto/cosmos.proto"; | ||
import "cosmos/base/v1beta1/coin.proto"; | ||
|
||
option go_package = "github.com/milkyway-labs/milkyway/x/tickers/types"; | ||
|
||
// Params defines the parameters for the module. | ||
message Params {} |
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,67 @@ | ||
syntax = "proto3"; | ||
package milkyway.tickers.v1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "google/api/annotations.proto"; | ||
import "cosmos/base/query/v1beta1/pagination.proto"; | ||
import "milkyway/tickers/v1/params.proto"; | ||
|
||
option go_package = "github.com/milkyway-labs/milkyway/x/tickers/types"; | ||
|
||
// Query defines the gRPC querier service. | ||
service Query { | ||
// Params defines a gRPC query method that returns the parameters of the | ||
// module. | ||
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { | ||
option (google.api.http).get = "/milkyway/tickers/v1/params"; | ||
} | ||
|
||
// Ticker defines a gRPC query method that returns a ticker of the given | ||
// token denomination. | ||
rpc Ticker(QueryTickerRequest) returns (QueryTickerResponse) { | ||
option (google.api.http).get = "/milkyway/tickers/v1/tickers/{denom}"; | ||
} | ||
|
||
// Denoms defines a gRPC query method that returns all the token | ||
// denominations associated with the given ticker. | ||
rpc Denoms(QueryDenomsRequest) returns (QueryDenomsResponse) { | ||
option (google.api.http).get = "/milkyway/tickers/v1/denoms/{ticker}"; | ||
} | ||
} | ||
|
||
// QueryParamsRequest is the request type for the Query/Params RPC method. | ||
message QueryParamsRequest {} | ||
|
||
// QueryParamsResponse is the response type for the Query/Params RPC method. | ||
message QueryParamsResponse { | ||
Params params = 1 [ (gogoproto.nullable) = false ]; | ||
} | ||
|
||
// QueryTickerRequest is the request type for the Query/Ticker RPC method. | ||
message QueryTickerRequest { | ||
// Denom is the token denomination for which the ticker is to be queried. | ||
string denom = 1; | ||
} | ||
|
||
// QueryTickerResponse is the response type for the Query/Ticker RPC method. | ||
message QueryTickerResponse { | ||
// Ticker is the ticker of the given token denomination. | ||
string ticker = 1; | ||
} | ||
|
||
// QueryDenomsRequest is the request type for the Query/Denoms RPC method. | ||
message QueryDenomsRequest { | ||
// Ticker is the ticker for which the denoms are to be queried. | ||
string ticker = 1; | ||
|
||
cosmos.base.query.v1beta1.PageRequest pagination = 2; | ||
} | ||
|
||
// QueryDenomsResponse is the response type for the Query/Denoms RPC method. | ||
message QueryDenomsResponse { | ||
// Denom is the list of all the token denominations associated with the | ||
// ticker. | ||
repeated string denoms = 1; | ||
|
||
cosmos.base.query.v1beta1.PageResponse pagination = 2; | ||
} |
Oops, something went wrong.