Skip to content

Commit

Permalink
Migrate gov, ibc-transfer genesis state to proto (cosmos#6866)
Browse files Browse the repository at this point in the history
* Migrate gov genesis state

* Migrate ibc-transfer genesis state

* format genesis proto
  • Loading branch information
sahith-narahari authored Jul 28, 2020
1 parent 72f6bf0 commit 804b80a
Show file tree
Hide file tree
Showing 7 changed files with 1,650 additions and 607 deletions.
40 changes: 40 additions & 0 deletions proto/cosmos/gov/genesis.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
syntax = "proto3";

package cosmos.gov;

import "gogoproto/gogo.proto";
import "cosmos/gov/gov.proto";

option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types";

// GenesisState - all staking state that must be provided at genesis
message GenesisState{
uint64 starting_proposal_id = 1 [
(gogoproto.customname) = "StartingProposalID",
(gogoproto.moretags) = "yaml:\"starting_proposal_id\""
];
repeated Deposit deposits = 2 [
(gogoproto.castrepeated) = "Deposits",
(gogoproto.nullable) = false
];
repeated Vote votes = 3 [
(gogoproto.castrepeated) = "Votes",
(gogoproto.nullable) = false
];
repeated Proposal proposals = 4 [
(gogoproto.castrepeated) = "Proposals",
(gogoproto.nullable) = false
];
DepositParams deposit_params = 5 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"deposit_params\""
];
VotingParams voting_params = 6 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"voting_params\""
];
TallyParams tally_params = 7 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"tally_params\""
];
}
17 changes: 17 additions & 0 deletions proto/ibc/transfer/genesis.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
syntax = "proto3";
package ibc.transfer;

option go_package = "github.com/cosmos/cosmos-sdk/x/ibc-transfer/types";

import "gogoproto/gogo.proto";
import "cosmos/cosmos.proto";
import "ibc/transfer/transfer.proto";

// GenesisState is currently only used to ensure that the InitGenesis gets run
// by the module manager
message GenesisState{
string port_id = 1 [
(gogoproto.customname) = "PortID",
(gogoproto.moretags) = "yaml:\"port_id\""
];
}
11 changes: 0 additions & 11 deletions x/gov/types/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,6 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
)

// GenesisState - all staking state that must be provided at genesis
type GenesisState struct {
StartingProposalID uint64 `json:"starting_proposal_id" yaml:"starting_proposal_id"`
Deposits Deposits `json:"deposits" yaml:"deposits"`
Votes Votes `json:"votes" yaml:"votes"`
Proposals Proposals `json:"proposals" yaml:"proposals"`
DepositParams DepositParams `json:"deposit_params" yaml:"deposit_params"`
VotingParams VotingParams `json:"voting_params" yaml:"voting_params"`
TallyParams TallyParams `json:"tally_params" yaml:"tally_params"`
}

// NewGenesisState creates a new genesis state for the governance module
func NewGenesisState(startingProposalID uint64, dp DepositParams, vp VotingParams, tp TallyParams) GenesisState {
return GenesisState{
Expand Down
Loading

0 comments on commit 804b80a

Please sign in to comment.