Make Git Escrow
You are automating the creation of a git escrow bounty via the git-escrows submit CLI command. This locks ERC20 tokens in escrow as a bounty for someone who can make a failing test suite pass.
Step 1: Check CLI availability
Run git-escrows --help to verify the CLI is installed. If it fails, try npx git-escrows --help or bunx git-escrows --help. Use whichever works for all subsequent commands. If none work, tell the user to install with npm i -g git-escrows.
Step 2: Check .env configuration
Check if a .env file exists in the current directory. If not, tell the user they need one and suggest running:
CODEBLOCK0
Verify it contains at least PRIVATE_KEY and NETWORK (or defaults to anvil). For base-sepolia and sepolia networks, contract addresses are auto-configured.
Step 3: Gather parameters
You need all of these to run the submit command:
- 1.
--tests-repo (required): Git repository URL containing the failing test suite.
- If the user provided a URL as an argument, use that.
- Otherwise, check if the current directory is a git repo and offer to use its remote URL.
- Ask the user if neither is available.
- 2.
--tests-commit (required): The commit hash of the test suite.
- If using the current repo, detect HEAD with
git rev-parse HEAD.
- Otherwise ask the user.
- 3.
--reward (required): Amount of tokens to escrow, in wei.
- Ask the user. Help them convert if they give a human-readable amount (e.g., "1 USDC" = "1000000" for 6-decimal tokens, "1 ETH worth" = "1000000000000000000" for 18-decimal tokens).
- 4.
--oracle (required): The Ethereum address of the oracle that will arbitrate.
- Ask the user. Mention the public demo oracle on Sepolia:
0xc5c132B69f57dAAAb75d9ebA86cab504b272Ccbc.
- 5.
--arbiter (required): The arbiter contract address.
- Ask the user. This is typically the TrustedOracleArbiter contract on their network.
- 6.
--token (required): The ERC20 token contract address for the reward.
- Ask the user.
Ask for any missing parameters, grouping related questions together when possible to minimize back-and-forth.
Step 4: Execute
Run the submit command with all gathered parameters:
CODEBLOCK1
Step 5: Report results
After successful execution:
- - Report the Escrow UID prominently
- Show the full escrow details (attester, recipient, schema, reward, token, oracle)
- Provide the fulfill command that a solver would use:
git-escrows fulfill --escrow-uid <UID> --solution-repo "<url>" --solution-commit "<hash>"
- - Mention they can track status with: INLINECODE16
If the command fails, help diagnose the issue (insufficient balance, wrong network, missing approval, etc.).
创建 Git 托管赏金
您正在通过 git-escrows submit CLI 命令自动化创建 Git 托管赏金。这将把 ERC20 代币锁定在托管合约中,作为让失败测试套件通过的人的赏金。
步骤 1:检查 CLI 可用性
运行 git-escrows --help 验证 CLI 是否已安装。如果失败,尝试 npx git-escrows --help 或 bunx git-escrows --help。后续所有命令使用可用的那个。如果都不行,告知用户使用 npm i -g git-escrows 安装。
步骤 2:检查 .env 配置
检查当前目录是否存在 .env 文件。如果不存在,告知用户需要创建并建议运行:
git-escrows new-client --privateKey 0x... --network sepolia
验证文件至少包含 PRIVATE_KEY 和 NETWORK(或默认使用 anvil)。对于 base-sepolia 和 sepolia 网络,合约地址会自动配置。
步骤 3:收集参数
运行提交命令需要以下所有参数:
- 1. --tests-repo(必需):包含失败测试套件的 Git 仓库 URL。
- 如果用户提供了 URL 作为参数,则使用该 URL。
- 否则,检查当前目录是否为 git 仓库并提供使用其远程 URL 的选项。
- 如果两者都不可用,询问用户。
- 2. --tests-commit(必需):测试套件的提交哈希。
- 如果使用当前仓库,使用 git rev-parse HEAD 检测 HEAD。
- 否则询问用户。
- 3. --reward(必需):要托管的代币数量,以 wei 为单位。
- 询问用户。如果他们提供人类可读的数量(例如,1 USDC = 1000000 对应 6 位小数代币,1 ETH worth = 1000000000000000000 对应 18 位小数代币),帮助他们转换。
- 4. --oracle(必需):负责仲裁的预言机以太坊地址。
- 询问用户。提及 Sepolia 上的公共演示预言机:0xc5c132B69f57dAAAb75d9ebA86cab504b272Ccbc。
- 5. --arbiter(必需):仲裁合约地址。
- 询问用户。这通常是其网络上的 TrustedOracleArbiter 合约。
- 6. --token(必需):用于奖励的 ERC20 代币合约地址。
- 询问用户。
询问任何缺失的参数,尽可能将相关问题分组以减少来回沟通。
步骤 4:执行
使用所有收集的参数运行提交命令:
git-escrows submit \
--tests-repo <仓库-url> \
--tests-commit <提交哈希> \
--reward <数量> \
--arbiter <地址> \
--oracle <地址> \
--token <地址>
步骤 5:报告结果
成功执行后:
- - 突出显示 托管 UID
- 显示完整的托管详情(证明者、接收者、模式、奖励、代币、预言机)
- 提供解决者会使用的履行命令:
git-escrows fulfill --escrow-uid --solution-repo --solution-commit
- - 提示他们可以使用以下命令跟踪状态:git-escrows list --status open
如果命令失败,帮助诊断问题(余额不足、网络错误、缺少授权等)。