-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #187 from decentrio/dong/fix-gov-proposal-types-dao
fix query gov proposals
- Loading branch information
Showing
16 changed files
with
3,728 additions
and
7 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
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,65 @@ | ||
syntax = "proto3"; | ||
package onomyprotocol.dao.v1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "cosmos/base/v1beta1/coin.proto"; | ||
|
||
option go_package = "github.com/onomyprotocol/onomy/x/dao/types"; | ||
option (gogoproto.equal_all) = true; | ||
|
||
// FundTreasuryProposal details a dao fund treasury proposal. | ||
message FundTreasuryProposal { | ||
option (gogoproto.equal) = false; | ||
option (gogoproto.goproto_getters) = false; | ||
option (gogoproto.goproto_stringer) = false; | ||
|
||
string sender = 1; | ||
string title = 2; | ||
string description = 3; | ||
repeated cosmos.base.v1beta1.Coin amount = 4 [ | ||
(gogoproto.nullable) = false, | ||
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" | ||
]; | ||
} | ||
|
||
// ExchangeWithTreasuryProposal details a dao exchange with treasury proposal. | ||
message ExchangeWithTreasuryProposal { | ||
option (gogoproto.equal) = false; | ||
option (gogoproto.goproto_getters) = false; | ||
option (gogoproto.goproto_stringer) = false; | ||
|
||
string sender = 1; | ||
string title = 2; | ||
string description = 3; | ||
repeated CoinsExchangePair coins_pairs = 4 [ | ||
(gogoproto.moretags) = "yaml:\"coins_pairs\"", | ||
(gogoproto.nullable) = false | ||
]; | ||
} | ||
|
||
// CoinsExchangePair is an ask/bid coins pair to exchange. | ||
message CoinsExchangePair { | ||
cosmos.base.v1beta1.Coin coin_ask = 1 [ | ||
(gogoproto.nullable) = false, | ||
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" | ||
]; | ||
cosmos.base.v1beta1.Coin coin_bid = 2 [ | ||
(gogoproto.nullable) = false, | ||
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" | ||
]; | ||
} | ||
|
||
// FundAccountProposal details a dao fund account proposal. | ||
message FundAccountProposal { | ||
option (gogoproto.equal) = false; | ||
option (gogoproto.goproto_getters) = false; | ||
option (gogoproto.goproto_stringer) = false; | ||
|
||
string recipient = 1; | ||
string title = 2; | ||
string description = 3; | ||
repeated cosmos.base.v1beta1.Coin amount = 4 [ | ||
(gogoproto.nullable) = false, | ||
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" | ||
]; | ||
} |
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,19 @@ | ||
syntax = "proto3"; | ||
package onomyprotocol.dao.v1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "cosmos/base/v1beta1/coin.proto"; | ||
import "onomyprotocol/dao/v1/params.proto"; | ||
|
||
option go_package = "github.com/onomyprotocol/onomy/x/dao/types"; | ||
|
||
// GenesisState defines the dao module's genesis state. | ||
message GenesisState { | ||
// the dao module managed params | ||
Params params = 1 [(gogoproto.nullable) = false]; | ||
// the list of dao module coins | ||
repeated cosmos.base.v1beta1.Coin treasury_balance = 2 [ | ||
(gogoproto.nullable) = false, | ||
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" | ||
]; | ||
} |
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,30 @@ | ||
syntax = "proto3"; | ||
package onomyprotocol.dao.v1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
|
||
option go_package = "github.com/onomyprotocol/onomy/x/dao/types"; | ||
|
||
// Params defines the parameters for the module. | ||
message Params { | ||
// option (gogoproto.goproto_stringer) = false; | ||
|
||
// the period of blocks to withdraw the dao staking reward | ||
int64 withdraw_reward_period = 1 [(gogoproto.moretags) = "yaml:\"withdraw_reward_period\""]; | ||
// the rate of total dao's staking coins to keep unstaked | ||
bytes pool_rate = 2 [ | ||
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", | ||
(gogoproto.nullable) = false | ||
]; | ||
// the max rage of total dao's staking coins to be allowed in proposals | ||
bytes max_proposal_rate = 3 [ | ||
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", | ||
(gogoproto.nullable) = false | ||
]; | ||
// the max validator's commission to be staked by the dao | ||
bytes max_val_commission = 4 [ | ||
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", | ||
(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,44 @@ | ||
syntax = "proto3"; | ||
package onomyprotocol.dao.v1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "cosmos/base/v1beta1/coin.proto"; | ||
import "google/api/annotations.proto"; | ||
import "onomyprotocol/dao/v1/params.proto"; | ||
|
||
option go_package = "github.com/onomyprotocol/onomy/x/dao/types"; | ||
option (gogoproto.goproto_stringer_all) = true; | ||
option (gogoproto.goproto_getters_all) = false; | ||
|
||
// Query defines the gRPC querier service. | ||
service Query { | ||
// Parameters queries the parameters of the module. | ||
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { | ||
option (google.api.http).get = "/onomyprotocol/dao/v1/params"; | ||
} | ||
|
||
// Treasury queries the dao treasury. | ||
rpc Treasury(QueryTreasuryRequest) returns (QueryTreasuryResponse) { | ||
option (google.api.http).get = "/onomyprotocol/dao/v1/treasury"; | ||
} | ||
} | ||
|
||
// QueryParamsRequest is request type for the Query/Params RPC method. | ||
message QueryParamsRequest {} | ||
|
||
// QueryParamsResponse is response type for the Query/Params RPC method. | ||
message QueryParamsResponse { | ||
// params holds all the parameters of this module. | ||
Params params = 1 [(gogoproto.nullable) = false]; | ||
} | ||
|
||
// QueryTreasuryRequest is request type for the Query/Treasury RPC method. | ||
message QueryTreasuryRequest {} | ||
|
||
// QueryTreasuryResponse is response type for the Query/Treasury RPC method. | ||
message QueryTreasuryResponse { | ||
repeated cosmos.base.v1beta1.Coin treasury_balance = 1 [ | ||
(gogoproto.nullable) = false, | ||
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" | ||
]; | ||
} |
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,33 @@ | ||
package types | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/cosmos/cosmos-sdk/codec" | ||
cdctypes "github.com/cosmos/cosmos-sdk/codec/types" | ||
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" | ||
) | ||
|
||
// RegisterCodec registers the legacy amino codec. | ||
func RegisterCodec(cdc *codec.LegacyAmino) { | ||
cdc.RegisterConcrete(&FundTreasuryProposal{}, fmt.Sprintf("%s/%s", ModuleName, ProposalTypeFundTreasuryProposal), nil) | ||
cdc.RegisterConcrete(&ExchangeWithTreasuryProposal{}, fmt.Sprintf("%s/%s", ModuleName, ProposalTypeExchangeWithTreasuryProposal), nil) | ||
cdc.RegisterConcrete(&FundAccountProposal{}, fmt.Sprintf("%s/%s", ModuleName, ProposalTypeFundAccountProposal), nil) | ||
} | ||
|
||
// RegisterInterfaces registers the cdctypes interface. | ||
func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { | ||
registry.RegisterImplementations( | ||
(*govtypes.Content)(nil), | ||
&FundTreasuryProposal{}, | ||
&ExchangeWithTreasuryProposal{}, | ||
&FundAccountProposal{}, | ||
) | ||
} | ||
|
||
var ( | ||
// Amino holds the LegacyAmino codec. | ||
Amino = codec.NewLegacyAmino() //nolint:gochecknoglobals // cosmos sdk style | ||
// ModuleCdc holds the default proto codec. | ||
ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) //nolint:gochecknoglobals // cosmos sdk style | ||
) |
Oops, something went wrong.