---
eip: 1081
label: ERC-1081
title: Standard Bounties
status: Stagnant
type: Standards Track
category: ERC
created: 2018-05-14
requires: 20
official: https://eips.ethereum.org/EIPS/eip-1081
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-1081.md
canonical: https://eips.huatuo.xyz/zh/eip-1081/
lang: zh
tldr: 一个面向链上悬赏的标准合约提案：发布任务、收集提交、并以 ETH 或任意 ERC-20 支付被接受的工作，让悬赏平台之间可以共享工作和信誉。
tags: [bounties, payments, erc20, coordination]
---

# ERC-1081: Standard Bounties

> A standard contract and interface for issuing bounties on Ethereum, usable for any type of task, paying in any ERC20 token or in ETH.

**TL;DR:** 一个面向链上悬赏的标准合约提案：发布任务、收集提交、并以 ETH 或任意 ERC-20 支付被接受的工作，让悬赏平台之间可以共享工作和信誉。

## 它解决什么问题？

悬赏平台（规范作者举了 Gitcoin、Bounties Network 和 Status Open Bounty）各自以自己的格式保存悬赏。发布在一个平台上的悬赏无法在另一个平台上被看到或完成，也没人能跨平台追踪信誉，比如发布者实际兑现的频率有多高，或者工作者的提交被接受的频率有多高。

ERC-1081 为悬赏提出一种统一的合约形态，使任何平台都能以相同的方式创建、读取、完成和支付悬赏，且每一步都可在链上公开审计。

## 它如何运作

悬赏分为三个阶段：

1. **Issued（已发布）**：`issuer`（可选地带一个 `arbiter`）发布需求和截止时间。需求存放在链下的 JSON 文档中，合约在 `data` 中保存其 IPFS 哈希。
2. **Fulfilled（已完成）**：一个或多个 `fulfillers` 提交成果，同样以 IPFS 哈希的形式。多人可以共享一次提交，功劳按同一分母下的分子来分配。
3. **Accepted（已接受）**：发布者或仲裁者接受一次提交并付款，可以同时用多种代币支付。

核心函数：

| 函数 | 用途 |
| --- | --- |
| `initializeBounty(issuer, arbiter, data, deadline)` | 设置悬赏（适用于代理部署） |
| `fulfillBounty(fulfillers[], numerators[], denominator, data)` | 提交工作，分配功劳 |
| `acceptFulfillment(fulfillmentId, tokens[], amounts[])` | 为某次提交付款 |
| `drainBounty(tokens[])` | 发布者提取剩余资金 |
| `changeBounty` / `changeIssuer` / `changeArbiter` / `changeData` / `changeDeadline` | 修改悬赏 |

可选的扩展包括 `acceptAndFulfill`（发布者一步完成提交与付款，这样新贡献者不需要 ETH 付 gas）以及 `refundableContribute` / `refundContribution`（如果到截止时间仍未付款，出资者可以取回资金）。

出资方式很灵活：任何人只需把代币转到悬赏的地址，就能增加奖励。

## 示例代码

发布时的 `data` 指向类似下面的 JSON（节选自规范的 schema）：

```json
{
  "payload": {
    "title": "Add dark mode to the dashboard",
    "description": "Requirements and acceptance criteria...",
    "issuer": { "address": "0xIssuerAddress" },
    "funders": [],
    "categories": ["code"],
    "tags": ["frontend"],
    "created": 1700000000,
    "tokenSymbol": "ETH",
    "tokenAddress": "0x0000000000000000000000000000000000000000",
    "webReferenceURL": "https://github.com/org/repo/issues/1"
  },
  "meta": { "platform": "example", "schemaVersion": "0.1", "schemaName": "standardSchema" }
}
```

必需函数的 Solidity 接口草图：

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

interface IStandardBounty {
    function initializeBounty(address issuer, address arbiter, string calldata data, uint256 deadline) external;
    function fulfillBounty(address[] calldata fulfillers, uint256[] calldata numerators, uint256 denominator, string calldata data) external;
    function acceptFulfillment(uint256 fulfillmentId, IERC20[] calldata payoutTokens, uint256[] calldata tokenAmounts) external;
    function drainBounty(IERC20[] calldata payoutTokens) external;
    function changeBounty(address issuer, address arbiter, string calldata data, uint256 deadline) external;
}
```

## 需要注意

- 状态是 **Stagnant**。它从未定稿，也没有被广泛采用的跨平台悬赏接口。
- 规范自带的参考实现被标注为未经审计，不建议在主网上用来持有资金。
- 发布者可以修改需求并提走资金，所以完成者是在信任发布者（或仲裁者）会付款。这个标准提供的是透明度，而不是强制执行。
- 支付使用 [ERC-20](/eip-20/) 代币或 ETH；关于非标准代币的常见注意事项同样适用。


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-1081
