Documentation
¶
Index ¶
- func CheckTokenBalance(tokenAddress, address common.Address, client *ethclient.Client) (error, *big.Int)
- func ConvertETHtoWETH(zk *Zk, client *ethclient.Client, chainID *big.Int, ...) (*types.Transaction, error)
- func GetOurRawTx(zk *Zk, chainID *big.Int, client *ethclient.Client, nonce uint64, ...) (*types.Transaction, string, error)
- func GetPairAddress(contractAddress, token, otherToken string) (common.Address, common.Address, error)
- func GetRawTx(hash string) string
- func Kill(zk *Zk, client *ethclient.Client, chainID *big.Int, ...) (*types.Transaction, error)
- func SendFlashbotsBundle(zk *Zk, client *ethclient.Client, flashbotsRelay string, bundle []string, ...) (string, error)
- func SetContractTrader(client *ethclient.Client, _address string) *contracts.FlashbotsTrader
- type FlashbotsTradeReturn
- type Zk
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckTokenBalance ¶
func CheckTokenBalance(tokenAddress, address common.Address, client *ethclient.Client) (error, *big.Int)
Checks token balance of a given address
func ConvertETHtoWETH ¶
func ConvertETHtoWETH(zk *Zk, client *ethclient.Client, chainID *big.Int, instance *contracts.FlashbotsTrader, WETHAddress string, ETHAmount_wei, gasPrice *big.Int) (*types.Transaction, error)
Converts ETHAmount_wei into WETH Note: Assumes contract already has ETH
func GetOurRawTx ¶
func GetOurRawTx(zk *Zk, chainID *big.Int, client *ethclient.Client, nonce uint64, token0 common.Address, instance *contracts.FlashbotsTrader, gasPrice *big.Int, inputToken, poolAddress common.Address, minerAmount, inputTokenAmount, outputTokenAmount, blockNumberToExecute *big.Int) (*types.Transaction, string, error)
Get our txHash and raw signed transaction
func GetPairAddress ¶
func GetPairAddress(contractAddress, token, otherToken string) (common.Address, common.Address, error)
Get the address of a UniswapV2 / SushiswapV2 pair given two contract addresses The first string returned is token0
func Kill ¶
func Kill(zk *Zk, client *ethclient.Client, chainID *big.Int, instance *contracts.FlashbotsTrader, gasPrice *big.Int) (*types.Transaction, error)
Selfdestructs instance and sends any ETH to our EOA
func SendFlashbotsBundle ¶
func SendFlashbotsBundle(zk *Zk, client *ethclient.Client, flashbotsRelay string, bundle []string, blockNumberToExecute *big.Int) (string, error)
Sends bundle to Flashbots relay, targetting a specific blockNumber to execute
func SetContractTrader ¶
func SetContractTrader(client *ethclient.Client, _address string) *contracts.FlashbotsTrader
Loads instance of FlashbotsTrader contract at its deployed address
Types ¶
type FlashbotsTradeReturn ¶
type FlashbotsTradeReturn struct { Executed bool Txs map[*big.Int][2]common.Hash BlockDeadline *big.Int }
func ExecuteDEXBuyAndSell ¶
func ExecuteDEXBuyAndSell(zk *Zk, chainID *big.Int, client *ethclient.Client, instance *contracts.FlashbotsTrader, flashbotsRelay string, WETHAddress, tokenAddress, poolAddress, token0 common.Address, WETHAmountBuy_wei, TokenAmountBuy, WETHAmountSell_wei, gasPrice, minerAmount *big.Int, nBundles uint64) (FlashbotsTradeReturn, error)
Simple example of submitting a WETH -> Token Buy, followed by a Token -> WETH sell. Works for both Flashbots and mempool, as dictated by isMempool bool.
type Zk ¶
type Zk struct { D *ecdsa.PrivateKey FromAddress common.Address }
EOA struct
func (*Zk) SetWalletFromMnemonic ¶
Setup wallet struct from mnemonic input, picking one of its EOA addresses via walletAddressIdx