worker

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2022 License: MIT Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TxReceiptsBatchSize = 16
	RequestTimeout      = 16 * time.Second
	RequestRetryDelay   = 32 * time.Millisecond
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute

type Attribute struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type Block

type Block struct {
	ID                interface{}        `json:"id"`
	Header            interface{}        `json:"header"`
	Data              BlockData          `json:"data"`
	Evidence          interface{}        `json:"evidence"`
	LastCommit        interface{}        `json:"last_commit"`
	Emission          string             `json:"emission"`
	Rewards           []ProposerReward   `json:"rewards"`
	CommissionRewards []CommissionReward `json:"commission_rewards"`
	BeginBlockEvents  []Event            `json:"begin_block_events"`
	EndBlockEvents    []Event            `json:"end_block_events"`
	Size              int                `json:"size"`
	EVM               BlockEVM           `json:"evm"`
	StateChanges      EventAccumulator   `json:"state_changes"`
}

type BlockData

type BlockData struct {
	Txs []Tx `json:"txs"`
}

type BlockEVM

type BlockEVM struct {
	Header       *web3types.Header    `json:"header"`
	Transactions []*TransactionEVM    `json:"transactions"`
	Uncles       []*web3types.Header  `json:"uncles"`
	Receipts     []*web3types.Receipt `json:"receipts"`
}

type CommissionReward

type CommissionReward struct {
	Amount        string `json:"amount"`
	Validator     string `json:"validator"`
	RewardAddress string `json:"reward_address"`
}

type Config

type Config struct {
	IndexerEndpoint string
	RpcEndpoint     string
	Web3Endpoint    string
	WorkersCount    int
}

type Event

type Event struct {
	Type       string      `json:"type"`
	Attributes []Attribute `json:"attributes"`
}

type EventAccumulator added in v0.0.8

type EventAccumulator struct {
	// [address][coin_symbol]amount changes
	BalancesChanges map[string]map[string]sdkmath.Int `json:"balances_changes"`
	// [denom]vr struct
	CoinsVR       map[string]UpdateCoinVR `json:"coins_vr"`
	PayCommission []EventPayCommission    `json:"pay_commission"`
	CoinsStaked   map[string]sdkmath.Int  `json:"coin_staked"`
	// [coin_symbol]
	CoinsCreates []EventCreateCoin          `json:"-"`
	CoinUpdates  map[string]EventUpdateCoin `json:"-"`
	// replace legacy
	LegacyReown        map[string]string    `json:"legacy_reown"`
	LegacyReturnNFT    []LegacyReturnNFT    `json:"legacy_return_nft"`
	LegacyReturnWallet []LegacyReturnWallet `json:"legacy_return_wallet"`
	// multisig
	MultisigCreateWallets []MultisigCreateWallet `json:"-"`
	MultisigCreateTxs     []MultisigCreateTx     `json:"-"`
	MultisigSignTxs       []MultisigSignTx       `json:"-"`
	// nft
	//Collection    []EventUpdateCollection `json:"collection"`
	CreateToken   []EventCreateToken   `json:"-"`
	MintSubTokens []EventMintToken     `json:"-"`
	BurnSubTokens []EventBurnToken     `json:"-"`
	UpdateToken   []EventUpdateToken   `json:"-"`
	UpdateReserve []EventUpdateReserve `json:"-"`
	SendNFTs      []EventSendToken     `json:"-"`
	// swap
	ActivateChain   []EventActivateChain   `json:"-"`
	DeactivateChain []EventDeactivateChain `json:"-"`
	SwapInitialize  []EventSwapInitialize  `json:"-"`
	SwapRedeem      []EventSwapRedeem      `json:"-"`
}

func NewEventAccumulator added in v0.0.8

func NewEventAccumulator() *EventAccumulator

func (*EventAccumulator) AddEvent added in v0.0.8

func (ea *EventAccumulator) AddEvent(event abci.Event, txHash string) error

type EventActivateChain added in v0.0.8

type EventActivateChain struct {
	Sender string `json:"sender"`
	ID     uint32 `json:"id"`
	Name   string `json:"name"`
	TxHash string `json:"txHash"`
}

type EventBurnToken added in v0.0.8

type EventBurnToken struct {
	Sender      string   ` json:"sender"`
	NftID       string   `json:"nftId"`
	SubTokenIDs []uint32 `json:"subTokenIds"`
	// from tx
	TxHash string `json:"txHash"`
}

type EventCreateCoin added in v0.0.8

type EventCreateCoin struct {
	Denom       string      `json:"denom"`
	Title       string      `json:"title"`
	Volume      sdkmath.Int `json:"volume"`
	Reserve     sdkmath.Int `json:"reserve"`
	CRR         uint64      `json:"crr"`
	LimitVolume sdkmath.Int `json:"limitVolume"`
	Creator     string      `json:"creator"`
	Avatar      string      `json:"avatar"` // identity
	// can get from transactions
	TxHash string `json:"txHash"`
}

type EventCreateToken added in v0.0.8

type EventCreateToken struct {
	NftID         string   `json:"nftId"`
	NftCollection string   `json:"nftCollection"`
	TokenURI      string   `json:"tokenUri"`
	Creator       string   `json:"creator"`
	StartReserve  sdk.Coin `json:"startReserve"`
	TotalReserve  sdk.Coin `json:"totalReserve"`
	AllowMint     bool     `json:"allowMint"`
	Recipient     string   `json:"recipient"`
	Quantity      uint32   `json:"quantity"`
	SubTokenIDs   []uint32 `json:"subTokenIds"`
	// from tx
	TxHash string `json:"txHash"`
}

type EventDeactivateChain added in v0.0.8

type EventDeactivateChain struct {
	Sender string `json:"sender"`
	ID     uint32 `json:"id"`
	TxHash string `json:"txHash"`
}

type EventDelegate added in v0.0.8

type EventDelegate struct {
	Delegator string
	Validator string
	Stake     Stake
}

type EventMintToken added in v0.0.8

type EventMintToken struct {
	Creator       string   `json:"creator"`
	Recipient     string   `json:"recipient"`
	NftCollection string   `json:"nftCollection"`
	NftID         string   `json:"nftId"`
	StartReserve  sdk.Coin `json:"startReserve"`
	SubTokenIDs   []uint32 `json:"subTokenIds"`
	// from tx
	TxHash string `json:"txHash"`
}

type EventPayCommission added in v0.0.8

type EventPayCommission struct {
	Payer  string    `json:"payer"`
	Coins  sdk.Coins `json:"coins"`
	Burnt  sdk.Coins `json:"burnt"`
	TxHash string    `json:"txHash"`
}

type EventRedelegateComplete added in v0.0.8

type EventRedelegateComplete struct {
	Delegator    string
	ValidatorSrc string
	ValidatorDst string
	Stake        Stake
}

type EventSendToken added in v0.0.8

type EventSendToken struct {
	Sender      string   ` json:"sender"`
	NftID       string   `json:"nftId"`
	Recipient   string   `json:"recipient"`
	SubTokenIDs []uint32 `json:"subTokenIds"`
	// from tx
	TxHash string `json:"txHash"`
}

type EventSwapInitialize added in v0.0.8

type EventSwapInitialize struct {
	Sender            string      `json:"sender"`
	DestChain         uint32      `json:"destChain"`
	FromChain         uint32      `json:"fromChain"`
	Recipient         string      `json:"recipient"`
	Amount            sdkmath.Int `json:"amount"`
	TokenDenom        string      `json:"tokenDenom"`
	TransactionNumber string      `json:"transactionNumber"`
	TxHash            string      `json:"txHash"`
}

type EventSwapRedeem added in v0.0.8

type EventSwapRedeem struct {
	Sender            string      `json:"sender"`
	From              string      `json:"from"`
	Recipient         string      `json:"recipient"`
	Amount            sdkmath.Int `json:"amount"`
	TokenDenom        string      `json:"tokenDenom"`
	TransactionNumber string      `json:"transactionNumber"`
	DestChain         uint32      `json:"destChain"`
	FromChain         uint32      `json:"fromChain"`
	HashReedem        string      `json:"hashReedem"`
	V                 string      `json:"v"`
	R                 string      `json:"r"`
	S                 string      `json:"s"`
	TxHash            string      `json:"txHash"`
}

type EventUndelegateComplete added in v0.0.8

type EventUndelegateComplete struct {
	Delegator string
	Validator string
	Stake     Stake
}

type EventUpdateCoin added in v0.0.8

type EventUpdateCoin struct {
	LimitVolume sdkmath.Int `json:"limitVolume"`
	Avatar      string      `json:"avatar"` // identity
}

type EventUpdateCoinPrices added in v0.0.8

type EventUpdateCoinPrices struct {
	Oracle     string
	CoinPrices struct {
		Denom     string
		Quote     string
		Price     string
		UpdatedAt time.Time
	}
}

type EventUpdateCoinsStaked added in v0.1.0

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

type EventUpdateCollection added in v0.0.8

type EventUpdateCollection struct {
	Creator string `json:"creator"`
	Denom   string `json:"nftCollection"`
	Supply  uint32 `json:"supply"`
	// from tx
	TxHash string `json:"txHash"`
}

CreateOrUpdate in postgres

type EventUpdateReserve added in v0.0.8

type EventUpdateReserve struct {
	//Sender      string   ` json:"sender"`
	NftID       string   `json:"nftId"`
	Reserve     sdk.Coin `json:"reserve"`
	Refill      sdk.Coin `json:"refill"`
	SubTokenIDs []uint32 `json:"subTokenIds"`
	// from tx
	TxHash string `json:"txHash"`
}

type EventUpdateToken added in v0.0.8

type EventUpdateToken struct {
	//Sender   string ` json:"sender"`
	NftID    string `json:"nftId"`
	TokenURI string `json:"tokenUri"`
	// from tx
	TxHash string `json:"txHash"`
}

type FailedTxLog

type FailedTxLog struct {
	Log string `json:"log"`
}

type LegacyReturnNFT added in v0.0.8

type LegacyReturnNFT struct {
	LegacyOwner string `json:"legacy_owner"`
	Owner       string `json:"owner"`
	Denom       string `json:"denom"`
	Creator     string `json:"creator"`
	ID          string `json:"id"`
}

type LegacyReturnWallet added in v0.0.8

type LegacyReturnWallet struct {
	LegacyOwner string `json:"legacy_owner"`
	Owner       string `json:"owner"`
	Wallet      string `json:"wallet"`
}

type MultisigCreateTx added in v0.0.8

type MultisigCreateTx struct {
	Sender      string    `json:"sender"`
	Wallet      string    `json:"wallet"`
	Receiver    string    `json:"receiver"`
	Transaction string    `json:"transaction"`
	Coins       sdk.Coins `json:"coins"`
	TxHash      string    `json:"txHash"`
}

type MultisigCreateWallet added in v0.0.8

type MultisigCreateWallet struct {
	Address   string          `json:"address"`
	Threshold uint32          `json:"threshold"`
	Creator   string          `json:"creator"`
	Owners    []MultisigOwner `json:"owners"`
}

decimal-models

type MultisigOwner added in v0.0.8

type MultisigOwner struct {
	Address  string `json:"address"`
	Multisig string `json:"multisig"`
	Weight   uint32 `json:"weight"`
}

type MultisigSignTx added in v0.0.8

type MultisigSignTx struct {
	Sender        string `json:"sender"`
	Wallet        string `json:"wallet"`
	Transaction   string `json:"transaction"`
	SignerWeight  uint32 `json:"signer_weight"`
	Confirmations uint32 `json:"confirmations"`
	Confirmed     bool   `json:"confirmed"`
}

type ParseTask

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

type ProposerReward

type ProposerReward struct {
	Reward    string `json:"reward"`
	Address   string `json:"address"`
	Delegator string `json:"delegator"`
}

type Stake added in v0.0.8

type Stake struct {
	Stake sdk.Coin `json:"stake"`
	Type  string   `json:"type"`
}

type TransactionEVM

type TransactionEVM struct {
	Type             web3hexutil.Uint64  `json:"type"`
	Hash             web3common.Hash     `json:"hash"`
	Nonce            web3hexutil.Uint64  `json:"nonce"`
	BlockHash        web3common.Hash     `json:"blockHash"`
	BlockNumber      web3hexutil.Uint64  `json:"blockNumber"`
	TransactionIndex web3hexutil.Uint64  `json:"transactionIndex"`
	From             web3common.Address  `json:"from"`
	To               *web3common.Address `json:"to"`
	Value            *web3hexutil.Big    `json:"value"`
	Data             web3hexutil.Bytes   `json:"input"`
	Gas              web3hexutil.Uint64  `json:"gas"`
	GasPrice         *web3hexutil.Big    `json:"gasPrice"`

	// Optional
	ChainId    *web3hexutil.Big     `json:"chainId,omitempty"`              // EIP-155 replay protection
	AccessList web3types.AccessList `json:"accessList,omitempty"`           // EIP-2930 access list
	GasTipCap  *web3hexutil.Big     `json:"maxPriorityFeePerGas,omitempty"` // EIP-1559 dynamic fee transactions
	GasFeeCap  *web3hexutil.Big     `json:"maxFeePerGas,omitempty"`         // EIP-1559 dynamic fee transactions
}

type Tx

type Tx struct {
	Hash      string        `json:"hash"`
	Log       []interface{} `json:"log"`
	Code      uint32        `json:"code"`
	Codespace string        `json:"codespace"`
	Data      interface{}   `json:"data"`
	GasUsed   int64         `json:"gas_used"`
	GasWanted int64         `json:"gas_wanted"`
	Info      TxInfo        `json:"info"`
}

type TxFee

type TxFee struct {
	Gas    uint64    `json:"gas"`
	Amount sdk.Coins `json:"amount"`
}

type TxInfo

type TxInfo struct {
	Msgs []TxMsg `json:"msgs"`
	Memo string  `json:"memo"`
	Fee  TxFee   `json:"fee"`
}

type TxMsg

type TxMsg struct {
	Type   string      `json:"type"`
	Params interface{} `json:"params"`
	From   []string    `json:"from"`
}

type UpdateCoinVR added in v0.0.8

type UpdateCoinVR struct {
	Volume  sdkmath.Int `json:"volume"`
	Reserve sdkmath.Int `json:"reserve"`
}

type Worker

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

func NewWorker

func NewWorker(cdc params.EncodingConfig, logger log.Logger, config *Config) (*Worker, error)

func (*Worker) GetBlockResult added in v0.0.8

func (w *Worker) GetBlockResult(height int64, txNum int) *Block

func (*Worker) Start

func (w *Worker) Start()

Jump to

Keyboard shortcuts

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