Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
texora committed Jul 22, 2024
0 parents commit 6bbe793
Show file tree
Hide file tree
Showing 1,123 changed files with 183,702 additions and 0 deletions.
98 changes: 98 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
test-ledger/
node_modules/
sdks/
.vscode/

# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/out-tsc

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# IDEs and editors
.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# misc
.sass-cache
connect.lock
typings

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*


# Dependency directories
node_modules/
jspm_packages/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next

# Lerna
lerna-debug.log

# System Files
.DS_Store
Thumbs.db



21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 x19

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## solana arbitrage bot

happy searching :)

## layout
- `client/`: off-chain arbitrage bot code
- `program/`: on-chain swap program
- `pools/`: dex pool metadata
- `onchain-data/`: analysis of other arbitrage swaps
- `mainnet-fork/`: fork mainnet account states to test swap input/output estimates

each folder contains a corresponding `README.md` which explains how it works

## dexs supported
- serum
- aldrin
- saber
- mercurial
- orca

## other notes
- we use rust unit tests (with mainnet forking) to ensure our swap quotes are correct (quoted swap amount = actual swap amount)
- to figure out how to interface with each dex (most dont have rust sdks or even public ts sdks) we reverse engineer how to interact with them through the jupiter-swap sdk (analyzing the npm package folder bc its also not public)
- in the client we use a brute-force approach to find arb opportunities instead of negative cycle algos bc its much faster and can find all opportunities
- we also dont calculate the optimal swap input amount for each arb bc its faster to spam multiple decreasing amounts and let the largest one land (this is what the winner of the arbitrage opportunities was doing - eg, send tx with input size N, N/2, N/4, ...)
- why do we need an on-chain swap program? checkout this [post](https://github.com/0xNineteen/blog.md/blob/8292c9c27b29f7d290f022a097511bb07bda4ea3/contents/rust-macros-arbitrage/index.md) out -- if you swap from A -> B -> C you might get more/less of B than expected which effects the swap instruction to C

## why share this alpha

the life of a lone searcher is a lonely one where you cant share what you find or share your code - while working on this project i realized this is not what im about and thus i open source
2 changes: 2 additions & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
log.txt
target/
Loading

0 comments on commit 6bbe793

Please sign in to comment.