GingerBread
A bot for executing arbitrage trades using flash swaps on the avalanche C-chain. Has the option to log successful arbitrage trades on Telegram.
Install / Use
npx skills add JO-OLADEJI/GingerBreadInstalls into whichever agent you are using.
README
GingerBread 🍪
A bot for executing arbitrage trades using flash swaps on the avalanche C-chain. Has the option to log succesful arbitrage trades on Telegram. <br /> <br />
How to Prepare 🥘
- clone this reposity:
git clone https://github.com/Joshua-Oladeji/GingerBread.git
-
run
npm installfrom the root directory to install dependencies -
fill the .env.example file with the appropriate data and rename the file to .env
PRIVATE_KEY: private key of the contract deployer address (metamask)GANACHE_PRIVATE_KEYprivate key of the deployer address from GanacheGANACHE_ADDR1_PRIVATE_KEYprivate key of another address from Ganache. This is only needed if you want to run the unit tests.C_CHAIN_NODE: a link that connects you to an avalanche C-chain node. you can get a 'speedy-node' from moralis.ioTELEGRAM_BOT_TOKEN: an authorization token from Telegram's Bot father. it's pretty easy to get oneSERVER_URL: base url of your server. it's for configuring a webhook for your telegram bot. if you're running on localhost, you will need to expose your server via a public url. check out ngrokFLASH_SWAP_ADDRESS: contract address of the bot you'll deploy
-
compile the contract using the following command:
npx hardhat compile
- deploy the contract to your preferred network. available networks can be found in
hardhat.config.js. default network is Ganache, so make sure to spin up a local blockchain using ganache before running this command.
npx hardhat run scripts/deploy.js --network <network-name>
- run the
server.jsfile, relax and wait to be served. <br />
Methods ⚡
you might want to know the purpose of each method if you want to tweak some things in the recipe. <br />
constructor(token0, token1) 🔥
- a new GingerBread is initialized with 2 parametes which represents the tokens that constitute a pair.
- each parameter is an object containing the 'symbol', 'address' and 'volume' keys.... like so:
{
symbol: 'WAVAX',
address: '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7',
volume: 1000
}
- volume represents the amount of a particular tokens to be borrowed during the arbitrage. <br />
bake() 👩🍳
- this method runs the bot by listening to every new block and executing arbitrage opportunities if they exist. <br />
taste() 🍰
- logs the prices of the tokens on the pangolin and traderjoe DEXes.
- logs the potential profit/loss realized if an arbitrage is attempted based on the current tokens prices.
<br />
serve() 🍽
- adds listeners for all events on the FlashSwapper contract. info from every event is then emitted to be logged to telegram. <br />
flourRemaining()
- returns the balance of AVAX remaining (gas fees) in the FlashSwapper contract. <br />
Written originally as a submission for @cryptofishx bounty.
Related Skills
node-connect
385.5kDiagnose OpenClaw Android, iOS, or macOS node pairing, QR/setup code, route, auth, and connection failures.
blender-python-addon
40.5kBlender Python add-on rules for operators, panels, properties, registration, testing, and API-safe scripting
flutter-development-guidelines-cursorrules-prompt-file
40.5kCursor rules for Flutter development with MVVM architecture, Riverpod state management, Material widgets, and Dart style guidelines.
commit-push-pr
140.7kCommit, push, and open a PR
