Skip to content

chore(escrow): align Quasar and Anchor escrow naming for side-by-side comparison#28

Merged
mikemaccana merged 1 commit into
quicknode:mainfrom
mikemaccana-edwardbot:chore/escrow-naming-alignment
May 14, 2026
Merged

chore(escrow): align Quasar and Anchor escrow naming for side-by-side comparison#28
mikemaccana merged 1 commit into
quicknode:mainfrom
mikemaccana-edwardbot:chore/escrow-naming-alignment

Conversation

@mikemaccana-edwardbot
Copy link
Copy Markdown

@mikemaccana-edwardbot mikemaccana-edwardbot commented May 14, 2026

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, 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 PR renames the Quasar program to match Anchor.

Renames in Quasar

Category Before After
Handler make make_offer
Handler take take_offer
Handler refund cancel_offer
Account struct Make (+ MakeBumps) MakeOffer (+ MakeOfferBumps)
Account struct Take (+ TakeBumps) TakeOffer (+ TakeOfferBumps)
Account struct Refund (+ RefundBumps) CancelOffer (+ CancelOfferBumps)
State type Escrow Offer
Field mint_a token_mint_a
Field mint_b token_mint_b
Field maker_ta_a maker_token_account_a
Field maker_ta_b maker_token_account_b
Field taker_ta_a taker_token_account_a
Field taker_ta_b taker_token_account_b
Field vault_ta_a vault
Field escrow (state account field) offer
File src/instructions/make.rs make_offer.rs
File src/instructions/take.rs take_offer.rs
File src/instructions/refund.rs cancel_offer.rs
Internal helper handle_make_escrow handle_make_offer
Internal helper handle_withdraw_tokens_and_close_refund handle_withdraw_tokens_and_close_cancel_offer

The internal helper renames pair each helper with its public handler: handle_make_offer with make_offer, handle_withdraw_tokens_and_close_cancel_offer with cancel_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" to b"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_offer handlers, MakeOffer/TakeOffer/CancelOffer structs, Offer state, token_mint_a/token_mint_b/maker_token_account_a/etc. fields, b"offer" seed. Nothing changed on the Anchor side.

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 helpershandle_deposit_tokens, handle_transfer_tokens, handle_withdraw_tokens_and_close_take. These are framework-neutral or already pair cleanly with their public handler.

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

(Quasar emits warning: fields ... are never read for #[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.

@mikemaccana-edwardbot mikemaccana-edwardbot force-pushed the chore/escrow-naming-alignment branch from f01ac04 to 0283643 Compare May 14, 2026 21:51
… 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.)
@mikemaccana-edwardbot mikemaccana-edwardbot force-pushed the chore/escrow-naming-alignment branch from 0283643 to a0aa8f1 Compare May 14, 2026 21:52
@mikemaccana mikemaccana merged commit 8ba5560 into quicknode:main May 14, 2026
18 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