|
| 1 | +# Changelog |
| 2 | + |
| 3 | +## 0.1.0 |
| 4 | + |
| 5 | +An atomic two-party token escrow: a maker swaps a fixed amount of one token for |
| 6 | +a wanted amount of another with a taker, without either party trusting the other |
| 7 | +and with no spread or middleman fee. |
| 8 | + |
| 9 | +- `Offer` PDA seeded `["offer", maker, id]` storing the `id`, `maker`, both |
| 10 | + mints (`token_mint_a` offered, `token_mint_b` wanted), the |
| 11 | + `token_b_wanted_amount`, and the `bump`; the `id` lets one maker keep several |
| 12 | + offers open at once. |
| 13 | +- The vault is the offer PDA's associated token account for token A; it holds |
| 14 | + the maker's offered tokens while the offer is open, and only the offer PDA can |
| 15 | + sign transfers out of it. |
| 16 | +- `make_offer` creates the offer PDA and vault, moves the offered token A into |
| 17 | + the vault with `transfer_checked`, and records the offer state; the maker |
| 18 | + signs and pays all rent. |
| 19 | +- `make_offer` also creates the maker's token-B associated token account if |
| 20 | + needed, paid by the maker, so the eventual taker never funds a maker-owned |
| 21 | + account. |
| 22 | +- `take_offer` sends the wanted token B from the taker to the maker, releases |
| 23 | + the vault's token A to the taker signed by the offer PDA, and closes both the |
| 24 | + vault and the offer account back to the maker. |
| 25 | +- `cancel_offer` returns the vault's token A to the maker and closes both |
| 26 | + accounts; only the maker can call it, so an abandoned offer never locks the |
| 27 | + maker's tokens forever. |
| 28 | +- Anchor constraints bind every account to the stored offer state (`has_one` on |
| 29 | + the maker and both mints, associated-token constraints on the vault and every |
| 30 | + token account, and the PDA seeds on the offer itself). |
| 31 | +- Every path that closes the offer and vault (`take_offer`, `cancel_offer`) |
| 32 | + refunds both rents to the maker, who paid them. |
| 33 | +- Settlement is atomic in a single transaction: neither party can take the |
| 34 | + other's tokens and run. |
| 35 | +- Ships Rust + LiteSVM integration tests (with solana-kite helpers) covering the |
| 36 | + make/take flow, the make/cancel flow, rejection of a non-maker cancel, token |
| 37 | + balances on every leg, and the maker's rent refunds after both take and |
| 38 | + cancel. |
| 39 | +- Based on Dean Little's Anchor Escrow, restructured for teaching. |
0 commit comments