EIPs Explained

ERC-7794 · Draft · ERC · 2024-10-22

ERC-7794: Grant Registry

A standard on-chain registry contract for grant programs, recording who funds what, for whom, with which milestones and disbursements, so grant data from different communities and chains can be tracked the same way.

What problem does it solve?

Grant programs across Ethereum and other chains each use their own forms, spreadsheets and payout flows. Funders, grantees and analysts have no common way to see which grants exist, who received them, what milestones were promised and whether money was actually paid out. Comparing programs, or following a team that holds grants on several chains, means stitching together incompatible data by hand.

ERC-7794 defines a single registry interface that any program can write to. Every lifecycle change emits an event, so indexers and dashboards can follow grants uniformly.

How it works

Registering. registerGrant(id, chainid, community, grantManager) creates a grant and returns a bytes32 grantId. In the reference implementation that ID is keccak256(abi.encodePacked(id, chainid, community, block.timestamp)). id, chainid and the community name are immutable; the chainid field lets a registry on one network describe grants paid on another.

Managing. Only the current grant manager may change a grant:

  • transferOwnership hands the grant to a new manager.
  • addGrantee / removeGrantee maintain a set of recipient addresses (team grants are supported).
  • setStartDate, addMilestoneDate, removeMilestoneDate define the timeline.
  • addDisbursement(grantId, milestoneDate, fundingToken, fundingAmount) attaches a payout to a milestone, setDisbursementStatus marks it paid, removeDisbursement clears it.
  • addExternalLink / removeExternalLink reference off-chain material such as proposals or reports.

Reading. getGrant, getGrantManager, getGrantees, getMilestonesDates, getDisbursement and getExternalLinks.

The registry tracks disbursements; it does not move funds. Programs that pay out off-chain can still use it for status, with external links for documentation.

Sample code

Registering a grant and a milestone payment (ethers v6):

import { Contract, parseUnits } from "ethers";

const abi = [
  "function registerGrant(uint256 id, uint256 chainid, string community, address grantManager) returns (bytes32)",
  "function addGrantee(bytes32 grantId, address grantee)",
  "function addMilestoneDate(bytes32 grantId, uint256 milestoneDate)",
  "function addDisbursement(bytes32 grantId, uint256 milestoneDate, address fundingToken, uint256 fundingAmount)",
  "function setDisbursementStatus(bytes32 grantId, uint256 milestoneDate, bool isDisbursed)",
  "event GrantRegistered(bytes32 indexed grantId, uint256 indexed id, uint256 chainid, string indexed community, address grantManager)",
];
const registry = new Contract(registryAddress, abi, managerSigner);

const receipt = await (await registry.registerGrant(42, 1, "Example DAO", managerSigner.address)).wait();
const grantId = registry.interface.parseLog(receipt!.logs[0])!.args.grantId;

const milestone = Math.floor(Date.UTC(2027, 0, 31) / 1000);
await registry.addGrantee(grantId, granteeAddress);
await registry.addMilestoneDate(grantId, milestone);
await registry.addDisbursement(grantId, milestone, tokenAddress, parseUnits("5000", 6));
// later, after paying out:
await registry.setDisbursementStatus(grantId, milestone, true);

Things to know

  • Status: Draft.
  • The data is self-reported by the grant manager. Marking a disbursement as made does not prove a payment happened; verify against token transfers.
  • The interface references Grant and Disbursements structs whose full definitions are not given in the interface section; check the reference implementation before building against it.
  • Because grantId includes block.timestamp, the same grant details registered twice in different blocks yield different IDs.
  • The spec lists no security concerns, but access control rests entirely on the single manager address per grant.

#grants #registry #public-goods #governance #draft

Details

Authors
Guilherme Neves (@0xneves)
Status
Draft
Type
Standards Track / ERC
Created
2024-10-22

Machine-readable: Markdown · JSON