{"id":17176208,"url":"https://github.com/haydenshively/cafe-chi","last_synced_at":"2026-01-28T02:51:46.622Z","repository":{"id":54270521,"uuid":"306549653","full_name":"haydenshively/Cafe-Chi","owner":"haydenshively","description":"Slow paced ETH-CHI arbitrage on Uniswap","archived":false,"fork":false,"pushed_at":"2021-06-09T08:45:54.000Z","size":161,"stargazers_count":17,"open_issues_count":0,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-20T17:24:28.950Z","etag":null,"topics":["1inch","arbitrage","bot","gas-token","uniswap","web3js"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/haydenshively.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-10-23T06:35:26.000Z","updated_at":"2025-04-14T13:09:15.000Z","dependencies_parsed_at":"2022-08-13T10:31:25.489Z","dependency_job_id":null,"html_url":"https://github.com/haydenshively/Cafe-Chi","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/haydenshively/Cafe-Chi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haydenshively%2FCafe-Chi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haydenshively%2FCafe-Chi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haydenshively%2FCafe-Chi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haydenshively%2FCafe-Chi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/haydenshively","download_url":"https://codeload.github.com/haydenshively/Cafe-Chi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haydenshively%2FCafe-Chi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28835151,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T02:10:51.810Z","status":"ssl_error","status_checked_at":"2026-01-28T02:10:50.806Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["1inch","arbitrage","bot","gas-token","uniswap","web3js"],"created_at":"2024-10-14T23:59:33.660Z","updated_at":"2026-01-28T02:51:46.599Z","avatar_url":"https://github.com/haydenshively.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cafe-Chi\n\n![Node.js CI](https://github.com/haydenshively/Cafe-Chi/workflows/Node.js%20CI/badge.svg)\n\nCafe-Chi is a fully operational arbitrage bot for the [CHI-ETH pair](https://info.uniswap.org/pair/0xa6f3ef841d371a82ca757fad08efc0dee2f1f5e2)\non Uniswap. Most arbitrage relies on complex routing algorithms to find the most\nprofitable path through a series of exchanges. In contrast, Cafe-Chi takes advantage\nof the fact that ETH can be used to mint CHI -- the two assets are uniquely coupled.\n\nThe price of CHI on Uniswap can be used to compute a sort of market-rate gas price\nfor transactions. Cafe-Chi sends transactions with gas prices slightly lower than\nthat market rate. If they get confirmed, CHI can be minted for less ETH than it\nwould take to buy it. The difference is taken as profit. Since profits are always\nin ETH and always get send back to `tx.origin`, Cafe-Chi is self-sustaining.\n\n## Project Layout\n\nAll Solidity code is under the `contracts` directory. In theory one could mint CHI,\nthen trade it on Uniswap, but here we use a flash swap for fun. Before going through\nwith the mint, the code checks that the transaction will be profitable according\nto `tx.gasprice` (technically some gas is spent before this check, but it's\nnegligble compared to what _would_ get spent during minting). If you're confused\nabout the math here, check out the excellent graphic at the top of [this page](https://uniswap.org/docs/v2/core-concepts/swaps/).\n\nSolidity code has already been deployed. Addresses can be found in the corresponding\n[Javascript wrapper](./src/network/webthree/haydenshively/cafechi.js). I haven't\nverified the code on Etherscan, but feel free to check it yourself or deploy your own\ncontracts.\n\nJavascript source code and tests are located in the `src` and `tests` directories\nrespectively.\n\n## Getting started\n\nInstall dependencies:\n\n```\nyarn install\n```\n\nAfter installation, you'll probably want to run some tests just to make sure your\nenvironment is set up correctly. Make sure your `.env` contains a `PROVIDER_INFURA_ID`\nand a `PROVIDER_ALCHEMY_KEY`. If you'd rather use your local node via IPC or some other\ncombination of providers, just multiple the array that's used to instantiate\n`MultiSendProvider` in [tests/setup.js](./tests/setup.js). Then run:\n\n```\nyarn test\n```\n\nTo actually run Cafe-Chi, you'll want to customize [config.json](./config.json). Each\nentry in the `txManagers` object should have its own `envKeyAddress` and `envKeySecret`.\nThese should reference the name of the `.env` variable that contains your address and\nsecret. For example, if your address is stored in the MY_ADDRESS variable, you should\nset `envKeyAddress: \"MY_ADDRESS\"`. Note that the \"secret\" is your private key *without*\nthe '0x' at the beginning, while your address should include the '0x'.\n\nOther parameters:\n\n- `interval`: How often (in seconds) to check market conditions and send new\ntransactions\n- `numPending`: How many transactions to keep pending at any given time. Don't set this\ntoo high, as you will eventually exhaust the arbitrage opportunity and all remaining\ntransactions will fail.\n- `ratio`: The percent of market-rate gas price that your transactions will be sent at.\nFor example, if the CHI-ETH pair thinks its CHI was minted at 30 gwei, and you set this\nto .99, your transactions will be sent at 29.7 gwei. Higher ratios are more likely to\nget confirmed, but lower ones result in more profit.\n- `providers`: Specifies what services will be used to send transactions. Infura will\nwork just fine. See [tests/setup.js](./tests/setup.js) for how to specify an Infura or\nAlchemy provider.\n\nAlso note that each txManager will run in its own Node.js process.\n\nFinally, it can be useful to get notifications when transactions are sent. If you want\nSlack messages, add a SLACK_WEBHOOK environment variable. Otherwise you can remove\nSlack from the winston transports array in [src/setup.js](./src/setup.js).\n\nReady to start? Run:\n\n```\nyarn cafe-chi\n```\n\nI recommend running this inside of a tmux session (`tmux new -s cafechi`) so that it\nwill run even if your SSH connection / terminal window gets closed.\n\n## What next?\n\nExperiment with the various parameters to see how consistently you can get transactions\nto go through, or modify the Solidity code to mint different amounts of CHI at once\n(I have one that mints 140 and another that mints only 10). As long as your account\nstarts out with ~0.2 ETH, you should be able to sit back and watch your balance grow\n(albeit rather slowly). Good luck!\n\n\u003e P.S. If you're a developer, feel free to write some tests for CafeChi.sol and/or\nsubmit a PR to use truffle rather than OpenZeppelin CLI.\n\n## Disclaimer\n\n_USE THIS CODE AT YOUR OWN RISK!_ There's no warranty of any kind, and I can't promise\nthat you'll make money. Do your own research.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaydenshively%2Fcafe-chi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhaydenshively%2Fcafe-chi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaydenshively%2Fcafe-chi/lists"}