DocsFeed
On this page

Feed

Feed is a social feed on your layer. Posts are events, tips in HYPE go straight to the author, and 2% of each tip goes to a pot address chosen at deploy. Nothing in the contract can edit or delete a post, and it never holds a tip.

#Parameters

Field in the Builder Constructor argument Default Notes
App name (none) the template's title The name of the listing.
Pot address for the 2% pot_ your wallet Fixed forever. Leave the field empty to use your own wallet.

#Posting

post(text) with 1 to 500 bytes of text. It gives the post the next id, records its author and emits Posted(id, author, text). The text lives in the event, not in storage.

#Tipping

tip(id) with HYPE as the value, on any existing post:

  • 2% (TIP_BPS = 200) goes to the pot;
  • the other 98% goes to the author;
  • both transfers happen in the same call, and tipped(id) adds up the total.

If the author or the pot could not receive HYPE, the tip reverts.

#The page

The app page lists posts newest first, from the most recent 9,000 blocks of the layer, with the HYPE tipped on each. Connected, you can post and tip other people's posts 0.001 HYPE with one click. The contract accepts any tip amount; the button is a fixed amount for convenience.

#Functions

Function Who may call What it does
post(string) Anyone Publishes a post as an event.
tip(uint256) payable Anyone Pays the author, with 2% to the pot.
postCount(), authorOf(uint256), tipped(uint256), pot() Read The feed's state.

Events: Posted(id, author, text), Tipped(id, from, author, toAuthor, toPot). Errors: BadPost, NoPost, ZeroTip, TransferFailed.