A small exchange on the cEVM, running in testnet (with a question for the devs)After the dev's post about building rather than mining, I took it literally. Over the last two days I built and deployed a small ZCD/credits exchange on the Zycord cEVM, in testnet, with a registered sequencer behind it:
- Two contracts: a delta-first token ("Credito") and a "Mercato" with internal balances (delta cells: two certificates on the same balance in one block both apply, which the tests check), a constant-product pool (0.3 % fee) and a limit order book (price-time priority, 0.1 % taker fee, 6 fills and 12 list steps per certificate to stay under the 64 reads/writes).
- A sequencer registered on the Mercato (the admin form of register-sequencer) and announced in the on-chain directory:
https://zycord.dcafrevolution.com (ZSI manifest on /, status on /v1/status).
- Swaps, orders, partial fills and cancels done through `zcd wallet intent`, found via the directory, applied in testnet blocks (10519 to 11676 if you want to look).
- A page that reads the sequencer and composes the wallet commands:
https://zycord.dcafrevolution.com/app/ . Paste a persistent address and it shows your internal balances, shares and open orders. It signs nothing.
Testnet addresses:
Mercato 0x05cc436e1e14523fd5797e5dd3634b035a86318a51579a3bc0fc9f48bce96fbb,
Credito 0x057efb1c504e21a9d8d4e31c28b241573496221168d1b46c30e6b36c80c8250f.
Everything runs on v0.6.1; I checked the v0.6.2 diff and it does not touch the sequencer, the ZSI or intents, so nothing above changes. (And thanks for the mention on !72.)
Things I learned that may be useful to others building on the cEVM: one discipline per cell per execution; an exact read on a contract with a registered sequencer makes a plain certificate invalid, so deposits of the token go through the sequencer while ZCD deposits stay free; an intent bound must name a cell the call really writes (a bound on the order-book head only works when your order becomes the head); intents pay from one-shot addresses, and in my runs the wallet twice ended up with none it considered free (one was still held by an earlier attempt) until an ordinary payment left change in fresh ones.
Maybe that is expected; if not, I can describe it in an issue.
The question: the wallet's site connections sign `transfer`, `call` and `deploy`, not intents. So a page can show everything but cannot ask the wallet to sign a swap; the user has to copy a command into a terminal.
Would you accept a merge request adding an `intent` request kind to POST /v1/sign (quote shown on the approval screen instead of a certificate, sequencer URL subject to the same netguard rules as src= fetches, payer holds as in `zcd wallet intent`)? I estimate 700-800 lines in wallet/ plus tests. I would rather ask before writing it. If yes, I will open an issue on GitLab with the details.
As before: I write the code together with Claude (Anthropic), I review and run everything myself, and the sequencer is on a server I operate. The repository is not public yet; it will be once the code settles.shadow_69 (Dario)