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
/learn @JO-OLADEJI/GingerBreadREADME
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
347.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
108.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
347.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
