CAUCUSLaunch app

Integration

Reading the program

Every account starts with the 8-byte Anchor discriminator of its type, so one getProgramAccounts call with a memcmp filter at offset 0 returns all accounts of a type: every Member record for the table, every Basket, every Asset with its latest close.

import { Connection, PublicKey } from "@solana/web3.js";

const conn = new Connection("https://api.mainnet-beta.solana.com", "confirmed");
const MEMBER = Buffer.from("3613a2151da611c6", "hex"); // sha256("account:Member")[0..8]
const members = await conn.getProgramAccounts(PROGRAM_ID, {
  filters: [{ memcmp: { offset: 0, bytes: MEMBER.toString("base64"), encoding: "base64" } }],
});
for (const { account } of members) {
  const d = account.data;
  const key = d.subarray(8, 16).toString().replace(/\0+$/, ""); // Bioguide ID
  const scored = d.readUInt32LE(16), beat = d.readUInt32LE(20), sum = d.readBigInt64LE(24); // sum in parts per billion
}

A request or position belongs to its owner at offset 8, so the same call with a second memcmp on the owner's key lists one person's requests and positions.

Events

EventWhen
FilingAccepted(member, asset, side, filed_day)A report line reached the threshold
CloseAccepted(asset, day, price)A close reached the threshold
Scored(member, asset, filed_day, excess_ppb, scored, beat)A buy was scored
TopChanged(seats)The Top 5 changed
Settled(basket, day, epoch, ret, pnl, fee, follow, fade)A basket settled

Addresses

None yet. The program is not deployed on Solana mainnet.

Next: API reference