feat(tokens/hackathon): Squads-multisig hackathon prize program#40
Open
mikemaccana wants to merge 1 commit into
Open
feat(tokens/hackathon): Squads-multisig hackathon prize program#40mikemaccana wants to merge 1 commit into
mikemaccana wants to merge 1 commit into
Conversation
Adds an Anchor 1.0 example at tokens/hackathon/anchor: a hackathon prize program whose authority is an external Squads multisig vault PDA. The program is multisig-agnostic — it stores one authority pubkey and checks signer == hackathon.authority on committee-only handlers, leaving the propose/vote/execute flow to Squads. - One hackathon, many prizes. Each prize has its own PDA and its own vault ATA (owned by the prize PDA) that holds the prize in escrow. - Committee-only handlers: create_hackathon, add_prize, set_winner, cancel_prize, close_hackathon. pay_winner is permissionless so anyone can deliver a payout the committee has already agreed on. - add_prize rejects zero amounts. pay_winner transfers exactly prize.amount via transfer_checked and marks the prize paid before the CPI. - anchor_spl::token_interface throughout, so the same program works for both the Classic Token Program and the Token Extensions Program. - The hackathon name is hashed into its PDA seed via the sol_sha256 syscall (solana-sha256-hasher), with an sha2 fallback for host/IDL builds. - Rust + LiteSVM tests build a real Squads 2-of-3 multisig and drive the full propose/vote/execute flow: happy path, failure cases, and lifecycle. - README covers the concepts for newcomers, a worked walkthrough, the account layout, and the handler-to-account mapping.
e940809 to
dd6b78d
Compare
mikemaccana
pushed a commit
that referenced
this pull request
Jun 4, 2026
These three Anchor examples were already migrated to Anchor 1.0.0 with complete Rust (litesvm/solana-kite) test suites, but were still listed in .ghaignore for reasons that no longer apply: - finance/escrow/anchor: old reason was a JS helpers bug (#40); the test is now pure Rust, so that bug is irrelevant. Verified: anchor test green (4/4 + lib test). - finance/token-swap/anchor: verified anchor build + 18/18 tests pass. - tokens/external-delegate-token-master/anchor: verified 3/3 tests pass. All three verified locally with Anchor 1.0.0, Solana CLI, and surfpool, matching the CI flow (anchor keys sync -> anchor build -> anchor test). Also clarifies basics/pyth/anchor's ignore reason: it fails because pyth-solana-receiver-sdk 1.1.0 pulls a borsh version incompatible with Anchor 1.0 / Solana 3.x (PriceUpdateV2 fails BorshDeserialize). Left ignored pending a compatible upstream SDK. https://claude.ai/code/session_013dpnF6uSGWXjkJJZseqzcP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this adds
An Anchor 1.0 example at
tokens/hackathon/anchor: a hackathon prize program whose authority is an external Squads multisig vault PDA. The program is multisig-agnostic — it stores oneauthoritypubkey and checkssigner == hackathon.authorityon committee-only handlers, leaving the propose/vote/execute flow to Squads.Design
create_hackathon,add_prize,set_winner,cancel_prize, andclose_hackathonrequire the committee's signature.pay_winneris permissionless, so once the committee has recorded a winner, anyone can deliver the payout without the committee staying online.anchor_spl::token_interface), so the same compiled program works for both the Classic Token Program and the Token Extensions Program. One mint per prize lets a hackathon mix denominations (e.g.USDCfor cash, a tokenized stock for a themed track).add_prizerejects zero amounts;pay_winnertransfers exactlyprize.amountviatransfer_checkedand marks the prize paid before the CPI; prize tokens live in program-owned vault PDAs with no admin escape outside the documented handlers.sol_sha256syscall (solana-sha256-hasher), with ansha2fallback for host/IDL builds.Handlers
create_hackathonHackathon.add_prizePrize+ vault ATA; incrementsprize_count.set_winnerPrize.winner.pay_winnerPrize.paid.cancel_prizePrize.cancelled.close_hackathonHackathononce every prize is resolved.Tests
Rust + LiteSVM integration tests build a real Squads v4 2-of-3 multisig and drive the full propose/vote/execute flow — happy path, failure cases (zero amount, no winner, under-funded, already paid, non-committee signer), and lifecycle (cancel and close). Run with:
Docs
The README covers the concepts for newcomers (with links to definitions on first use), a worked walkthrough with named committee members and sample tokens (
USDC,NVDAx,TSLAx), the account layout, and the handler-to-account mapping.https://claude.ai/code/session_01DBFPwFobdi4SKkDq4BZdd8