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

     1  package v3
     2  
     3  var DenomAddressPrefix = []byte{0x03}
     4  
     5  // CreateDenomAddressPrefix creates a prefix for a reverse index of denomination
     6  // to account balance for that denomination.
     7  func CreateDenomAddressPrefix(denom string) []byte {
     8  	// we add a "zero" byte at the end - null byte terminator, to allow prefix denom prefix
     9  	// scan. Setting it is not needed (key[last] = 0) - because this is the default.
    10  	key := make([]byte, len(DenomAddressPrefix)+len(denom)+1)
    11  	copy(key, DenomAddressPrefix)
    12  	copy(key[len(DenomAddressPrefix):], denom)
    13  	return key
    14  }