★ Prezzies ← Back to the tree

The tree vault program

Where the presents live, and the rules nobody can bend

Every present is USDC held by a small Solana program. It has no private key and no admin override. Only five instructions exist, and before Christmas the only way money leaves is an owner opening their own present. This page lists every address, every rule and the exact maths, so you can check it all yourself.

Addresses

Live numbers, read from the chain

What the program guarantees

What the bot can and can't do

The bot (the tree's authority) collects creator fees, runs the nice-list draws and puts presents under the tree.

It can

  • Add a present for any wallet before Christmas, paying the full $100 into the vault from its own USDC. The new present is worth exactly that, so it takes nothing from anyone else.
  • Top up the vault with late fees before Christmas, which grows every present wrapped at that moment (anyone can do this).
  • Sweep the vault after the claim deadline (6 January), to re-gift unclaimed presents to holders.
  • Sweep the vault from Christmas onwards only if every present has been opened (dust left over from rounding).

It can't

  • Withdraw anything before Christmas.
  • Open, move or cancel anyone's present.
  • Change the dates, the early-opening rates or the present amount.
  • Send swept USDC anywhere except its own token account.
  • Add presents after Christmas begins.

The maths

A present's value

value = present_amount + (acc_per_present − acc_snapshot) ÷ 10¹²

acc_per_present is a running total on the tree: how much each wrapped present has been given so far by early openings and top-ups. A present records it when it's added (acc_snapshot), so it only counts what happens after it went under the tree. This is the same bookkeeping staking programs use to share out rewards.

Opening early (before 25 Dec 00:00 UTC)

keep_bps        = keep_start_bps + (keep_end_bps − keep_start_bps) × elapsed ÷ (christmas − launch)
payout          = value × keep_bps ÷ 10,000
left behind     = value − payout
acc_per_present += left behind × 10¹² ÷ presents still wrapped

elapsed is the time since launch, clamped between launch and Christmas. With this tree it rises in a straight line from 1% at launch to 50% just before Christmas. All maths is in whole token units, rounded down.

On or after Christmas

payout = value

Every owner gets their own present's value. Presents that waited through more early openings are worth more.

Top-ups

acc_per_present += amount × 10¹² ÷ presents still wrapped

Worked example: openings

EventVaultWrappedEach presentPaid out
10 presents added$1,000.0010$100.00
5 Dec: one opened (keep 9.16%)$990.849$110.09$9.16
12 Dec: one opened (keep 23.45%)$965.028$120.63$25.82
20 Dec: one opened (keep 39.79%)$917.037$131.00$48.00
Christmas: the other 7 claim$0.000$131.00 each

Worked example: a present added late

EventVaultWrappedOlder presentsNew present
Mid-December, after some early openings$950.005$190.00 each
The bot adds a present ($100 in)$1,050.006$190.00 each$100.00
Someone opens an older one early, keeping $90 and leaving $100 behind$960.005$210.00 each$120.00

The first example's numbers come straight from the program's own test suite; the second shows the rule that adding a present never changes anyone else's value, which the suite also tests.

Instructions

The whole program: five instructions, no others.

init_tree

Who: the bot, once. When: before launch.

Creates the tree and its vault, and writes the rules: launch, Christmas and claim-deadline times, the early-opening rates and the amount per present. Rejects bad input: the times must be in order, the rates must satisfy start ≤ end ≤ 100%, and the amount must be above zero.

add_present(owner)

Who: the bot only. When: before 25 Dec 00:00 UTC.

Moves exactly one present's worth of USDC from the bot into the vault and creates the next numbered present for owner. Each present is its own on-chain account, so anyone can list every present and who owns it.

open_present

Who: the present's owner only (their wallet signs). When: until the claim deadline.

Before Christmas, it pays the early slice of this present's value and shares the rest among the presents still wrapped. From Christmas, it pays the present's full value. The USDC goes to the owner's own USDC account, which is created if they don't have one; the owner pays that small rent. The present is marked opened forever.

top_up(amount)

Who: anyone. When: before Christmas, while presents are wrapped.

Adds USDC to the vault and shares it evenly among the presents wrapped at that moment. The bot uses it for fees that arrive after the last draw.

sweep

Who: the bot only. When: after the claim deadline, or from Christmas once every present is opened.

Moves whatever is left in the vault to the bot's own USDC account, to be re-gifted to holders.

Accounts

Tree

PDA seeds: ["tree", authority]

authoritythe bot's wallet
usdc_mintthe token presents are paid in (USDC)
vaultthe token account holding the presents
launch_ts · christmas_ts · claim_deadline_tsthe schedule (Unix seconds)
keep_start_bps · keep_end_bpsearly-opening rates, in basis points
present_amountUSDC per present (100 USDC = 100,000,000)
present_count · wrapped_countpresents ever added · still wrapped
opened_early_count · paid_earlyearly openings and their total payout
acc_per_presentrunning total given to each wrapped present (× 10¹²)
topped_uptotal added by top-ups

Vault

PDA seeds: ["vault", tree]

A USDC token account whose owner is the Tree PDA. Only the program can sign for it.

Present

PDA seeds: ["present", tree, index (u64, little-endian)]

indexpresent number, from 0
ownerthe only wallet that can open it
created_tswhen it went under the tree
status0 wrapped · 1 opened early · 2 opened at Christmas
paid · opened_tswhat it paid and when
acc_snapshotthe tree's running total when it was added

Events and errors

Events

Every instruction emits one, so explorers and indexers can follow the tree:

  • TreeInitialized: the rules, once
  • PresentAdded: index, owner, amount, vault balance
  • PresentOpened: index, owner, early or Christmas, keep rate, value, paid
  • TreeToppedUp: who, amount, new running total
  • VaultSwept: amount, presents still wrapped

Errors

6000InvalidTimes
6001InvalidBps
6002InvalidPresentAmount
6003ChristmasStarted: no new presents
6004NotOwner: only the owner can open
6005AlreadyOpened
6006ClaimWindowClosed
6007SweepNotAllowed
6008NoWrappedPresents
6009MathOverflow
6010InvalidTopUpAmount

Check it yourself

You don't need to trust this page. With the Solana CLI:

Is the program locked?


        

If it's locked, Authority shows none: nobody can ever change the program again. Solscan shows the same thing as the program's upgrade authority. If the CLI asks for a default signer, add --keypair with any wallet file; it signs nothing.

How much is in the vault?


        

Every present and its owner


        

The program's interface

The full interface definition (IDL) is at /idl/xmas_tree.json. Every account and instruction above decodes from it.

Source code

Each draw

Who goes on the nice list is decided off-chain by the bot, from a holder snapshot and a Solana blockhash. Every draw's snapshot is published at /api/draws/<id>/snapshot, so anyone can re-run it and get the same winner.

Limits, stated plainly