Scopes
Drops and polls: their terms, their window, their cap and how they close.
A scope is one thing an app hands out once per person. Anyone can open one, and each enrolled person can claim in it once. Every claim in a scope is recorded under its own scope nullifier.
Kinds
| Kind | What a claim does | Funding |
|---|---|---|
| Drop | Pays a fixed amount per person, in SOL or USDC, into a private note only the claimant can open | The creator funds the whole drop at creation: amount per person times cap, plus the protocol fee |
| Poll | Adds one vote to one option | The creator deposits a relay budget in SOL that pays for relaying each vote; no protocol fee |
Terms
create_scope takes the terms and refuses any that break these rules with InvalidScope:
- A title of 1 to 64 bytes of UTF-8.
- A cap above zero: the most claims the scope accepts.
- A window:
opens_atat or after zero, andcloses_atafter bothopens_atand the current time. Times are Unix seconds. - For a drop, an amount per person larger than the relay fee for its asset, and no options.
- For a poll, 2 to 8 options of 1 to 32 bytes each, the asset SOL, and no amount per person.
The relay fee for the scope's asset is copied from the program's config into the scope when it is created, so a later change to the fee doesn't touch a scope already open. Fees and ONCE covers what each fee pays for.
Where a scope lives
Each scope is an account at the address derived from ["scope", id], where id is a counter the program keeps in its config, starting at zero, written as eight little-endian bytes. The account holds the terms, the claim count, a poll's tally, the relay fee and budget, and for a drop the state of its pool note. The fields are listed under Scope.
Status
A scope is upcoming before opens_at, open from opens_at until closes_at, and closed from closes_at on. While it is open, a claim is refused once the count reaches the cap (ScopeFull). Before it opens, a claim is refused with NotOpen, and after it closes with Closed.
Closing
At or after closes_at, anyone can call close_scope. For a drop it spends what remains of the pool note back to the creator, and for a poll it returns the unspent relay budget to the creator. The scope is then marked closed and stays readable, with its count and tally.
After that, close_claims takes pairs of claim receipt and the relayer that paid for it, closes each receipt and returns its rent to that relayer. A receipt is the proof that a person claimed, so a program that checks claims reads it before the scope is closed. Check a claim from another program covers that.
Reading scopes
$ curl "$ONCE_API/v1/scopes?status=open&kind=drop"
$ curl "$ONCE_API/v1/scopes/<id>"A single scope comes with its terms, how many have claimed, what is left in the pool or the relay budget, and for a poll each option's tally. API has the full shapes.