Co-authored-by: Cursor <cursoragent@cursor.com>
5.0 KiB
Deploy and Verify Smart Contracts — One at a Time
Last Updated: 2026-02-13
Purpose: Compile, deploy, and verify Chain 138 contracts one contract at a time for controlled rollouts and easier debugging.
Prerequisites
- Foundry installed (
forgein PATH). - Network: Host must reach Chain 138 RPC (set
RPC_URL_138, e.g. http://192.168.11.211:8545 for Core) and, for verification, Blockscout (e.g. https://explorer.d-bis.org). - Env:
smom-dbis-138/.envwithPRIVATE_KEYandRPC_URL_138(Chain 138 Core).
Chain 138 gas: Always use --with-gas-price 1000000000 (1 gwei) for forge script and forge create.
Step 1 — Compile
From repo root or smom-dbis-138:
cd smom-dbis-138
forge build
- First run can take several minutes (67+ files,
via_irin default profile). - Re-runs are fast if cache is warm. Use
forge build --skip testto skip test contracts for a quicker compile when only deploying.
Step 2 — Deploy One Contract
Pick one deploy script and run it without --broadcast first (dry run), then with --broadcast to deploy.
Template:
cd smom-dbis-138
source .env
# Dry run (no on-chain tx)
forge script script/DeployMulticall.s.sol:DeployMulticall \
--rpc-url "$RPC_URL_138" \
--with-gas-price 1000000000
# Deploy (on-chain)
forge script script/DeployMulticall.s.sol:DeployMulticall \
--rpc-url "$RPC_URL_138" \
--broadcast \
--private-key "$PRIVATE_KEY" \
--with-gas-price 1000000000
Suggested order (matches deploy-all-contracts.sh):
| # | Contract | Script | Notes |
|---|---|---|---|
| 1 | Multicall | script/DeployMulticall.s.sol:DeployMulticall |
Single contract |
| 2 | Oracle | script/DeployOracle.s.sol:DeployOracle |
Deploys Aggregator + Proxy; set ADDR_ORACLE_PROXY to Proxy address for verification |
| 3 | MultiSig | script/DeployMultiSig.s.sol:DeployMultiSig |
Governance |
Other single-contract or small scripts:
script/DeployAddressMapper.s.sol— AddressMapperscript/DeployMirrorManager.s.sol— MirrorManagerscript/DeployCCIPWETH9Bridge.s.sol— CCIP WETH9 bridge (env: CCIP_ROUTER, etc.)script/smart-accounts/DeploySmartAccountsKit.s.sol— ERC-4337 (EntryPoint, Factory, Paymaster)
After each deploy, note the deployed address(es) from the log (e.g. Multicall deployed at: 0x...). Update .env or config/contract-addresses.conf if this contract is used by later deploys or verification.
Step 3 — Verify on Blockscout
Use the Forge Verification Proxy so Forge’s JSON API is translated for Blockscout.
3a. Start the proxy (if not already running):
# From repo root
BLOCKSCOUT_URL=http://192.168.11.140:4000 node forge-verification-proxy/server.js
# Or for public explorer: BLOCKSCOUT_URL=https://explorer.d-bis.org node forge-verification-proxy/server.js
3b. Verify one contract:
cd smom-dbis-138
source .env 2>/dev/null
RPC="${RPC_URL_138:-http://192.168.11.211:8545}"
VERIFIER_URL="${FORGE_VERIFIER_URL:-http://127.0.0.1:3080/api}"
# Example: verify Multicall at 0xYourDeployedAddress
forge verify-contract \
0xYourDeployedAddress \
contracts/utils/Multicall.sol:Multicall \
--chain-id 138 \
--verifier blockscout \
--verifier-url "$VERIFIER_URL" \
--rpc-url "$RPC" \
--flatten
Example verification paths (contract:path):
| Contract | Path |
|---|---|
| Multicall | contracts/utils/Multicall.sol:Multicall |
| Oracle Proxy | contracts/oracle/Proxy.sol:Proxy |
| Aggregator | contracts/oracle/Aggregator.sol:Aggregator |
| CCIPWETH9Bridge | contracts/ccip/CCIPWETH9Bridge.sol:CCIPWETH9Bridge |
| CCIPSender | contracts/ccip/CCIPSender.sol:CCIPSender |
Or use the batch script for one contract:
source smom-dbis-138/.env 2>/dev/null
./scripts/verify/run-contract-verification-with-proxy.sh --only Proxy
# (Script currently includes a fixed list; add your contract to config/contract-addresses.conf and verify-contracts-blockscout.sh to use --only.)
Step 4 — Confirm On-Chain
Check that the contract exists and (if applicable) is verified:
./scripts/verify/check-contracts-on-chain-138.sh "${RPC_URL_138:-http://192.168.11.211:8545}"
Or open the contract on the explorer:
https://explorer.d-bis.org/address/
Quick Reference
| Action | Command |
|---|---|
| Compile | cd smom-dbis-138 && forge build |
| Dry run | forge script <SCRIPT> --rpc-url $RPC_URL_138 --with-gas-price 1000000000 |
| Deploy | Add --broadcast --private-key $PRIVATE_KEY to the above |
| Verify | forge verify-contract <ADDR> <PATH> --chain-id 138 --verifier blockscout --verifier-url $FORGE_VERIFIER_URL --rpc-url $RPC_URL_138 --flatten |
| Gas price | Always --with-gas-price 1000000000 for Chain 138 |
See also: CONTRACT_DEPLOYMENT_RUNBOOK.md, CONTRACTS_TO_DEPLOY, CONTRACT_ADDRESSES_REFERENCE.