github.com/cosmos/cosmos-sdk@v0.50.10/x/gov/migrations/v4/keys.go (about)

     1  package v4
     2  
     3  import "encoding/binary"
     4  
     5  const (
     6  	// ModuleName is the name of the module
     7  	ModuleName = "gov"
     8  )
     9  
    10  var (
    11  	// ParamsKey is the key of x/gov params
    12  	ParamsKey = []byte{0x30}
    13  
    14  	// - 0x04<proposalID_Bytes>: ProposalContents
    15  	VotingPeriodProposalKeyPrefix = []byte{0x04}
    16  )
    17  
    18  // VotingPeriodProposalKey gets if a proposal is in voting period.
    19  func VotingPeriodProposalKey(proposalID uint64) []byte {
    20  	return append(VotingPeriodProposalKeyPrefix, GetProposalIDBytes(proposalID)...)
    21  }
    22  
    23  // GetProposalIDBytes returns the byte representation of the proposalID
    24  func GetProposalIDBytes(proposalID uint64) (proposalIDBz []byte) {
    25  	proposalIDBz = make([]byte, 8)
    26  	binary.BigEndian.PutUint64(proposalIDBz, proposalID)
    27  	return
    28  }