Originally published November 9, 2026, at 11:21 (UTC+08:00). This is a conceptual summary of the source article, not a tested deployment guide.
The article uses a Solana escrow swap program built with Anchor to explain three actions:
- Create an offer: The maker sets the swap terms, which are stored in an offer account. An offer-derived program address (PDA) controls the vault.
- Accept an offer: The taker supplies a minimum amount to receive and a maximum amount to pay. These limits help protect against an offer being replaced before acceptance.
- Cancel an offer: The maker can cancel. The account-closing flow returns rent.
Anchor account constraints check the maker, token mints and token accounts. The article also examines why attempts involving incorrect accounts, a reused offer ID, cancellation by someone other than the maker, zero amounts or an offer exchanging a token for itself fail before transfers. It covers testing with LiteSVM and steps for building and deploying to devnet, without establishing that any particular reader’s deployment has been tested.
Source: learnblockchain.cn (originally published 2026-11-09 11:21 UTC+8)

