Local Devnet Setup

Run the full Strike protocol locally using Foundry's Anvil.

Prerequisites

Install Foundryarrow-up-right:

curl -L https://foundry.paradigm.xyz | bash
foundryup

This provides three tools:

  • anvil -- local Ethereum node

  • forge -- build, test, and deploy Solidity contracts

  • cast -- CLI for interacting with contracts

Start Anvil

anvil --chain-id 31337

Anvil starts with 10 pre-funded accounts (each with 10,000 ETH). The default account (index 0) is:

  • Address: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266

  • Private key: 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80

Leave this terminal running.

Deploy

In a new terminal, from the project root:

The deploy script:

  1. Deploys all 9 contracts (FeeModel, OutcomeToken, Vault, OrderBook, BatchAuction, MockPyth, MarketFactory, PythResolver, Redemption)

  2. Wires all access control roles

  3. Creates a test market (BTC/USD, strike price $50,000, 1-hour duration, 12-second batch intervals)

  4. Prints all contract addresses as JSON to stdout

Save the JSON output -- you will need the addresses for subsequent commands.

Useful Cast Commands

Set up address variables from the deploy output:

Approve & Deposit USDT

On devnet, a MockUSDT is deployed. Approve the Vault, then place orders (deposit happens automatically):

Check Balance

Place a Bid Order

Place a bid at tick 60 for 10 lots on orderBookMarketId 1:

Arguments: marketId=1, side=0(Bid), orderType=1(GTC), tick=60, lots=10.

Collateral required: 10 * 1e18 * 60 / 100 = 6e18 = 6 USDT.

Place an Ask Order

Place an ask at tick 60 for 10 lots (from a different account):

Clear a Batch

Wait for the batch interval (12 seconds on the test market), then clear:

Note: Settlement is atomic — all orders in the batch are settled inline during clearBatch(). No separate claim step is needed.

Read Market State

Check Volume at a Tick

Cancel an Order

Withdraw from Vault

Advance Block Time

Anvil supports time manipulation for testing resolution flows:

MockPyth

The devnet deploy uses Pyth's MockPyth contract instead of the real Pyth oracle. To create mock price updates for resolution testing:

Running Tests

For a specific test file:

Full Stack (with Infrastructure)

For batch clearing keepers and the indexer, see the strike-infraarrow-up-right repo. It provides:

  • Batch clearing keeper

  • Market resolution keeper

  • Event indexer with REST/WebSocket API

Troubleshooting

  • "insufficient available balance" -- ensure you have approved the Vault for sufficient USDT before placing orders.

  • "too soon" -- wait for the batch interval to elapse before calling clearBatch again, or use cast rpc evm_increaseTime.

  • "market halted" / "not active" -- check the market state with cast call $ORDERBOOK "markets(uint256)" <id>.

  • Role errors -- verify role wiring with cast call <contract> "hasRole(bytes32,address)(bool)" <role_hash> <address>.

Last updated