-
Starts: July 03, 2025 Noon UTC
-
Ends: July 10, 2025 Noon UTC
-
nSLOC: 217
-
OrderBook.sol:
The
OrderBook
contract is a peer-to-peer trading system designed forERC20
tokens likewETH
,wBTC
, andwSOL
. Sellers can list tokens at their desired price inUSDC
, and buyers can fill them directly on-chain.The flow is simple:
- Sellers lock their tokens and list an order with a price and deadline
- Buyers purchase tokens by paying the listed
USDc
amount - if the order isn't filled before the deadline, sellers can cancel and retrieve their tokens
All orders are tracked using a unique
orderId
, and sellers retain full control over their listings until filled or expired.Token transfers use
SafeERC20
to ensure secure movement of funds, and the system enforces a strict set of violation rules to prevent misuse.The contract also supports:
- Amending orders (e.g. changing price or amount)
- Canceling active or expired orders
- Emergency withdrawals by the owner (for non-core tokens only)
- human-readable order infor using
getOrderDetailsString
-
Features:
- Fixed-price order creation for selected
ERC20
tokens - Secure and gas-efficient architecture
- Deadline enforcement to prevent stale listings
- Fixed-price order creation for selected
-
Resources:
- Scope:
├── src
│ └── OrderBook.sol
-
Compatibility:
- Chain: Ethereum
- Tokens:
wETH
,wBTC
,wSOL
,USDC
git clone https://github.com/CodeHawks-Contests/2025-06-orderbook.git
forge build
forge test
None!