refactor(proto): host module proto files within modules (#18758)
This commit is contained in:
@@ -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
|
||||
@@ -0,0 +1,18 @@
|
||||
version: v1
|
||||
managed:
|
||||
enabled: true
|
||||
go_package_prefix:
|
||||
default: cosmossdk.io/api
|
||||
except:
|
||||
- buf.build/googleapis/googleapis
|
||||
- buf.build/cosmos/gogo-proto
|
||||
- buf.build/cosmos/cosmos-proto
|
||||
override:
|
||||
buf.build/cosmos/cosmos-sdk: cosmossdk.io/api
|
||||
plugins:
|
||||
- name: go-pulsar
|
||||
out: ..
|
||||
opt: paths=source_relative
|
||||
- name: go-grpc
|
||||
out: ..
|
||||
opt: paths=source_relative
|
||||
@@ -0,0 +1,28 @@
|
||||
# Generated by buf. DO NOT EDIT.
|
||||
version: v1
|
||||
deps:
|
||||
- remote: buf.build
|
||||
owner: cosmos
|
||||
repository: cosmos-proto
|
||||
commit: 1935555c206d4afb9e94615dfd0fad31
|
||||
digest: shake256:c74d91a3ac7ae07d579e90eee33abf9b29664047ac8816500cf22c081fec0d72d62c89ce0bebafc1f6fec7aa5315be72606717740ca95007248425102c365377
|
||||
- remote: buf.build
|
||||
owner: cosmos
|
||||
repository: cosmos-sdk
|
||||
commit: cf13c7d232dd405180c2af616fa8a075
|
||||
digest: shake256:769a38e306a98339b549bc96991c97fae8bd3ceb1a7646c7bfe9a74e406ab068372970fbc5abda1891e2f3c36527cf2d3a25f631739d36900787226e564bb612
|
||||
- remote: buf.build
|
||||
owner: cosmos
|
||||
repository: gogo-proto
|
||||
commit: 5e5b9fdd01804356895f8f79a6f1ddc1
|
||||
digest: shake256:0b85da49e2e5f9ebc4806eae058e2f56096ff3b1c59d1fb7c190413dd15f45dd456f0b69ced9059341c80795d2b6c943de15b120a9e0308b499e43e4b5fc2952
|
||||
- remote: buf.build
|
||||
owner: googleapis
|
||||
repository: googleapis
|
||||
commit: 28151c0d0a1641bf938a7672c500e01d
|
||||
digest: shake256:49215edf8ef57f7863004539deff8834cfb2195113f0b890dd1f67815d9353e28e668019165b9d872395871eeafcbab3ccfdb2b5f11734d3cca95be9e8d139de
|
||||
- remote: buf.build
|
||||
owner: protocolbuffers
|
||||
repository: wellknowntypes
|
||||
commit: 657250e6a39648cbb169d079a60bd9ba
|
||||
digest: shake256:00de25001b8dd2e29d85fc4bcc3ede7aed886d76d67f5e0f7a9b320b90f871d3eb73507d50818d823a0512f3f8db77a11c043685528403e31ff3fef18323a9fb
|
||||
@@ -0,0 +1,18 @@
|
||||
version: v1
|
||||
name: buf.build/mods/protocolpool
|
||||
deps:
|
||||
- buf.build/cosmos/cosmos-sdk # pin the Cosmos SDK version
|
||||
- buf.build/cosmos/cosmos-proto
|
||||
- buf.build/cosmos/gogo-proto
|
||||
- buf.build/googleapis/googleapis
|
||||
lint:
|
||||
use:
|
||||
- DEFAULT
|
||||
- COMMENTS
|
||||
- FILE_LOWER_SNAKE_CASE
|
||||
except:
|
||||
- UNARY_RPC
|
||||
- COMMENT_FIELD
|
||||
- SERVICE_SUFFIX
|
||||
- PACKAGE_VERSION_SUFFIX
|
||||
- RPC_REQUEST_STANDARD_NAME
|
||||
@@ -0,0 +1,15 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package cosmos.protocolpool.module.v1;
|
||||
|
||||
import "cosmos/app/v1alpha1/module.proto";
|
||||
|
||||
// Module is the config object of the consensus module.
|
||||
message Module {
|
||||
option (cosmos.app.v1alpha1.module) = {
|
||||
go_import: "cosmossdk.io/x/protocolpool"
|
||||
};
|
||||
|
||||
// authority defines the custom module authority. If not set, defaults to the governance module.
|
||||
string authority = 1;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
syntax = "proto3";
|
||||
package cosmos.protocolpool.v1;
|
||||
|
||||
option go_package = "cosmossdk.io/x/protocolpool/types";
|
||||
|
||||
import "cosmos/protocolpool/v1/types.proto";
|
||||
import "gogoproto/gogo.proto";
|
||||
import "cosmos_proto/cosmos.proto";
|
||||
|
||||
// GenesisState defines the protocolpool module's genesis state.
|
||||
message GenesisState {
|
||||
// ContinuousFund defines the continuous funds at genesis.
|
||||
repeated ContinuousFund continuous_fund = 1;
|
||||
// Budget defines the budget proposals at genesis.
|
||||
repeated Budget budget = 2;
|
||||
|
||||
string to_distribute = 3 [
|
||||
(cosmos_proto.scalar) = "cosmos.Int",
|
||||
(gogoproto.customtype) = "cosmossdk.io/math.Int",
|
||||
(gogoproto.nullable) = false
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
syntax = "proto3";
|
||||
package cosmos.protocolpool.v1;
|
||||
|
||||
option go_package = "cosmossdk.io/x/protocolpool/types";
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
import "google/api/annotations.proto";
|
||||
import "cosmos/base/v1beta1/coin.proto";
|
||||
import "cosmos_proto/cosmos.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "google/protobuf/duration.proto";
|
||||
|
||||
// Query defines the gRPC querier service for community pool module.
|
||||
service Query {
|
||||
// CommunityPool queries the community pool coins.
|
||||
rpc CommunityPool(QueryCommunityPoolRequest) returns (QueryCommunityPoolResponse) {
|
||||
option (google.api.http).get = "/cosmos/protocolpool/v1/community_pool";
|
||||
}
|
||||
|
||||
// UnclaimedBudget queries the remaining budget left to be claimed and it gives overall budget allocation view.
|
||||
rpc UnclaimedBudget(QueryUnclaimedBudgetRequest) returns (QueryUnclaimedBudgetResponse) {
|
||||
option (google.api.http).get = "/cosmos/protocolpool/v1/unclaimed_budget/{address}";
|
||||
}
|
||||
}
|
||||
|
||||
// QueryCommunityPoolRequest is the request type for the Query/CommunityPool RPC
|
||||
// method.
|
||||
message QueryCommunityPoolRequest {}
|
||||
|
||||
// QueryCommunityPoolResponse is the response type for the Query/CommunityPool
|
||||
// RPC method.
|
||||
message QueryCommunityPoolResponse {
|
||||
// pool defines community pool's coins.
|
||||
repeated cosmos.base.v1beta1.DecCoin pool = 1
|
||||
[(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
// QueryUnclaimedBudgetRequest is the request type for the Query/UnclaimedBudgetRequest
|
||||
// RPC method.
|
||||
message QueryUnclaimedBudgetRequest {
|
||||
// address is the recipient address to query unclaimed budget amount for.
|
||||
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
}
|
||||
|
||||
// QueryUnclaimedBudgetResponse is the response type for the Query/UnclaimedBudget
|
||||
// RPC method.
|
||||
message QueryUnclaimedBudgetResponse {
|
||||
// total_budget is the total budget allocated to the recipient
|
||||
cosmos.base.v1beta1.Coin total_budget = 1;
|
||||
// claimed_amount is the budget amount already claimed by the recipient
|
||||
cosmos.base.v1beta1.Coin claimed_amount = 2;
|
||||
// unclaimed_amount is the remaining budget amount that is unclaimed by the recipient
|
||||
cosmos.base.v1beta1.Coin unclaimed_amount = 3;
|
||||
// next_claim_from is the next starting claim time for fund distribution.
|
||||
// It represents the time when we can claim funds after the period time interval has passed.
|
||||
google.protobuf.Timestamp next_claim_from = 4 [(gogoproto.stdtime) = true];
|
||||
// period is the time interval for fund distribution
|
||||
google.protobuf.Duration period = 5 [(gogoproto.stdduration) = true];
|
||||
// tranches_left is the number of tranches left for the amount to be distributed
|
||||
uint64 tranches_left = 6;
|
||||
}
|
||||
@@ -0,0 +1,175 @@
|
||||
syntax = "proto3";
|
||||
package cosmos.protocolpool.v1;
|
||||
|
||||
option go_package = "cosmossdk.io/x/protocolpool/types";
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
import "cosmos/base/v1beta1/coin.proto";
|
||||
import "cosmos_proto/cosmos.proto";
|
||||
import "cosmos/msg/v1/msg.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "google/protobuf/duration.proto";
|
||||
|
||||
// Msg defines the pool Msg service.
|
||||
service Msg {
|
||||
option (cosmos.msg.v1.service) = true;
|
||||
|
||||
// FundCommunityPool defines a method to allow an account to directly
|
||||
// fund the community pool.
|
||||
rpc FundCommunityPool(MsgFundCommunityPool) returns (MsgFundCommunityPoolResponse);
|
||||
|
||||
// CommunityPoolSpend defines a governance operation for sending tokens from
|
||||
// the community pool in the x/protocolpool module to another account, which
|
||||
// could be the governance module itself. The authority is defined in the
|
||||
// keeper.
|
||||
rpc CommunityPoolSpend(MsgCommunityPoolSpend) returns (MsgCommunityPoolSpendResponse);
|
||||
|
||||
// SubmitBudgetProposal defines a method to set a budget proposal.
|
||||
rpc SubmitBudgetProposal(MsgSubmitBudgetProposal) returns (MsgSubmitBudgetProposalResponse);
|
||||
|
||||
// ClaimBudget defines a method to claim the distributed budget.
|
||||
rpc ClaimBudget(MsgClaimBudget) returns (MsgClaimBudgetResponse);
|
||||
|
||||
// CreateContinuousFund defines a method to add funds continuously.
|
||||
rpc CreateContinuousFund(MsgCreateContinuousFund) returns (MsgCreateContinuousFundResponse);
|
||||
|
||||
// WithdrawContinuousFund defines a method to withdraw continuous fund allocated.
|
||||
rpc WithdrawContinuousFund(MsgWithdrawContinuousFund) returns (MsgWithdrawContinuousFundResponse);
|
||||
|
||||
// CancelContinuousFund defines a method for cancelling continuous fund.
|
||||
rpc CancelContinuousFund(MsgCancelContinuousFund) returns (MsgCancelContinuousFundResponse);
|
||||
}
|
||||
|
||||
// MsgFundCommunityPool allows an account to directly
|
||||
// fund the community pool.
|
||||
message MsgFundCommunityPool {
|
||||
option (cosmos.msg.v1.signer) = "depositor";
|
||||
option (gogoproto.equal) = false;
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
repeated cosmos.base.v1beta1.Coin amount = 1
|
||||
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
|
||||
string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
}
|
||||
|
||||
// MsgFundCommunityPoolResponse defines the Msg/FundCommunityPool response type.
|
||||
message MsgFundCommunityPoolResponse {}
|
||||
|
||||
// MsgCommunityPoolSpend defines a message for sending tokens from the community
|
||||
// pool to another account. This message is typically executed via a governance
|
||||
// proposal with the governance module being the executing authority.
|
||||
message MsgCommunityPoolSpend {
|
||||
option (cosmos.msg.v1.signer) = "authority";
|
||||
|
||||
// Authority is the address that controls the module (defaults to x/gov unless overwritten).
|
||||
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
string recipient = 2;
|
||||
repeated cosmos.base.v1beta1.Coin amount = 3
|
||||
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
|
||||
}
|
||||
|
||||
// MsgCommunityPoolSpendResponse defines the response to executing a
|
||||
// MsgCommunityPoolSpend message.
|
||||
message MsgCommunityPoolSpendResponse {}
|
||||
|
||||
// MsgSubmitBudgetProposal defines budget proposal type.
|
||||
message MsgSubmitBudgetProposal {
|
||||
option (cosmos.msg.v1.signer) = "authority";
|
||||
|
||||
// Authority is the address that controls the module (defaults to x/gov unless overwritten).
|
||||
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
// RecipientAddress is the address of the recipient who can claim the budget.
|
||||
string recipient_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
// TotalBudget is the total amount allocated for the budget.
|
||||
cosmos.base.v1beta1.Coin total_budget = 3;
|
||||
// StartTime is the time when the budget becomes claimable.
|
||||
// If StartTime is less than the current block time, proposal will not be accepted.
|
||||
google.protobuf.Timestamp start_time = 4 [(gogoproto.stdtime) = true];
|
||||
// Tranches is the number of times the total budget amount is to be distributed.
|
||||
uint64 tranches = 5;
|
||||
// Period is the time interval(number of seconds) at which funds distribution should be performed.
|
||||
// For example, if a period is set to 3600, it represents an action that
|
||||
// should occur every hour (3600 seconds).
|
||||
google.protobuf.Duration period = 6 [(gogoproto.stdduration) = true];
|
||||
}
|
||||
|
||||
// MsgSubmitBudgetProposalResponse defines the response to executing a
|
||||
// MsgSubmitBudgetProposal message.
|
||||
message MsgSubmitBudgetProposalResponse {}
|
||||
|
||||
// MsgClaimBudget defines a message for claiming the distributed budget.
|
||||
message MsgClaimBudget {
|
||||
option (cosmos.msg.v1.signer) = "recipient_address";
|
||||
string recipient_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
}
|
||||
|
||||
// MsgClaimBudgetResponse defines the response to executing a
|
||||
// MsgClaimBudget message.
|
||||
message MsgClaimBudgetResponse {
|
||||
cosmos.base.v1beta1.Coin amount = 1
|
||||
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
|
||||
;
|
||||
}
|
||||
|
||||
// MsgCreateContinuousFund defines a message for adding continuous funds.
|
||||
message MsgCreateContinuousFund {
|
||||
option (cosmos.msg.v1.signer) = "authority";
|
||||
|
||||
// Authority is the address that controls the module (defaults to x/gov unless overwritten).
|
||||
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
// Recipient address of the account receiving funds.
|
||||
string recipient = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
// Percentage is the percentage of funds to be allocated from Community pool.
|
||||
string percentage = 3 [
|
||||
(cosmos_proto.scalar) = "cosmos.Dec",
|
||||
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
|
||||
(gogoproto.nullable) = false
|
||||
];
|
||||
// Optional, if expiry is set, removes the state object when expired.
|
||||
google.protobuf.Timestamp expiry = 4 [(gogoproto.stdtime) = true];
|
||||
}
|
||||
|
||||
// MsgCreateContinuousFundResponse defines the response to executing a
|
||||
// MsgCreateContinuousFund message.
|
||||
message MsgCreateContinuousFundResponse {}
|
||||
|
||||
// MsgCancelContinuousFund defines a message to cancel continuous funds for a specific recipient.
|
||||
message MsgCancelContinuousFund {
|
||||
option (cosmos.msg.v1.signer) = "authority";
|
||||
|
||||
// Authority is the account address of authority.
|
||||
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
// RecipientAddress is the account address of recipient whose funds are to be cancelled.
|
||||
string recipient_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
}
|
||||
|
||||
// MsgCancelContinuousFundResponse defines the response to executing a
|
||||
// MsgCancelContinuousFund message.
|
||||
message MsgCancelContinuousFundResponse {
|
||||
// CanceledTime is the canceled time.
|
||||
google.protobuf.Timestamp canceled_time = 1 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
|
||||
// CanceledHeight defines the canceled block height.
|
||||
uint64 canceled_height = 2;
|
||||
// RecipientAddress is the account address of recipient whose funds are cancelled.
|
||||
string recipient_address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
// withdrawnAllocatedFund represents the fund allocated to this recipient (if any) that have not been withdrawn yet,
|
||||
// before a cancellation request has been initiated.
|
||||
// It involves first withdrawing the funds and then canceling the request.
|
||||
cosmos.base.v1beta1.Coin withdrawn_allocated_fund = 4
|
||||
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
|
||||
;
|
||||
}
|
||||
|
||||
// MsgWithdrawContinuousFund defines a message for withdrawing the continuous fund allocated to it.
|
||||
message MsgWithdrawContinuousFund {
|
||||
option (cosmos.msg.v1.signer) = "recipient_address";
|
||||
string recipient_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
}
|
||||
|
||||
// MsgWithdrawContinuousFundResponse defines the response to executing a
|
||||
// MsgWithdrawContinuousFund message.
|
||||
message MsgWithdrawContinuousFundResponse {
|
||||
cosmos.base.v1beta1.Coin amount = 1
|
||||
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
|
||||
;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
syntax = "proto3";
|
||||
package cosmos.protocolpool.v1;
|
||||
|
||||
option go_package = "cosmossdk.io/x/protocolpool/types";
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
import "cosmos_proto/cosmos.proto";
|
||||
import "cosmos/base/v1beta1/coin.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "google/protobuf/duration.proto";
|
||||
|
||||
// Budget defines the fields of a budget proposal.
|
||||
message Budget {
|
||||
// recipient_address is the address of the recipient who can claim the budget.
|
||||
string recipient_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
// total_budget is the total amount allocated for the budget.
|
||||
cosmos.base.v1beta1.Coin total_budget = 2;
|
||||
// claimed_amount is the total amount claimed from the total budget amount requested.
|
||||
cosmos.base.v1beta1.Coin claimed_amount = 3;
|
||||
// start_time is the time when the budget becomes claimable.
|
||||
google.protobuf.Timestamp start_time = 4 [(gogoproto.stdtime) = true];
|
||||
// next_claim_from is the time when the budget was last successfully claimed or distributed.
|
||||
// It is used to track the next starting claim time for fund distribution. If set, it cannot be less than start_time.
|
||||
google.protobuf.Timestamp next_claim_from = 5 [(gogoproto.stdtime) = true];
|
||||
// tranches is the number of times the total budget amount is to be distributed.
|
||||
uint64 tranches = 6;
|
||||
// tranches_left is the number of tranches left for the amount to be distributed.
|
||||
uint64 tranches_left = 7;
|
||||
// Period is the time interval(number of seconds) at which funds distribution should be performed.
|
||||
// For example, if a period is set to 3600, it represents an action that
|
||||
// should occur every hour (3600 seconds).
|
||||
google.protobuf.Duration period = 8 [(gogoproto.stdduration) = true];
|
||||
}
|
||||
|
||||
// ContinuousFund defines the fields of continuous fund proposal.
|
||||
message ContinuousFund {
|
||||
// Recipient address of the account receiving funds.
|
||||
string recipient = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
// Percentage is the percentage of funds to be allocated from Community pool.
|
||||
string percentage = 2 [
|
||||
(cosmos_proto.scalar) = "cosmos.Dec",
|
||||
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
|
||||
(gogoproto.nullable) = false
|
||||
];
|
||||
// Optional, if expiry is set, removes the state object when expired.
|
||||
google.protobuf.Timestamp expiry = 3 [(gogoproto.stdtime) = true];
|
||||
}
|
||||
Reference in New Issue
Block a user