A builder implementing an escrow swap needs to control who can release deposited tokens and verify the terms before a transfer. An article published on November 9, 2026, at 11:21 a.m. UTC+8 uses a Solana program built with Anchor to explain three actions: a maker creates an offer, a taker accepts it, or the maker cancels it.
The example uses an offer PDA—a program-derived address—to control the vault holding the deposited tokens. An offer account stores the trade terms. Anchor account constraints check the maker, token mint and token accounts. When accepting an offer, the taker supplies both a minimum amount to receive and a maximum amount to pay, protecting against the offer being replaced just before acceptance. The article also covers closing accounts and returning their rent deposits.
The source examines why incorrect accounts, a reused offer ID, cancellation by someone other than the maker, zero amounts and offers involving the same token mint fail before transfers. It also discusses testing with LiteSVM, building the program and deploying it to devnet; the supplied summary does not include commands or code for those steps.
Source: learnblockchain.cn (originally published 2026-11-09 11:21 UTC+8)
