Commit a0aa8f1
Mike MacCana
chore(escrow): align Quasar and Anchor escrow naming for side-by-side 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.)1 parent 586902b commit a0aa8f1
10 files changed
Lines changed: 309 additions & 309 deletions
File tree
- tokens/escrow/quasar/src
- instructions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
| 1 | + | |
| 2 | + | |
3 | 3 | | |
4 | | - | |
5 | | - | |
| 4 | + | |
| 5 | + | |
6 | 6 | | |
7 | | - | |
8 | | - | |
| 7 | + | |
| 8 | + | |
This file was deleted.
This file was deleted.
0 commit comments