← Back to home

juni

Uniswap V4 Hook With FHE Based Encrypted Orders To Protect LPs & Traders

Problem Statement

This project uses encrypted orders with arb auctions to benefit LPs and traders where LPs earn the encrypted amounts generated in arb auction for each block & traders get to benefit from low MEV as all critical amounts are encrypted or sufficiently masked which makes it difficult sandwich. Current balances of users are also hidden by a hook paired confidential ERC20 token wrapper. It also features an efficient 256 bit packing an unpacking algorithm encrypt or decrypt an entire block's transactions.

Solution

Made using uniswap v4 hook template, and inco lightning rod template. It is a single pool hook which uses a function to allow users to submit encrypted swap requests. Each swap request contains an encrypted zero for one, arb auction fee and an input transformer. Since zero for one is encrypted and an input transformer is available, it help hides the input token even in pairs where price is very low or very high, thus preventing MEV. An inbuilt encrypted arb auction provides a way for LPs to offset loss from LVR. Encrypted content of all transactions in a block are packed in a single uint256 variable including 1 bit per tx zero for one, 1 bit per tx order validity, 5 bit per tx input multiplier which allows masking the amount in by either multiplying it by up to 100,000 or dividing it by up to 100,000, 12 bits of arb auction winner index and 128 bit of arb auction winner fee. These are then put up for decryption after certain blocks are passed. Upon public decryption, the entire block is unpacked and executed starting with the arb winning auction.

Hackathon

ETHGlobal New Delhi

2025

Contributors