shuttleflow

package
v0.0.0-...-f9b7526 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2021 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindContract

func BindContract(client *ethclient.Client, addr string, abiPath string) (*bind.BoundContract, error)

BindContract binds a generic wrapper to an already deployed contract.

func GetBTCBalance

func GetBTCBalance(addr string) (*big.Int, error)

GetBTCBalance returns the balance of the address with error code.

func GetBTCCurrentHeight

func GetBTCCurrentHeight() int64

GetBTCCurrentHeight Get BTC current height

func GetBTCEvents

func GetBTCEvents(addr string, fromHeight *big.Int, toHeight *big.Int) []gobcy.TX

GetBTCEvents Get BTC events

func GetCFXEvents

func GetCFXEvents(cfx *sdk.Client, epoch *big.Int, erc777s []types.Address, topics [][]types.Hash) ([]types.Log, error)

GetCFXEvents ..

func GetCreate2Transactions

func GetCreate2Transactions(client *ethclient.Client, addr string, blockNumber *big.Int, abi ethabi.ABI) []string

GetCreate2Transactions Get create2-generated addresses from Blockcypher

func GetETHBalance

func GetETHBalance(client *ethclient.Client, addr string) (*big.Int, error)

GetETHBalance returns the balance of the address with error code.

func GetETHEvents

func GetETHEvents(client *ethclient.Client, blockNumber *big.Int, walletMap map[string]bool) []*types.Transaction

GetETHEvents Get ETH events

func GetETHEventsByAPI

func GetETHEventsByAPI(addr string, fromHeight *big.Int, toHeight *big.Int) []gobcy.TXRef

GetETHEventsByAPI Get ETH events by Blockcypher

func GetETHLatestBlock

func GetETHLatestBlock(client *ethclient.Client) *big.Int

GetETHLatestBlock Get the latest ETH block

func GetUSDTBalance

func GetUSDTBalance(client *ethclient.Client, addr string, usdt *bind.BoundContract, opts *bind.CallOpts) (*big.Int, error)

GetUSDTBalance returns the balance of the address with error code.

func GetUSDTEvents

func GetUSDTEvents(client *ethclient.Client, addr string, fromBlock *big.Int, toBlock *big.Int, topics [][]common.Hash) []types.Log

GetUSDTEvents Get USDT events

func MustGetBTCBalance

func MustGetBTCBalance(addr string) *big.Int

MustGetBTCBalance the balance of the address.

func MustGetBurnedTx

func MustGetBurnedTx(ethFactory *bind.BoundContract, txHash string, opts *bind.CallOpts) bool

MustGetBurnedTx ..

func MustGetETHBalance

func MustGetETHBalance(client *ethclient.Client, addr string) *big.Int

MustGetETHBalance returns the balance of the address.

func MustGetUSDTBalance

func MustGetUSDTBalance(client *ethclient.Client, addr string, usdt *bind.BoundContract, opts *bind.CallOpts) *big.Int

MustGetUSDTBalance returns the balance of the address.

func Start

func Start(cfxURL string, shuttleURL string, assets []common.Asset, cb *Config, wg *sync.WaitGroup)

Start bootstraps auditor workers for ShuttleFlow

Types

type BTCBalance

type BTCBalance struct {
	Address            string           `json:"address"`
	TotalReceived      int64            `json:"total_received"`
	TotalSent          int64            `json:"total_sent"`
	Balance            int64            `json:"balance"`
	UnconfirmedBalance int64            `json:"unconfirmed_balance"`
	FinalBalance       int64            `json:"final_balance"`
	NTx                int64            `json:"n_tx"`
	UnconfirmedNTx     int64            `json:"unconfirmed_n_tx"`
	FinalNTx           int64            `json:"final_n_tx"`
	TxRefs             []TransactionRef `json:"txrefs"`
}

BTCBalance balance of BTC address

type Config

type Config struct {
	TimeoutInMinute  int64
	TimeoutInSecond  int64
	ETHDial          string
	LevelDBPath      string
	Create2Sync      bool
	BTCInitialHeight int64
	ETHInitialBlock  int64
	ETHDelayBlock    int64
	CFXInitialBlock  string
	BTCMinus         int64
}

Config configuration for shuttleflow auditor

type DepositInspector

type DepositInspector struct {
	Client    *conflux.Client
	Timeout   time.Duration
	BTCWallet string
	Factory   string
	USDT      string
	Custodian *common.Contract
	Cb        *Config
}

DepositInspector auditor

func (*DepositInspector) Start

func (d *DepositInspector) Start(wg *sync.WaitGroup, vp *viper.Viper)

Start up an auditor

type LogTransfer

type LogTransfer struct {
	From  common.Address
	To    common.Address
	Value *big.Int
}

LogTransfer ..

type TransactionRef

type TransactionRef struct {
	TxHash        string `json:"tx_hash"`
	BlockHeight   int64  `json:"block_height"`
	TxInputN      int64  `json:"tx_input_n"`
	TxOutputN     int64  `json:"tx_output_n"`
	Value         int64  `json:"value"`
	RefBalance    int64  `json:"ref_balance"`
	Spent         bool   `json:"spent"`
	Confirmations int64  `json:"confirmations"`
	Confirmed     string `json:"confirmed"`
	DoubleSpend   bool   `json:"double_spend"`
}

TransactionRef transaction ref

type WithdrawInspector

type WithdrawInspector struct {
	Client     *conflux.Client
	Timeout    time.Duration
	Erc777Map  map[string]*common.Contract
	BTCWallet  string
	ETHFactory *bind.BoundContract
	Cb         *Config
}

WithdrawInspector auditor

func (*WithdrawInspector) Start

func (w *WithdrawInspector) Start(wg *sync.WaitGroup, vp *viper.Viper)

Start up an auditor

type Worker

type Worker struct {
	Erc777Map   map[string]*common.Contract
	UsdtAddress string
	Cb          *Config
}

Worker auditor

func (*Worker) Start

func (w *Worker) Start(wg *sync.WaitGroup, vp *viper.Viper)

Start up an auditor

Jump to

Keyboard shortcuts

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