BuzzerLens
Title: BuzzerLens — public read API over Buzzer and BuzzerTreasury
Author: Buzzer
Stateless aggregator so a client can render any screen with ONE RPC call. Every function is
a view; nothing here can change state. It reads only public storage of the two contracts,
so it can be redeployed or extended at any time without touching them.
Naming
getX(...)one entity, with per-input arrays (fields to read, uids/addresses to relate to)getXs(...)the bulk form: the same inputs applied to every id in a list...ByName/ByAddressresolve then fetchaggregate(...)escape hatch: batch arbitrarystaticcalls to any contract Everything that can be a client convention (field keys, relationship bits) is passed in by the caller, so the lens never needs to know what"bio"or bit 0 mean.
State Variables
BUZZ
The protocol contract this lens reads.
Buzzer public immutable BUZZ
TREASURY
The treasury contract this lens reads.
BuzzerTreasury public immutable TREASURY
Functions
constructor
constructor(Buzzer buzz, BuzzerTreasury treasury) ;
Parameters
| Name | Type | Description |
|---|---|---|
buzz |
Buzzer |
Deployed Buzzer. |
treasury |
BuzzerTreasury |
Deployed BuzzerTreasury (may be address(0) if not needed; treasury views then revert). |
getProfile
Full profile view.
function getProfile(uint256 uid, bytes32[] calldata fields, uint256[] calldata friends, address[] calldata addrs)
public
view
returns (ProfileView memory v);
Parameters
| Name | Type | Description |
|---|---|---|
uid |
uint256 |
Profile id. |
fields |
bytes32[] |
Profile-data keys to read (client convention, e.g. "name", "bio", "pfp"). |
friends |
uint256[] |
uids to fetch relationship words for, in both directions. |
addrs |
address[] |
Addresses to fetch permissions / link status for. |
getProfiles
Bulk getProfile: the same fields/friends/addrs applied to every uid.
function getProfiles(
uint256[] calldata uids,
bytes32[] calldata fields,
uint256[] calldata friends,
address[] calldata addrs
) external view returns (ProfileView[] memory out);
getProfileByName
getProfile for the uid owning buzz name name (exists == false if unregistered).
function getProfileByName(
bytes32 name,
bytes32[] calldata fields,
uint256[] calldata friends,
address[] calldata addrs
) external view returns (ProfileView memory);
getProfileByAddress
getProfile for the uid addr belongs to (exists == false if none).
function getProfileByAddress(
address addr,
bytes32[] calldata fields,
uint256[] calldata friends,
address[] calldata addrs
) external view returns (ProfileView memory);
getNames
Names of many uids (0 = none).
function getNames(uint256[] calldata uids) external view returns (bytes32[] memory names);
getProfileFields
Profile fields for many uids: values[i][j] = profileData[uids[i]][keys[j]].
function getProfileFields(uint256[] calldata uids, bytes32[] calldata keys)
external
view
returns (bytes[][] memory values);
getRecoveryStates
Recovery state for many uids.
function getRecoveryStates(uint256[] calldata uids)
external
view
returns (address[] memory recoveryAddr, address[] memory pendingTo, uint64[] memory pendingAt);
Returns
| Name | Type | Description |
|---|---|---|
recoveryAddr |
address[] |
Guardian per uid. |
pendingTo |
address[] |
Pending new custody per uid (0 = none). |
pendingAt |
uint64[] |
Earliest execution time per uid. |
getIdentity
What addr is: which uid it belongs to, in what role, with which permissions.
function getIdentity(address addr) public view returns (IdentityView memory v);
getIdentities
Bulk getIdentity.
function getIdentities(address[] calldata addrs) external view returns (IdentityView[] memory out);
uidsOf
Resolve many addresses → uids (0 = none).
function uidsOf(address[] calldata addrs) external view returns (uint256[] memory uids);
uidsOfNames
Resolve many buzz names → uids (0 = unregistered).
function uidsOfNames(bytes32[] calldata names) external view returns (uint256[] memory uids);
hasPermissions
Pairwise permission check: ok[i] = permissions[uids[i]][addrs[i]] & bits[i] != 0.
Use to pre-validate a batch (multicall) before sending it.
function hasPermissions(uint256[] calldata uids, address[] calldata addrs, uint256[] calldata bits)
external
view
returns (bool[] memory ok);
getOffers
Pending offers (custody hand-offs, link proposals) made to addr on each of uids.
The candidate uid list comes from CustodyTransferProposed / LinkProposed events;
this call tells the client which are still valid right now.
function getOffers(address addr, uint256[] calldata uids) external view returns (OfferView[] memory out);
getSignerContext
Everything a wallet needs to sign an Execute or LinkConsent for signer.
function getSignerContext(address signer) external view returns (SignerContext memory c);
getGraph
Relationship words between uid and each target, both directions.
function getGraph(uint256 uid, uint256[] calldata targets)
external
view
returns (bytes32[] memory outgoing, bytes32[] memory incoming);
relationshipsOf
Arbitrary pairs: r[i] = relationships[a[i]][b[i]].
function relationshipsOf(uint256[] calldata a, uint256[] calldata b) external view returns (bytes32[] memory r);
getAuthors
Author cards for a feed, from viewerUid's perspective (follow/block/mute both ways).
function getAuthors(uint256 viewerUid, uint256[] calldata authorUids, bytes32[] calldata fields)
external
view
returns (AuthorView[] memory out);
Parameters
| Name | Type | Description |
|---|---|---|
viewerUid |
uint256 |
The viewing profile (0 for anonymous — relationship words come back as 0). |
authorUids |
uint256[] |
Authors of the posts on screen. |
fields |
bytes32[] |
Profile-data keys to include (display name, avatar, …). |
getCommunity
Full community view.
function getCommunity(uint256 communityId, bytes32[] calldata fields, uint256[] calldata uids)
public
view
returns (CommunityView memory v);
Parameters
| Name | Type | Description |
|---|---|---|
communityId |
uint256 |
Community id. |
fields |
bytes32[] |
Community-data keys to read. |
uids |
uint256[] |
uids to fetch standing and edge for (e.g. the viewer, or a member list). |
getCommunities
Bulk getCommunity: the same fields/uids applied to every community.
function getCommunities(uint256[] calldata communityIds, bytes32[] calldata fields, uint256[] calldata uids)
external
view
returns (CommunityView[] memory out);
getCommunityByName
getCommunity for the community owning handle name (exists == false if unregistered).
function getCommunityByName(bytes32 name, bytes32[] calldata fields, uint256[] calldata uids)
external
view
returns (CommunityView memory);
getCommunityNames
Community handles for many community ids (0 = none).
function getCommunityNames(uint256[] calldata communityIds) external view returns (bytes32[] memory names);
getCommunityFields
Community fields for many communities: values[i][j] = communityData[communityIds[i]][keys[j]].
function getCommunityFields(uint256[] calldata communityIds, bytes32[] calldata keys)
external
view
returns (bytes[][] memory values);
getMemberships
uid's standing on each community: owner?, standing word, display can-post hint, own edge, name.
"My communities" / "communities I follow" screens: the client supplies the list from events.
function getMemberships(uint256 uid, uint256[] calldata communityIds)
external
view
returns (MembershipView[] memory out);
canPost
Advisory "would clients show this uid's posts here?": owner, or an existing community with the uid not carrying the BANNED bit. Posting is records-only on-chain — this is only a display hint.
function canPost(uint256 communityId, uint256 uid) external view returns (bool);
_canPost
Display hint only (see canPost). STANDING_BANNED == 1<<2 is used as a literal to stay pure.
function _canPost(uint256 owner, uint256 standingWord, uint256 uid) internal pure returns (bool);
quoteName
Price and availability of one candidate name in both namespaces. Never reverts.
function quoteName(bytes32 name) public view returns (NameQuote memory q);
quoteNames
Bulk quoteName — e.g. to show suggestions while the user types.
function quoteNames(bytes32[] calldata names) external view returns (NameQuote[] memory out);
getTreasury
Treasury snapshot including balances and withdrawal timing for the given tokens
(address(0) = ETH).
function getTreasury(address[] calldata tokens) external view returns (TreasuryView memory v);
sweepable
Funds parked in Buzzer (failed pushes) that anyone may sweep.
function sweepable(address[] calldata tokens) external view returns (uint256[] memory amounts);
_balanceOf
balanceOf(who) that returns 0 instead of reverting for non-conforming tokens (views must not fail).
function _balanceOf(address token, address who) internal view returns (uint256);
counters
Current id counters (last assigned uid, bid, communityId).
function counters() external view returns (uint256 uids, uint256 bids, uint256 communityIds);
constants
Protocol constants and permission bits, so clients never hard-code them.
function constants() external view returns (Constants memory c);
aggregate
Escape hatch: batch arbitrary read-only calls to any contracts in one RPC round trip.
Each entry is staticcalled; a failing entry yields ok[i] == false with its revert data
instead of aborting the batch. Use it to combine lens views with token balances, ENS, etc.
function aggregate(address[] calldata targets, bytes[] calldata calls)
external
view
returns (bool[] memory ok, bytes[] memory results);
Parameters
| Name | Type | Description |
|---|---|---|
targets |
address[] |
Contract per call. |
calls |
bytes[] |
ABI-encoded call data per entry. |
Returns
| Name | Type | Description |
|---|---|---|
ok |
bool[] |
Success flag per entry. |
results |
bytes[] |
Return data (or revert data) per entry. |
Structs
ProfileView
Everything about one profile, plus relations to caller-chosen friends and addresses.
struct ProfileView {
uint256 uid;
bool exists; // custody != 0
// ── addresses ──
address custody;
address recovery;
address payout; // resolved: payoutAddress, or custody when unset
address payoutRaw; // as stored
address pendingCustody; // address that may acceptCustody (0 = none)
address pendingRecoveryTo; // 0 = none
uint64 pendingRecoveryAt;
// ── meta ──
uint24 linkCount;
uint24 communityCount;
bytes32 name; // buzz handle, 0 = none
uint40 nameChangedAt;
uint256 custodyNonce; // EIP-712 nonce of the custody address
// ── per-input arrays ──
bytes[] fields; // profileData[uid][fields[i]]
bytes32[] outgoing; // relationships[uid][friends[i]]
bytes32[] incoming; // relationships[friends[i]][uid]
uint256[] addrPermissions; // permissions[uid][addrs[i]]
uint256[] addrLinkedUid; // linkedUid[addrs[i]] (0 = free, uid = ours, other = someone else's)
}
IdentityView
What an address is, protocol-wise.
struct IdentityView {
address addr;
uint256 uid; // 0 = not linked to any profile
uint8 role; // 0 none, 1 custody, 2 linked key
uint256 permissions; // permissions[uid][addr]
uint256 nonce; // EIP-712 nonce
address custody; // custody of `uid`
bytes32 name; // buzz name of `uid`
}
OfferView
A pending offer made to an address on a given uid.
struct OfferView {
uint256 uid;
bool custodyOffered; // pendingCustody[uid] == addr
address linkProposer; // pendingLink[uid][addr].proposer (0 = none)
uint64 linkExpires;
uint256 linkPerms;
bool linkValid; // proposer is still custody and not expired
}
AuthorView
Compact author card for rendering a feed from the viewer's perspective.
struct AuthorView {
uint256 uid;
bool exists;
bytes32 name;
address custody;
address payout;
bytes[] fields; // profileData[uid][fields[i]]
bytes32 viewerToAuthor; // relationships[viewer][uid]
bytes32 authorToViewer; // relationships[uid][viewer]
}
CommunityView
Everything about one community, plus standing/edges of caller-chosen uids.
struct CommunityView {
uint256 communityId;
bool exists; // owner != 0
uint256 owner;
uint256 pendingOwner; // uid that may acceptCommunity (0 = none)
bytes32 kind; // self-describing type token (0 = unset)
bytes32 name; // community handle, 0 = none
uint64 nameChangedAt;
address ownerCustody;
bytes[] fields; // communityData[communityId][fields[i]]
uint256[] standings; // standing[communityId][uids[i]] (community's view of each uid)
uint256[] edges; // memberEdge[communityId][uids[i]] (each uid's own view of the community)
}
MembershipView
One uid's standing on one community.
struct MembershipView {
uint256 communityId;
bool exists;
bool isOwner;
uint256 standing; // standing[communityId][uid]
bool canPost; // advisory: owner, or not banned (posting is records-only, so this is a display hint)
uint256 edge; // memberEdge[communityId][uid]
bytes32 name;
}
NameQuote
Price/availability of a candidate name.
struct NameQuote {
bytes32 name;
bool valid; // passes [a-z0-9]{1,16}
uint256 fee; // 0 if invalid
bool buzzNameFree;
bool communityNameFree;
}
SignerContext
What a signer needs to build an EIP-712 message.
struct SignerContext {
address signer;
uint256 nonce;
uint256 uid; // linkedUid[signer]
address custody; // custody of that uid
uint256 permissions; // permissions[uid][signer]
bytes32 domainSeparator;
uint256 chainId;
address verifyingContract;
}
TreasuryView
Treasury snapshot: the ten founder wallets, with per-token balances and withdrawal timing.
struct TreasuryView {
address[10] wallets; // slots 0-4 = group A, 5-9 = group B
address[] tokens; // echo of input (address(0) = ETH)
uint256[] balances;
uint64[] lastWithdrawAt;
uint256[] nextPerWallet; // what the next withdraw would pay each wallet (1% of balance)
uint256[] availableAt; // when the next withdraw is allowed for this token
}
Constants
Immutable protocol parameters, for clients that want to avoid hard-coding.
struct Constants {
uint256 profileFee;
uint256 communityFee;
uint256 nameChangeInterval;
uint256 recoveryDelay;
uint256 linkProposalTtl;
uint256 nameMaxLen;
uint256 permVerified;
uint256 permPost;
uint256 permReact;
uint256 permGraph;
uint256 permProfile;
uint256 permCommunity;
uint256 permMessage;
address treasury;
}