Indexedex Script Orchestration
This skill captures the scripting patterns that proved necessary for the repo's Sepolia plus Base Sepolia SuperSim rehearsal.
Use This Skill For
- editing
scripts/foundry/supersim/deploy_mainnet_bridge_ui.sh - refactoring shell wrappers around
forge script --use solar - debugging sender, signer, or broadcast issues on local SuperSim forks
- passing deployment output directories and network profiles into Solidity scripts
- stabilizing long chain-local deployment runs
Shell Rules
- Use
#!/usr/bin/env bash, not/bin/sh. - Use
set -euo pipefail. - Keep helper functions small and single-purpose.
- Prefer arrays for command construction so quoting stays correct.
- Every
forge script/forge buildarray includes--use solar. Do not drop the flag to match an older log. - Redact API keys or provider secrets from any logged RPC URL.
- Validate and create required output directories before broadcasting.
Wrapper Responsibilities
The top-level shell wrapper should own orchestration. In this repo that means:
- resolve upstream RPCs from Foundry aliases when explicit env vars are absent
- derive the shared fork height from Crane network constants
- start or reuse SuperSim fork mode
- wait for both local RPC endpoints
- prepare the broadcast identity
- sweep ETH to the deployer on both forks
- run direct per-chain
forge script --use solarcommands - deploy bridge infra and bridge config
- export frontend artifacts
Avoid pushing this orchestration into one large Solidity script.
Prefer Direct Per-Chain Forge Scripts
Use shell-driven direct invocations such as:
scripts/foundry/supersim/ethereum/Script_DeployAll.s.sol:Script_DeployAllscripts/foundry/supersim/base/Script_DeployAll.s.sol:Script_DeployAllscripts/foundry/supersim/Script_24_DeploySuperchainBridgeInfra.s.sol:Script_24_DeploySuperchainBridgeInfrascripts/foundry/supersim/Script_25_ConfigureProtocolDetfBridge.s.sol:Script_25_ConfigureProtocolDetfBridge
This is more debuggable and less fragile than a top-level script that nests many script contracts.
Solidity Script Configuration Rules
Deployment scripts should accept configuration from the shell wrapper instead of inferring too much from tx.origin.
Recommended environment contract:
SENDERfor the desired deployer addressPRIVATE_KEYonly when key-backed broadcast is requiredOUT_DIR_OVERRIDEfor per-run manifest directoriesNETWORK_PROFILEfor address binding modeREMOTE_OUT_DIRfor cross-chain bridge configSUPERSIM_ETHEREUM_RPC_URLandSUPERSIM_BASE_RPC_URLwhen scripts need both endpoints
In Solidity, load deployer config in this order:
SENDERif present and nonzero- fallback to
tx.origin - if
PRIVATE_KEYis present, derive deployer from that key
Sender and Signer Rules
--senderselects the sender address.vm.startBroadcast(address)still needs a signer that the RPC can use.- On local forked RPCs with
--unlocked, default dev accounts are directly signable. - Non-default addresses are not automatically signable just because they were funded.
- If the local RPC supports Anvil impersonation, use
anvil_impersonateAccountbefore broadcasting from a non-default deployer.
This distinction was critical in the recent SuperSim deployment work.
Broadcast Stability Rules
- Forward
-vthrough-vvvvvfrom the wrapper intoforge script --use solar. - Use
--slowfor long broadcast runs to serialize sends. - Expect long deploy phases to appear quiet while Foundry simulates and broadcasts.
- Treat mempool drops, upstream
429responses, and flaky late broadcast failures as sequencing pressure first, not necessarily contract logic bugs.
If a long deploy still flakes after --slow, split the sequence rather than hiding the problem behind more abstraction.
Base Sepolia Rehearsal Rules
For the local Base Sepolia rehearsal:
- do not assume every upstream dependency already exists
- deploy local Uniswap V2, Balancer V3, and Aerodrome dependencies when needed
- deploy Balancer V3 using Crane packages and deterministic factory flows
- keep protocol address overrides in JSON manifests read by
scripts/foundry/anvil_base_main/DeploymentBase.sol - keep shared WETH assumptions consistent across Balancer, Aerodrome, and Uniswap wiring
Logging Rules
- Emit short progress logs before each major script run.
- Log the active RPC, network profile, and output directory.
- Redact upstream provider secrets.
- Keep final post-deploy balance sweeping separate from the deployment workflow.
Related (not this skill)
Robinhood Anvil launch trees (4663 / 46630), Phase/Stage file layout, and EIP-1559 gas quotes: skill:indexedex-launch-scripts.
Anti-Patterns
/bin/shwrapper that uses Bash-only syntax- relying only on
tx.originwhen shell orchestration already knows the intended sender - assuming sender selection implies signer availability
- one opaque top-level Solidity wrapper that hides the failing stage
- hardcoding Base Sepolia protocol addresses when the rehearsal intentionally deploys local replacements
Source Files
scripts/foundry/supersim/deploy_mainnet_bridge_ui.shscripts/foundry/anvil_sepolia/DeploymentBase.solscripts/foundry/anvil_base_main/DeploymentBase.solscripts/foundry/supersim/Script_24_DeploySuperchainBridgeInfra.s.solscripts/foundry/supersim/Script_25_ConfigureProtocolDetfBridge.s.sol