Polymarket/ctf-exchange-v2 — reverse-engineered prompt
Reverse engineered prompt
Build me a Solidity smart contract project for a Polymarket style CTF exchange.
I want users to sign orders off chain, then an approved operator can match a taker order against maker orders on chain. The exchange should support buy and sell orders, check that prices cross, validate fees, track fills and cancellations, and settle trades as direct transfers, minting outcome tokens, or merging outcome tokens back into collateral.
Please include support for normal wallet signatures, proxy wallet signatures, Gnosis Safe style signatures, and EIP 1271 smart contract wallets. Add an operator order preapproval flow too.
I also need a wrapped collateral token around USDC or USDCe, with simple contracts for wrapping, unwrapping, and adapting it into CTF split, merge, and redeem flows. Include admin controls, global pause, and a user self pause with a delay for emergency recovery.
Use a clean Foundry Solidity setup with deployment scripts and solid tests. Look up current docs online if you need to.
Want more depth? Deep Reverse