An orderbook implementation on the Fhenix blockchain, leveraging FHE for private balances and trade history.
Private orderbooks have a few interesting features:
- Private history of trades (visible only to user that completed trades)
- Private balances of encrypted ERC20 tokens (base & trade tokens)
- Absence of slippage thus impermanent loss
- Absence of MEV
This project implements a private orderbook on the Fhenix blockchain leveraging FHE. We forked a publicy available repo and adapted that to use Fhenix's FHE Solidity library. The Solidity contract compiles and accepts buy orders and sell orders. We also incorporated the encrypted ERC20 template (FHERC20) into the contract.
We also deployed the contract on the Fhenix Frontier testnet (https://explorer.testnet.fhenix.zone/address/0xdE7f141Af8F0ccd82FC78AbF15116356dA98fD05).
- FHERC20: Encrypted ERC20, allowing for private balances and transfers
- Orderbook: Private Orderbook, having features described previously.
- Buy orders (incomplete)
- Sell orders (incomplete)
We antecipate the following steps to bring this idea from hackathon project to a proper MVP:
- Sanitize
Orderbook.sol
and confirm that no data leaks are present - Clean-up Hardhat usage (add hardhat-deploy for reproducible deployments)
- Write tests
- Decrypt makes code "vulnerable" to determinism
- See while loops from auction example