watcher

package
v0.0.0-...-1bfa4a9 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2021 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddressEncodeDecoder

func AddressEncodeDecoder(chain multichain.Chain, network multichain.Network) multichain.AddressEncodeDecoder

func NetParams

func NetParams(chain multichain.Chain, net multichain.Network) *chaincfg.Params

func ZcashNetParams

func ZcashNetParams(network multichain.Network) *zcash.Params

Types

type BlockHeightFetcher

type BlockHeightFetcher interface {
	FetchBlockHeight(ctx context.Context) (uint64, error)
}

type BurnInfo

type BurnInfo struct {
	Txid        pack.Bytes
	Amount      pack.U256
	ToBytes     []byte
	Nonce       pack.Bytes32
	BlockNumber pack.U64
}

type BurnLogFetcher

type BurnLogFetcher interface {
	FetchBurnLogs(ctx context.Context, from uint64, to uint64) (chan BurnLogResult, error)
}

type BurnLogResult

type BurnLogResult struct {
	Result BurnInfo
	Error  error
}

type EthBlockHeightFetcher

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

func NewEthBlockHeightFetcher

func NewEthBlockHeightFetcher(ethClient *ethclient.Client) EthBlockHeightFetcher

func (EthBlockHeightFetcher) FetchBlockHeight

func (fetcher EthBlockHeightFetcher) FetchBlockHeight(ctx context.Context) (uint64, error)

currentBlockNumber returns the current block number for the chain being watched

type EthBurnLogFetcher

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

func NewEthBurnLogFetcher

func NewEthBurnLogFetcher(bindings *gatewaybinding.MintGatewayLogicV1) EthBurnLogFetcher

func (EthBurnLogFetcher) FetchBurnLogs

func (fetcher EthBurnLogFetcher) FetchBurnLogs(ctx context.Context, from uint64, to uint64) (chan BurnLogResult, error)

This will fetch the burn event logs using the ethereum bindings and emit them via a channel We do this so that we can unit test the log handling without calling ethereum

type SolFetcher

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

func NewSolFetcher

func NewSolFetcher(client *solanaRPC.Client, gatewayAddress string) SolFetcher

func (SolFetcher) FetchBlockHeight

func (fetcher SolFetcher) FetchBlockHeight(ctx context.Context) (uint64, error)

Behaves differently, as it checks the maximum burn index that should be fetched

func (SolFetcher) FetchBurnLogs

func (fetcher SolFetcher) FetchBurnLogs(ctx context.Context, from uint64, to uint64) (chan BurnLogResult, error)

type Watcher

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

Watcher watches for event logs for burn transactions. These transactions are then forwarded to the cacher.

func NewWatcher

func NewWatcher(logger logrus.FieldLogger, network multichain.Network, selector tx.Selector, bindings binding.Bindings, burnLogFetcher BurnLogFetcher, blockHeightFetcher BlockHeightFetcher, resolver jsonrpc.Resolver, cache redis.Cmdable, pollInterval time.Duration, maxBlockAdvance uint64, confidenceInterval uint64) Watcher

NewWatcher returns a new Watcher.

func (Watcher) Run

func (watcher Watcher) Run(ctx context.Context)

Run starts the watcher until the context is canceled.

Jump to

Keyboard shortcuts

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