Category 2: (Hot) Smart Contract, DeFi, AI, Layer2, DePIN, etc.
- Bifrost
- Moonbeam
- Blockchain for good
- Demo Video: NoSandwichSwap Demo Video
- PPT: NoSandwichSwap Demo
- Github Repo: NoSandwichSwap Github
No Sandwich Swap is an anti-MEV DEX that utilizes Hyperbolic Call Auction (HCA) to aggregate multiple trades over a period of time. By subdividing them infinitely and staggering them evenly, it helps to amortize the price shock effect of a single trade, while spreading out the trades of MEV attackers over the entire cycle. This effectively reduces arbitrage gains for MEV attackers.
- For the Market: Reduces price shocks, allowing the actual transaction price to be closer to the fair price.
- For Attackers: Effectively protects against MEV attacks, making sandwich attacks unprofitable.
- For Traders: Enhances user experience by reducing slippage encountered by regular traders.
- For Liquidity Providers (LPs): Reduces price volatility and minimizes LPs' exposure to impermanent losses.
- For the Ecosystem: Encourages more trades and increases market liquidity through governance token incentives.
anvil --fork-url https://rpc.api.moonbase.moonbeam.network
PS: Remember to create a .env
file with ANVIL_PRIVATE_KEY
inside.
source .env
forge script script/DeployNoSandwichSwapPair.s.sol:DeployNoSandwichSwapPair --rpc-url http://127.0.0.1:8545 --private-key $ANVIL_PRIVATE_KEY --broadcast
cd Web/NoSandwichSwapPair_Web
npm run dev
forge test --match-test "testTradeDex1|testTradeDex2" -vv
- Derived a brand-new Anti-MEV AMM theory through mathematical proof.
- Implemented the refined mathematical theory with a closed form of parity price and designed tokenomics based on this theory.
We have developed No Sandwich Swap, an MEV-resistant DEX that uses a Hyperbolic Call Auction (HCA) mechanism. This mechanism aggregates multiple transactions over a certain period and then infinitely subdivides and uniformly interleaves them, thereby smoothing out the price impact of individual transactions and dispersing the trades of MEV attackers throughout the entire cycle, significantly reducing their arbitrage profits. Based on this approach, we have proven that the upper bound of asset price volatility within each phase is
Assume the initial liquidity pool satisfies
Divide both
1. Deposit
$\alpha/N$ units of token X;2. Deposit
$\alpha/N$ units of token Y;3. Deposit
$\alpha/N$ units of token X;4. Deposit
$\alpha/N$ units of token Y;......
2n-1. Deposit
$\alpha/N$ units of token X;2n. Deposit
$\alpha/N$ units of token Y.
After the
- If
$i$ is odd,$\displaystyle x_i = x_{i-1} + \frac{\alpha}{N}, y_i = \frac{k}{x_{i-1} + \frac{\alpha}{N}}$ - If
$i$ is even,$\displaystyle x_i = \frac{k}{y_{i-1} + \frac{\beta}{N}}, y_i = y_{i-1} + \frac{\beta}{N}$
As
- When
$i$ is even, we have$\displaystyle x_i = \frac{kNx_{i-2}+\alpha k}{kN+(x_{i-2}+\frac{\alpha}{N})\beta}$ - As
$N$ becomes sufficiently large,$\displaystyle\frac{\alpha\beta}{N} \to 0$ , it is easy to see that$x_i$ is a monotonic sequence - The amount of funds injected into the liquidity pool is finite, so
$x_i$ cannot increase indefinitely and is therefore a bounded sequence - According to the monotone convergence theorem,
$\displaystyle\lim_{N \to \infty} x_{2N}$ must exist.
Thus, as transactions are evenly divided infinitely, the liquidity pool will eventually converge to a fixed value. Numerical simulations show that when
In each settlement period, a trader may send multiple actual transactions. For the initial transactions, only data is recorded without settlement; for the final transaction of the period, the settlement process is triggered, and the collected tokens are distributed to the traders based on their contributions.
- Traders who provide token X will receive
$\displaystyle \frac{a_i}{\alpha} (y_0 + \beta - y')$ units of token Y. - Traders who provide token Y will receive
$\displaystyle \frac{b_i}{\beta} (x_0 + \alpha - x')$ units of token X.
This method of trading is similar to the call auction process on the A-share market, where trades are not settled in real-time within the settlement period but instead a price is determined at the end of the period and all transactions are settled at this uniform price. Since the final settlement is still based on the constant product AMM (Automated Market Maker), any trader who successfully submits a transaction on-chain will secure a trade. We refer to this trading method as Hyperbolic Call Auction.
Since the trader who triggers settlement will have to pay more gas to complete the settlement and distribution, it is necessary to provide compensation. We stipulate that the initiator of the last transaction in each settlement cycle (i.e., the settlement trigger) will receive a reward in governance tokens. Here, we assume the governance token is $SANDWICH.
This incentive mechanism encourages more users to participate in trading, as the act of trading itself becomes a form of mining. The more transactions a user makes, the higher the chance they have to trigger settlement and receive token rewards.
The supply of $SANDWICH follows an exponential decay model, with an initial supply of 10,000 SANDWICH per cycle and a half-life of 1 month.
One potential issue is that MEV attackers can still manipulate transaction ordering to become the settlement trigger and claim governance tokens. However, this kind of MEV attack does not directly harm regular traders like previous MEV strategies did. On the other hand, as MEV attackers accumulate more $SANDWICH tokens, their interests become aligned with the NoSandwichSwap protocol, forcing them to act as guardians of the protocol's ecosystem.
- First submission
- Pre-demo
- Testnet launch
- Completed features
- Tests
- Documentation
- Production release
Name | Role | GitHub / X Handle |
---|---|---|
Treap | Product Manager | https://github.com/TreapGoGo |
Artist Zhou | Financial Mathematical Modeler | https://github.com/artistzhou |
Jawk | Contract Developer | https://github.com/jawkjiang |
Fox(Qian Zhang) | Full Stack Engineer | https://github.com/HappyFox001 |
SegmentOverflow | Architect | https://github.com/whusjj |
OwesTre | UI Designer | https://github.com/XiiiijWhy |
- Artist Zhou: President of ZJUBCA, INTJ
- Treap(leader): President of WHU Web3 Club
- Fox: Core builder of WHU Web3 Club
- Jawk: Core builder of WHU Web3 Club
- SegmentOverflow: Core builder of WHU Web3 Club
- OwesTre: Core builder of WHU Web3 Club
- Artist Zhou: [email protected]
- Jawk: [email protected]
- Fox: [email protected]
- SegmentOverflow: [email protected]
- Treap(leader): [email protected]
- OwesTre: [email protected]