Skip to content

Commit

Permalink
Improve create proposal code
Browse files Browse the repository at this point in the history
  • Loading branch information
PrathyushaLakkireddy committed Feb 15, 2021
1 parent e306e5b commit 0b5dc7d
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions x/gov/types/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,6 @@ const DefaultStartingProposalID uint64 = 1

// NewProposal creates a new Proposal instance
func NewProposal(content Content, id uint64, submitTime, depositEndTime time.Time) (Proposal, error) {
p := Proposal{
ProposalId: id,
Status: StatusDepositPeriod,
FinalTallyResult: EmptyTallyResult(),
TotalDeposit: sdk.NewCoins(),
SubmitTime: submitTime,
DepositEndTime: depositEndTime,
}

msg, ok := content.(proto.Message)
if !ok {
return Proposal{}, fmt.Errorf("%T does not implement proto.Message", content)
Expand All @@ -37,6 +28,15 @@ func NewProposal(content Content, id uint64, submitTime, depositEndTime time.Tim
return Proposal{}, err
}

p := Proposal{
ProposalId: id,
Status: StatusDepositPeriod,
FinalTallyResult: EmptyTallyResult(),
TotalDeposit: sdk.NewCoins(),
SubmitTime: submitTime,
DepositEndTime: depositEndTime,
}

p.Content = any

return p, nil
Expand Down

0 comments on commit 0b5dc7d

Please sign in to comment.