shared

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2022 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAX_CONCURRENT_COIN_DECRYPT int           = 100
	DB_OPERATION_TIMEOUT        time.Duration = 1 * time.Second
)
View Source
const (
	DefaultAPIPort               = 9001
	DefaultMongoAddress          = ""
	DefaultMongoDB               = "coins"
	DefaultMaxConcurrentOTACheck = 100
	DefaultChainFolder           = "chain"
	DefaultFullnode              = ""
	DefaultMode                  = QUERYMODE
	DefaultNetwork               = "testnet2"
	DefaultHighway               = "74.207.247.250:9330"
	DefaultNumOfShard            = 8
)
View Source
const (
	VERSION       = "1.0.0"
	CHAINSYNCMODE = "chainsync"
	INDEXERMODE   = "indexer"
	QUERYMODE     = "query"
	WORKERMODE    = "indexworker"
	// FULLMODE      = "full"
	LIQUIDITYMODE   = "liquidity"
	SHIELDMODE      = "shield"
	TRADEMODE       = "trade"
	ASTMODE         = "assistant"
	COORDINATORMODE = "coordinator"
)
View Source
const (
	MONGO_STATUS_OK   = "connected"
	MONGO_STATUS_NOK  = "disconnected"
	HEALTH_STATUS_OK  = "healthy"
	HEALTH_STATUS_NOK = "unhealthy"
)
View Source
const (
	TOKENTYPE_PIRCE_STABLE = iota
	TOKENTYPE_PIRCE_VOLATILE
	TOKENTYPE_PIRCE_UNKNOW
)
View Source
const (
	BurnCoinID = "1y4gnYS1Ns2K7BjQTjgfZ5nTR8JZMkMJ3CTGMj2Pk7CQkSTFgA"
)

Variables

View Source
var ENABLE_PROFILER bool
View Source
var GITCOMMIT string
View Source
var RESET_FLAG bool
View Source
var RestyClient = resty.New()

Functions

func AssetTagStringToPoint

func AssetTagStringToPoint(assetTags []string) ([]*operation.Point, error)

func CalculateSharedSecret

func CalculateSharedSecret(txOTARandomPointList []string, otakey string) ([]*operation.Point, error)

func CheckTokenIDWithOTA

func CheckTokenIDWithOTA(sharedSecret, assetTag *operation.Point, tokenID *common.Hash) (bool, error)

func DeserializeTransactionJSON

func DeserializeTransactionJSON(data []byte) (*transaction.TxChoice, error)

DeserializeTransactionJSON parses a transaction from raw JSON into a TxChoice object. It covers all transaction types.

func OTAKeyFromRaw

func OTAKeyFromRaw(b []byte) privacy.OTAKey

func ReadConfigAndArg

func ReadConfigAndArg()

func TokenIDStringToHash

func TokenIDStringToHash(tokenID []string) ([]*common.Hash, error)

Types

type BridgeStateData added in v1.8.1

type BridgeStateData struct {
	mgm.DefaultModel `bson:",inline"`
	Version          int    `json:"version" bson:"version"`
	State            string `json:"state" bson:"state"`
	Height           uint64 `json:"height" bson:"height"`
}

func NewBridgeStateData added in v1.8.1

func NewBridgeStateData(state string, version int) *BridgeStateData

func (*BridgeStateData) Creating added in v1.8.1

func (model *BridgeStateData) Creating() error

func (*BridgeStateData) Saving added in v1.8.1

func (model *BridgeStateData) Saving() error

type ClientAssistantData added in v1.8.0

type ClientAssistantData struct {
	mgm.DefaultModel `bson:",inline"`
	DataName         string `json:"dataname" bson:"dataname"`
	Data             string `json:"data" bson:"data"`
}

func (*ClientAssistantData) Creating added in v1.8.0

func (model *ClientAssistantData) Creating() error

func (*ClientAssistantData) Saving added in v1.8.0

func (model *ClientAssistantData) Saving() error

type CoinCache

type CoinCache struct {
	Coins           []CoinData
	PRVLastHeight   map[int]uint64
	TokenLastHeight map[int]uint64
	Length          int
	Time            time.Time
}

func (*CoinCache) Read

func (cc *CoinCache) Read() ([]CoinData, map[int]uint64, map[int]uint64)

func (*CoinCache) Reset

func (cc *CoinCache) Reset()

func (*CoinCache) Update

func (cc *CoinCache) Update(coins []CoinData, PRVLastHeight, TokenLastHeight map[int]uint64)

type CoinData

type CoinData struct {
	mgm.DefaultModel `bson:",inline"`
	CoinIndex        uint64 `json:"coinidx" bson:"coinidx"`
	CoinVersion      int    `json:"version" bson:"version"`
	TokenID          string `json:"tokenid" bson:"tokenid"`
	RealTokenID      string `json:"realtokenid" bson:"realtokenid"`
	Coin             []byte `json:"coin" bson:"coin"`
	CoinPubkey       string `json:"coinpubkey" bson:"coinpubkey"`
	OTASecret        string `json:"otasecret" bson:"otasecret"`
	TxHash           string `json:"txhash" bson:"txhash"`
	BeaconHeight     uint64 `json:"beaconheight" bson:"beaconheight"`
	ShardID          int    `json:"shardid" bson:"shardid"`
	IsNFT            bool   `json:"isnft" bson:"isnft"`
}

func NewCoinData

func NewCoinData(beaconHeight, idx uint64, coin []byte, tokenID, coinPubkey, OTASecret, txHash string, shardID, version int) *CoinData

func (*CoinData) Creating

func (model *CoinData) Creating() error

func (*CoinData) Saving

func (model *CoinData) Saving() error

type CoinDataV1

type CoinDataV1 CoinData

type CoinInfo

type CoinInfo struct {
	Start       uint64
	Total       uint64
	End         uint64
	LastScanned uint64
}

type CoinPendingData

type CoinPendingData struct {
	mgm.DefaultModel `bson:",inline"`
	Keyimages        []string `json:"keyimage" bson:"keyimage"`
	ShardID          int      `json:"shardid" bson:"shardid"`
	Locktime         int64    `json:"locktime" bson:"locktime"`
	TxData           string   `json:"txdata" bson:"txdata"`
	TxHash           string   `json:"txhash" bson:"txhash"`
}

func NewCoinPendingData

func NewCoinPendingData(keyimages []string, shardID int, txHash, txdata string, locktime int64) *CoinPendingData

func (*CoinPendingData) Creating

func (model *CoinPendingData) Creating() error

func (*CoinPendingData) Saving

func (model *CoinPendingData) Saving() error

type Config

type Config struct {
	APIPort               int    `json:"apiport"`
	ChainDataFolder       string `json:"chaindata"`
	EnableChainLog        bool   `json:"chainlog"`
	MaxConcurrentOTACheck int    `json:"concurrentotacheck"`
	Mode                  string `json:"mode"`
	MongoAddress          string `json:"mongo"`
	MongoDB               string `json:"mongodb"`
	ChainNetwork          string `json:"chainnetwork"`
	Highway               string `json:"highway"`
	NumOfShard            int    `json:"numberofshard"`
	IndexerID             int    `json:"indexerid"`
	MasterIndexerAddr     string `json:"masterindexer"`
	AnalyticService       string `json:"analyticservice"`
	AnalyticsAPIEndpoint  string `json:"analyticsAPIEndpoint"`
	ExternalDecimals      string `json:"externaldecimals"`
	FullnodeData          bool   `json:"fullnodedata"`
	CoordinatorAddr       string `json:"coordinator"`
	LogRecorderAddr       string `json:"logrecorder"`
}
var ServiceCfg Config

type ConfigJSON

type ConfigJSON struct {
	APIPort               int    `json:"apiport"`
	ChainDataFolder       string `json:"chaindata"`
	EnableChainLog        bool   `json:"chainlog"`
	MaxConcurrentOTACheck int    `json:"concurrentotacheck"`
	Mode                  string `json:"mode"`
	MongoAddress          string `json:"mongo"`
	MongoDB               string `json:"mongodb"`
	ChainNetwork          string `json:"chainnetwork"`
	IndexerID             int    `json:"indexerid"`
	MasterIndexerAddr     string `json:"masterindexer"`
	AnalyticService       string `json:"analyticservice"`
	AnalyticsAPIEndpoint  string `json:"analyticsAPIEndpoint"`
	ExternalDecimals      string `json:"externaldecimals"`
	FullnodeData          bool   `json:"fullnodedata"`
	CoordinatorAddr       string `json:"coordinator"`
	LogRecorderAddr       string `json:"logrecorder"`
}

type ContributionData

type ContributionData struct {
	mgm.DefaultModel `bson:",inline"`
	RequestTxs       []string `json:"requesttxs" bson:"requesttxs"`
	RespondTxs       []string `json:"respondtxs" bson:"respondtxs"`
	PairID           string   `json:"pairid" bson:"pairid"`
	PoolID           string   `json:"poolid" bson:"poolid"`
	PairHash         string   `json:"pairhash" bson:"pairhash"`
	ContributeTokens []string `json:"contributetokens" bson:"contributetokens"`
	ContributeAmount []string `json:"contributeamount" bson:"contributeamount"`
	ReturnTokens     []string `json:"returntokens" bson:"returntokens"`
	ReturnAmount     []string `json:"returnamount" bson:"returnamount"`
	Contributor      string   `json:"contributor" bson:"contributor"`
	NFTID            string   `json:"nftid" bson:"nftid"`
	RequestTime      int64    `json:"requesttime" bson:"requesttime"`
	Status           string   `json:"status" bson:"status"`
	Version          int      `json:"version" bson:"version"`
}

func (*ContributionData) Creating

func (model *ContributionData) Creating() error

func (*ContributionData) Saving

func (model *ContributionData) Saving() error

type CurrentPDEState added in v1.8.0

type CurrentPDEState struct {
	Version         uint
	StateV1         PDEStateV1
	StateV2         PDEStateV2
	BeaconTimeStamp int64
}

type CustomTokenInfo added in v1.8.0

type CustomTokenInfo struct {
	mgm.DefaultModel `bson:",inline"`
	TokenID          string `json:"TokenID" bson:"tokenid"`
	Image            string `json:"Image" bson:"image"`
	IsPrivacy        int    `json:"IsPrivacy" bson:"isprivacy"`
	Name             string `json:"Name" bson:"name"`
	Symbol           string `json:"Symbol" bson:"symbol"`
	OwnerAddress     string `json:"OwnerAddress" bson:"owneraddress"`
	OwnerName        string `json:"OwnerName" bson:"ownername"`
	OwnerEmail       string `json:"OwnerEmail" bson:"owneremail"`
	OwnerWebsite     string `json:"OwnerWebsite" bson:"ownerwebsite"`
	ShowOwnerAddress int    `json:"ShowOwnerAddress" bson:"showowneraddress"`
	Description      string `json:"Description" bson:"description"`
	Verified         bool   `json:"Verified" bson:"verified"`
}

func (*CustomTokenInfo) Creating added in v1.8.0

func (model *CustomTokenInfo) Creating() error

func (*CustomTokenInfo) Saving added in v1.8.0

func (model *CustomTokenInfo) Saving() error

type ExtraTokenInfo added in v1.8.0

type ExtraTokenInfo struct {
	mgm.DefaultModel `bson:",inline"`
	TokenID          string `json:"TokenID" bson:"tokenid"`
	Name             string `json:"Name" bson:"name"`
	Symbol           string `json:"Symbol" bson:"symbol"`
	PSymbol          string `json:"PSymbol" bson:"psymbol"`
	PDecimals        uint64 `json:"PDecimals" bson:"pdecimals"`
	Decimals         int64  `json:"Decimals" bson:"decimals"`
	ContractID       string `json:"ContractID" bson:"contractid"`
	Status           int    `json:"Status" bson:"status"`
	Type             int    `json:"Type" bson:"type"`
	CurrencyType     int    `json:"CurrencyType" bson:"currencytype"`
	Default          bool   `json:"Default" bson:"default"`
	Verified         bool   `json:"Verified" bson:"verified"`
	UserID           int    `json:"UserID" bson:"userid"`

	PriceUsd           float64 `json:"PriceUsd" bson:"priceusd"`
	PercentChange1h    string  `json:"PercentChange1h" bson:"percentchange1h"`
	PercentChangePrv1h string  `json:"PercentChangePrv1h" bson:"percentchangeprv1h"`
	CurrentPrvPool     uint64  `json:"CurrentPrvPool" bson:"currentprvpool"`
	PricePrv           float64 `json:"priceprv" bson:"priceprv"`
	Volume24           uint64  `json:"volume24" bson:"volume24"`
	ParentID           int     `json:"ParentID" bson:"parentid"`
	OriginalSymbol     string  `json:"OriginalSymbol" bson:"originalsymbol"`
	LiquidityReward    float64 `json:"LiquidityReward" bson:"liquidityreward"`

	Network           string `json:"Network" bson:"Network"`
	ListChildToken    string `json:"ListChildToken" bson:"listchildtoken"`
	ListUnifiedToken  string `json:"ListUnifiedToken"`
	NetworkID         int    `json:"NetworkID"`
	MovedUnifiedToken bool   `json:"MovedUnifiedToken"`
	ParentUnifiedID   int    `json:"ParentUnifiedID"`
}

func (*ExtraTokenInfo) Creating added in v1.8.0

func (model *ExtraTokenInfo) Creating() error

func (*ExtraTokenInfo) Saving added in v1.8.0

func (model *ExtraTokenInfo) Saving() error

type ICoinInfo

type ICoinInfo interface {
	GetVersion() uint8
	GetCommitment() *privacy.Point
	GetInfo() []byte
	GetPublicKey() *privacy.Point
	GetValue() uint64
	GetKeyImage() *privacy.Point
	GetRandomness() *privacy.Scalar
	GetShardID() (uint8, error)
	GetSNDerivator() *privacy.Scalar
	GetCoinDetailEncrypted() []byte
	IsEncrypted() bool
	GetTxRandom() *coin.TxRandom
	GetSharedRandom() *privacy.Scalar
	GetSharedConcealRandom() *privacy.Scalar
	GetAssetTag() *privacy.Point
}

func NewCoinFromJsonOutCoinV1

func NewCoinFromJsonOutCoinV1(jsonOutCoin OutCoinV1) (ICoinInfo, *big.Int, error)

func NewCoinFromJsonOutCoinV2

func NewCoinFromJsonOutCoinV2(jsonOutCoin OutCoinV2) (ICoinInfo, *big.Int, error)

type InstructionBeaconData added in v1.8.0

type InstructionBeaconData struct {
	mgm.DefaultModel `bson:",inline"`
	Metatype         string `json:"metatype" bson:"metatype"`
	TxRequest        string `json:"txrequest" bson:"txrequest"`
	Content          string `json:"content" bson:"content"`
	Status           string `json:"status" bson:"status"`
}

func (*InstructionBeaconData) Creating added in v1.8.0

func (model *InstructionBeaconData) Creating() error

func (*InstructionBeaconData) Saving added in v1.8.0

func (model *InstructionBeaconData) Saving() error

type KeyImageData

type KeyImageData struct {
	mgm.DefaultModel `bson:",inline"`
	TokenID          string `json:"tokenid" bson:"tokenid"`
	KeyImage         string `json:"keyimage" bson:"keyimage"`
	TxHash           string `json:"txhash" bson:"txhash"`
	BeaconHeight     uint64 `json:"beaconheight" bson:"beaconheight"`
	ShardID          int    `json:"shardid" bson:"shardid"`
}

func NewKeyImageData

func NewKeyImageData(tokenID, txHash, keyimage string, beaconHeight uint64, shardID int) *KeyImageData

func (*KeyImageData) Creating

func (model *KeyImageData) Creating() error

func (*KeyImageData) Saving

func (model *KeyImageData) Saving() error

type KeyInfoData

type KeyInfoData struct {
	mgm.DefaultModel `bson:",inline"`
	Pubkey           string              `json:"pubkey" bson:"pubkey"`
	OTAKey           string              `json:"otakey" bson:"otakey"`
	CoinIndex        map[string]CoinInfo `json:"coinindex" bson:"coinindex"`
	NFTIndex         map[string]CoinInfo `json:"nftindex" bson:"nftindex"`
	TotalReceiveTxs  map[string]uint64   `json:"receivetxs" bson:"receivetxs"`
	LastScanTxID     string              `json:"lastscantxid" bson:"lastscantxid"`
}

func NewKeyInfoData

func NewKeyInfoData(Pubkey, OTAKey string, coinIdx map[string]CoinInfo) *KeyInfoData

func (*KeyInfoData) Creating

func (model *KeyInfoData) Creating() error

func (*KeyInfoData) Saving

func (model *KeyInfoData) Saving() error

type KeyInfoDataV2

type KeyInfoDataV2 KeyInfoData

type LimitOrderStatus added in v1.8.0

type LimitOrderStatus struct {
	mgm.DefaultModel `bson:",inline"`
	PoolID           string `json:"poolid" bson:"poolid"`
	PairID           string `json:"pairid" bson:"pairid"`
	RequestTx        string `json:"requesttx" bson:"requesttx"`
	Token1Balance    string `json:"token1balance" bson:"token1balance"`
	Token2Balance    string `json:"token2balance" bson:"token2balance"`
	Direction        byte   `json:"direction" bson:"direction"`
	NftID            string `json:"nftid" bson:"nftid"`
}

func (*LimitOrderStatus) Creating added in v1.8.0

func (model *LimitOrderStatus) Creating() error

func (*LimitOrderStatus) Saving added in v1.8.0

func (model *LimitOrderStatus) Saving() error

type MakingVolume added in v1.8.0

type MakingVolume struct {
	Volume map[string]*big.Int // nftID -> amount
}

type OrderReward added in v1.8.0

type OrderReward struct {
	UncollectedRewards Reward
}

type OutCoinV1

type OutCoinV1 struct {
	Version     string `json:"Version"`
	Index       string `json:"Index"`
	PublicKey   string `json:"PublicKey"`
	Commitment  string `json:"Commitment"`
	SNDerivator string `json:"SNDerivator"`
	KeyImage    string `json:"KeyImage"`
	Randomness  string `json:"Randomness"`
	Value       string `json:"Value"`
	Info        string `json:"Info"`
	// SharedRandom         string `json:"SharedRandom"`
	// SharedConcealRandom  string `json:"SharedConcealRandom"`
	// TxRandom             string `json:"TxRandom"`
	CoinDetailsEncrypted string `json:"CoinDetailsEncrypted"`
	// AssetTag             string `json:"AssetTag"`
	TxHash string `json:"TxHash"`
}

func NewOutCoinV1

func NewOutCoinV1(outCoin ICoinInfo, base58Fmt bool) OutCoinV1

func NewOutcoinV1FromInterface

func NewOutcoinV1FromInterface(data interface{}) (*OutCoinV1, error)

type OutCoinV2

type OutCoinV2 struct {
	Version              string `json:"Version"`
	Index                string `json:"Index"`
	PublicKey            string `json:"PublicKey"`
	Commitment           string `json:"Commitment"`
	SNDerivator          string `json:"SNDerivator"`
	KeyImage             string `json:"KeyImage"`
	Randomness           string `json:"Randomness"`
	Value                string `json:"Value"`
	Info                 string `json:"Info"`
	SharedRandom         string `json:"SharedRandom"`
	SharedConcealRandom  string `json:"SharedConcealRandom"`
	TxRandom             string `json:"TxRandom"`
	CoinDetailsEncrypted string `json:"CoinDetailsEncrypted"`
	AssetTag             string `json:"AssetTag"`
	TxHash               string `json:"TxHash"`
}

func NewOutCoinV2

func NewOutCoinV2(outCoin ICoinInfo, base58Fmt bool) OutCoinV2

type PDEStateData

type PDEStateData struct {
	mgm.DefaultModel `bson:",inline"`
	Version          int    `json:"version" bson:"version"`
	State            string `json:"state" bson:"state"`
	Height           uint64 `json:"height" bson:"height"`
}

func NewPDEStateData

func NewPDEStateData(state string, version int) *PDEStateData

func (*PDEStateData) Creating

func (model *PDEStateData) Creating() error

func (*PDEStateData) Saving

func (model *PDEStateData) Saving() error

type PDEStateV1 added in v1.8.0

type PDEStateV1 struct {
	WaitingContributions map[string]*rawdbv2.PDEContribution
	PDEPoolPairs         map[string]*rawdbv2.PDEPoolForPair
	PDEShares            map[string]uint64
	PDETradingFees       map[string]uint64
}

type PDEStateV2 added in v1.8.0

type PDEStateV2 struct {
	// WaitingContributions map[string]*rawdbv2.Pdexv3Contribution
	PoolPairs         map[string]*PoolPairState         //
	StakingPoolsState map[string]*pdex.StakingPoolState // tokenID -> StakingPoolState
	Params            *pdex.Params
}

type PNodeDevice added in v1.8.0

type PNodeDevice struct {
	mgm.DefaultModel `bson:",inline"`
	QRCode           string `json:"QRCode" bson:"qr_code"`
	BLS              string `json:"BLS" bson:"bls"`
}

func (*PNodeDevice) Creating added in v1.8.0

func (model *PNodeDevice) Creating() error

func (*PNodeDevice) Saving added in v1.8.0

func (model *PNodeDevice) Saving() error

type PairInfoData added in v1.8.0

type PairInfoData struct {
	mgm.DefaultModel `bson:",inline"`
	PairID           string `json:"pairid" bson:"pairid"`
	TokenID1         string `json:"tokenid1" bson:"tokenid1"`
	TokenID2         string `json:"tokenid2" bson:"tokenid2"`
	Token1Amount     string `json:"token1amount" bson:"token1amount"`
	Token2Amount     string `json:"token2amount" bson:"token2amount"`
	PoolCount        int    `json:"poolcount" bson:"poolcount"`
}

func NewPairData added in v1.8.0

func NewPairData(pairid, token1, token2 string, poolcount int, token1value, token2value string) *PairInfoData

func (*PairInfoData) Creating added in v1.8.0

func (model *PairInfoData) Creating() error

func (*PairInfoData) Saving added in v1.8.0

func (model *PairInfoData) Saving() error

type PairRanking added in v1.8.0

type PairRanking struct {
	mgm.DefaultModel `bson:",inline"`
	PairID           string `json:"pairid" bson:"pairid"`
	Value            uint64 `json:"value" bson:"value"`
	LeadPool         string `json:"leadpool" bson:"leadpool"`
}

func (*PairRanking) Creating added in v1.8.0

func (model *PairRanking) Creating() error

func (*PairRanking) Saving added in v1.8.0

func (model *PairRanking) Saving() error

type Pdexv3GetStateRPCResult added in v1.8.0

type Pdexv3GetStateRPCResult struct {
	ID     int `json:"Id"`
	Result struct {
		Beacontimestamp      int              `json:"BeaconTimeStamp"`
		Params               jsond.RawMessage `json:"Params"`
		Poolpairs            jsond.RawMessage `json:"PoolPairs"`
		Waitingcontributions struct {
		} `json:"WaitingContributions"`
		Nftids       jsond.RawMessage `json:"NftIDs"`
		Stakingpools jsond.RawMessage `json:"StakingPools"`
	} `json:"Result"`
	Error  interface{} `json:"Error"`
	Params []struct {
		Beaconheight int `json:"BeaconHeight"`
	} `json:"Params"`
	Method  string `json:"Method"`
	Jsonrpc string `json:"Jsonrpc"`
}

type Pdexv3PoolPairChild added in v1.8.0

type Pdexv3PoolPairChild struct {
	PoolID string `json:"PoolID"`
}

type Pdexv3PoolPairWithId added in v1.8.0

type Pdexv3PoolPairWithId struct {
	rawdbv2.Pdexv3PoolPair
	Pdexv3PoolPairChild
}

type PoolInfoData added in v1.8.0

type PoolInfoData struct {
	mgm.DefaultModel `bson:",inline"`
	PoolID           string `json:"poolid" bson:"poolid"`
	PairID           string `json:"pairid" bson:"pairid"`
	TokenID1         string `json:"tokenid1" bson:"tokenid1"`
	TokenID2         string `json:"tokenid2" bson:"tokenid2"`
	AMP              uint   `json:"amp" bson:"amp"`
	Token1Amount     string `json:"token1amount" bson:"token1amount"`
	Token2Amount     string `json:"token2amount" bson:"token2amount"`
	Virtual1Amount   string `json:"virtual1amount" bson:"virtual1amount"`
	Virtual2Amount   string `json:"virtual2amount" bson:"virtual2amount"`
	TotalShare       string `json:"totalshare" bson:"totalshare"`
	Version          int    `json:"version" bson:"version"`
}

func NewPoolInfoData added in v1.8.0

func NewPoolInfoData(poolid, pairid, token1, token2 string, amp uint, token1amount, token2amount string) *PoolInfoData

func (*PoolInfoData) Creating added in v1.8.0

func (model *PoolInfoData) Creating() error

func (*PoolInfoData) Saving added in v1.8.0

func (model *PoolInfoData) Saving() error

type PoolPairState added in v1.8.0

type PoolPairState struct {
	ProtocolFees      map[common.Hash]uint64
	StakingPoolFees   map[common.Hash]uint64
	LpFeesPerShare    map[common.Hash]*big.Int
	LmRewardsPerShare map[common.Hash]*big.Int
	State             rawdbv2.Pdexv3PoolPair
	Shares            map[string]*pdex.Share
	Orderbook         struct {
		Orders []*pdex.Order
	}
	MakingVolume map[common.Hash]*MakingVolume // tokenID -> MakingVolume
	OrderRewards map[string]*OrderReward       // nftID -> orderReward
}

type PoolShareData added in v1.8.0

type PoolShareData struct {
	mgm.DefaultModel `bson:",inline"`
	PoolID           string            `json:"poolid" bson:"poolid"`
	NFTID            string            `json:"nftid" bson:"nftid"`
	Amount           uint64            `json:"amount" bson:"amount"`
	TradingFee       map[string]uint64 `json:"tradingfee" bson:"tradingfee"`
	OrderReward      map[string]uint64 `json:"orderreward" bson:"orderreward"`
	Version          int               `json:"version" bson:"version"`
}

func (*PoolShareData) Creating added in v1.8.0

func (model *PoolShareData) Creating() error

func (*PoolShareData) Saving added in v1.8.0

func (model *PoolShareData) Saving() error

type PoolStakeData added in v1.8.0

type PoolStakeData struct {
	mgm.DefaultModel `bson:",inline"`
	TokenID          string `json:"tokenid" bson:"tokenid"`
	Amount           uint64 `json:"amount" bson:"amount"`
}

func (*PoolStakeData) Creating added in v1.8.0

func (model *PoolStakeData) Creating() error

func (*PoolStakeData) Saving added in v1.8.0

func (model *PoolStakeData) Saving() error

type PoolStakeHistoryData added in v1.8.0

type PoolStakeHistoryData struct {
	mgm.DefaultModel `bson:",inline"`
	IsStaking        bool   `json:"isstaking" bson:"isstaking"`
	RequestTx        string `json:"requesttx" bson:"requesttx"`
	RespondTx        string `json:"respondtx" bson:"respondtx"`
	Status           int    `json:"status" bson:"status"`
	TokenID          string `json:"tokenid" bson:"tokenid"`
	NFTID            string `json:"nftid" bson:"nftid"`
	Amount           uint64 `json:"amount" bson:"amount"`
	Requesttime      int64  `json:"requesttime" bson:"requesttime"`
}

func (*PoolStakeHistoryData) Creating added in v1.8.0

func (model *PoolStakeHistoryData) Creating() error

func (*PoolStakeHistoryData) Saving added in v1.8.0

func (model *PoolStakeHistoryData) Saving() error

type PoolStakeRewardHistoryData added in v1.8.0

type PoolStakeRewardHistoryData struct {
	mgm.DefaultModel `bson:",inline"`
	RequestTx        string   `json:"requesttx" bson:"requesttx"`
	RespondTxs       []string `json:"respondtxs" bson:"respondtxs"`
	RewardTokens     []string `json:"rewardtokens" bson:"rewardtokens"`
	Status           int      `json:"status" bson:"status"`
	TokenID          string   `json:"tokenid" bson:"tokenid"`
	NFTID            string   `json:"nftid" bson:"nftid"`
	Amount           []uint64 `json:"amount" bson:"amount"`
	Requesttime      int64    `json:"requesttime" bson:"requesttime"`
}

func (*PoolStakeRewardHistoryData) Creating added in v1.8.0

func (model *PoolStakeRewardHistoryData) Creating() error

func (*PoolStakeRewardHistoryData) Saving added in v1.8.0

func (model *PoolStakeRewardHistoryData) Saving() error

type PoolStakerData added in v1.8.0

type PoolStakerData struct {
	mgm.DefaultModel `bson:",inline"`
	TokenID          string            `json:"tokenid" bson:"tokenid"`
	NFTID            string            `json:"nftid" bson:"nftid"`
	Amount           uint64            `json:"amount" bson:"amount"`
	Reward           map[string]uint64 `json:"reward" bson:"reward"`
}

func (*PoolStakerData) Creating added in v1.8.0

func (model *PoolStakerData) Creating() error

func (*PoolStakerData) Saving added in v1.8.0

func (model *PoolStakerData) Saving() error

type ProcessorState added in v1.8.0

type ProcessorState struct {
	mgm.DefaultModel `bson:",inline"`
	Processor        string `json:"processor" bson:"processor"`
	State            string `json:"state" bson:"state"`
}

func (*ProcessorState) Creating added in v1.8.0

func (model *ProcessorState) Creating() error

func (*ProcessorState) Saving added in v1.8.0

func (model *ProcessorState) Saving() error

type Reward added in v1.8.0

type Reward map[common.Hash]uint64 // tokenID -> amount

type RewardAPYTracking added in v1.8.0

type RewardAPYTracking struct {
	mgm.DefaultModel `bson:",inline"`
	DataID           string  `json:"dataid" bson:"dataid"`
	APY              float64 `json:"apy" bson:"apy"`
	BeaconHeight     uint64  `json:"beaconheight" bson:"beaconheight"`
	TotalReceive     int64   `json:"totalreceive" bson:"totalreceive"`
	TotalAmount      int64   `json:"totalamount" bson:"totalamount"`
	APY2             float64 `json:"apy2" bson:"apy2"`
}

func (*RewardAPYTracking) Creating added in v1.8.0

func (model *RewardAPYTracking) Creating() error

func (*RewardAPYTracking) Saving added in v1.8.0

func (model *RewardAPYTracking) Saving() error

type RewardRecord added in v1.8.0

type RewardRecord struct {
	mgm.DefaultModel `bson:",inline"`
	DataID           string `json:"dataid" bson:"dataid"`
	Data             string `json:"data" bson:"data"`
	BeaconHeight     uint64 `json:"beaconheight" bson:"beaconheight"`
}

func (*RewardRecord) Creating added in v1.8.0

func (model *RewardRecord) Creating() error

func (*RewardRecord) Saving added in v1.8.0

func (model *RewardRecord) Saving() error

type ShieldData

type ShieldData struct {
	mgm.DefaultModel `bson:",inline"`
	Bridge           string `json:"bridge" bson:"bridge"`
	TokenID          string `json:"tokenid" bson:"tokenid"`
	Amount           string `json:"amount" bson:"amount"`
	RespondTx        string `json:"respondtx" bson:"respondtx"`
	RequestTx        string `json:"requesttx" bson:"requesttx"`
	IsDecentralized  bool   `json:"isdecentralized" bson:"isdecentralized"`
	Pubkey           string `json:"pubkey" bson:"pubkey"`
	BeaconHeight     uint64 `json:"height" bson:"height"`
	RequestTime      int64  `json:"requesttime" bson:"requesttime"`
}

func NewShieldData

func NewShieldData(requestTx, respondTx, tokenID, bridge, pubkey string, isDecentralized bool, amount string, height uint64, requestTime int64) *ShieldData

func (*ShieldData) Creating

func (model *ShieldData) Creating() error

func (*ShieldData) Saving

func (model *ShieldData) Saving() error

type SubmittedOTAKeyData

type SubmittedOTAKeyData struct {
	mgm.DefaultModel `bson:",inline"`
	OTAKey           string `json:"otakey" bson:"otakey"`
	Pubkey           string `json:"pubkey" bson:"pubkey"`
	Fullkey          string `json:"fullkey" bson:"fullkey"`
	IndexerID        int    `json:"indexerid" bson:"indexerid"`
}

func NewSubmittedOTAKeyData

func NewSubmittedOTAKeyData(OTAkey, pubkey, fullkey string, indexerID int) *SubmittedOTAKeyData

func (*SubmittedOTAKeyData) Creating

func (model *SubmittedOTAKeyData) Creating() error

func (*SubmittedOTAKeyData) Saving

func (model *SubmittedOTAKeyData) Saving() error

type TokenInfoData

type TokenInfoData struct {
	mgm.DefaultModel `bson:",inline"`
	TokenID          string `json:"tokenid" bson:"tokenid"`
	Name             string `json:"name" bson:"name"`
	Symbol           string `json:"symbol" bson:"symbol"`
	Image            string `json:"image" bson:"image"`
	Amount           string `json:"amount" bson:"amount"`
	IsPrivacy        bool   `json:"isprivacy" bson:"isprivacy"`
	IsBridge         bool   `json:"isbridge" bson:"isbridge"`
	IsNFT            bool   `json:"isnft" bson:"isnft"`
	ExternalID       string `json:"externalid" bson:"externalid"`
	PastPrice        string `json:"pastprice" bson:"pastprice"`
	CurrentPrice     string `json:"currentprice" bson:"currentprice"`
}

func NewTokenInfoData

func NewTokenInfoData(tokenID, name, symbol, image string, isprivacy, isbridge bool, amount uint64, isNFT bool, externalid string) *TokenInfoData

func (*TokenInfoData) Creating

func (model *TokenInfoData) Creating() error

func (*TokenInfoData) Saving

func (model *TokenInfoData) Saving() error

type TokenMarketCap added in v1.8.0

type TokenMarketCap struct {
	mgm.DefaultModel `bson:",inline"`
	TokenSymbol      string `json:"symbol" bson:"symbol"`
	Value            uint64 `json:"value" bson:"value"`
	Rank             int    `json:"rank" bson:"rank"`
	PriceChange      string `json:"pricechange" bson:"pricechange"`
}

func (*TokenMarketCap) Creating added in v1.8.0

func (model *TokenMarketCap) Creating() error

func (*TokenMarketCap) Saving added in v1.8.0

func (model *TokenMarketCap) Saving() error

type TokenPrice added in v1.8.0

type TokenPrice struct {
	mgm.DefaultModel `bson:",inline"`
	TokenID          string `json:"tokenid" bson:"tokenid"`
	TokenName        string `json:"name" bson:"name"`
	TokenSymbol      string `json:"symbol" bson:"symbol"`
	Price            string `json:"price" bson:"price"`
	Time             int64  `json:"time" bson:"time"`
}

func (*TokenPrice) Creating added in v1.8.0

func (model *TokenPrice) Creating() error

func (*TokenPrice) Saving added in v1.8.0

func (model *TokenPrice) Saving() error

type TradeOrderData added in v1.8.0

type TradeOrderData struct {
	mgm.DefaultModel `bson:",inline"`
	RequestTx        string                            `json:"requesttx" bson:"requesttx"`
	WithdrawTxs      []string                          `json:"withdrawtxs" bson:"withdrawtxs"`
	WithdrawPendings []string                          `json:"withdrawpendings" bson:"withdrawpendings"`
	WithdrawInfos    map[string]TradeOrderWithdrawInfo `json:"withdrawinfos" bson:"withdrawinfos"`
	RespondTxs       []string                          `json:"respondtxs" bson:"respondtxs"`
	RespondTokens    []string                          `json:"respondtokens" bson:"respondtokens"`
	RespondAmount    []uint64                          `json:"respondamount" bson:"respondamount"`
	Status           int                               `json:"status" bson:"status"`
	SellTokenID      string                            `json:"selltokenid" bson:"selltokenid"`
	BuyTokenID       string                            `json:"buytokenid" bson:"buytokenid"`
	PairID           string                            `json:"pairid" bson:"pairid"`
	PoolID           string                            `json:"poolid" bson:"poolid"`
	MinAccept        string                            `json:"minaccept" bson:"minaccept"`
	Amount           string                            `json:"amount" bson:"amount"`
	Requesttime      int64                             `json:"requesttime" bson:"requesttime"`
	NFTID            string                            `json:"nftid" bson:"nftid"`
	Receiver         string                            `json:"receiver" bson:"receiver"`
	ShardID          int                               `json:"shardid" bson:"shardid"`
	BlockHeight      uint64                            `json:"blockheight" bson:"blockheight"`
	Fee              uint64                            `json:"fee" bson:"fee"`
	FeeToken         string                            `json:"feetoken" bson:"feetoken"`
	IsSwap           bool                              `json:"isswap" bson:"isswap"`
	Version          int                               `json:"version" bson:"version"`
	TradingPath      []string                          `json:"tradingpath" bson:"tradingpath"`
}

func NewTradeOrderData added in v1.8.0

func NewTradeOrderData(requestTx, selltoken, buytoken, poolid, pairid, nftid string, status int, minAccept, amount string, requestTime int64, shardID int, blockHeight uint64) *TradeOrderData

func (*TradeOrderData) Creating added in v1.8.0

func (model *TradeOrderData) Creating() error

func (*TradeOrderData) Saving added in v1.8.0

func (model *TradeOrderData) Saving() error

type TradeOrderWithdrawInfo added in v1.8.0

type TradeOrderWithdrawInfo struct {
	TokenIDs      []string `json:"tokenids" bson:"tokenids"`
	Amount        uint64   `json:"amount" bson:"amount"`
	Status        []int    `json:"status" bson:"status"`
	IsRejected    bool     `json:"isrejected" bson:"isrejected"`
	Responds      []string `json:"responds" bson:"responds"`
	RespondTokens []string `json:"respondtokens" bson:"respondtokens"`
	RespondAmount []uint64 `json:"respondamount" bson:"respondamount"`
}

type TransactionDetail

type TransactionDetail struct {
	BlockHash   string `json:"BlockHash"`
	BlockHeight uint64 `json:"BlockHeight"`
	TxSize      uint64 `json:"TxSize"`
	Index       uint64 `json:"Index"`
	ShardID     byte   `json:"ShardID"`
	Hash        string `json:"Hash"`
	Version     int8   `json:"Version"`
	Type        string `json:"Type"` // Transaction type
	LockTime    string `json:"LockTime"`
	Fee         uint64 `json:"Fee"` // Fee applies: always consant
	Image       string `json:"Image"`

	IsPrivacy        bool                   `json:"IsPrivacy"`
	Proof            privacy.Proof          `json:"Proof"`
	ProofDetail      jsonresult.ProofDetail `json:"ProofDetail"`
	InputCoinPubKey  string                 `json:"InputCoinPubKey"`
	OutputCoinPubKey []string               `json:"OutputCoinPubKey"`
	OutputCoinSND    []string               `json:"OutputCoinSND"`

	TokenInputCoinPubKey  string   `json:"TokenInputCoinPubKey"`
	TokenOutputCoinPubKey []string `json:"TokenOutputCoinPubKey"`
	TokenOutputCoinSND    []string `json:"TokenOutputCoinSND"`

	SigPubKey string `json:"SigPubKey,omitempty"` // 64 bytes
	Sig       string `json:"Sig,omitempty"`       // 64 bytes

	Metatype                      int                    `json:"Metatype"`
	Metadata                      string                 `json:"Metadata"`
	CustomTokenData               string                 `json:"CustomTokenData"`
	PrivacyCustomTokenID          string                 `json:"PrivacyCustomTokenID"`
	PrivacyCustomTokenName        string                 `json:"PrivacyCustomTokenName"`
	PrivacyCustomTokenSymbol      string                 `json:"PrivacyCustomTokenSymbol"`
	PrivacyCustomTokenData        string                 `json:"PrivacyCustomTokenData"`
	PrivacyCustomTokenProofDetail jsonresult.ProofDetail `json:"PrivacyCustomTokenProofDetail"`
	PrivacyCustomTokenIsPrivacy   bool                   `json:"PrivacyCustomTokenIsPrivacy"`
	PrivacyCustomTokenFee         uint64                 `json:"PrivacyCustomTokenFee"`

	IsInMempool bool `json:"IsInMempool"`
	IsInBlock   bool `json:"IsInBlock"`

	Info string `json:"Info"`
}

func NewTransactionDetail

func NewTransactionDetail(tx metadata.Transaction, blockHash *common.Hash, blockHeight uint64, index int, shardID byte, base58Fmt bool) (*TransactionDetail, error)

type TxData

type TxData struct {
	mgm.DefaultModel `bson:",inline"`
	KeyImages        []string `json:"keyimages" bson:"keyimages"`
	PubKeyReceivers  []string `json:"pubkeyreceivers" bson:"pubkeyreceivers"`
	TxHash           string   `json:"txhash" bson:"txhash"`
	TxVersion        int      `json:"txversion" bson:"txversion"`
	TxType           string   `json:"txtype" bson:"txtype"`
	TxDetail         string   `json:"txdetail" bson:"txdetail"`
	TokenID          string   `json:"tokenid" bson:"tokenid"`
	RealTokenID      string   `json:"realtokenid" bson:"realtokenid"`
	BlockHash        string   `json:"blockhash" bson:"blockhash"`
	BlockHeight      uint64   `json:"blockheight" bson:"blockheight"`
	ShardID          int      `json:"shardid" bson:"shardid"`
	Locktime         int64    `json:"locktime" bson:"locktime"`
	Metatype         string   `json:"metatype" bson:"metatype"`
	Metadata         string   `json:"metadata" bson:"metadata"`
	IsNFT            bool     `json:"isnft" bson:"isnft"`
}

func NewTxData

func NewTxData(locktime int64, shardID, txVersion int, blockHeight uint64, blockhash, tokenID, txHash, txType, txDetail, metatype, metadata string, keyimages, pubKeyReceivers []string, isNFT bool) *TxData

func (*TxData) Creating

func (model *TxData) Creating() error

func (*TxData) Saving

func (model *TxData) Saving() error

type WithdrawContributionData

type WithdrawContributionData struct {
	mgm.DefaultModel      `bson:",inline"`
	Status                int      `json:"status" bson:"status"`
	RequestTx             string   `json:"requesttx" bson:"requesttx"`
	RespondTxs            []string `json:"respondtxs" bson:"respondtxs"`
	WithdrawTokens        []string `json:"withdrawtokens" bson:"withdrawtokens"`
	WithdrawAmount        []string `json:"withdrawamount" bson:"withdrawamount"`
	ShareAmount           string   `json:"shareamount" bson:"shareamount"`
	ContributorAddressStr string   `json:"contributor" bson:"contributor"`
	RequestTime           int64    `json:"requesttime" bson:"requesttime"`
	NFTID                 string   `json:"nftid" bson:"nftid"`
	PoolID                string   `json:"poolid" bson:"poolid"`
	Version               int      `json:"version" bson:"version"`
}

func (*WithdrawContributionData) Creating

func (model *WithdrawContributionData) Creating() error

func (*WithdrawContributionData) Saving

func (model *WithdrawContributionData) Saving() error

type WithdrawContributionFeeData

type WithdrawContributionFeeData struct {
	mgm.DefaultModel      `bson:",inline"`
	RequestTx             string   `json:"requesttx" bson:"requesttx"`
	RespondTxs            []string `json:"respondtxs" bson:"respondtxs"`
	Status                int      `json:"status" bson:"status"`
	PoodID                string   `json:"poolid" bson:"poolid"`
	WithdrawTokens        []string `json:"withdrawtokens" bson:"withdrawtokens"`
	WithdrawAmount        []string `json:"withdrawamount" bson:"withdrawamount"`
	ContributorAddressStr string   `json:"contributor" bson:"contributor"`
	RequestTime           int64    `json:"requesttime" bson:"requesttime"`
	NFTID                 string   `json:"nftid" bson:"nftid"`
	Version               int      `json:"version" bson:"version"`
}

func (*WithdrawContributionFeeData) Creating

func (model *WithdrawContributionFeeData) Creating() error

func (*WithdrawContributionFeeData) Saving

func (model *WithdrawContributionFeeData) Saving() error

Jump to

Keyboard shortcuts

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