The full write-up
Overview
The question. Can a limit-order strategy such as “sell if ETH drops below a price, but only when gas is cheap” be drawn, turned into a 1inch Limit Order Protocol (LOP) extension and proven to fill, without hand-packing calldata?
The answer. For three of its four templates, yes, in local Foundry tests. Orders carrying the stop-loss, gas-guard and TWAP slice extensions fill through LOP v4.3.2, pinned by commit, in tests that deploy the protocol locally and call fillOrderArgs. The fourth template, a DCA schedule, is tested by registering its series, not by filling an order.
Scope. Independent portfolio project, not affiliated with or endorsed by 1inch. The studio runs locally. Nothing has been deployed, and nothing signs or submits an order.
How it works
A strategy moves through five workspace packages:
apps/studiois a Next.js 15 app. You draw the strategy as a graph, replay fill conditions in a simulation panel, generate the bundle and runforge testfrom the Verify page.packages/hook-dsldefines the strategy document as a Zod schema, plus the template catalog.packages/lop-sdkpacks extensions, derives the order salt and holds an LOP address registry of 10 chains (9 mainnets and Sepolia).packages/codegenwrites the Solidity, a deploy script, a README and amanifest.jsonwith the strategy hash, extension hash, LOP pin and compiled bytecode hash. The same input produces byte-identical output.packages/contractsholds the Foundry templates and a harness that deploys LOP 4.3.2 locally with mock oracles and tokens.
The demo strategy is AND(stop-loss, gas-guard). The stop-loss reads the oracle’s latest round and reverts on stale, incomplete or wrong-decimals data. The codegen command line refuses mainnet output unless the template is marked audit-ready and the strategy sets audited: true. audit-ready is this repo’s own maturity label, not an audit.
Results
- Four templates generate code. Stop-loss, gas guard, TWAP slice and DCA schedule each go from strategy file to Solidity, manifest and a Foundry integration test. The stop-loss, gas-guard and TWAP tests fill an order through LOP, including revert cases for a stale oracle, a decimals mismatch, a base fee above the cap and a slice above the TWAP cap. The DCA test checks that its series registers. Four more catalog entries (oracle band, deadline window, private taker, Dutch auction) are marked planned or research only and generate no code.
- The salt rule is tested in two languages. A TypeScript test asserts the low 160 bits of the salt equal the extension hash, and a Solidity test helper applies the same rule.
- Gas snapshot. The checked-in snapshot records 208,825 gas for a full
fillOrderArgscall on a stop-loss order with a gas guard. The stop-loss check costs 22,712 gas against 13,526 for a naive baseline that skips the staleness, round and decimals checks.
How it was checked
The README records all 22 Bun tests (across the strategy format, SDK and code generator) and all 34 Foundry tests (17 unit, 11 integration, 1 fuzz, 5 benchmark) passing on 2026-10-21. CI builds and tests the contracts, runs forge snapshot --check, asserts the LOP submodule is at the 4.3.2 commit, and fails if the committed bytecode hashes change.
A self-review in docs/1inch-review.md is written from the point of view of a 1inch protocol engineer. No one at 1inch wrote, reviewed or endorsed it. It lists the four release blockers and five production gaps it found as closed.
Limits and next steps
- No external audit. Generated contracts are not audited.
- No deployment and no live users.
- No orderbook submission. The SDK builds the payload shape for the 1inch Orderbook API, but nothing signs or submits it.
- Integration tests cover one EVM-mainnet-shaped environment. The registry lists 10 chains, but no test exercises zkSync Era, which has a different LOP address.
- The studio simulation is a logical replay with synthetic inputs, not an on-chain
simulatecall. - TWAP and DCA fills depend on a keeper, and the project ships none. The generated bundle documents what a keeper must do.
Links
Completed: October 21, 2026
