chain

package
v0.0.0-...-a287f25 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainClient

type ChainClient interface {
	// account
	EncryptKey(pk *ecdsa.PrivateKey, password string) ([]byte, error)
	DecryptKey(cipher []byte, password string) (*ecdsa.PrivateKey, error)
	HexToPrivate(pk string) (*ecdsa.PrivateKey, string, error)
	AddAccount(private *ecdsa.PrivateKey) error
	GetSignAccount() (string, error)
	GetRelayerAccounts() []string

	// arb
	GetGasPrice(ctx context.Context, gasAddress string) ([]decimal.Decimal, error)

	// erc20
	BalanceOf(ctx context.Context, token, owner string, decimals int32) (decimal.Decimal, error)
	Allowance(ctx context.Context, token, owner, spender string, decimals int32) (decimal.Decimal, error)

	IsNotFoundError(err error) bool
	GetGasBalance(ctx context.Context, brokerAddress string, address string) (decimal.Decimal, error)
	GetLatestBlockNumber() (uint64, error)
	PendingNonceAt(account string) (uint64, error)
	TransactionByHash(txHash string) (bool, error)
	SendTransaction(tx *model.LaunchTransaction) (string, error)
	WaitTransactionReceipt(txHash string) (*model.Receipt, error)
	GetAccountStorage(ctx context.Context, readerAddress string, perpetualIndex int64, poolAddress, account string) (*model.AccountStorage, error)
	GetLiquidityPoolStorage(ctx context.Context, readerAddress, poolAddress string) (*model.LiquidityPoolStorage, error)
	FilterTradeSuccess(ctx context.Context, brokerAddress string, start, end uint64) ([]*model.TradeSuccessEvent, error)
	FilterTradeFailed(ctx context.Context, brokerAddress string, start, end uint64) ([]*model.TradeFailedEvent, error)
	BatchTradeDataPack(compressedOrders [][]byte, matchAmounts []decimal.Decimal, gasRewards []*big.Int) ([]byte, error)
	ParseLogs(brokerAddress string, logs []*ethtypes.Log) ([]*model.TradeSuccessEvent, []*model.TradeFailedEvent)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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