The code

The rules of the game, as the contracts state them. None can be changed by anyone, the owner included, except where it says so.

Rule 1. Every trade is a bet. A trade in one quarter hour bets on the next. A buy (ETH in) says JAM: more vehicles than the same quarter hour a week earlier (a day earlier during the first week). A sell (ETH out) says CLEAR. The stake is the trade's ETH, credited to the wallet that sends the transaction.

Rule 2. The pot. Every trade pays two fees of 1%. The pool's LP fee goes to its liquidity, all of which is the owner's position. The hook takes 1% of every stake, in ETH, into the pot of the quarter hour bet on, so a pot is exactly what its own bets paid in.

Rule 3. The payout. When the court rules, the side that called it shares the pot in proportion to its stakes, in ETH. A tie, too few cameras to compare, or a window where nobody took the winning side returns the pot to everyone in it. A window not ruled within 3 days of its end is returned the same way. Anyone may claim for anyone; the payment always goes to the trader.

Rule 4. Trade anywhere a bot can. The hook takes its 1% in ETH on every kind of swap, buy or sell, exact input or exact output. This site, Maestro and other trading bots, aggregators quoting through Uniswap's V4 Quoter and any contract trade the pool. The Uniswap app routes a hook that takes a fee only after Uniswap has reviewed it.

Rule 5. The loop. On each camera a counting line crosses the lanes, cut into lane-wide loops. In every frame a loop is hit when a fifth of its pixels differ from the background it has learned by more than 16 levels of brightness; a vehicle is counted when a run of hits starts, and the run ends after 6 frames without one. The first 30 frames of a window only learn the road. A camera its operator has turned sits the window out. Every window the reporters draw two maps of what the camera saw, where things moved and the outline of the scene, and correlate each with the same map of the view the loops were placed on. The camera counts when its motion matches at 0.85, or at 0.60 with its outline matching at 0.60 too; otherwise it files nothing for that window. Frozen footage sits out the same way.

Rule 6. The record. After each window every reporter files a leaf per camera: the hash of the footage it downloaded, of the pixels it decoded, of every step of its count, and the count. A camera counts only where two reporters filed the same leaf. Footage that never moves on the loops (a "camera unavailable" card, a frozen feed) is filed as no footage, not as an empty road.

Rule 7. Appeals. For 40 minutes anyone may appeal a camera's leaf with a 0.05 ETH bond and their own trace. The court halves the frames until both sides agree on one state and disagree on the next, re-runs that one frame on chain, and rules. A wrong count is struck and its reporters lose their bonds to the challenger; a wrong challenger loses its bond to the reporters. A side that misses its hour loses.

Rule 8. The ruling. Every camera on record in both windows votes: busier than in the earlier window (vehicles per million frames), quieter, or the same. More cameras busier: JAM. More quieter: CLEAR. A tie: PUSH. Each camera is one vote however busy its road, so a camera turned to another view by its operator sways one vote, not the ruling. The earlier window is the same quarter hour a week before, or a day before where the week-earlier one cannot be compared. A window not entered into the record within a day of its end never will be, and is a PUSH. The court rules only once every window a ruling rests on is final, so a ruling, once given, never changes.

Rule 9. The clerk. The owner registers reporters and cameras; each takes effect 24 hours after it is announced, and a camera's loops never change.

Rule 10. The opening. The court, the token and the hook were deployed and verified before anyone could trade: the pool sat at its opening price, empty, until the owner opened it once, putting the whole supply in as the owner's position, the only one there will ever be.

Limits. The footage is attested, not proven: no contract can watch video, so the court trusts that two reporters downloading the same public file got the same bytes (they do; measured byte for byte). The owner runs the reporters at launch. Operators turn these cameras often (7 of the 28 first chosen within three hours, measured); a turned camera sits out until it is turned back, and one turned only slightly may still pass the check and count a slightly different stretch of road. Some agencies serve only their own country; those need a reporter there. A queue that has stopped is not counted: the loops count vehicles that cross them. This is a game on traffic, not traffic data. The liquidity is one position, minted to the owner as an LP NFT at the opening: while the owner holds it, the owner can withdraw it, and the table below reads from the chain who holds it now. The pots are held by the hook, which nobody can take them from.

Addresses

The contracts are not on Ethereum yet.