Documentation ¶
Index ¶
- Constants
- Variables
- type Order
- func (o *Order) Approve(c *blockclient.Client, wallet *wallet.Wallet, ammount *big.Int) (*types.Receipt, error)
- func (o *Order) ApproveAmount(c *blockclient.Client, wallet *wallet.Wallet) (*types.Receipt, error)
- func (o *Order) ApproveMax(c *blockclient.Client, wallet *wallet.Wallet) (*types.Receipt, error)
- func (o *Order) CompAndSwap(c *blockclient.Client, wallet *wallet.Wallet, amount *big.Int) (*types.Receipt, error)
- func (o *Order) GetAddreses() []common.Address
- func (o *Order) GetBuyAmount() (*big.Int, error)
- func (o *Order) GetBuyToken() *Token
- func (o *Order) GetPriceStream(c bind.ContractBackend, done <-chan bool) (chan *big.Int, chan error)
- func (o *Order) GetSellToken() *Token
- func (o *Order) Init(client bind.ContractBackend, routerHex string, chainID int64) error
- func (o *Order) Swap(c *blockclient.Client, wallet *wallet.Wallet, amountOut *big.Int) (*types.Receipt, error)
- type Router
- type Token
- type Type
Constants ¶
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Order ¶
type Order struct { ID uint `json:"id"` Type Type `json:"type"` Path []string `json:"path"` SellAmount string `json:"sell_amount"` BuyAmount string `json:"buy_amount"` Slippage float64 `json:"slippage"` GasPriceMult float64 `json:"gas_price_multiplier"` GasLimit uint64 `json:"gas_limit"` UserID uint // contains filtered or unexported fields }
func (*Order) Approve ¶
func (o *Order) Approve(c *blockclient.Client, wallet *wallet.Wallet, ammount *big.Int) (*types.Receipt, error)
Executes the approve transaction if not already approved Returns the transaction or nil if the token is already approved
func (*Order) ApproveAmount ¶
Executes the approve transaction with the exact order sell amount
func (*Order) ApproveMax ¶
Executes the approve transaction with the maximum amount
func (*Order) CompAndSwap ¶
func (o *Order) CompAndSwap(c *blockclient.Client, wallet *wallet.Wallet, amount *big.Int) (*types.Receipt, error)
Compares the given amount with the wanted amount and returns the transaction or nil if no transaction has been made
func (*Order) GetAddreses ¶
Returns the addresses of the path
func (*Order) GetBuyAmount ¶
Calls get amounts out contract and returns the buy amount
func (*Order) GetBuyToken ¶
Returns the address of the token which will be bought
func (*Order) GetPriceStream ¶
func (o *Order) GetPriceStream(c bind.ContractBackend, done <-chan bool) (chan *big.Int, chan error)
Returns a price channel for receiving a stream of prices and a channel for error. Stops only when it receives from the done channel
func (*Order) GetSellToken ¶
Returns the address of the token which will be sold
type Token ¶
type Token struct { Address common.Address Decimals *big.Int Amount *big.Int Instance *bep20_token.Bep20Token }