Company: HodlTree
Role: Senior Solidity Developer
Stack: Solidity 0.8.0 · Truffle · Ganache · Mocha · Web3.js · OpenZeppelin
Period: 09/2020 - 05/2021
Smart contract framework orchestrating atomic arbitrage trades and flash loan interactions across multiple decentralized exchanges. The architecture abstracts protocol-specific complexity through modular connector contracts, enabling seamless execution of sophisticated multi-leg trading strategies across Ethereum and Polygon. Implements delegatecall-based proxy pattern with stateful memory threading to execute complex arbitrage paths atomically without intermediate state mutations. Operated alongside a self-hosted Geth full node for low-latency RPC access in time-sensitive arbitrage execution.
| Decision | Rationale |
|---|---|
| Delegatecall proxy over wrapper contracts | Atomic execution within single contract context eliminates intermediate transfers and reentrancy risks |
| Modular connectors per DEX | Protocol-specific optimizations (Curve dynamics, Bancor paths, 0x fees) reduce generic overhead |
| ArbMemory for state threading | Reduces calldata overhead and enables reusable transaction templates for complex multi-leg arbitrage |
| Flash loan callback patterns | Callback-based repayment verification enables 0-capital arbitrage on both Uniswap V3 and Balancer pools |
| Direct pool interaction | Bypasses router layers, reducing hop count and implicit protocol fees for maximum spread capture |
Flash loan callbacks authorized via a one-time token. When a flash loan is initiated, the expected caller’s address is written into a dedicated memory slot. The callback reads that slot to verify the caller - and the read destroys the value. Authorization is consumed by the act of checking it, so no explicit cleanup is needed and replay is structurally impossible.
Same interface for simple and chained swaps. Every connector function accepts an optional memory reference alongside the explicit amount. When the reference is absent, the value travels directly in the call; when present, it is fetched from shared memory and erased after use. This lets the same function handle both a standalone swap and a step inside a multi-hop arbitrage path without any conditional logic in the connector itself.
Error messages survive proxy indirection. Connector logic runs inside the proxy via low-level delegation, which normally discards revert reasons. The proxy captures the raw failure data and re-throws it verbatim, so debugging a failed arbitrage spell shows the original connector error rather than a generic revert - a deliberate tradeoff of assembly complexity for operational transparency.
Vanity address generator as companion tooling. CREATE3Factory enables deploying contracts to deterministic addresses regardless of nonce or bytecode — useful for predictable protocol addresses across chains. To generate candidates efficiently, built a companion vanity address generator in C++/OpenCL (GPU-accelerated) and a multithreaded Node.js version, both brute-forcing CREATE3 salts until the output address matched a desired prefix pattern.
See HodlTree page for additional context.