ERC-1081 Standard Bounties
Stagnant · Vaults & DeFi · created 2018-05-14
A common contract and interface in which a requester posts a reward (bounty), and once the fulfiller's submitted work is approved, payment is made in ETH or ERC20 tokens.
Why it is needed
Without a bounty standard, bounty issuance, submission, and approval logic differs across platforms such as Gitcoin and Bounties Network and is incompatible between them. A bounty created on one platform cannot be displayed or processed by another, recreating the walled gardens of the Web 2.0 era across platforms. Reputation information, such as how often an issuer approves submissions or how often a fulfiller's submissions get accepted, also accumulates separately on each platform and cannot be tracked across them. Early implementations also had rigid payment methods: all funds had to be deposited upfront before issuing a bounty, and payment was fixed to a single token and a single fulfiller for a fixed amount.
What to implement
initializeBounty(address _issuer, address _arbiter, string _data, uint _deadline): Sets the issuer, arbiter, work description (IPFS hash), and deadline when deploying a new StandardBounty contract. Used in place of a constructor when a proxy pattern is used.fulfillBounty(address[] _fulfillers, uint[] _numerators, uint _denomenator, string _data): Submits the IPFS hash of the completed work. When multiple people collaborate, each person's share can be specified as a numerator and denominator.acceptFulfillment(uint _fulfillmentId, StandardToken[] _payoutTokens, uint[] _tokenAmounts): The issuer or arbiter approves a specific submission and distributes the reward to participants in the specified token and amount.drainBounty(StandardToken[] _payoutTokens): The issuer withdraws funds remaining in the bounty if needed.changeBounty(address _issuer, address _arbiter, string _data, uint _deadline): The issuer changes the bounty's issuer, arbiter, data, and deadline all at once.changeIssuer(address _issuer): The issuer replaces the bounty's issuer with a new address.changeArbiter(address _arbiter): The issuer replaces the bounty's arbiter with a new address.changeData(string _data): The issuer changes only the bounty's data (IPFS hash).changeDeadline(uint _deadline): The issuer changes only the bounty's deadline.acceptAndFulfill(address[] _fulfillers, uint[] _numerators, uint _denomenator, string _data, StandardToken[] _payoutTokens, uint[] _tokenAmounts): The issuer handles submission and approval in one step on the fulfiller's behalf, letting the fulfiller receive the reward without paying gas fees.changeMasterCopy(StandardBounty _masterCopy): When using a proxy pattern, the issuer changes the master contract that the proxy contract references.refundableContribute(uint[] _amounts, StandardToken[] _tokens): Contributes funds to the bounty under a condition that allows a refund.refundContribution(uint _contributionId): If the deadline has passed and payment has not yet been made to a valid submission, funds contributed via refundableContribute are returned.
In depth
The three stages of a bounty
The source defines a bounty as having three stages: issued, fulfilled, and accepted. The issuer sets the desired work outcome and payment amount and posts the bounty; the fulfiller completes the work and submits the result (or a record of completion), and the hash of this result is stored immutably on chain to serve as evidence later. The issuer or arbiter selects one or more submissions to approve, pays the reward to the fulfiller accordingly, and ownership of the result transfers to the issuer.
Initialization and modification functions
initializeBounty starts a bounty by setting the issuer, arbiter, data (IPFS hash), and deadline. It is kept as a separate function because initialization cannot be done in the constructor when using the proxy design pattern. changeBounty changes all four of these fields at once, while changeIssuer, changeArbiter, changeData, and changeDeadline are functions that change only one field each. All of these can be called only by the issuer.
Submission and share distribution
fulfillBounty takes an array of fulfiller addresses (_fulfillers), an array of numerators (_numerators), and a common denominator (_denomenator), allowing each participant's share to be specified as a fraction when multiple people have worked on the task. The source explains that initially only one person could submit at a time, but this structure was changed because users wanted collaborative submissions. It is also possible for a bounty-matching platform to include itself as a collaborator and receive a set fee.
Approval, payment, and fund withdrawal
acceptFulfillment lets the issuer or arbiter specify an array of tokens to pay out (_payoutTokens) and an array of amounts for each token (_tokenAmounts) for a specific submission (_fulfillmentId), distributing the payment to participants. Funds for a bounty can also be sent directly to the contract address, so the payout amount can be variable, and it is also possible to pay out a single bounty's balance across multiple submissions. drainBounty is a function that lets the issuer withdraw funds remaining in the bounty if needed.
Submitting without gas fees
acceptAndFulfill is an optional function in which the issuer handles submission and approval in one step on the fulfiller's behalf, so the fulfiller can receive the reward even without ETH to pay gas fees. The work result and payment record still remain immutably on chain.
Refundable contribution
Unlike a simple transfer, refundableContribute is a function that contributes funds to a bounty under a refund condition. If the bounty's deadline passes without payment being made to a valid submission, anyone who contributed through this function can call refundContribution to get their contribution back.
Data schema
Bounty issuance data is JSON made up of a payload (title, description, issuer/sponsor information, category/tags, creation time, payment token symbol/address, etc.) and meta (hosting platform, schema version/name); it is uploaded to IPFS and only its hash is recorded in the contract. Submission data is similarly made up of a payload containing a description, the IPFS hash of the submitted file, and the fulfillers' persona information, along with meta. A persona is identifying information for an individual or team consisting of a name, email, and GitHub ID (all optional) and a web3 address (required).
Development status
This proposal is in Stagnant status, a proposal that has not yet been finalized and has stalled. The source states that the reference implementation has been tested but has not undergone an audit or a bug bounty, that its correctness cannot be guaranteed, and that it is currently not recommended for holding real funds on mainnet.