chore(escrow): align Quasar and Anchor escrow naming for side-by-side comparison#28
Merged
mikemaccana merged 1 commit intoMay 14, 2026
Conversation
f01ac04 to
0283643
Compare
… comparison
Mike's writing an Anchor-vs-Quasar comparison doc. The two implementations
diverged cosmetically: Anchor had been refactored to canonical names
(`make_offer`/`take_offer`/`cancel_offer`, `Offer` state, `token_mint_a`,
`maker_token_account_a`, etc.), but Quasar still used the older `make`/`take`/
`refund` with `Escrow` state and `mint_a`/`maker_ta_a`-style fields. Those
surface-level differences make it hard to compare framework syntax without
also tracking name differences. This commit renames Quasar to match Anchor.
Renames in Quasar (rename-only, no behaviour change):
Handlers:
- `make` → `make_offer`
- `take` → `take_offer`
- `refund` → `cancel_offer`
Account structs (+ associated `*Bumps`):
- `Make` → `MakeOffer`
- `Take` → `TakeOffer`
- `Refund` → `CancelOffer`
State type:
- `Escrow` → `Offer` (in `src/state.rs`)
Account fields:
- `mint_a` → `token_mint_a`
- `mint_b` → `token_mint_b`
- `maker_ta_a` → `maker_token_account_a`
- `maker_ta_b` → `maker_token_account_b`
- `taker_ta_a` → `taker_token_account_a`
- `taker_ta_b` → `taker_token_account_b`
- `vault_ta_a` → `vault`
- `escrow` → `offer` (the state account field on each instruction)
Source files:
- `src/instructions/make.rs` → `make_offer.rs`
- `src/instructions/take.rs` → `take_offer.rs`
- `src/instructions/refund.rs` → `cancel_offer.rs`
Internal helper renames:
- `handle_make_escrow` → `handle_make_offer` (natural pairing with the
public `make_offer` handler; body constructs an `Offer`, not an `Escrow`).
- `handle_withdraw_tokens_and_close_refund` →
`handle_withdraw_tokens_and_close_cancel_offer` (pairs with the public
`cancel_offer` handler; "refund" is dead as a verb in the rename spec).
Deliberately NOT renamed:
- Crate / directory names (`tokens/escrow/anchor/programs/escrow/`,
`tokens/escrow/quasar/`). The program is called "escrow"; the state inside
is called "Offer". Both correct.
- Other internal helpers (`handle_deposit_tokens`, `handle_transfer_tokens`,
`handle_withdraw_tokens_and_close_take`).
Breaking changes:
- PDA seed for the offer state account changed from `b"escrow"` to `b"offer"`
in the Quasar program, matching Anchor. This alters PDA derivation, but
this is an example program with no deployed users and the alignment is
worth it.
Verification:
cd tokens/escrow/anchor && cargo check
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.80s
cd tokens/escrow/quasar && cargo check
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.46s
cd tokens/escrow/quasar && cargo check --tests
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.33s
(The Quasar warnings about never-read fields are a `#[account]` codegen
quirk and pre-date this change.)
0283643 to
a0aa8f1
Compare
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 and why
Mike's writing an Anchor-vs-Quasar comparison doc. The two implementations had diverged cosmetically: Anchor had already been refactored to canonical names (
make_offer/take_offer/cancel_offer,Offerstate,token_mint_a,maker_token_account_a, etc.), but Quasar still used the oldermake/take/refundwithEscrowstate andmint_a/maker_ta_a-style fields. Those surface-level differences make it hard to compare framework syntax without also tracking name differences.This PR renames the Quasar program to match Anchor.
Renames in Quasar
makemake_offertaketake_offerrefundcancel_offerMake(+MakeBumps)MakeOffer(+MakeOfferBumps)Take(+TakeBumps)TakeOffer(+TakeOfferBumps)Refund(+RefundBumps)CancelOffer(+CancelOfferBumps)EscrowOffermint_atoken_mint_amint_btoken_mint_bmaker_ta_amaker_token_account_amaker_ta_bmaker_token_account_btaker_ta_ataker_token_account_ataker_ta_btaker_token_account_bvault_ta_avaultescrow(state account field)offersrc/instructions/make.rsmake_offer.rssrc/instructions/take.rstake_offer.rssrc/instructions/refund.rscancel_offer.rshandle_make_escrowhandle_make_offerhandle_withdraw_tokens_and_close_refundhandle_withdraw_tokens_and_close_cancel_offerThe internal helper renames pair each helper with its public handler:
handle_make_offerwithmake_offer,handle_withdraw_tokens_and_close_cancel_offerwithcancel_offer. "Refund" and "escrow" are dead as verbs/nouns in the rename spec.Breaking change: PDA seed
The PDA seed for the offer state account changes from
b"escrow"tob"offer"in the Quasar program, matching Anchor. This alters PDA derivation. This is an example program with no deployed users, so the alignment with Anchor is worth the seed change.No renames needed in Anchor
The Anchor program (
tokens/escrow/anchor/programs/escrow/) was already canonical:make_offer/take_offer/cancel_offerhandlers,MakeOffer/TakeOffer/CancelOfferstructs,Offerstate,token_mint_a/token_mint_b/maker_token_account_a/etc. fields,b"offer"seed. Nothing changed on the Anchor side.Deliberately not renamed
tokens/escrow/anchor/programs/escrow/,tokens/escrow/quasar/). The program is called "escrow"; the state inside is called "Offer". Both correct.handle_deposit_tokens,handle_transfer_tokens,handle_withdraw_tokens_and_close_take. These are framework-neutral or already pair cleanly with their public handler.Verification
(Quasar emits
warning: fields ... are never readfor#[account]codegen — pre-existing, not introduced by this PR.)git grep -E '\b(Make|Take|Refund|Escrow|mint_a|mint_b|maker_ta_a|maker_ta_b|taker_ta_a|taker_ta_b|vault_ta_a|handle_make_escrow|handle_withdraw_tokens_and_close_refund)\b' tokens/escrow/quasar/→ 0 matches.Follow-up
None. Self-contained.