-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
91 changed files
with
12,553 additions
and
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# This Dockerfile is used for proto generation | ||
# To build, run `make proto-image-build` | ||
|
||
FROM bufbuild/buf:1.7.0 as BUILDER | ||
|
||
FROM golang:1.19-alpine | ||
|
||
|
||
RUN apk add --no-cache \ | ||
nodejs \ | ||
npm \ | ||
git \ | ||
make | ||
|
||
ENV GOLANG_PROTOBUF_VERSION=1.28.0 \ | ||
GOGO_PROTOBUF_VERSION=1.3.2 \ | ||
GRPC_GATEWAY_VERSION=1.16.0 | ||
|
||
|
||
RUN go install github.com/cosmos/cosmos-proto/cmd/protoc-gen-go-pulsar@latest | ||
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v${GOLANG_PROTOBUF_VERSION} | ||
RUN go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@v${GRPC_GATEWAY_VERSION} \ | ||
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@v${GRPC_GATEWAY_VERSION} | ||
|
||
# install all gogo protobuf binaries | ||
RUN git clone https://github.com/regen-network/protobuf.git; \ | ||
cd protobuf; \ | ||
go mod download; \ | ||
make install | ||
|
||
# we need to use git clone because we use 'replace' directive in go.mod | ||
# protoc-gen-gocosmos was moved to to in cosmos/gogoproto but pending a migration there. | ||
RUN git clone https://github.com/regen-network/cosmos-proto.git; \ | ||
cd cosmos-proto/protoc-gen-gocosmos; \ | ||
go install . | ||
|
||
RUN npm install -g swagger-combine | ||
|
||
COPY --from=BUILDER /usr/local/bin /usr/local/bin |
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,5 @@ | ||
version: v1 | ||
plugins: | ||
- name: doc | ||
out: ../docs/proto | ||
opt: ../docs/proto/protodoc-markdown.tmpl,proto-docs.md |
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,8 @@ | ||
version: v1 | ||
plugins: | ||
- name: gocosmos | ||
out: .. | ||
opt: plugins=grpc,Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types | ||
- name: grpc-gateway | ||
out: .. | ||
opt: logtostderr=true,allow_colon_final_segments=true |
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
17 changes: 17 additions & 0 deletions
17
proto/osmosis/tokenfactory/v1beta1/authorityMetadata.proto
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 osmosis.tokenfactory.v1beta1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "cosmos/base/v1beta1/coin.proto"; | ||
|
||
option go_package = "github.com/CosmosTokenFactory/token-factory/x/tokenfactory/types"; | ||
|
||
// DenomAuthorityMetadata specifies metadata for addresses that have specific | ||
// capabilities over a token factory denom. Right now there is only one Admin | ||
// permission, but is planned to be extended to the future. | ||
message DenomAuthorityMetadata { | ||
option (gogoproto.equal) = true; | ||
|
||
// Can be empty for no admin, or a valid osmosis address | ||
string admin = 1 [ (gogoproto.moretags) = "yaml:\"admin\"" ]; | ||
} |
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,32 @@ | ||
syntax = "proto3"; | ||
package osmosis.tokenfactory.v1beta1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "osmosis/tokenfactory/v1beta1/authorityMetadata.proto"; | ||
import "osmosis/tokenfactory/v1beta1/params.proto"; | ||
|
||
option go_package = "github.com/CosmosTokenFactory/token-factory/x/tokenfactory/types"; | ||
|
||
// GenesisState defines the tokenfactory module's genesis state. | ||
message GenesisState { | ||
// params defines the paramaters of the module. | ||
Params params = 1 [ (gogoproto.nullable) = false ]; | ||
|
||
repeated GenesisDenom factory_denoms = 2 [ | ||
(gogoproto.moretags) = "yaml:\"factory_denoms\"", | ||
(gogoproto.nullable) = false | ||
]; | ||
} | ||
|
||
// GenesisDenom defines a tokenfactory denom that is defined within genesis | ||
// state. The structure contains DenomAuthorityMetadata which defines the | ||
// denom's admin. | ||
message GenesisDenom { | ||
option (gogoproto.equal) = true; | ||
|
||
string denom = 1 [ (gogoproto.moretags) = "yaml:\"denom\"" ]; | ||
DenomAuthorityMetadata authority_metadata = 2 [ | ||
(gogoproto.moretags) = "yaml:\"authority_metadata\"", | ||
(gogoproto.nullable) = false | ||
]; | ||
} |
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 @@ | ||
syntax = "proto3"; | ||
package osmosis.tokenfactory.v1beta1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "osmosis/tokenfactory/v1beta1/authorityMetadata.proto"; | ||
import "cosmos_proto/cosmos.proto"; | ||
import "cosmos/base/v1beta1/coin.proto"; | ||
|
||
option go_package = "github.com/CosmosTokenFactory/token-factory/x/tokenfactory/types"; | ||
|
||
// Params defines the parameters for the tokenfactory module. | ||
message Params { | ||
repeated cosmos.base.v1beta1.Coin denom_creation_fee = 1 [ | ||
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", | ||
(gogoproto.moretags) = "yaml:\"denom_creation_fee\"", | ||
(gogoproto.nullable) = false | ||
]; | ||
|
||
// if denom_creation_fee is an empty array, then this field is used to add more gas consumption | ||
// to the base cost. | ||
// https://github.com/CosmWasm/token-factory/issues/11 | ||
uint64 denom_creation_gas_consume = 2 [ | ||
(gogoproto.moretags) = "yaml:\"denom_creation_gas_consume\"", | ||
(gogoproto.nullable) = true | ||
]; | ||
} |
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,71 @@ | ||
syntax = "proto3"; | ||
package osmosis.tokenfactory.v1beta1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "google/api/annotations.proto"; | ||
import "cosmos/base/query/v1beta1/pagination.proto"; | ||
import "osmosis/tokenfactory/v1beta1/authorityMetadata.proto"; | ||
import "osmosis/tokenfactory/v1beta1/params.proto"; | ||
|
||
option go_package = "github.com/CosmosTokenFactory/token-factory/x/tokenfactory/types"; | ||
|
||
// Query defines the gRPC querier service. | ||
service Query { | ||
// Params defines a gRPC query method that returns the tokenfactory module's | ||
// parameters. | ||
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { | ||
option (google.api.http).get = "/osmosis/tokenfactory/v1beta1/params"; | ||
} | ||
|
||
// DenomAuthorityMetadata defines a gRPC query method for fetching | ||
// DenomAuthorityMetadata for a particular denom. | ||
rpc DenomAuthorityMetadata(QueryDenomAuthorityMetadataRequest) | ||
returns (QueryDenomAuthorityMetadataResponse) { | ||
option (google.api.http).get = | ||
"/osmosis/tokenfactory/v1beta1/denoms/{denom}/authority_metadata"; | ||
} | ||
|
||
// DenomsFromCreator defines a gRPC query method for fetching all | ||
// denominations created by a specific admin/creator. | ||
rpc DenomsFromCreator(QueryDenomsFromCreatorRequest) | ||
returns (QueryDenomsFromCreatorResponse) { | ||
option (google.api.http).get = | ||
"/osmosis/tokenfactory/v1beta1/denoms_from_creator/{creator}"; | ||
} | ||
} | ||
|
||
// 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 defines the parameters of the module. | ||
Params params = 1 [ (gogoproto.nullable) = false ]; | ||
} | ||
|
||
// QueryDenomAuthorityMetadataRequest defines the request structure for the | ||
// DenomAuthorityMetadata gRPC query. | ||
message QueryDenomAuthorityMetadataRequest { | ||
string denom = 1 [ (gogoproto.moretags) = "yaml:\"denom\"" ]; | ||
} | ||
|
||
// QueryDenomAuthorityMetadataResponse defines the response structure for the | ||
// DenomAuthorityMetadata gRPC query. | ||
message QueryDenomAuthorityMetadataResponse { | ||
DenomAuthorityMetadata authority_metadata = 1 [ | ||
(gogoproto.moretags) = "yaml:\"authority_metadata\"", | ||
(gogoproto.nullable) = false | ||
]; | ||
} | ||
|
||
// QueryDenomsFromCreatorRequest defines the request structure for the | ||
// DenomsFromCreator gRPC query. | ||
message QueryDenomsFromCreatorRequest { | ||
string creator = 1 [ (gogoproto.moretags) = "yaml:\"creator\"" ]; | ||
} | ||
|
||
// QueryDenomsFromCreatorRequest defines the response structure for the | ||
// DenomsFromCreator gRPC query. | ||
message QueryDenomsFromCreatorResponse { | ||
repeated string denoms = 1 [ (gogoproto.moretags) = "yaml:\"denoms\"" ]; | ||
} |
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,109 @@ | ||
syntax = "proto3"; | ||
package osmosis.tokenfactory.v1beta1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "cosmos/base/v1beta1/coin.proto"; | ||
import "cosmos/bank/v1beta1/bank.proto"; | ||
|
||
option go_package = "github.com/CosmosTokenFactory/token-factory/x/tokenfactory/types"; | ||
|
||
// Msg defines the tokefactory module's gRPC message service. | ||
service Msg { | ||
rpc CreateDenom(MsgCreateDenom) returns (MsgCreateDenomResponse); | ||
rpc Mint(MsgMint) returns (MsgMintResponse); | ||
rpc Burn(MsgBurn) returns (MsgBurnResponse); | ||
rpc ChangeAdmin(MsgChangeAdmin) returns (MsgChangeAdminResponse); | ||
rpc SetDenomMetadata(MsgSetDenomMetadata) | ||
returns (MsgSetDenomMetadataResponse); | ||
rpc ForceTransfer(MsgForceTransfer) returns (MsgForceTransferResponse); | ||
} | ||
|
||
// MsgCreateDenom defines the message structure for the CreateDenom gRPC service | ||
// method. It allows an account to create a new denom. It requires a sender | ||
// address and a sub denomination. The (sender_address, sub_denomination) tuple | ||
// must be unique and cannot be re-used. | ||
// | ||
// The resulting denom created is defined as | ||
// <factory/{creatorAddress}/{subdenom}>. The resulting denom's admin is | ||
// originally set to be the creator, but this can be changed later. The token | ||
// denom does not indicate the current admin. | ||
message MsgCreateDenom { | ||
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; | ||
// subdenom can be up to 44 "alphanumeric" characters long. | ||
string subdenom = 2 [ (gogoproto.moretags) = "yaml:\"subdenom\"" ]; | ||
} | ||
|
||
// MsgCreateDenomResponse is the return value of MsgCreateDenom | ||
// It returns the full string of the newly created denom | ||
message MsgCreateDenomResponse { | ||
string new_token_denom = 1 | ||
[ (gogoproto.moretags) = "yaml:\"new_token_denom\"" ]; | ||
} | ||
|
||
// MsgMint is the sdk.Msg type for allowing an admin account to mint | ||
// more of a token. For now, we only support minting to the sender account | ||
message MsgMint { | ||
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; | ||
cosmos.base.v1beta1.Coin amount = 2 [ | ||
(gogoproto.moretags) = "yaml:\"amount\"", | ||
(gogoproto.nullable) = false | ||
]; | ||
string mintToAddress = 3 | ||
[ (gogoproto.moretags) = "yaml:\"mint_to_address\"" ]; | ||
} | ||
|
||
message MsgMintResponse {} | ||
|
||
// MsgBurn is the sdk.Msg type for allowing an admin account to burn | ||
// a token. For now, we only support burning from the sender account. | ||
message MsgBurn { | ||
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; | ||
cosmos.base.v1beta1.Coin amount = 2 [ | ||
(gogoproto.moretags) = "yaml:\"amount\"", | ||
(gogoproto.nullable) = false | ||
]; | ||
string burnFromAddress = 3 | ||
[ (gogoproto.moretags) = "yaml:\"burn_from_address\"" ]; | ||
} | ||
|
||
message MsgBurnResponse {} | ||
|
||
// MsgChangeAdmin is the sdk.Msg type for allowing an admin account to reassign | ||
// adminship of a denom to a new account | ||
message MsgChangeAdmin { | ||
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; | ||
string denom = 2 [ (gogoproto.moretags) = "yaml:\"denom\"" ]; | ||
string new_admin = 3 [ (gogoproto.moretags) = "yaml:\"new_admin\"" ]; | ||
} | ||
|
||
// MsgChangeAdminResponse defines the response structure for an executed | ||
// MsgChangeAdmin message. | ||
message MsgChangeAdminResponse {} | ||
|
||
// MsgSetDenomMetadata is the sdk.Msg type for allowing an admin account to set | ||
// the denom's bank metadata | ||
message MsgSetDenomMetadata { | ||
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; | ||
cosmos.bank.v1beta1.Metadata metadata = 2 [ | ||
(gogoproto.moretags) = "yaml:\"metadata\"", | ||
(gogoproto.nullable) = false | ||
]; | ||
} | ||
|
||
// MsgSetDenomMetadataResponse defines the response structure for an executed | ||
// MsgSetDenomMetadata message. | ||
message MsgSetDenomMetadataResponse {} | ||
|
||
message MsgForceTransfer { | ||
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; | ||
cosmos.base.v1beta1.Coin amount = 2 [ | ||
(gogoproto.moretags) = "yaml:\"amount\"", | ||
(gogoproto.nullable) = false | ||
]; | ||
string transferFromAddress = 3 | ||
[ (gogoproto.moretags) = "yaml:\"transfer_from_address\"" ]; | ||
string transferToAddress = 4 | ||
[ (gogoproto.moretags) = "yaml:\"transfer_to_address\"" ]; | ||
} | ||
|
||
message MsgForceTransferResponse {} |
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
Oops, something went wrong.