solidity-deploy
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDeployment Workflow
部署工作流
Language Rule
语言规则
- Always respond in the same language the user is using. If the user asks in Chinese, respond in Chinese. If in English, respond in English.
- 始终使用与用户相同的语言回复。如果用户用中文提问,就用中文回复;如果用英文,就用英文回复。
Pre-deployment Checklist (all must pass)
预部署检查清单(必须全部通过)
| Step | Command / Action |
|---|---|
| Format code | |
| Run all tests | |
| Check gas report | |
| Verify config | Manually check |
| Dry-run | |
| Check balance | |
| Gas limit set | Deployment command must include |
| 步骤 | 命令 / 操作 |
|---|---|
| 格式化代码 | |
| 运行所有测试 | |
| 查看gas报告 | |
| 验证配置 | 手动检查 |
| 模拟运行 | |
| 检查余额 | |
| 设置gas上限 | 部署命令必须包含 |
Deployment Decision Rules
部署决策规则
| Situation | Rule |
|---|---|
| Default deployment | No |
| User requests verification | Add |
| Post-deploy verification | Use |
| Multi-chain deploy | Separate scripts per chain, never batch multiple chains in one script |
| Proxy deployment | Deploy implementation first, then proxy — verify both separately |
| 场景 | 规则 |
|---|---|
| 默认部署 | 不添加 |
| 用户要求验证 | 在命令中添加 |
| 部署后验证 | 单独使用 |
| 多链部署 | 每条链使用单独的脚本,切勿在一个脚本中批量处理多条链 |
| 代理部署 | 先部署实现合约,再部署代理合约 — 分别验证两者 |
Post-deployment Operations (all required)
部署后操作(必须全部执行)
- Update addresses in and
config/*.jsondeployments/latest.env - Test critical functions: to verify on-chain state is correct
cast call - Record changes in
docs/CHANGELOG.md - Submit PR with deployment transaction hash link
- If verification needed, run separately
forge verify-contract
- 更新 和
config/*.json中的地址deployments/latest.env - 测试核心函数:使用 验证链上状态是否正确
cast call - 在 中记录变更
docs/CHANGELOG.md - 提交包含部署交易哈希链接的PR
- 如果需要验证,单独运行
forge verify-contract
Key Security Rule
核心安全规则
- Never pass private keys directly in commands. Use Foundry Keystore () to manage keys securely.
cast wallet import - Never include in templates. The user must explicitly add it when ready to deploy.
--broadcast
- 切勿在命令中直接传入私钥。使用Foundry Keystore()安全管理密钥。
cast wallet import - 切勿在模板中包含 。用户准备好部署时必须手动添加该参数。
--broadcast
Command Templates
命令模板
bash
undefinedbash
undefinedDry-run (simulation only, no on-chain execution)
模拟运行(仅模拟,不执行链上操作)
forge script script/Deploy.s.sol:DeployScript
--rpc-url <RPC_URL>
--gas-limit 5000000
-vvvv
--rpc-url <RPC_URL>
--gas-limit 5000000
-vvvv
forge script script/Deploy.s.sol:DeployScript
--rpc-url <RPC_URL>
--gas-limit 5000000
-vvvv
--rpc-url <RPC_URL>
--gas-limit 5000000
-vvvv
When user is ready to deploy, instruct them to add:
当用户准备好部署时,指导他们添加:
--account <KEYSTORE_NAME> --broadcast
--account <KEYSTORE_NAME> --broadcast
Verify existing contract separately
单独验证已部署的合约
forge verify-contract <ADDRESS> <CONTRACT>
--chain-id <CHAIN_ID>
--etherscan-api-key <API_KEY>
--constructor-args $(cast abi-encode "constructor(address)" <ARG>)
--chain-id <CHAIN_ID>
--etherscan-api-key <API_KEY>
--constructor-args $(cast abi-encode "constructor(address)" <ARG>)
forge verify-contract <ADDRESS> <CONTRACT>
--chain-id <CHAIN_ID>
--etherscan-api-key <API_KEY>
--constructor-args $(cast abi-encode "constructor(address)" <ARG>)
--chain-id <CHAIN_ID>
--etherscan-api-key <API_KEY>
--constructor-args $(cast abi-encode "constructor(address)" <ARG>)
Quick on-chain read test after deployment
部署后快速链上读取测试
cast call <CONTRACT_ADDRESS> "functionName()" --rpc-url <RPC_URL>
undefinedcast call <CONTRACT_ADDRESS> "functionName()" --rpc-url <RPC_URL>
undefined