ERC-1129 · Stagnant · ERC · 2018-05-31
ERC-1129: Standardised DAPP announcements
A simple contract interface for posting and removing service announcements (outages, migrations, freezes) on-chain so dapp users can see a project's status in a standard way.
What problem does it solve?
When a token or dapp has a problem, moves to a new contract, or pauses for maintenance, there is no standard place to tell users. Teams post on social media or their website, and nothing ties the message to the contract itself.
ERC-1129 proposes that a contract carry its own announcement board: authorised accounts post messages, anyone can read them, and removals record a reason. Because the format is shared, wallets and front ends could display announcements for any contract that implements it, and the history is traceable on-chain.
How it works
The contract keeps two small records:
- Announcer: whether an address may post (
allowedToPost) and a human-friendlyname. - Announcement: the author's name, the author's address and the
posttext.
Functions:
| Function | Purpose |
|---|---|
givePostingPermission(addr, bool, name) |
Owner grants or revokes posting rights |
postAnnouncement(message) |
Authorised announcer publishes a message |
removeAnnouncement(id, reason) |
Removes a message and explains why (issue resolved, next steps) |
readPosts(id) |
Returns author name and message |
theNumberOfAnnouncements() |
Optional count of active announcements |
Events NewAnnouncement(author, message) and RemovedAnnouncement(author, message, reason, remover) MUST be emitted, so off-chain tools can follow announcements without polling storage. When an announcement is removed, the list is compacted so there are no empty slots.
Sample code
A compact modern-Solidity sketch of the interface (the spec itself uses pre-0.5 syntax):
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
contract Announcements {
struct Announcement { string author; address authorAddress; string post; }
address public owner = msg.sender;
mapping(address => bool) public allowedToPost;
mapping(address => string) public posterName;
Announcement[] private posts;
event NewAnnouncement(string author, string message);
event RemovedAnnouncement(string author, string message, string reason, address remover);
function givePostingPermission(address who, bool allowed, string calldata name) external {
require(msg.sender == owner, "owner");
allowedToPost[who] = allowed;
posterName[who] = name;
}
function postAnnouncement(string calldata message) external {
require(allowedToPost[msg.sender], "cannot post");
posts.push(Announcement(posterName[msg.sender], msg.sender, message));
emit NewAnnouncement(posterName[msg.sender], message);
}
function removeAnnouncement(uint256 id, string calldata reason) external {
require(allowedToPost[msg.sender], "cannot remove");
Announcement memory a = posts[id];
posts[id] = posts[posts.length - 1]; // keep the array dense
posts.pop();
emit RemovedAnnouncement(a.author, a.post, reason, msg.sender);
}
function readPosts(uint256 id) external view returns (string memory, string memory) {
return (posts[id].author, posts[id].post);
}
function theNumberOfAnnouncements() external view returns (uint256) { return posts.length; }
}
Things to know
- Status: Stagnant. It was never widely adopted by wallets or explorers.
- The spec does not say who may call
removeAnnouncement; restricting it (as above) is up to the implementer. - Storing long strings on-chain is expensive. Many projects now emit events only, or point to off-chain content.