/
export.go
92 lines (80 loc) · 2.99 KB
/
export.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package gov
import (
"time"
sdk "github.com/oracleNetworkProtocol/plugchain-sdk-go/types"
)
// expose Gov module api for user
type Client interface {
sdk.Module
SubmitProposal(request SubmitProposalRequest, baseTx sdk.BaseTx) (uint64, sdk.ResultTx, sdk.Error)
Deposit(request DepositRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error)
Vote(request VoteRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error)
QueryProposal(proposalId uint64) (QueryProposalResp, sdk.Error)
QueryProposals(proposalStatus string) ([]QueryProposalResp, sdk.Error)
QueryVote(proposalId uint64, voter string) (QueryVoteResp, sdk.Error)
QueryVotes(proposalId uint64) ([]QueryVoteResp, sdk.Error)
QueryParams(paramsType string) (QueryParamsResp, sdk.Error)
QueryDeposit(proposalId uint64, depositor string) (QueryDepositResp, sdk.Error)
QueryDeposits(proposalId uint64) ([]QueryDepositResp, sdk.Error)
QueryTallyResult(proposalId uint64) (QueryTallyResultResp, sdk.Error)
}
type SubmitProposalRequest struct {
Title string `json:"title"`
Description string `json:"description"`
Type string `json:"type"`
InitialDeposit sdk.DecCoins `json:"initial_deposit"`
}
type DepositRequest struct {
ProposalId uint64 `json:"proposal_id"`
Amount sdk.DecCoins `json:"amount"`
}
type VoteRequest struct {
ProposalId uint64 `json:"proposal_id"`
Option string `json:"option"`
}
type QueryProposalResp struct {
ProposalId uint64 `json:"proposal_id"`
Content Content `json:"content"`
Status string `json:"status"`
FinalTallyResult QueryTallyResultResp `json:"final_tally_result"`
SubmitTime time.Time `json:"submit_time"`
DepositEndTime time.Time `json:"deposit_end_time"`
TotalDeposit sdk.Coins `json:"total_deposit"`
VotingStartTime time.Time `json:"voting_start_time"`
VotingEndTime time.Time `json:"voting_end_time"`
}
type QueryVoteResp struct {
ProposalId uint64 `json:"proposal_id"`
Voter string `json:"voter"`
Option int32 `json:"option"`
}
type (
votingParams struct {
VotingPeriod time.Duration `json:"voting_period"`
}
depositParams struct {
MinDeposit sdk.Coins `json:"min_deposit"`
MaxDepositPeriod time.Duration `json:"max_deposit_period"`
}
tallyParams struct {
Quorum sdk.Dec `json:"quorum"`
Threshold sdk.Dec `json:"threshold"`
VetoThreshold sdk.Dec `json:"veto_threshold"`
}
QueryParamsResp struct {
VotingParams votingParams `json:"voting_params"`
DepositParams depositParams `json:"deposit_params"`
TallyParams tallyParams `json:"tally_params"`
}
)
type QueryDepositResp struct {
ProposalId uint64 `json:"proposal_id"`
Depositor string `json:"depositor"`
Amount sdk.Coins `json:"amount"`
}
type QueryTallyResultResp struct {
Yes sdk.Int `json:"yes"`
Abstain sdk.Int `json:"abstain"`
No sdk.Int `json:"no"`
NoWithVeto sdk.Int `json:"no_with_veto"`
}