swap

package
v0.0.0-...-50fcca9 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2021 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SwapTokenReceived common.SwapStatus = "received"
	SwapQuoteRejected common.SwapStatus = "rejected"
	SwapConfirmed     common.SwapStatus = "confirmed"
	SwapSending       common.SwapStatus = "sending"
	SwapSent          common.SwapStatus = "sent"
	SwapSendFailed    common.SwapStatus = "sent_fail"
	SwapSuccess       common.SwapStatus = "sent_success"

	SwapPairReceived   common.SwapPairStatus = "received"
	SwapPairConfirmed  common.SwapPairStatus = "confirmed"
	SwapPairSending    common.SwapPairStatus = "sending"
	SwapPairSent       common.SwapPairStatus = "sent"
	SwapPairSendFailed common.SwapPairStatus = "sent_fail"
	SwapPairSuccess    common.SwapPairStatus = "sent_success"
	SwapPairFinalized  common.SwapPairStatus = "finalized"

	RetrySwapConfirmed  common.RetrySwapStatus = "confirmed"
	RetrySwapSending    common.RetrySwapStatus = "sending"
	RetrySwapSent       common.RetrySwapStatus = "sent"
	RetrySwapSendFailed common.RetrySwapStatus = "sent_fail"
	RetrySwapSuccess    common.RetrySwapStatus = "sent_success"

	SwapEth2BSC common.SwapDirection = "eth_bsc"
	SwapBSC2Eth common.SwapDirection = "bsc_eth"

	BatchSize                = 50
	TrackSentTxBatchSize     = 100
	SleepTime                = 5
	SwapSleepSecond          = 2
	TrackSwapPairSMBatchSize = 5

	TxFailedStatus = 0x00

	MaxUpperBound = "999999999999999999999999999999999999"
)

Variables

This section is empty.

Functions

func BuildKeys

func BuildKeys(privateKeyStr string) (*ecdsa.PrivateKey, *ecdsa.PublicKey, error)

func GetKeyConfig

func GetKeyConfig(cfg *util.Config) (*util.KeyConfig, error)

Types

type SwapEngine

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

func NewSwapEngine

func NewSwapEngine(db *gorm.DB, cfg *util.Config, bscClient, ethClient *ethclient.Client) (*SwapEngine, error)

NewSwapEngine returns the swapEngine instance

func (*SwapEngine) AddSwapPairInstance

func (engine *SwapEngine) AddSwapPairInstance(swapPair *model.SwapPair) error

func (*SwapEngine) GetSwapPairInstance

func (engine *SwapEngine) GetSwapPairInstance(erc20Addr ethcom.Address) (*SwapPairIns, error)

func (*SwapEngine) InsertRetryFailedSwaps

func (engine *SwapEngine) InsertRetryFailedSwaps(swapIDList []uint) ([]uint, []uint, error)

func (*SwapEngine) Start

func (engine *SwapEngine) Start()

func (*SwapEngine) UpdateSwapInstance

func (engine *SwapEngine) UpdateSwapInstance(swapPair *model.SwapPair)

func (*SwapEngine) WithdrawToken

func (engine *SwapEngine) WithdrawToken(chain string, tokenAddr, recipient ethcom.Address, amount *big.Int) (string, error)

type SwapPairEngine

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

func NewSwapPairEngine

func NewSwapPairEngine(db *gorm.DB, cfg *util.Config, bscClient *ethclient.Client, swapEngine *SwapEngine) (*SwapPairEngine, error)

func (*SwapPairEngine) Start

func (engine *SwapPairEngine) Start()

type SwapPairIns

type SwapPairIns struct {
	Symbol     string
	Name       string
	Decimals   int
	LowBound   *big.Int
	UpperBound *big.Int

	BEP20Addr ethcom.Address
	ERC20Addr ethcom.Address
}

Jump to

Keyboard shortcuts

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