Windmill Exchange Protocol

Windmill Exchange is a fully on-chain order matching engine for EVM-compatible blockchains. It implements configurable dynamic pricing curves with autonomous keeper-based settlement.

Core Contract

WindmillExchange.sol — Handles order creation, cancellation, matching, and settlement with ReentrancyGuard protection.

Keeper Network

Node.js service using ethers.js that continuously scans for matchable order pairs and executes settlement transactions to earn 0.1% fees.

Architecture

src/ ├── core/ │ └── WindmillExchange.sol # Main contract (order lifecycle + matching) ├── interfaces/ │ ├── IERC20.sol # Minimal ERC-20 interface │ └── IWindmillExchange.sol # Exchange interface ├── libraries/ │ ├── MathUtils.sol # mulDiv, abs (RAY arithmetic) │ ├── PriceCurve.sol # currentPrice, isMatchable, settlementPrice │ └── TokenTransfer.sol # Safe ERC-20 transfers ├── storage/ │ ├── OrderStorage.sol # Order state management │ └── PairStorage.sol # Token pair → order ID mappings └── types/ └── OrderTypes.sol # Order struct definition