ERC-5247 · Review · ERC · 2022-07-13
ERC-5247: Smart Contract Executable Proposal Interface
A minimal interface for onchain proposals: record a batch of contract calls (targets, values, gas limits, calldata) now and execute them later, independent of how approval or voting happens.
What problem does it solve?
Often the code you want to run is agreed on separately from when it runs. A DAO drafts a proposal, members vote, and only then is it executed. A trustee or delegate prepares a set of actions for someone else to approve. One party makes an "offer" as a ready-to-run transaction bundle that the other can accept by executing it.
Governance frameworks each have their own proposal format, tangled up with their voting logic. ERC-5247 pulls the proposal part out on its own, originally split off from the voting standard ERC-1202, so proposals can be created, stored and executed the same way regardless of how approval works.
How it works
Two functions and two events:
createProposal(proposalId, targets[], values[], gasLimits[], calldatas[], extraParams)records a list of calls. Each indexidescribes one call: sendvalues[i]wei withcalldatas[i]totargets[i], using up togasLimits[i]gas. It returns aregisteredProposalId, letting each implementation choose its own ID scheme. EmitsProposalCreated.executeProposal(proposalId, extraParams)runs the recorded calls. EmitsProposalExecuted.extraParamsis free-form bytes for implementation-specific data, such as signatures or vote references.
Arrays let one proposal bundle any number of calls. Who may execute, and when, is left to the implementation (a vote result, a multisig, a timelock, the counterparty of an offer…).
Sample code
Creating and executing a two-call proposal (ethers v6):
import { Contract, Interface } from "ethers";
const nft = new Interface(["function mint(address to, uint256 id)"]);
const calls = [
nft.encodeFunctionData("mint", [recipient, 1]),
nft.encodeFunctionData("mint", [recipient, 2]),
];
const registry = new Contract(registryAddress, [
"function createProposal(uint256,address[],uint256[],uint256[],bytes[],bytes) returns (uint256)",
"function executeProposal(uint256,bytes)",
], signer);
await (await registry.createProposal(
0, // proposer-chosen id
[nftAddress, nftAddress], // targets
[0, 0], // ETH values
[0, 0], // gas limits (0 = no explicit limit in this example)
calls,
"0x", // extraParams
)).wait();
// later, once approved by whatever process the registry enforces
await (await registry.executeProposal(0, "0x")).wait();
Things to know
- Status: Review. The interface may still change, and its Security Considerations section just says "Needs discussion".
- The standard does not define authorisation. The reference code shown in the spec lets anyone execute and never marks a proposal as executed, so a real deployment must add access control, approval checks and replay protection.
- That code also does not apply the
gasLimitsit stores. If you depend on per-call gas limits, check your implementation honours them. - Executing arbitrary calls from a contract that holds funds or privileges is exactly as powerful as it sounds; treat the executor like an admin key.
- Mature DAO frameworks offer a similar targets/values/calldatas model; ERC-5247 standardises it as a standalone interface.