github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/x/gov/types/querier.go (about)

     1  package types
     2  
     3  import (
     4  	sdk "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/types"
     5  )
     6  
     7  // query endpoints supported by the governance Querier
     8  const (
     9  	QueryParams    = "params"
    10  	QueryProposals = "proposals"
    11  	QueryProposal  = "proposal"
    12  	QueryDeposits  = "deposits"
    13  	QueryDeposit   = "deposit"
    14  	QueryVotes     = "votes"
    15  	QueryVote      = "vote"
    16  	QueryTally     = "tally"
    17  
    18  	ParamDeposit  = "deposit"
    19  	ParamVoting   = "voting"
    20  	ParamTallying = "tallying"
    21  )
    22  
    23  // Params for queries:
    24  // - 'custom/gov/proposal'
    25  // - 'custom/gov/deposits'
    26  // - 'custom/gov/tally'
    27  // - 'custom/gov/votes'
    28  type QueryProposalParams struct {
    29  	ProposalID uint64
    30  }
    31  
    32  // creates a new instance of QueryProposalParams
    33  func NewQueryProposalParams(proposalID uint64) QueryProposalParams {
    34  	return QueryProposalParams{
    35  		ProposalID: proposalID,
    36  	}
    37  }
    38  
    39  // Params for query 'custom/gov/deposit'
    40  type QueryDepositParams struct {
    41  	ProposalID uint64
    42  	Depositor  sdk.AccAddress
    43  }
    44  
    45  // creates a new instance of QueryDepositParams
    46  func NewQueryDepositParams(proposalID uint64, depositor sdk.AccAddress) QueryDepositParams {
    47  	return QueryDepositParams{
    48  		ProposalID: proposalID,
    49  		Depositor:  depositor,
    50  	}
    51  }
    52  
    53  // Params for query 'custom/gov/vote'
    54  type QueryVoteParams struct {
    55  	ProposalID uint64
    56  	Voter      sdk.AccAddress
    57  }
    58  
    59  // creates a new instance of QueryVoteParams
    60  func NewQueryVoteParams(proposalID uint64, voter sdk.AccAddress) QueryVoteParams {
    61  	return QueryVoteParams{
    62  		ProposalID: proposalID,
    63  		Voter:      voter,
    64  	}
    65  }
    66  
    67  // Params for query 'custom/gov/proposals'
    68  type QueryProposalsParams struct {
    69  	Voter          sdk.AccAddress
    70  	Depositor      sdk.AccAddress
    71  	ProposalStatus ProposalStatus
    72  	Limit          uint64
    73  }
    74  
    75  // creates a new instance of QueryProposalsParams
    76  func NewQueryProposalsParams(status ProposalStatus, limit uint64, voter, depositor sdk.AccAddress) QueryProposalsParams {
    77  	return QueryProposalsParams{
    78  		Voter:          voter,
    79  		Depositor:      depositor,
    80  		ProposalStatus: status,
    81  		Limit:          limit,
    82  	}
    83  }