|
| 1 | +# RetroPick Testnet Deployment |
| 2 | + |
| 3 | +Deployment guide for the CRE + Nitrolite Yellow checkpoint stack to **Tenderly Virtual TestNet** (Worldchain Sepolia). |
| 4 | + |
| 5 | +## Target Network |
| 6 | + |
| 7 | +| Property | Value | |
| 8 | +|----------|-------| |
| 9 | +| Network | Tenderly Virtual TestNet (Worldchain Sepolia) | |
| 10 | +| RPC URL | `https://virtual.worldchain-sepolia.eu.rpc.tenderly.co/41d3ff02-8fa1-4270-aa65-a652be2c6541` | |
| 11 | +| Chain ID | 4801 | |
| 12 | +| Native Token | ETH | |
| 13 | +| Block Explorer | https://worldchain-sepolia-explorer.alchemy.com/ | |
| 14 | + |
| 15 | +## Configuration (from .env) |
| 16 | + |
| 17 | +| Variable | Value | Description | |
| 18 | +|----------|-------|-------------| |
| 19 | +| `PRIVATE_KEY` | (deployer key) | Wallet that broadcasts deployment | |
| 20 | +| `OPERATOR` | `0xbeaA395506D02d20749d8E39ddb996ACe1C85Bfc` | Checkpoint signer for ChannelSettlement | |
| 21 | +| `OPERATOR_PRIVATE_KEY` | (same as deployer) | Used by relayer for signing | |
| 22 | +| `SETTLEMENT_TOKEN` | `0x0000000000000000000000000000000000000000` | ERC20 collateral; deploy MockERC20 if needed | |
| 23 | +| `CHAINLINK_FORWARDER` | `0x0000000000000000000000000000000000000000` | On VT, deploy/mock if receivers enforce it | |
| 24 | +| `MIN_CONFIDENCE` | `8000` | Oracle confidence (80% in bps) | |
| 25 | +| `PROTOCOL_FEE_BPS` | `250` | Protocol fee 2.5% | |
| 26 | +| `LP_FEE_SHARE_BPS` | `1750` | LP share 17.5% | |
| 27 | +| `CREATOR_FEE_SHARE_BPS` | `1000` | Creator share 10% | |
| 28 | +| `USE_RECEIVER_ALLOWLIST` | `true` | Enforce receiver allowlist | |
| 29 | +| `APPROVE_MARKET_REGISTRY_RECEIVER` | `true` | MarketRegistry approved for settlement | |
| 30 | +| `EXPECTED_WORKFLOW_NAME` | `retropickV1` | ReceiverTemplate workflow filter | |
| 31 | + |
| 32 | +## Pre-deploy |
| 33 | + |
| 34 | +1. Ensure `.env` is populated (copy from `.env.example`). |
| 35 | +2. **Required:** `SETTLEMENT_TOKEN` and `CHAINLINK_FORWARDER` must be non-zero. Deployment reverts otherwise: |
| 36 | + - **SETTLEMENT_TOKEN** – CollateralVault requires a valid ERC20. Deploy a MockERC20 on the VT and mint tokens. |
| 37 | + - **CHAINLINK_FORWARDER** – ReceiverTemplate requires a valid forwarder. On VT, deploy a mock (e.g. a simple contract you control) that can call `onReport` for testing. |
| 38 | +3. Fund the deployer wallet with native ETH on the VT for gas. |
| 39 | + |
| 40 | +## Deploy |
| 41 | + |
| 42 | +```bash |
| 43 | +cd packages/contracts |
| 44 | +source .env # or export vars manually |
| 45 | +forge script script/DeployTestnet.s.sol:DeployTestnet \ |
| 46 | + --rpc-url "$RPC_URL" \ |
| 47 | + --broadcast \ |
| 48 | + --slow |
| 49 | +``` |
| 50 | + |
| 51 | +# Export private key ke global |
| 52 | +export PRIVATE_KEY=$(cast wallet private-key --account rudeus33) |
| 53 | +# Deploy with script |
| 54 | +forge script script/DeployTestnet.s.sol \ |
| 55 | + --rpc-url https://sepolia.base.org/ \ |
| 56 | + --broadcast \ |
| 57 | + --account rudeus33 |
| 58 | + |
| 59 | +`--slow` waits for each transaction to confirm before sending the next, avoiding "replacement transaction underpriced" errors when deploying many contracts. |
| 60 | + |
| 61 | +For a dry run (no broadcast): |
| 62 | + |
| 63 | +```bash |
| 64 | +forge script script/DeployTestnet.s.sol:DeployTestnet --rpc-url "$RPC_URL" |
| 65 | +``` |
| 66 | + |
| 67 | +**"Replacement transaction underpriced"** – Use `--slow` (included above). If you have pending txs from a failed run, either wait for them to confirm or clear and retry. |
| 68 | + |
| 69 | +**Resume partial deployment:** |
| 70 | + |
| 71 | +```bash |
| 72 | +forge script script/DeployTestnet.s.sol:DeployTestnet --rpc-url "$RPC_URL" --broadcast --slow --resume |
| 73 | +``` |
| 74 | + |
| 75 | +## Deployed Contracts |
| 76 | + |
| 77 | +After deployment, record addresses from the script output: |
| 78 | + |
| 79 | +| Contract | Address | |
| 80 | +|----------|---------| |
| 81 | +| ExecutionLedger | | |
| 82 | +| ChannelSettlement | | |
| 83 | +| MultiAssetVault | | |
| 84 | +| CollateralVault | | |
| 85 | +| MarketRegistry | | |
| 86 | +| FeeManager | | |
| 87 | +| FeePool | | |
| 88 | +| TreasuryPool | | |
| 89 | +| ReportValidator | | |
| 90 | +| CREReceiver | | |
| 91 | +| OracleCoordinator | | |
| 92 | +| SettlementRouter | | |
| 93 | +| MarketPolicy | | |
| 94 | +| MarketDraftBoard | | |
| 95 | +| DraftClaimManager | | |
| 96 | +| LiquidityVaultFactory | | |
| 97 | +| CREPublishReceiver | | |
| 98 | +| MarketFactory | | |
| 99 | + |
| 100 | +## Post-deploy |
| 101 | + |
| 102 | +### 1. Relayer (`apps/relayer/.env`) |
| 103 | + |
| 104 | +``` |
| 105 | +CHANNEL_SETTLEMENT_ADDRESS=<ChannelSettlement address from deploy> |
| 106 | +OPERATOR_PRIVATE_KEY=<operator key> |
| 107 | +``` |
| 108 | + |
| 109 | +### 2. CRE Workflows |
| 110 | + |
| 111 | +Configure workflows to use: |
| 112 | + |
| 113 | +- **CREReceiver** – outcome resolution + checkpoint submit |
| 114 | +- **CREPublishReceiver** – publish from draft |
| 115 | +- **MarketFactory** – CRE feed market creation |
| 116 | + |
| 117 | +### 3. Draft Proposals |
| 118 | + |
| 119 | +Deployer has `AI_ORACLE_ROLE`. Set `AI_ORACLE_ADDRESS` in `.env` and re-run deploy to grant the role to a CRE workflow for automated draft proposals. |
| 120 | + |
| 121 | +## Tenderly Notes |
| 122 | + |
| 123 | +- Virtual TestNets use ephemeral forked state; deployments are not persistent across sessions unless you use Tenderly persistence features. |
| 124 | +- No official Chainlink Forwarder on VT; use a mock or disable forwarder checks for testing. |
| 125 | +- Fund the deployer wallet with native ETH on the VT for gas. |
0 commit comments