-
Notifications
You must be signed in to change notification settings - Fork 353
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sponsorship): added proto contracts (#990)
- Loading branch information
Showing
12 changed files
with
5,833 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,35 @@ | ||
syntax = "proto3"; | ||
package dymensionxyz.dymension.sponsorship; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "cosmos_proto/cosmos.proto"; | ||
import "dymensionxyz/dymension/sponsorship/sponsorship.proto"; | ||
|
||
option go_package = "github.com/dymensionxyz/dymension/v3/x/sponsorship/types"; | ||
|
||
message EventUpdateParams { | ||
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; | ||
Params new_params = 2 [ (gogoproto.nullable) = false ]; | ||
Params old_params = 3 [ (gogoproto.nullable) = false ]; | ||
} | ||
|
||
message EventVote { | ||
string voter = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; | ||
Vote vote = 2 [ (gogoproto.nullable) = false ]; | ||
} | ||
|
||
message EventRevokeVote { | ||
string voter = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; | ||
} | ||
|
||
message EventUpdateVotingPower { | ||
string voter = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; | ||
string new_voting_power = 2 [ | ||
(gogoproto.nullable) = false, | ||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" | ||
]; | ||
string old_voting_power = 3 [ | ||
(gogoproto.nullable) = false, | ||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" | ||
]; | ||
} |
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,13 @@ | ||
syntax = "proto3"; | ||
package dymensionxyz.dymension.sponsorship; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "dymensionxyz/dymension/sponsorship/sponsorship.proto"; | ||
|
||
option go_package = "github.com/dymensionxyz/dymension/v3/x/sponsorship/types"; | ||
|
||
// GenesisState defines the sponsorship module's genesis state. | ||
message GenesisState { | ||
// Params defines params for x/sponsorship module. | ||
Params params = 1 [ (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,59 @@ | ||
syntax = "proto3"; | ||
package dymensionxyz.dymension.sponsorship; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "cosmos_proto/cosmos.proto"; | ||
import "google/api/annotations.proto"; | ||
import "dymensionxyz/dymension/sponsorship/sponsorship.proto"; | ||
|
||
option go_package = "github.com/dymensionxyz/dymension/v3/x/sponsorship/types"; | ||
|
||
// Query defines the gRPC querier service. | ||
service Query { | ||
// Param queries the parameters of the module. | ||
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { | ||
option (google.api.http).get = "/dymensionxyz/dymension/sponsorship/params"; | ||
} | ||
|
||
// Vote returns the vote for the specified address. | ||
rpc Vote(QueryVoteRequest) returns (QueryVoteResponse) { | ||
option (google.api.http).get = | ||
"/dymensionxyz/dymension/sponsorship/vote/{voter}"; | ||
} | ||
|
||
// Distribution returns the current distribution plan. | ||
rpc Distribution(QueryDistributionRequest) | ||
returns (QueryDistributionResponse) { | ||
option (google.api.http).get = | ||
"/dymensionxyz/dymension/streamer/distribution"; | ||
} | ||
} | ||
|
||
// 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 ]; | ||
} | ||
|
||
// QueryVoteRequest is the request type for the Query/Vote RPC method. | ||
message QueryVoteRequest { | ||
// Voter is the bech32 encoded address of the voted user. | ||
string voter = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; | ||
} | ||
|
||
// QueryVoteResponse is the response type for the Query/Vote RPC method. | ||
message QueryVoteResponse { | ||
// Vote is the user's vote. | ||
Vote vote = 1 [ (gogoproto.nullable) = false ]; | ||
} | ||
|
||
// QueryVoteRequest is the request type for the Query/Distribution RPC method. | ||
message QueryDistributionRequest {} | ||
|
||
// QueryVoteResponse is the response type for the Query/Distribution RPC method. | ||
message QueryDistributionResponse { | ||
// Distribution is the current voting power distribution among gauges. | ||
Distribution distribution = 1 [ (gogoproto.nullable) = false ]; | ||
} |
71 changes: 71 additions & 0 deletions
71
proto/dymensionxyz/dymension/sponsorship/sponsorship.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,71 @@ | ||
syntax = "proto3"; | ||
package dymensionxyz.dymension.sponsorship; | ||
|
||
import "gogoproto/gogo.proto"; | ||
|
||
option go_package = "github.com/dymensionxyz/dymension/v3/x/sponsorship/types"; | ||
|
||
// Params is a module parameters. | ||
message Params { | ||
// MinAllocationWeight is a minimum portion of the user's voting power that | ||
// one can allocate to a single gauge. The value must fall between 0 and 100, | ||
// inclusively. For example, if this parameter is 20%, then the min allocation | ||
// is 20%, and consequently, the user can vote on a max of 5 gauges (100 / 20 | ||
// = 5). | ||
string min_allocation_weight = 1 [ | ||
(gogoproto.nullable) = false, | ||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" | ||
]; | ||
// MinVotingPower is a minimum voting power a user must have in order to be | ||
// able to vote. | ||
string min_voting_power = 2 [ | ||
(gogoproto.nullable) = false, | ||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" | ||
]; | ||
} | ||
|
||
// Distribution holds the distribution plan among gauges. | ||
message Distribution { | ||
// TotalVotingPower is the total voting power that the plan holds. | ||
string total_voting_power = 1 [ | ||
(gogoproto.nullable) = false, | ||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" | ||
]; | ||
// Gauges is a breakdown of the users' votes for different gauges. | ||
repeated Gauge gauges = 2; | ||
} | ||
|
||
// Gauge represents a single gauge with its absolute power. | ||
message Gauge { | ||
// GaugeID is the ID of the gauge. | ||
uint64 gauge_id = 1; | ||
// Power is a total voting power distributed to this gauge. | ||
string power = 2 [ | ||
(gogoproto.nullable) = false, | ||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" | ||
]; | ||
} | ||
|
||
// Vote represents the user's vote. | ||
message Vote { | ||
// Voting power is a total voting power of the vote. | ||
string voting_power = 1 [ | ||
(gogoproto.nullable) = false, | ||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" | ||
]; | ||
// Weights is a breakdown of the user's vote for different gauges. | ||
repeated GaugeWeight weights = 2 [ (gogoproto.nullable) = false ]; | ||
} | ||
|
||
// Weight is a weight distributed to the specified gauge. | ||
message GaugeWeight { | ||
// GaugeID is the ID of the gauge. | ||
uint64 gauge_id = 1; | ||
// Weight is a portion of the voting power that the user wants to allocate for | ||
// the given gauge. The value must fall between Params.MinAllocationWeight and | ||
// 100, inclusive. | ||
string weight = 2 [ | ||
(gogoproto.nullable) = false, | ||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int" | ||
]; | ||
} |
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,58 @@ | ||
syntax = "proto3"; | ||
package dymensionxyz.dymension.sponsorship; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "cosmos_proto/cosmos.proto"; | ||
import "cosmos/msg/v1/msg.proto"; | ||
import "dymensionxyz/dymension/sponsorship/sponsorship.proto"; | ||
|
||
option go_package = "github.com/dymensionxyz/dymension/v3/x/sponsorship/types"; | ||
|
||
// Msg defines the Msg service. | ||
service Msg { | ||
option (cosmos.msg.v1.service) = true; | ||
|
||
// UpdateParams is used for updating module params. | ||
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); | ||
|
||
// Vote allows a user to cast their vote. The user specifies a desired weight | ||
// breakdown among existing gauges. | ||
rpc Vote(MsgVote) returns (MsgVoteResponse); | ||
|
||
// RevokeVote allows a user to revoke their vote. | ||
rpc RevokeVote(MsgRevokeVote) returns (MsgRevokeVoteResponse); | ||
} | ||
|
||
// MsgUpdateParams allows to update module params. | ||
message MsgUpdateParams { | ||
option (cosmos.msg.v1.signer) = "authority"; | ||
|
||
// Authority is the address that controls the module. | ||
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; | ||
// NewParams should be fully populated. | ||
Params new_params = 2 [ (gogoproto.nullable) = false ]; | ||
} | ||
|
||
message MsgUpdateParamsResponse {} | ||
|
||
// MsgVote defines a message to cast a vote. | ||
message MsgVote { | ||
option (cosmos.msg.v1.signer) = "voter"; | ||
|
||
// Voter is the bech32 encoded address of the user sending the vote. | ||
string voter = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; | ||
// Weights is a breakdown of the user's vote for different gauges. | ||
repeated GaugeWeight weights = 2 [ (gogoproto.nullable) = false ]; | ||
} | ||
|
||
message MsgVoteResponse {} | ||
|
||
// MsgRevoke defines a message to revoke the vote. | ||
message MsgRevokeVote { | ||
option (cosmos.msg.v1.signer) = "voter"; | ||
|
||
// Voter is the bech32 encoded address of the user sending the vote. | ||
string voter = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; | ||
} | ||
|
||
message MsgRevokeVoteResponse {} |
Oops, something went wrong.