Skip to Content
Recipe CatalogSimple AMM

Simple AMM

Compile and evaluate submitted Solidity strategies against the fixed simple_amm evaluator runtime. Supports deterministic seed batch evaluation, contiguous seed chunks, bytecode-size validation, and reusable build artifacts.

Current public support: shared placement on CPU workers only. Submit via POST /api/v1/recipes/simple_amm/jobs or POST /api/v1/jobs with "recipe": "simple_amm".

Compiler Profile

The sealed runtime compiles Strategy.sol with Foundry stable and this fixed profile:

SettingValue
solc_version0.8.33
optimizertrue
optimizer_runs200
via_irtrue
evm_versionprague
max_deployed_size_bytes24576

Build, validate, and eval results include compiler_profile and compiler_profile_hash.

Operations

OperationDescription
buildCompile one Solidity strategy into deterministic build outputs keyed by normalized source bytes
validateValidate one strategy against the sealed simple_amm guardrails and bytecode-size rules
evalRun one full deterministic evaluation over the requested seed window
eval_chunkRun one deterministic chunk evaluation over a contiguous slice of the requested seed space

Payload Fields

FieldTypeRequiredDescription
operationstringyesOne of the operations above
strategy_refstringaltArtifact ID of the Solidity source bytes or an archive containing Strategy.sol
sol_source_b64stringaltBase64-encoded Solidity source (alternative to strategy_ref)
seed_baseintegernoStarting seed for simulation
startintegernoStart offset for chunk operations
countintegernoNumber of seeds to run
stepsintegernoSimulation steps
per_seedbooleannoReturn per-seed edge data
max_deployed_size_bytesintegernoOverride deployed bytecode-size ceiling
chunk_indexintegerchunk opsZero-based chunk index
chunk_countintegerchunk opsTotal number of chunks for the run
total_countintegerchunk opsTotal seed count the chunks cover

Provide exactly one of strategy_ref or sol_source_b64.

For eval_chunk, pass either direct start + count or chunk_index + chunk_count + total_count. total_count may also be included as metadata with direct start + count. Top-level fan_out: {"chunks": N, "total": M} expands each task with start, count, chunk_index, chunk_count, and total_count.

Examples

Validate a strategy

POST /api/v1/recipes/simple_amm/jobs { "payload": { "operation": "validate", "strategy_ref": "art_123" }, "timeout_s": 900 }

Build compiled artifacts

POST /api/v1/recipes/simple_amm/jobs { "payload": { "operation": "build", "strategy_ref": "art_123" }, "timeout_s": 600 }

The build operation publishes compiled_strategy and build_manifest artifacts keyed by the normalized source bytes.

Full evaluation

POST /api/v1/recipes/simple_amm/jobs { "payload": { "operation": "eval", "strategy_ref": "art_123", "seed_base": 0, "count": 1000, "steps": 200 }, "timeout_s": 1800 }

Chunked evaluation

POST /api/v1/recipes/simple_amm/jobs { "payload": { "operation": "eval_chunk", "strategy_ref": "art_123", "chunk_index": 0, "chunk_count": 10, "total_count": 10000 }, "timeout_s": 1800 }

Fan-out chunked evaluation

POST /api/v1/recipes/simple_amm/jobs { "payload": { "operation": "eval_chunk", "strategy_ref": "art_123" }, "fan_out": { "chunks": 10, "total": 10000 }, "timeout_s": 1800 }

Result Fields

  • build: success, source_hash, cache_hit, source_job_id, build_artifact_id, compiler_profile, compiler_profile_hash, output_tail
  • validate: success, source_hash, deployed_size, compiler_profile, compiler_profile_hash, output_tail
  • eval: success, source_hash, avg_edge, mean_delta, n_seeds, bid_fee, ask_fee, deployed_size, avg_gas_per_trade, compiler_profile, compiler_profile_hash, output_tail
  • eval_chunk: eval fields plus chunk_index, chunk_count, total_count, start, count
Last updated on