rawdbv2

package
v0.0.0-...-7ece11e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 29, 2023 License: MIT Imports: 14 Imported by: 5

Documentation

Index

Constants

View Source
const (
	// Beacon
	StoreBeaconBlockError = iota
	StoreBeaconBlockWithViewError
	UpdateBeaconBlockViewError
	GetBeaconBlockByViewError
	DeleteBeaconBlockByViewError
	StoreBeaconBlockIndexError
	GetIndexOfBeaconBlockError
	HasBeaconBlockError
	GetBeaconBlockByHashError
	GetBeaconBlockByIndexError
	DeleteBeaconBlockError
	StoreBeaconBestStateError
	GetBeaconBestStateError
	FinalizedBeaconBlockError
	GetFinalizedBeaconBlockError
	StoreBeaconConsensusRootHashError
	GetBeaconConsensusRootHashError
	StoreBeaconRewardRootHashError
	GetBeaconRewardRootHashError
	StoreBeaconFeatureRootHashError
	GetBeaconFeatureRootHashError
	StoreBeaconSlashRootHashError
	GetBeaconSlashRootHashError
	StoreShardCommitteeRewardRootHashError
	GetShardCommitteeRewardRootHashError
	DeleteShardCommitteeRewardRootHashError
	StoreShardConsensusRootHashError
	GetShardConsensusRootHashError
	DeleteShardConsensusRootHashError
	StoreShardTransactionRootHashError
	GetShardTransactionRootHashError
	DeleteShardTransactionRootHashError
	StoreShardFeatureRootHashError
	GetShardFeatureRootHashError
	DeleteShardFeatureRootHashError
	StoreShardSlashRootHashError
	GetShardSlashRootHashError
	DeleteShardSlashRootHashError
	StorePreviousBeaconBestStateError
	GetPreviousBeaconBestStateError
	CleanUpPreviousBeaconBestStateError
	StoreBeaconPreCommitteeError
	StoreBeaconPreCommitteeInfoError
	GetBeaconPreCommitteeInfoError
	GetShardPendingValidatorsError
	// Shard
	StoreShardBlockError
	StoreShardBlockWithViewError
	UpdateShardBlockViewError
	GetShardBlockByViewError
	DeleteShardBlockByViewError
	FinalizedShardBlockError
	GetFinalizedShardBlockError
	StoreShardBlockIndexError
	HasShardBlockError
	GetShardBlockByHashError
	GetShardBlockByIndexError
	DeleteShardBlockError
	StoreCrossShardNextHeightError
	FetchCrossShardNextHeightError
	GetIndexOfBlockError
	StoreShardBestStateError
	StoreFeeEstimatorError
	GetFeeEstimatorError
	StorePreviousShardBestStateError
	GetPreviousShardBestStateError
	CleanUpPreviousShardBestStateError
	RestoreCrossShardNextHeightsError
	StoreShardPreCommitteeError
	// tx
	StoreTransactionIndexError
	GetTransactionByHashError
	DeleteTransactionByHashError
	StoreTxByPublicKeyError
	GetTxByPublicKeyError

	// relaying - portal
	StoreRelayingBNBHeaderError
	GetRelayingBNBHeaderError
	GetBNBDataHashError

	// output coins by OTA key
	StoreOutcoinByOTAKeyError
	GetOutcoinByOTAKeyError
	StoreOTAKeyError
	DeleteOTAKeyError
	GetOTAKeyError
	StoreCoinHashError
	GetCoinHashError

	//Tx by input or output
	StoreTxByCoinIndexError
	GetTxByCoinIndexError
	StoreTxBySerialNumberError
	GetTxBySerialNumberError

	// state prune
	StoreShardPruneStatusError

	//cache committee from block hash
	StoreCommmitteeFromBlockCacheError
	GetCommmitteeFromBlockCacheError

	StoreFFIndexError
	GetFFIndexError
	StoreShardStakingTx
	GetShardStakingTx
)

Variables

View Source
var (
	// PDE
	WaitingPDEContributionPrefix = []byte("waitingpdecontribution-")
	PDEPoolPrefix                = []byte("pdepool-")
	PDESharePrefix               = []byte("pdeshare-")
	PDETradingFeePrefix          = []byte("pdetradingfee-")
	PDETradeFeePrefix            = []byte("pdetradefee-")
	PDEContributionStatusPrefix  = []byte("pdecontributionstatus-")
	PDETradeStatusPrefix         = []byte("pdetradestatus-")
	PDEWithdrawalStatusPrefix    = []byte("pdewithdrawalstatus-")
	PDEFeeWithdrawalStatusPrefix = []byte("pdefeewithdrawalstatus-")
)

key prefix

View Source
var ErrCodeMessage = map[int]struct {
	Code    int
	message string
}{
	HasBeaconBlockError:           {-1000, "Has Beacon Block Error"},
	GetBeaconBlockByHashError:     {-1001, "Get Beacon Block By Hash Error"},
	GetBeaconBlockByIndexError:    {-1002, "Get Beacon Block By Index Error"},
	DeleteBeaconBlockError:        {-1003, "Delete Beacon Block Error"},
	StoreBeaconBlockIndexError:    {-1004, "Store Beacon Block Index Error"},
	GetIndexOfBeaconBlockError:    {-1005, "Get Index Of Beacon Block Error"},
	StoreBeaconBestStateError:     {-1006, "Store Beacon Best State Error"},
	GetBeaconBestStateError:       {-1007, "Fetch Beacon Best State Error"},
	StoreBeaconBlockWithViewError: {-1008, "Store Beacon Block With View Error"},
	UpdateBeaconBlockViewError:    {-1009, "Update Beacon Block View Error"},
	GetBeaconBlockByViewError:     {-1010, "Get Beacon Block By View Error"},
	DeleteBeaconBlockByViewError:  {-1011, "Delete Beacon Block By View"},
	FinalizedBeaconBlockError:     {-2016, "Finalized Beacon Block Error "},
	GetFinalizedBeaconBlockError:  {-2017, "Get Finalized Beacon Block Error"},

	StoreShardBlockError:           {-2000, "Store Shard Block Error"},
	HasShardBlockError:             {-2001, "Has Shard Block Error"},
	GetShardBlockByHashError:       {-2002, "Get Shard Block By Hash Error"},
	GetShardBlockByIndexError:      {-2003, "Get Shard Block By Index Error"},
	DeleteShardBlockError:          {-2004, "Delete Shard Block Error"},
	StoreCrossShardNextHeightError: {-2005, "Store Cross Shard Next Height Error"},
	FetchCrossShardNextHeightError: {-2006, "Fetch Cross Shard Next Height Error"},
	StoreShardBlockIndexError:      {-2007, "Store Shard Block Index Error"},
	GetIndexOfBlockError:           {-2008, "Get GetIndex Of Shard Block Error"},
	StoreShardBestStateError:       {-2009, "Store Shard Best State Error"},
	StoreFeeEstimatorError:         {-2010, "Store Fee Estimator Error"},
	GetFeeEstimatorError:           {-2011, "Get Fee Estimator Error"},
	StoreShardBlockWithViewError:   {-2012, "Store Shard Block With View Error"},
	UpdateShardBlockViewError:      {-2013, "Update Shard Block View Error"},
	GetShardBlockByViewError:       {-2014, "Get Shard Block By View Error"},
	DeleteShardBlockByViewError:    {-2015, "Delete Shard Block By View"},
	FinalizedShardBlockError:       {-2016, "Finalized Shard Block Error "},
	GetFinalizedShardBlockError:    {-2017, "Get Finalized Shard Block Error"},

	StoreTransactionIndexError:   {-3000, "Store Transaction Index Error"},
	GetTransactionByHashError:    {-3001, "Get Transaction By Hash Error"},
	StoreTxByPublicKeyError:      {-3002, "Store Tx By PublicKey Error"},
	GetTxByPublicKeyError:        {-3003, "Get Tx By Public Key Error"},
	DeleteTransactionByHashError: {-3004, "Delete Transaction By Hash Error"},

	StoreBeaconConsensusRootHashError:       {-4000, "Store Beacon Consensus Root Hash Error"},
	GetBeaconConsensusRootHashError:         {-4001, "Get Beacon Consensus Root Hash Error"},
	StoreBeaconRewardRootHashError:          {-4002, "Store Beacon Reward Root Hash Error"},
	GetBeaconRewardRootHashError:            {-4003, "Get Beacon Reward Root Hash Error"},
	StoreBeaconFeatureRootHashError:         {-4004, "Store Beacon Feature Root Hash Error"},
	GetBeaconFeatureRootHashError:           {-4005, "Get Beacon Feature Root Hash Error"},
	StoreBeaconSlashRootHashError:           {-4006, "Store Beacon Slash Root Hash Error"},
	GetBeaconSlashRootHashError:             {-4007, "Get Beacon Slash Root Hash Error"},
	StoreShardCommitteeRewardRootHashError:  {-4008, "Store Shard Committee Reward Root Hash Error"},
	GetShardCommitteeRewardRootHashError:    {-4009, "Get Shard Committee Reward Root Hash Error"},
	StoreShardConsensusRootHashError:        {-4010, "Store Shard Consensus Root Hash Error"},
	GetShardConsensusRootHashError:          {-4011, "Get Shard Consensus Root Hash Error"},
	StoreShardTransactionRootHashError:      {-4012, "Store Shard Transaction Root Hash Error"},
	GetShardTransactionRootHashError:        {-4013, "Get Shard Transaction Root Hash Error"},
	StoreShardFeatureRootHashError:          {-4014, "Store Shard Feature Root Hash Error"},
	GetShardFeatureRootHashError:            {-4015, "Get Shard Feature Root Hash Error"},
	StoreShardSlashRootHashError:            {-4016, "Store Shard Slash Root Hash Error"},
	GetShardSlashRootHashError:              {-4017, "Get Shard Slash Root Hash Error"},
	StorePreviousBeaconBestStateError:       {-4018, "Store Previous Beacon Best State Error"},
	GetPreviousBeaconBestStateError:         {-4019, "Get Previous Beacon Best State Error"},
	CleanUpPreviousBeaconBestStateError:     {-4020, "Clean Previous Beacon Best State Error"},
	StorePreviousShardBestStateError:        {-4021, "Store Previous Shard Best State Error"},
	GetPreviousShardBestStateError:          {-4022, "Get Previous Shard Best State Error"},
	CleanUpPreviousShardBestStateError:      {-4023, "Clean Previous Shard Best State Error"},
	DeleteShardCommitteeRewardRootHashError: {-4024, "Delete Shard Committee Reward Root Hash Error"},
	DeleteShardConsensusRootHashError:       {-4025, "Delete Shard Consensus Root Hash Error"},
	DeleteShardTransactionRootHashError:     {-4026, "Delete Shard Transaction Root Hash Error"},
	DeleteShardFeatureRootHashError:         {-4027, "Delete Shard Feature Root Hash Error"},
	DeleteShardSlashRootHashError:           {-4028, "Delete Shard Slash Root Hash Error"},
	RestoreCrossShardNextHeightsError:       {-4029, "Restore Cross Shard Next Heights Error"},
	StoreBeaconPreCommitteeError:            {-4030, "Store Beacon Pre Committee Error"},
	StoreBeaconPreCommitteeInfoError:        {-4031, "Store Beacon Pre Committee Info Error"},
	GetBeaconPreCommitteeInfoError:          {-4032, "Get Beacon Pre Committee Info Error"},
	GetShardPendingValidatorsError:          {-4033, "Get Shard Pending Validators Error"},

	StoreRelayingBNBHeaderError: {-5001, "Store relaying header bnb error"},
	GetRelayingBNBHeaderError:   {-5002, "Get relaying header bnb error"},
	GetBNBDataHashError:         {-5003, "Get bnb data hash by block height error"},

	StoreOutcoinByOTAKeyError:          {-6001, "Store output coin by OTA key error"},
	GetOutcoinByOTAKeyError:            {-6002, "Get output coin by OTA key error"},
	StoreOTAKeyError:                   {-6003, "Store OTA key error"},
	GetOTAKeyError:                     {-6004, "Get OTA keys error"},
	DeleteOTAKeyError:                  {-6005, "Delete OTA keys error"},
	StoreCoinHashError:                 {-6006, "Store coin hash error"},
	GetCoinHashError:                   {-6007, "Get coin hash error"},
	StoreShardPruneStatusError:         {-7001, "Store shard prune status error"},
	StoreCommmitteeFromBlockCacheError: {-7002, "Store shard prune status error"},
	GetCommmitteeFromBlockCacheError:   {-7003, "Get shard prune status error"},
	StoreFFIndexError:                  {-7004, "Store FF Index error"},
	GetFFIndexError:                    {-7005, "Get FF Index error"},

	StoreShardStakingTx: {-7006, "Store shard stakign error"},
	GetShardStakingTx:   {-7007, "Get shard staking error"},
}

Functions

func BuildPDEPoolForPairKey

func BuildPDEPoolForPairKey(
	beaconHeight uint64,
	token1IDStr string,
	token2IDStr string,
) []byte

func BuildPDESharesKey

func BuildPDESharesKey(
	beaconHeight uint64,
	token1IDStr string,
	token2IDStr string,
	contributedTokenIDStr string,
	contributorAddressStr string,
) ([]byte, error)

func BuildPDESharesKeyV2

func BuildPDESharesKeyV2(
	beaconHeight uint64,
	token1IDStr string,
	token2IDStr string,
	contributorAddressStr string,
) ([]byte, error)

func BuildPDETradeFeesKey

func BuildPDETradeFeesKey(
	beaconHeight uint64,
	token1IDStr string,
	token2IDStr string,
	tokenForFeeIDStr string,
) []byte

func BuildPDETradingFeeKey

func BuildPDETradingFeeKey(
	beaconHeight uint64,
	token1IDStr string,
	token2IDStr string,
	contributorAddressStr string,
) ([]byte, error)

func BuildWaitingPDEContributionKey

func BuildWaitingPDEContributionKey(
	beaconHeight uint64,
	pairID string,
) []byte

func CleanUpPreviousBeaconBestState

func CleanUpPreviousBeaconBestState(db incdb.Database) error

func CleanUpPreviousShardBestState

func CleanUpPreviousShardBestState(db incdb.Database, shardID byte) error

func DeleteIndexedOTAKey

func DeleteIndexedOTAKey(db incdb.Database, theKey []byte) error

func DeleteTransactionIndex

func DeleteTransactionIndex(db incdb.Database, txHash common.Hash) error

func GetAllCacheCommitteeFromBlock

func GetAllCacheCommitteeFromBlock(db incdb.Database) (map[int]map[common.Hash][]incognitokey.CommitteePublicKey, error)

func GetBeaconBlockByHash

func GetBeaconBlockByHash(db incdb.KeyValueReader, hash common.Hash) ([]byte, error)

func GetBeaconBlockHashToIndexKey

func GetBeaconBlockHashToIndexKey(hash common.Hash) []byte

func GetBeaconConfirmInstantFinalityShardBlock

func GetBeaconConfirmInstantFinalityShardBlock(db incdb.KeyValueReader, sid byte, index uint64) (*common.Hash, error)

func GetBeaconConfirmShardBlockPrefix

func GetBeaconConfirmShardBlockPrefix(shardID byte, index uint64) []byte

func GetBeaconConsensusRootHashKey

func GetBeaconConsensusRootHashKey(height uint64) []byte

func GetBeaconFeatureRootHashKey

func GetBeaconFeatureRootHashKey(height uint64) []byte

func GetBeaconHashToBlockKey

func GetBeaconHashToBlockKey(hash common.Hash) []byte

============================= BEACON =======================================

func GetBeaconIndexToBlockHashKey

func GetBeaconIndexToBlockHashKey(index uint64) []byte

func GetBeaconRewardRootHashKey

func GetBeaconRewardRootHashKey(height uint64) []byte

func GetBeaconRootsHash

func GetBeaconRootsHash(db incdb.KeyValueReader, hash common.Hash) ([]byte, error)

func GetBeaconRootsHashKey

func GetBeaconRootsHashKey(hash common.Hash) []byte

func GetBeaconSlashRootHashKey

func GetBeaconSlashRootHashKey(height uint64) []byte

func GetBeaconViews

func GetBeaconViews(db incdb.KeyValueReader) ([]byte, error)

func GetBeaconViewsKey

func GetBeaconViewsKey() []byte

func GetBlockHashToFFIndexKey

func GetBlockHashToFFIndexKey(hash common.Hash) []byte

func GetBlockHashToValidationDataKey

func GetBlockHashToValidationDataKey(hash common.Hash) []byte

func GetCacheCommitteeFromBlock

func GetCacheCommitteeFromBlock(db incdb.Database, hash common.Hash, cid int) ([]incognitokey.CommitteePublicKey, error)

func GetCacheCommitteeFromBlockKey

func GetCacheCommitteeFromBlockKey(hash common.Hash, cid int) []byte

func GetCachedCoinHashes

func GetCachedCoinHashes(db incdb.Database) ([][]byte, error)

func GetCrossShardNextHeight

func GetCrossShardNextHeight(db incdb.KeyValueReader, fromShard byte, toShard byte, curHeight uint64) ([]byte, error)

func GetCrossShardNextHeightKey

func GetCrossShardNextHeightKey(fromShard byte, toShard byte, height uint64) []byte

============================= Cross Shard =======================================

func GetFeeEstimator

func GetFeeEstimator(db incdb.KeyValueReader, shardID byte) ([]byte, error)

GetFeeEstimator - Get data for FeeEstimator object as a json in byte format

func GetFeeEstimatorPrefix

func GetFeeEstimatorPrefix(shardID byte) []byte

func GetFinalizedBeaconBlockHashByIndex

func GetFinalizedBeaconBlockHashByIndex(db incdb.KeyValueReader, index uint64) (*common.Hash, error)

func GetFinalizedShardBlockHashByIndex

func GetFinalizedShardBlockHashByIndex(db incdb.KeyValueReader, sid byte, index uint64) (*common.Hash, error)

func GetFlatFileIndexByBlockHash

func GetFlatFileIndexByBlockHash(db incdb.KeyValueReader, hash common.Hash) (uint64, error)

func GetIndexedOTAKeys

func GetIndexedOTAKeys(db incdb.Database) ([][]byte, error)

func GetLastBeaconBlockKey

func GetLastBeaconBlockKey() []byte

func GetLastBeaconHeightConfirmCrossShardKey

func GetLastBeaconHeightConfirmCrossShardKey() []byte

func GetLastBeaconStateConfirmCrossShard

func GetLastBeaconStateConfirmCrossShard(db incdb.Database) []byte

func GetLastShardBlockKey

func GetLastShardBlockKey(shardID byte) []byte

func GetOutCoinsByIndexedOTAKey

func GetOutCoinsByIndexedOTAKey(db incdb.Database, tokenID common.Hash, shardID byte, publicKey []byte) ([][]byte, error)

func GetPreviousBeaconBestState

func GetPreviousBeaconBestState(db incdb.Database) ([]byte, error)

func GetPreviousBestStateKey

func GetPreviousBestStateKey(shardID int) []byte

func GetPreviousShardBestState

func GetPreviousShardBestState(db incdb.Database, shardID byte) ([]byte, error)

func GetPruneStatus

func GetPruneStatus(db incdb.KeyValueReader) ([]byte, error)

func GetPruneStatusKey

func GetPruneStatusKey() []byte

func GetRootHashPrefix

func GetRootHashPrefix() []byte

============================= State Root =======================================

func GetShardBestState

func GetShardBestState(db incdb.KeyValueReader, shardID byte) ([]byte, error)

func GetShardBestStateKey

func GetShardBestStateKey(shardID byte) []byte

func GetShardBlockByHash

func GetShardBlockByHash(db incdb.KeyValueReader, hash common.Hash) ([]byte, error)

func GetShardBlockHashToIndexKey

func GetShardBlockHashToIndexKey(hash common.Hash) []byte

func GetShardCommitteeRewardRootHashKey

func GetShardCommitteeRewardRootHashKey(shardID byte, height uint64) []byte

func GetShardConsensusRootHashKey

func GetShardConsensusRootHashKey(shardID byte, height uint64) []byte

func GetShardFeatureRootHashKey

func GetShardFeatureRootHashKey(shardID byte, height uint64) []byte

func GetShardHashToBlockKey

func GetShardHashToBlockKey(hash common.Hash) []byte

============================= Shard =======================================

func GetShardIndexToBlockHashKey

func GetShardIndexToBlockHashKey(shardID byte, index uint64, hash common.Hash) []byte

func GetShardIndexToBlockHashPrefix

func GetShardIndexToBlockHashPrefix(shardID byte, index uint64) []byte

func GetShardRootsHash

func GetShardRootsHash(db incdb.KeyValueReader, shardID byte, hash common.Hash) ([]byte, error)

func GetShardRootsHashKey

func GetShardRootsHashKey(shardID byte, hash common.Hash) []byte

func GetShardRootsHashPrefix

func GetShardRootsHashPrefix(shardID byte) []byte

func GetShardSlashRootHashKey

func GetShardSlashRootHashKey(shardID byte, height uint64) []byte

func GetShardTransactionRootHashKey

func GetShardTransactionRootHashKey(shardID byte, height uint64) []byte

func GetStakingTx

func GetStakingTx(db incdb.KeyValueReader, sid byte, hash common.Hash) ([]byte, error)

func GetStakingTxKey

func GetStakingTxKey(shardID byte, hash common.Hash) []byte

func GetStoreTxByPublicKey

func GetStoreTxByPublicKey(publicKey []byte, txID common.Hash, shardID byte) []byte

func GetStoreTxByPublicPrefix

func GetStoreTxByPublicPrefix(publicKey []byte) []byte

func GetTransactionByHash

func GetTransactionByHash(db incdb.Database, txHash common.Hash) (common.Hash, int, error)

func GetTransactionHashKey

func GetTransactionHashKey(hash common.Hash) []byte

============================= Transaction =======================================

func GetTxByCoinIndex

func GetTxByCoinIndex(db incdb.Database, index []byte, tokenID common.Hash, shardID byte) (*common.Hash, error)

func GetTxByPublicKey

func GetTxByPublicKey(db incdb.Database, publicKey []byte) (map[byte][]common.Hash, error)

GetTxByPublicKey - from public key, use this function to get list all txID which someone send use by txID from any shardID

func GetTxByPublicKeyV2

func GetTxByPublicKeyV2(
	db incdb.Database, publicKey []byte,
	skip, limit uint,
) (map[byte][]common.Hash, uint, uint, error)

GetTxByPublicKeyV2 returns list of all tx IDs in paging fashion for a given public key

func GetTxBySerialNumber

func GetTxBySerialNumber(db incdb.Database, serialNumber []byte, tokenID common.Hash, shardID byte) (*common.Hash, error)

func GetValidationDataByBlockHash

func GetValidationDataByBlockHash(db incdb.KeyValueReader, hash common.Hash) ([]byte, error)

func GetViewBeaconKey

func GetViewBeaconKey(view common.Hash, height uint64) []byte

func GetViewPrefixWithValue

func GetViewPrefixWithValue(view common.Hash) []byte

============================= View =======================================

func GetViewShardKey

func GetViewShardKey(view common.Hash, shardID byte, height uint64) []byte

func HasBeaconBlock

func HasBeaconBlock(db incdb.KeyValueReader, hash common.Hash) (bool, error)

func HasBeaconConfirmInstantFinalityShardBlock

func HasBeaconConfirmInstantFinalityShardBlock(db incdb.KeyValueReader, sid byte, index uint64) (bool, error)

func HasShardBlock

func HasShardBlock(db incdb.KeyValueReader, hash common.Hash) (bool, error)

func RestoreCrossShardNextHeights

func RestoreCrossShardNextHeights(db incdb.Database, fromShard byte, toShard byte, curHeight uint64) error

func StoreBeaconBlockByHash

func StoreBeaconBlockByHash(db incdb.KeyValueWriter, hash common.Hash, v interface{}) error

StoreBeaconBlock store block hash => block value

func StoreBeaconConfirmInstantFinalityShardBlock

func StoreBeaconConfirmInstantFinalityShardBlock(db incdb.KeyValueWriter, sid byte, index uint64, hash common.Hash) error

func StoreBeaconRootsHash

func StoreBeaconRootsHash(db incdb.KeyValueWriter, hash common.Hash, rootsHash interface{}) error

func StoreBeaconViews

func StoreBeaconViews(db incdb.KeyValueWriter, val []byte) error

func StoreCacheCommitteeFromBlock

func StoreCacheCommitteeFromBlock(db incdb.KeyValueWriter, hash common.Hash, cid int, cpks []incognitokey.CommitteePublicKey) error

func StoreCachedCoinHash

func StoreCachedCoinHash(db incdb.Database, theCoinHash []byte) error

func StoreCrossShardNextHeight

func StoreCrossShardNextHeight(db incdb.KeyValueWriter, fromShard byte, toShard byte, curHeight uint64, val []byte) error

func StoreFeeEstimator

func StoreFeeEstimator(db incdb.KeyValueWriter, val []byte, shardID byte) error

StoreFeeEstimator - Store data for FeeEstimator object

func StoreFinalizedBeaconBlockHashByIndex

func StoreFinalizedBeaconBlockHashByIndex(db incdb.KeyValueWriter, index uint64, hash common.Hash) error

func StoreFinalizedShardBlockHashByIndex

func StoreFinalizedShardBlockHashByIndex(db incdb.KeyValueWriter, sid byte, index uint64, hash common.Hash) error

func StoreFlatFileIndexByBlockHash

func StoreFlatFileIndexByBlockHash(db incdb.KeyValueWriter, hash common.Hash, index uint64) error

store block hash => block value

func StoreIndexedOTAKey

func StoreIndexedOTAKey(db incdb.Database, theKey []byte, state int) error

func StoreIndexedOutCoins

func StoreIndexedOutCoins(db incdb.Database, tokenID common.Hash, publicKey []byte, outputCoins [][]byte, shardID byte) error

func StoreLastBeaconStateConfirmCrossShard

func StoreLastBeaconStateConfirmCrossShard(db incdb.Database, state interface{}) error

func StorePreviousBeaconBestState

func StorePreviousBeaconBestState(db incdb.Database, data []byte) error

func StorePreviousShardBestState

func StorePreviousShardBestState(db incdb.Database, shardID byte, data []byte) error

func StorePruneStatus

func StorePruneStatus(db incdb.KeyValueWriter, v []byte) error

func StoreShardBestState

func StoreShardBestState(db incdb.KeyValueWriter, shardID byte, v interface{}) error

func StoreShardBlock

func StoreShardBlock(db incdb.KeyValueWriter, hash common.Hash, v interface{}) error

StoreShardBlock store block hash => block value and block index => block hash record1: prefix-shardid-index-hash => empty record2: prefix-hash => block value

func StoreShardRootsHash

func StoreShardRootsHash(db incdb.KeyValueWriter, shardID byte, hash common.Hash, rootsHash interface{}) error

func StoreStakingTx

func StoreStakingTx(db incdb.KeyValueWriter, sid byte, hash common.Hash, data []byte) error

func StoreTransactionIndex

func StoreTransactionIndex(db incdb.KeyValueWriter, txHash common.Hash, blockHash common.Hash, index int) error

func StoreTxByCoinIndex

func StoreTxByCoinIndex(db incdb.Database, index []byte, tokenID common.Hash, shardID byte, txID common.Hash) error

These functions are used for storing and getting a transaction by an output coin index TODO: refactor these functions for more efficient read/write

func StoreTxByPublicKey

func StoreTxByPublicKey(db incdb.Database, publicKey []byte, txID common.Hash, shardID byte) error

StoreTxByPublicKey - store txID by public key of receiver, use this data to get tx which send to receiver key format: 1st 33b bytes for pubkey 2nd 32 bytes fir txID which receiver get from 3nd 1 byte for shardID where sender send to receiver

func StoreTxBySerialNumber

func StoreTxBySerialNumber(db incdb.Database, serialNumber []byte, tokenID common.Hash, shardID byte, txID common.Hash) error

These functions are used for storing/retrieving a transaction by an input coin serial number TODO: refactor these functions for more efficient read/write

func StoreValidationDataByBlockHash

func StoreValidationDataByBlockHash(db incdb.KeyValueWriter, hash common.Hash, val []byte) error

store block hash => validation data

Types

type BridgeTokenInfo

type BridgeTokenInfo struct {
	TokenID         *common.Hash `json:"tokenId"`
	Amount          uint64       `json:"amount"`
	ExternalTokenID []byte       `json:"externalTokenId"`
	Network         string       `json:"network"`
	IsCentralized   bool         `json:"isCentralized"`
}

TODO - change json to CamelCase

func NewBridgeTokenInfo

func NewBridgeTokenInfo(tokenID *common.Hash, amount uint64, externalTokenID []byte, network string, isCentralized bool) *BridgeTokenInfo

type PDEContribution

type PDEContribution struct {
	ContributorAddressStr string
	TokenIDStr            string
	Amount                uint64
	TxReqID               common.Hash
}

func NewPDEContribution

func NewPDEContribution(contributorAddressStr string, tokenIDStr string, amount uint64, txReqID common.Hash) *PDEContribution

type PDEPoolForPair

type PDEPoolForPair struct {
	Token1IDStr     string
	Token1PoolValue uint64
	Token2IDStr     string
	Token2PoolValue uint64
}

func NewPDEPoolForPair

func NewPDEPoolForPair(token1IDStr string, token1PoolValue uint64, token2IDStr string, token2PoolValue uint64) *PDEPoolForPair

type Pdexv3Contribution

type Pdexv3Contribution struct {
	// contains filtered or unexported fields
}

Pdexv3Contribution Real data store to statedb

func NewPdexv3Contribution

func NewPdexv3Contribution() *Pdexv3Contribution

func NewPdexv3ContributionWithValue

func NewPdexv3ContributionWithValue(
	poolPairID, otaReceiver string,
	tokenID, txReqID, nftID common.Hash,
	amount uint64, amplifier uint, shardID byte,
) *Pdexv3Contribution

func (*Pdexv3Contribution) Amount

func (contribution *Pdexv3Contribution) Amount() uint64

func (*Pdexv3Contribution) Amplifier

func (contribution *Pdexv3Contribution) Amplifier() uint

func (*Pdexv3Contribution) Clone

func (contribution *Pdexv3Contribution) Clone() *Pdexv3Contribution

func (*Pdexv3Contribution) MarshalJSON

func (contribution *Pdexv3Contribution) MarshalJSON() ([]byte, error)

func (*Pdexv3Contribution) NftID

func (contribution *Pdexv3Contribution) NftID() common.Hash

func (*Pdexv3Contribution) OtaReceiver

func (contribution *Pdexv3Contribution) OtaReceiver() string

func (*Pdexv3Contribution) PoolPairID

func (contribution *Pdexv3Contribution) PoolPairID() string

func (*Pdexv3Contribution) SetAmount

func (contribution *Pdexv3Contribution) SetAmount(amount uint64)

func (*Pdexv3Contribution) ShardID

func (contribution *Pdexv3Contribution) ShardID() byte

func (*Pdexv3Contribution) TokenID

func (contribution *Pdexv3Contribution) TokenID() common.Hash

func (*Pdexv3Contribution) TxReqID

func (contribution *Pdexv3Contribution) TxReqID() common.Hash

func (*Pdexv3Contribution) UnmarshalJSON

func (contribution *Pdexv3Contribution) UnmarshalJSON(data []byte) error

type Pdexv3Order

type Pdexv3Order struct {
	// contains filtered or unexported fields
}

func NewPdexv3OrderWithValue

func NewPdexv3OrderWithValue(
	id string, nftID common.Hash,
	token0Rate, token1Rate, token0Balance, token1Balance uint64,
	tradeDirection byte,
	receiver [2]string,
) *Pdexv3Order

func (*Pdexv3Order) Clone

func (o *Pdexv3Order) Clone() *Pdexv3Order

func (*Pdexv3Order) Id

func (o *Pdexv3Order) Id() string

func (*Pdexv3Order) MarshalJSON

func (o *Pdexv3Order) MarshalJSON() ([]byte, error)

func (*Pdexv3Order) NftID

func (o *Pdexv3Order) NftID() common.Hash

func (*Pdexv3Order) SetToken0Balance

func (o *Pdexv3Order) SetToken0Balance(b uint64)

SetToken0Balance() changes the token0 balance of this order. Only balances can be updated, while rates, id & trade direction cannot

func (*Pdexv3Order) SetToken1Balance

func (o *Pdexv3Order) SetToken1Balance(b uint64)

func (*Pdexv3Order) Token0Balance

func (o *Pdexv3Order) Token0Balance() uint64

func (*Pdexv3Order) Token0Rate

func (o *Pdexv3Order) Token0Rate() uint64

func (*Pdexv3Order) Token0Receiver

func (o *Pdexv3Order) Token0Receiver() string

func (*Pdexv3Order) Token1Balance

func (o *Pdexv3Order) Token1Balance() uint64

func (*Pdexv3Order) Token1Rate

func (o *Pdexv3Order) Token1Rate() uint64

func (*Pdexv3Order) Token1Receiver

func (o *Pdexv3Order) Token1Receiver() string

func (*Pdexv3Order) TradeDirection

func (o *Pdexv3Order) TradeDirection() byte

func (*Pdexv3Order) UnmarshalJSON

func (o *Pdexv3Order) UnmarshalJSON(data []byte) error

type Pdexv3PoolPair

type Pdexv3PoolPair struct {
	// contains filtered or unexported fields
}

func NewPdexv3PoolPair

func NewPdexv3PoolPair() *Pdexv3PoolPair

func NewPdexv3PoolPairWithValue

func NewPdexv3PoolPairWithValue(
	token0ID, token1ID common.Hash,
	shareAmount, lmLockedShareAmount,
	token0RealAmount, token1RealAmount uint64,
	token0VirtualAmount, token1VirtualAmount *big.Int,
	amplifier uint,
) *Pdexv3PoolPair

func (*Pdexv3PoolPair) Amplifier

func (pp *Pdexv3PoolPair) Amplifier() uint

func (*Pdexv3PoolPair) Clone

func (pp *Pdexv3PoolPair) Clone() *Pdexv3PoolPair

func (*Pdexv3PoolPair) LmLockedShareAmount

func (pp *Pdexv3PoolPair) LmLockedShareAmount() uint64

func (*Pdexv3PoolPair) MarshalJSON

func (pp *Pdexv3PoolPair) MarshalJSON() ([]byte, error)

func (*Pdexv3PoolPair) SetLmLockedShareAmount

func (pp *Pdexv3PoolPair) SetLmLockedShareAmount(lmLockedShareAmount uint64)

func (*Pdexv3PoolPair) SetShareAmount

func (pp *Pdexv3PoolPair) SetShareAmount(shareAmount uint64)

func (*Pdexv3PoolPair) SetToken0RealAmount

func (pp *Pdexv3PoolPair) SetToken0RealAmount(amount uint64)

func (*Pdexv3PoolPair) SetToken0VirtualAmount

func (pp *Pdexv3PoolPair) SetToken0VirtualAmount(amount *big.Int)

func (*Pdexv3PoolPair) SetToken1RealAmount

func (pp *Pdexv3PoolPair) SetToken1RealAmount(amount uint64)

func (*Pdexv3PoolPair) SetToken1VirtualAmount

func (pp *Pdexv3PoolPair) SetToken1VirtualAmount(amount *big.Int)

func (*Pdexv3PoolPair) ShareAmount

func (pp *Pdexv3PoolPair) ShareAmount() uint64

func (*Pdexv3PoolPair) Token0ID

func (pp *Pdexv3PoolPair) Token0ID() common.Hash

func (*Pdexv3PoolPair) Token0RealAmount

func (pp *Pdexv3PoolPair) Token0RealAmount() uint64

func (*Pdexv3PoolPair) Token0VirtualAmount

func (pp *Pdexv3PoolPair) Token0VirtualAmount() *big.Int

func (*Pdexv3PoolPair) Token1ID

func (pp *Pdexv3PoolPair) Token1ID() common.Hash

func (*Pdexv3PoolPair) Token1RealAmount

func (pp *Pdexv3PoolPair) Token1RealAmount() uint64

func (*Pdexv3PoolPair) Token1VirtualAmount

func (pp *Pdexv3PoolPair) Token1VirtualAmount() *big.Int

func (*Pdexv3PoolPair) UnmarshalJSON

func (pp *Pdexv3PoolPair) UnmarshalJSON(data []byte) error

type RawdbError

type RawdbError struct {
	Code    int
	Message string
	// contains filtered or unexported fields
}

func NewRawdbError

func NewRawdbError(key int, err error, params ...interface{}) *RawdbError

func (RawdbError) Error

func (e RawdbError) Error() string

func (RawdbError) GetError

func (e RawdbError) GetError() error

func (RawdbError) GetErrorCode

func (e RawdbError) GetErrorCode() int

func (RawdbError) GetMessage

func (e RawdbError) GetMessage() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL