binance

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: MIT Imports: 44 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Binance

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

Binance is a structure to sign and broadcast tx to binance chain used by signer mostly

func NewBinance

func NewBinance(ddKeys *ddclient.Keys, cfg config.BifrostChainConfiguration, server *tssp.TssServer, ddchainBridge ddclient.DdchainBridge, m *metrics.Metrics) (*Binance, error)

NewBinance create new instance of binance client

func (*Binance) BroadcastTx

func (b *Binance) BroadcastTx(tx stypes.TxOutItem, hexTx []byte) (string, error)

BroadcastTx is to broadcast the tx to binance chain

func (*Binance) ConfirmationCountReady

func (b *Binance) ConfirmationCountReady(txIn stypes.TxIn) bool

ConfirmationCountReady binance chain has almost instant finality , so doesn't need to wait for confirmation

func (*Binance) GetAccount

func (b *Binance) GetAccount(pkey common.PubKey, height *big.Int) (common.Account, error)

func (*Binance) GetAccountByAddress

func (b *Binance) GetAccountByAddress(address string, height *big.Int) (common.Account, error)

func (*Binance) GetAddress

func (b *Binance) GetAddress(poolPubKey common.PubKey) string

GetAddress return current signer address, it will be bech32 encoded address

func (*Binance) GetChain

func (b *Binance) GetChain() common.Chain

func (*Binance) GetConfig

func (b *Binance) GetConfig() config.BifrostChainConfiguration

GetConfig return the configuration used by Binance chain client

func (*Binance) GetConfirmationCount

func (b *Binance) GetConfirmationCount(txIn stypes.TxIn) int64

GetConfirmationCount determinate how many confirmation it required

func (*Binance) GetHeight

func (b *Binance) GetHeight() (int64, error)

func (*Binance) IsBlockScannerHealthy

func (b *Binance) IsBlockScannerHealthy() bool

func (*Binance) OnObservedTxIn

func (b *Binance) OnObservedTxIn(txIn stypes.TxInItem, blockHeight int64)

func (*Binance) ReportSolvency

func (b *Binance) ReportSolvency(bnbBlockHeight int64) error

func (*Binance) ShouldReportSolvency

func (b *Binance) ShouldReportSolvency(height int64) bool

ShouldReportSolvency given block height , should chain client report solvency to DDNode

func (*Binance) SignTx

func (b *Binance) SignTx(tx stypes.TxOutItem, ddchainHeight int64) ([]byte, []byte, *stypes.TxInItem, error)

SignTx sign the the given TxArrayItem

func (*Binance) Start

func (b *Binance) Start(globalTxsQueue chan stypes.TxIn, globalErrataQueue chan stypes.ErrataBlock, globalSolvencyQueue chan stypes.Solvency)

Start Binance chain client

func (*Binance) Stop

func (b *Binance) Stop()

Stop Binance chain client

type BinanceBlockScanner

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

BinanceBlockScanner is to scan the blocks

func NewBinanceBlockScanner

func NewBinanceBlockScanner(cfg config.BifrostBlockScannerConfiguration,
	scanStorage blockscanner.ScannerStorage,
	isTestNet bool,
	bridge ddclient.DdchainBridge,
	m *metrics.Metrics, solvencyReporter SolvencyReporter,
) (*BinanceBlockScanner, error)

NewBinanceBlockScanner create a new instance of BlockScan

func (*BinanceBlockScanner) BlockRequest

func (b *BinanceBlockScanner) BlockRequest(height int64) string

func (*BinanceBlockScanner) FetchMemPool

func (c *BinanceBlockScanner) FetchMemPool(height int64) (stypes.TxIn, error)

func (*BinanceBlockScanner) FetchTxs

func (b *BinanceBlockScanner) FetchTxs(height, chainHeight int64) (stypes.TxIn, error)

func (*BinanceBlockScanner) GetHeight

func (b *BinanceBlockScanner) GetHeight() (int64, error)

func (*BinanceBlockScanner) UnmarshalBlock

func (b *BinanceBlockScanner) UnmarshalBlock(buf []byte) ([]string, error)

type BinanceMetaDataStore

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

func NewBinanceMetaDataStore

func NewBinanceMetaDataStore() *BinanceMetaDataStore

func (*BinanceMetaDataStore) Get

func (*BinanceMetaDataStore) GetByAccount

func (b *BinanceMetaDataStore) GetByAccount(acct int64) BinanceMetadata

func (*BinanceMetaDataStore) SeqInc

func (b *BinanceMetaDataStore) SeqInc(pk common.PubKey)

func (*BinanceMetaDataStore) Set

type BinanceMetadata

type BinanceMetadata struct {
	AccountNumber int64
	SeqNumber     int64
	BlockHeight   int64
}

type SolvencyReporter

type SolvencyReporter func(int64) error

SolvencyReporter is to report solvency info to DDNode

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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