PoolTogether hyperstructure (v5) bot to find arbitrage opportunities and liquidate the prize token (likely WETH) for yield.
NOTE ON NODE VERSIONS: Requires Node v20 or greater
This package is helpful for working on the bot locally.
The bulk of determining if an arbitrage is profitable is in /packages/library/src/liquidator.ts#L44.
To run this bot locally first set up your environment variables using dotenv:
Copy .envrc.example and input the env variables needed to run this project.
cp .envrc.example .envrcOnce your env variables are setup, load them with:
direnv allowCHAIN_ID: The chain ID of which network to run the autotask on
JSON_RPC_URL: Your Infura/Alchemy/etc JSON RPC URL
MIN_PROFIT_THRESHOLD_USD: the minimum (in USD) you want to profit from each swap (ie. 1 is $1.00)
CUSTOM_RELAYER_PRIVATE_KEY: send transactions using your own EOA
CONTRACT_JSON_URL: the URL of the JSON file where the contract addresses and ABIs live (typically a commit on GitHub)
COVALENT_API_KEY: Your Covalent API key for getting USD values of tokens (optional)
### LIQUIDATOR SPECIFIC:
# OPTIONAL
SWAP_RECIPIENT: Address of the account that will receive the resulting swap tokens, can be any other contract/EOA address or if blank sets recipient to be the relayer address
# OPTIONAL, comma-seperated:
ENV_TOKEN_ALLOW_LIST: List of addresses that will be added to the token allowlist (if you want to liquidate new exotic tokens or your own prize vault tokens, add them here!)
# OPTIONAL, comma-seperated:
PAIRS_TO_LIQUIDATE: List of LiquidationPair addresses to filter by
# OPTIONAL, comma-seperated:
CLAIM_REWARDS: Claims rewards on behalf of SimpleVaultBooster contracts, rewards can then be liquidated by bots
When everything is set and the env vars have been exported you can run the bot locally:
npm run start
