ERC-7794 Cross-chain grant registry (Grant Registry)

Draft · Other · created 2024-10-22

Enables tracking of grant registrations, participants, milestones, and disbursement status across multiple blockchains using standardized events in a single registry contract.

Why it is needed

Each grant program has its own interface and management approach, forcing both funders and grantees to learn different procedures, and making it difficult to aggregate data for grants spanning multiple chains in one place. Milestone progress and disbursement status cannot be recorded in a standardized way, reducing transparency and making it hard to compare programs or analyze outcomes. Even when a grantee team's composition changes, there is no way to record this consistently on-chain, making it difficult for external protocols to reliably use grant data.

What to implement

In depth

Separation of identifiers from data structures

A grant is divided into immutable identifying information consisting of id, chainid, and community, and mutable information consisting of grantManager, grantees, milestones, disbursements, and external links. grantId is generated by hashing id, chainid, community, and block.timestamp with keccak256, so it is uniquely determined at each registration. community cannot be an empty string, grantManager cannot be the zero address, and an already-registered grantId cannot be registered again (GrantAlreadyRegistered).

Grant manager permission model

transferOwnership, addGrantee, removeGrantee, setStartDate, addMilestoneDate, removeMilestoneDate, addDisbursement, removeDisbursement, setDisbursementStatus, addExternalLink, and removeExternalLink can all only be called by the current grantManager. The reference implementation's _requireManager reverts with InvalidGrantManager if msg.sender differs from grantManager. Ownership can be transferred to another address via transferOwnership, and the new address also cannot be the zero address.

Grantee management

grantees is managed as an EnumerableSet.AddressSet, which prevents duplicate additions and supports listing and removal. Calling addGrantee again on an already-added address triggers GranteeAlreadyAdded, and calling removeGrantee on a nonexistent address triggers GranteeNotFound. The zero address cannot be added as a grantee.

Milestones and start date

setStartDate records the grant's start date, and addMilestoneDate and removeMilestoneDate add or remove milestone dates in an EnumerableSet.UintSet. Adding a date that already exists triggers MilestoneDateAlreadyAdded, and removing or referencing a date that does not exist triggers MilestoneDateNotFound. getMilestonesDates returns the start date together with the array of milestone dates.

Per-milestone disbursements

addDisbursement records fundingToken and fundingAmount for a specific milestoneDate, overwriting any existing values. The milestoneDate must already exist on the grant before calling it; otherwise MilestoneDateNotFound is triggered. setDisbursementStatus updates only the isDisbursed flag to indicate whether the disbursement has actually been made, and removeDisbursement deletes the disbursement data for that milestone.

Off-chain integration via external links

addExternalLink lets you add a grant-related URL to a string array, and an empty string is rejected with InvalidExternalLink. removeExternalLink removes a link by array index; the reference implementation is built by moving the last element into that index and popping the array, so link order is not preserved. If the index is out of the array's bounds, InvalidIndex is triggered.

Modularity with off-chain disbursement programs

According to the Rationale, not all grant programs disburse funds on-chain, so the design records only the disbursement status (isDisbursed) in the registry while leaving the actual disbursement to be handled via external links or off-chain procedures. This allows both on-chain and off-chain disbursement programs to track status in the same registry.

Standard status

This ERC is currently in Draft status, a proposal still undergoing community review and change.

Original ERC · ← ERCs