Protocol modules
Dark pool
Sealed WETH/USDG orders crossed pro rata at the oracle mid.
The dark pool crosses WETH against USDG in sealed batches. While a batch is open, the chain only ever sees a hash of each order; once it closes, traders reveal; then the whole batch crosses at the oracle mid observed afterwards. Nobody — not other traders, not the operator — sees an order's direction or size before the batch closes, and the price comes from outside the pool, so there is nothing to front-run or sandwich.
Lifecycle of batch #
- Deposit. Traders keep USDG and WETH balances in the pool. Deposits and withdrawals are immediate.
- Commit — during batch 's window (30 seconds by default). You submit
keccak256(abi.encode(trader, b, isBuy, amount, limitPrice, salt)). Nothing is locked. - Reveal — during the next window. You submit the preimage; the pool checks it against your commitment and locks the amount from your balance. A buy's amount is the USDG to spend; a sell's is the WETH to sell.
- Settle — any time after the reveal window closes, anyone can settle with a signed ETH price published after the reveals ended.
The cross#
With price , let be the USDG of every buy whose limit is at or above , and the WETH of every sell whose limit is at or below . Buyers want WETH, so
and each side fills pro rata: every eligible buy and sell fills the same fraction of its size. Unfilled amounts, and every order whose limit the price doesn't meet, return to the trader's balance. A 5 bps fee is taken from what each side receives. Rounding always goes against the credit, and the remainder goes to fees, so the pool can never credit more than the batch locked.
Guarantees and limits#
- An unrevealed order locks nothing. If you don't reveal in time, the commitment simply expires.
- Copying a commitment doesn't block you. Commitments are stored per trader, so someone replaying your hash from the mempool gets their own, unusable entry.
- Expired batches refund. If a batch can't be settled within a day (no fresh price), anyone can refund all its orders — the Terminal offers it on your intents.
- Capacity. At most 100 revealed orders per batch; minimum size 10 USDG or 0.001 WETH.
- What it doesn't hide. Commit transactions reveal the trader's address and timing, and reveals are public once the batch is closed. A trader can also choose not to reveal after seeing the market move during the reveal window, which limits orders to whatever they commit to within their guard.
The Terminal stores each order's preimage in your browser before sending the commit, and can export them as receipts.
Interface#
function deposit(address token, uint256 amount) external;
function withdraw(address token, uint256 amount) external;
function commitmentOf(address trader, uint256 batch, bool isBuy, uint256 amount, uint256 limitPrice, bytes32 salt) external pure returns (bytes32);
function commit(bytes32 commitment) external;
function reveal(uint256 batch, bool isBuy, uint256 amount, uint256 limitPrice, bytes32 salt) external returns (uint256 index);
function settle(uint256 batch, PriceBatch calldata prices, bytes[] calldata signatures) external;
function refundExpired(uint256 batch) external;