Skip to content

Port the token fundraiser and order book Anchor v1 copies up to their v2 counterparts - #160

Merged
mikemaccana merged 2 commits into
mainfrom
claude/kind-pasteur-2sw8p5
Sep 23, 2026
Merged

mikemaccana merged 2 commits into
mainfrom
claude/kind-pasteur-2sw8p5

Conversation

@mikemaccana

Copy link
Copy Markdown
Collaborator

Summary

#156 changed CONTRIBUTING.md so that anchor-v1/ copies track their Anchor v2 counterparts, and brought the betting market's v1 copy up to date. Its description named the two v1 copies that still lagged. This PR ports both, one commit each.

Changes

  • Token fundraiser, Anchor v1: ports close_contributor (f209222).
    • A successful raise closes the vault and the fundraiser account but leaves every contributor account open. refund, their only other closer, runs only on a failed raise, so the rent was stuck.
    • The handler checks that the passed fundraiser account is no longer owned by the program, else the new FundraiserStillOpen error, and closes the contributor account to the contributor.
    • Brings over the same two tests as v2, plus the README and changelog text.
  • Order book, Anchor v1: ports the vault PDAs (e0a9498).
    • The base, quote and fee vaults are created at ["base_vault", market], ["quote_vault", market] and ["fee_vault", market] instead of at client-generated keys, so a client derives them rather than generating and signing with three extra keypairs.
    • The tests derive the vaults too.
    • The v1 copy keeps validating the vaults it is passed with its existing has_one constraints, which is still what blocks passing the fee vault where the quote vault belongs.
    • The program and test diffs match the v2 commit's line for line (10, 9 and 155 changed lines).
    • The README conflicted where v1 says has_one and v2 says address =. I kept v1's constraint name.

Verification

  • Checked locally: both v1 programs and their tests compile.
  • Clippy adds no warnings. The order book's warning count is 10 before and after. The fundraiser's new lib.rs entry repeats the file's existing needless_borrow pattern, as every other handler there does.
  • Not run locally: the LiteSVM suites, which need the SBF build. This PR's Anchor v1 CI job runs them.

🤖 Generated with Claude Code

https://claude.ai/code/session_01F8Wo5zNLqZ2NQqSjGD7WpK


Generated by Claude Code

A successful raise closes the vault and the fundraiser account but leaves
every contributor account open, and refund, their only other closer, runs
only on a failed raise. The v2 copy gained close_contributor for this; the
v1 copy was left behind while anchor-v1/ was frozen. Port the handler, the
FundraiserStillOpen error, the two tests, and the README and changelog text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F8Wo5zNLqZ2NQqSjGD7WpK
…market PDAs

The v2 copy moved the three vaults to PDAs of the market at
["base_vault", market], ["quote_vault", market] and ["fee_vault", market];
the v1 copy still created them at client-generated keys. Port the seeds, the
tests (which now derive the vaults instead of generating and signing with
them), and the README and changelog text. The v1 copy keeps checking the
vaults it is passed with has_one, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F8Wo5zNLqZ2NQqSjGD7WpK
@mikemaccana
mikemaccana merged commit db4b8b5 into main Sep 23, 2026
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants