Docs menu

SNAG docs

How it works

One buy becomes one piece with no extra step from the buyer. Six parties touch it in order: the buyer, the pool, the server, the keeper, the collection, and the wallet the piece lands in, which is the buyer's own.

Status

The path of one buy

1 buys 2 sends 3 reads, signs 4 submits 5 mints Buyer Pool Server Keeper Collection Wallet

The wallet at the end is the same wallet as the buyer at the start. The piece comes back to where the buy started.

  1. The buyer buys. An ordinary swap. The pool sends $SNAG to the buyer's wallet, which the token contract records as a Transfer log with the pool as the sender.
  2. The pool's transfer is the proof. Nothing about the buy is trusted from outside the chain: the only evidence that matters is that exact log.
  3. The server reads and signs. It reads the transaction's receipt back from the chain, insists it succeeded with at least two confirmations, finds the token's own Transfer log with the pool as sender and an amount at or above the collection's minimum, and only then signs an EIP-712 MintAuthorization naming the buyer, a buy reference, the amount and a fifteen minute deadline.
  4. The keeper submits. It watches the same pool logs, asks the server's own code for an authorisation for each buy it has not seen minted yet, and submits mintForBuy on the collection. Anyone could submit a valid authorisation; in practice the keeper always does, so the buyer never pays gas.
  5. The collection mints. It checks the signature against its own signer, marks the buy reference used before anything else happens, computes the seed from the pool, the buyer, the swap number and the amount, and mints the piece straight to the buyer's wallet.

What "moments after your buy" means

The piece is not part of the buy's own transaction. The server waits for two confirmations before it will sign anything, and the keeper polls for new buys rather than watching every block instantly. In normal conditions a buyer sees their piece in well under a minute, but there is a real gap, and during it the wallet holds the token and not yet the piece.

What can make a mint not happen

Limit

A buy under the minimum. If the amount is below the collection's minBuy, the server refuses with "buy under the minimum" and nothing is signed.

A transfer that is not from the pool. A wallet-to-wallet transfer, a transfer of a different token, or a transfer into the pool never qualifies. The server only ever signs for a Transfer whose sender is the pool address.

A replay. Every buy reference can be used once. If the same transaction is submitted again, the collection's own usedBuy mapping and the server's own check both refuse it as "that buy already has its piece."

What the buyer sees in each case is the same thing: no second piece, and no error to act on. A buy that never qualified never had a piece coming; a buy that already has its piece will not get a second one no matter how many times the mint is submitted.