github.com/InjectiveLabs/sdk-go@v1.53.0/chain/insurance/types/key.go (about)

     1  package types
     2  
     3  import (
     4  	"time"
     5  
     6  	sdk "github.com/cosmos/cosmos-sdk/types"
     7  )
     8  
     9  const (
    10  	ModuleName = "insurance"
    11  	StoreKey   = ModuleName
    12  )
    13  
    14  var (
    15  	// Key for insurance prefixes
    16  	InsuranceFundPrefixKey = []byte{0x02}
    17  
    18  	// Key for insurance redemption prefixes
    19  	RedemptionSchedulePrefixKey = []byte{0x03}
    20  
    21  	GlobalShareDenomIdPrefixKey         = []byte{0x04, 0x00}
    22  	GlobalRedemptionScheduleIdPrefixKey = []byte{0x05, 0x00}
    23  
    24  	ParamsKey = []byte{0x10}
    25  )
    26  
    27  // GetRedemptionScheduleKey provides the key to store a single pending redemption
    28  func GetRedemptionScheduleKey(redemptionID uint64, claimTime time.Time) []byte {
    29  	key := RedemptionSchedulePrefixKey
    30  	key = append(key, sdk.FormatTimeBytes(claimTime)...)
    31  	key = append(key, sdk.Uint64ToBigEndian(redemptionID)...)
    32  	return key
    33  }
    34  
    35  // GetRedemptionScheduleKey provides the key to store a single pending redemption
    36  func (sh RedemptionSchedule) GetRedemptionScheduleKey() []byte {
    37  	return GetRedemptionScheduleKey(sh.Id, sh.ClaimableRedemptionTime)
    38  }