This bot requires you to run the GETH client + use ethers framework.
Supports any EVM environment and UniSwapV2 forked AMM seemlessly.
This is heavily based on https://github.com/Supercycled/cake_sniper, so major thanks to him.
Use at you own risk.
AX-50 is a frontrunning bot primarily aimed at liquidity sniping on AMMs like PancakeSwap. Even though this repository serves as a liquidity sniper, it's architecture is flexible enough to allow any type of frontrunning operation to be built on top of it (eg. liquidations, sandwich attacks, etc).
Being able to frontrun implies building over GETH client and having access to the mempool. It's HIGHLY RECOMMENDED to have your own node for liquidity sniping (and pretty much any frontrunning operation). If you don't have access to a node of your own the bot still supports a less performant mode of sniping.
The bot is divided in 2 sections:
- Configurations: An initial phase (previous to the actual snipe) where we configure the environment:
- A trigger contract which is setted up with the configuration of the token you want to snipe (token address, route of swap, amount, wallet address that receives, etc). This trigger will be the one in charge of buying the tokens thus performing the snipe, when the time comes.
- A swarm of accounts/wallets that will clogg the mempool once the liquidity is added, executing the snipe through the trigger. This swarm of accounts is useful because we will be racing against other bots trying to frontrun the liquidity addition. So the more accounts trying the better the odds. Ideally one of all the accounts will succesfully snipe while the others will fail/revert (without doing nothing, except wasting gas).
- Sniping: Consists on a stimulus phase where we listen to a stimulus of a liquidity addition. Once we spot it we clogg the mempool with our own txs executing the trigger that will perform the snipe (one tx per account in the swarm). All txs have the same gas as the liquidity addition tx, so the mempool sets them (ideally) at the same priority as the add liq tx. addition, hence frontrunning others. Sniping can be performed in 2 modes: PendingTxs or Block. Each one offers vastly different results at the cost of resources.
- PendingTxs: The most performant and profitable mode, but by far the most resource intensive. This mode observes pending txs arriving to the mempool whilst looking for the liquidity addition we expect.
- Block: Far less performant mode but with way lower requirements. This mode observes newly mined blocks as they are added to the head of the blockchain and scans the txs in it, looking for the liquidity addition we expect.
-
Create a
config/local.json
file following the template and samples provided inside the directory (config/*.local.json
). This will be used by our scripts in the configuration and sniping phase. (you won't have yet the trigger address, this comes later) -
Deploy all contracts using the truffle migrations (create an
.env
file withBINANCE_MAINNET_WALLET_PRIVATE_KEY
orBINANCE_MAINNET_WALLET_MNEMONIC
). Contract deployment uses variables provided inconfig/local.json
(eg. the factory ones) so make sure to have it properly configured beforehand. Running them should configure:- The trigger custom router address with your CustomRouter
- The trigger admin with the deployer wallet (this is important)
- Trigger and Router addresses (factory, native wrapped coin, factory creationCode hash)
-
Set the trigger address generated by the contract deployment in your
config/local.json
. -
If you don't have a swarm yet, create one running
npm run create-swarm
. This should create aconfig/bee_book.json
similar to the template one (config/template.bee_book.json
) to be used by the sniper on each snipe -
[Optional] Preview the order you will create and snipe with
npm run order-preview
, to avoid undesired results. -
Configure the trigger contract with the provided order running
npm run configure-trigger
-
[Optional] If you want to recover the spread bnb in the swarm or rollback the trigger configuration (recovering the bnb supplied), run
npm run swarm-refund
/npm run withdraw-trigger
. Else leave it there for future snipes.
In future snipes, you can avoid most of the steps and just run step 1 & 6, simply configuring the trigger for a new snipe.
If you have already configured the trigger contract, simply leave the client running with go run ./...
. Once the liquidity is added it should snipe it transparently.
And that's it! the bot should be working without hassles! The bot is currently defined to work with any EVM and UniSwapV2 forked AMM.
If you found the bot useful and you want to share some of those juicy profits with me, I accept donations through BEP20 (BSC) at 0x8f5d3374373aDA8b2c201C5cAc4c384FD42d2390
in any type of token (hopefully one with liquidity hehe)
Cheers and happy sniping!