package types

import (
	sdk "github.com/cosmos/cosmos-sdk/types"
)

const (
	ModuleName 	  		= "graph"
	RouterKey 	  		= ModuleName
	StoreKey      	    = ModuleName
	QuerierRoute  		= ModuleName

	TStoreKey           = "transient_index"
)

var (
	GlobalStoreKeyPrefix  	 = []byte{0x00}
	CidStoreKeyPrefix	  	 = []byte{0x01}
	CidReverseStoreKeyPrefix = []byte{0x02}
	CyberlinkStoreKeyPrefix  = []byte{0x03}
	CyberlinkTStoreKeyPrefix = []byte{0x04} // inter-block cache for cyberlinks
	NeudegStoreKeyPrefix     = []byte{0x05}
	NeudegTStoreKeyPrefix    = []byte{0x06} // inter-block cache for neurons cyberlink' degree

	LastCidNumber    		 = append(GlobalStoreKeyPrefix, []byte("lastParticleNumber")...)
	LinksCount 				 = append(GlobalStoreKeyPrefix, []byte("cyberlinksAmount")...)
	HasNewLinks 		     = append(GlobalStoreKeyPrefix, []byte("blockHasNewLinks")...)
)

func CidStoreKey(cid Cid) []byte {
	return append(CidStoreKeyPrefix, []byte(cid)...)
}

func CidReverseStoreKey(num CidNumber) []byte {
	return append(CidReverseStoreKeyPrefix, sdk.Uint64ToBigEndian(uint64(num))...)
}

func CyberlinksStoreKey(linkKey []byte) []byte {
	return append(CyberlinkStoreKeyPrefix, linkKey...)
}

func CyberlinksTStoreKey(link []byte) []byte {
	return append(CyberlinkTStoreKeyPrefix, link...)
}

func NeudegStoreKey(accNumber uint64) []byte {
	return append(NeudegStoreKeyPrefix, sdk.Uint64ToBigEndian(accNumber)...)
}

func NeudegTStoreKey(accNumber uint64) []byte {
	return append(NeudegTStoreKeyPrefix, sdk.Uint64ToBigEndian(accNumber)...)
}

func CyberlinkRawKey(link CompactLink) []byte {
	keyAsBytes := make([]byte, 24)
	copy(keyAsBytes[0:8],sdk.Uint64ToBigEndian(link.From))
	copy(keyAsBytes[8:16],sdk.Uint64ToBigEndian(link.Account))
	copy(keyAsBytes[16:24],sdk.Uint64ToBigEndian(link.To))
	return keyAsBytes
}

Synonyms

go-cyber/app/keepers/keys.go
go-cyber/x/rank/types/keys.go
go-cyber/x/dmn/types/keys.go
go-cyber/x/resources/types/keys.go
space-pussy/x/grid/types/keys.go
go-cyber/x/graph/types/keys.go
space-pussy/x/cyberbank/types/keys.go
space-pussy/x/dmn/types/keys.go
go-cyber/x/liquidity/types/keys.go
go-cyber/x/grid/types/keys.go
go-cyber/x/cyberbank/types/keys.go
go-cyber/x/clock/types/keys.go
space-pussy/x/resources/types/keys.go
space-pussy/x/rank/types/keys.go
go-cyber/x/tokenfactory/types/keys.go
space-pussy/x/bandwidth/types/keys.go
go-cyber/x/bandwidth/types/keys.go

Neighbours