Skip to content

Use a payment fixture from another repository ​

This repository owns a temporary chain and its contracts. Your test runner owns its services and tests. Both use the same local Docker engine and join an explicitly named internal network.

Requires
A prepared source checkout with locked Solidity dependencies. This fixture does not require the JavaScript workspace.
Changes
An exclusive chain-31337 fixture with public test accounts; no host RPC port.
Success
A verified JSON descriptor, followed by your service's own accounting/collection assertions and ordered cleanup.

1. Choose a unique ID and start

Set these values in the caller's shell. The output directory must already exist. IDs contain 1–48 lowercase letters, digits, underscores or hyphens, starting with a letter or digit; allocate a different ID for every concurrent run.

CTX=your-local-context &&
DAPPS_CHECKOUT=/absolute/path/to/dapp32 &&
RUN_ID=unique-payment-test-001 &&
RUN_DIR=/absolute/existing/test-output &&
test -d "$RUN_DIR" &&
make --no-print-directory -C "$DAPPS_CHECKOUT" pay-to-play/local/fixture/up \
  DOCKER_CONTEXT="$CTX" FIXTURE_ID="$RUN_ID" \
  > "$RUN_DIR/fixture.json" 2> "$RUN_DIR/fixture-start.log"

Consume the descriptor only after a successful exit. Immediately register your runner's cleanup for that successfully created fixture, before starting its clients. A failed or interrupted command may leave partial output; the file alone is not success.

up refuses existing resources under the ID: it neither resumes nor redeploys into them. Omitting the ID generates one, but caller allocation makes recovery independent of receiving stdout. Projects use the separate dapps-pay-to-play-fixture- prefix, not the GUI/scenario project.

2. Use the returned facts, not assumed addresses

up and info emit one JSON line, bounded to 1 MiB, with diagnostics on stderr. --no-print-directory prevents Make's directory banner from corrupting stdout.

Descriptor fieldUse
schema, fixtureIdRequire pay-to-play.local-fixture.v1 and retain the exact lifecycle handle.
composeProject, dockerNetworkIdentify owned resources and the existing network your consumer joins.
rpcUrl, chainIdConfigure the consumer inside that network; chain ID is 31337.
contracts.CamRoot, contracts.PayToPlay, contracts.PayToPlayUIEach includes address, mined deployment block and creation transaction. PayToPlay also contains its matching abi.
publicFixtureAccountsAdmin, customer, relayer and payee addresses and deliberately public test keys.

The exporter checks chain identity, successful deployment receipts at their recorded blocks, deployed code and the payment creation input. The ABI comes from the Forge invocation that deployed it, retained in the fixture volume—not a substituted current ABI. This is fixture provenance, not a general remote-code verification service.

3. Attach and run the actual service tests

Declare an external Compose network whose name is the returned dockerNetwork, and give your test service the returned rpcUrl. No RPC port is exposed on the host. Network peers can invoke Anvil's test-only mutation methods; admit only trusted fixture clients.

Fresh deployments have reserve channel 0 and funded fixture accounts, not service channels or registered voucher keys. Create channels, register keys and fund through normal calls. Use contracts.PayToPlay.address for voucher signing and settlement; the CAM host and projection are not substitutes.

To recheck the running fixture:

make --no-print-directory -C "$DAPPS_CHECKOUT" pay-to-play/local/fixture/info \
  DOCKER_CONTEXT="$CTX" FIXTURE_ID="$RUN_ID"

info uses a temporary reader and grants no cleanup ownership. Deployment readiness does not prove invoice acceptance, durability, delivery or collection allocation; assert those in your integration.

4. Stop clients, then remove only your fixture

Your runner's finally/cleanup path must stop and disconnect its own containers first, then remove the fixture even when its tests or a later info call failed:

make -C "$DAPPS_CHECKOUT" pay-to-play/local/fixture/down \
  DOCKER_CONTEXT="$CTX" FIXTURE_ID="$RUN_ID"

Removal is safe to repeat for your owned ID. A rejected collision or info-only attachment does not authorize removing somebody else's resources. Trappable startup/verification/output failures attempt cleanup of that start attempt; SIGKILL, host loss or an unavailable engine can leave an uncertain outcome.

Retain the allocated ID and stderr log, which announces recovery coordinates before resource creation. Inspect an uncertain result before removal or another start. Do not infer ownership from a partially written descriptor or silently guess that cleanup succeeded.

Implementation: fixture lifecycle. For self-contained campaigns, use the app checks.