A strategy implementing atomic, cross-market NFT arbitrage between Seaport and Sudoswap. At a high level, we listen to a stream of new seaport orders, and compute whether we can atomically fulfill the order and sell the NFT into a sudoswap pool while making a profit.
The strategy first syncs its initial state, by rebuilding the state of all Sudoswap pools in memory. We do this as follows:
- Starting from the Sudoswap factory deployment block, filter for all
NewPair
events emitted to build a full list of pools. - We batch read quotes for all pools by using a specialized quoter contract via eth_call bytecode injection.
- We update the state of a pair of HashMaps in memory for fast retrival of each NFT collection's best quote.
After the initial sync is done, we stream the following events:
- New Blocks: for every new block, we find all sudo pools that were either touched or created, and update their internal state in memory after getting new quotes.
- Seaport orders: we stream seaport orders, filtering for sell orders on the collections which have valid sudo quotes. We compute whether an arb is available, and if so, submit a transaction to our atomic arb contract.
This strategy relies on two contracts:
-
SudoOpenseaArb
: Execute an atomic arb by buying an NFT on seaport by callingfulfillBasicOrder
, and selling it on Sudoswap by callingswapNFTsForToken
. -
SudoPairQuoter
: Batch read contract that checks whether sudo pools have valid quotes.
In order to run the solidity test, you need access to an alchemy/infura key. You can run tests with the following command:
ETH_MAINNET_HTTP=<YOUR_KEY> forge test --root ./contracts
You can run the rust tests with the following command:
cargo test
And if you need to regenerate rust bindings for contracts, you can run
forge bind --bindings-path ./bindings --root ./contracts --crate-name bindings