Skip to content

Instantly share code, notes, and snippets.

Deconstructing a $2.5M CEX-DEX Arbitrage Bot

Atomic MEV is becoming tougher in recent years as competition intensifies and more skilled teams enter the game. To stay competitive, teams integrate more exchanges and capture untouched arbitrage paths and order flow which is not always trivial, especially when dealing with cross-chain MEV or any non atomic arbitrage.

One common arbitrage is CEX-DEX arbitrage. I've noticed many on-chain bots but never dug deep into their performance until now.

I'll be looking at the bot 0x98C3d3183C4b8A650614ad179A1a98be0a8d6B8E, specifically the transaction 0x6f94aa47e74de8897979fdc3b6e541bb515be9c72f2a912cd548f98e2c11729a USUAL ETH Swap

Investigating the Trade

This token is listed on many exchanges, I'll focus on Bina

@tatelax
tatelax / firebase-scheduled-functions-emulator.js
Last active May 22, 2025 01:48
Emulate Firebase Functions
// Provide database URL and database name where specified
// Provide file location for your function
const express = require("express");
const admin = require("firebase-admin");
const functions = require("firebase-functions/v2");
const cron = require("node-cron");
const app = express();
@jlia0
jlia0 / agent loop
Last active August 3, 2025 06:45
Manus tools and prompts
You are Manus, an AI agent created by the Manus team.
You excel at the following tasks:
1. Information gathering, fact-checking, and documentation
2. Data processing, analysis, and visualization
3. Writing multi-chapter articles and in-depth research reports
4. Creating websites, applications, and tools
5. Using programming to solve various problems beyond development
6. Various tasks that can be accomplished using computers and the internet
@VictorTaelin
VictorTaelin / claude_code_hvm_work.txt
Created March 5, 2025 02:18
Claude Code optimizes HVM3-Nano from 183 MIPS to 265 MIPS on Apple M3 // 217 MIPS to 328 MIPS on Apple M4
╭────────────────────────────────────────────╮
│ ✻ Welcome to Claude Code research preview! │
│ │
│ /help for help │
│ │
│ cwd: /Users/v/vic/dev/IC │
╰────────────────────────────────────────────╯
! cat InteractionCalculus.md
@dg
dg / gist:72bc9f585a068d2e9c4edc5ae4c6d9ee
Created October 6, 2024 01:19
gpt-4o-canmore system prompt
## canmore
// # The `canmore` tool creates and updates text documents that render to the user on a space next to the conversation (referred to as the "canvas").
// Lean towards NOT using `canmore` if the content can be effectively presented in the conversation. Creating content with `canmore` can be unsettling for users as it changes the UI.
// ## How to use `canmore`:
// - To create a new document, use the `create_textdoc` function. Use this function when the user asks for anything that should produce a new document. Also use this when deriving a new document from an existing one.
@PraneshASP
PraneshASP / Test.t.sol
Last active February 13, 2024 05:11
Using Mesc in foundry tests to avoid hardcoding urls.
// See Mesc Reference for setup: https://github.com/paradigmxyz/mesc/tree/main/cli#reference
contract TestSetup is Test {
function fetchRpcUrlFromMesc(string memory networkName) internal returns (string memory url) {
string[] memory inputs = new string[](3);
inputs[0] = "mesc";
inputs[1] = "url";
inputs[2] = networkName;
@Shungy
Shungy / EIP138128.md
Last active December 26, 2023 22:21
EIP138128: Custom selector and encodings (Very early draft)

Using LEB128 encoding scheme for custom abi/interface.

ERC-138128: Custom function selector and calldata encoding scheme declaration standard

  • A contract SHOULD use ERC-165 standard to declare its support for ERC-138128 standard.
  • A contract supporting ERC-138128 MUST have these two view functions: customSelectors() and customEncodings().

customSelectors()

This function is used to declare alternative function selectors for any number of standard function signatures. This function MUST have the following interface.

@cassc
cassc / rekt.news.bugs.md
Created October 6, 2023 04:14
rekt.news bugs summary by chatgpt3.5

11-rekt

  • Contract names: Eleven.finance, Nerve Finance, NRV vault, Eleven "MasterMind" farming contract
  • Contract hex addresses: Not mentioned in the article
  • Bug types mentioned in the article:
    1. Vulnerable function (emergencyBurn()) in the intermediate vault contract
    2. Flashloan exploit
    3. Logic issue
    4. Unauthorized withdrawal
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
import "hardhat/console.sol";
contract TryCatchCaller {
TryCatchCallee calee;
constructor () {
calee = new TryCatchCallee();
"use strict";
const defaultOptions = {
reverse: true,
python: false
}
function merge(sequences) {
let result = [];
sequences = sequences.map(s => s.slice());