The buy gate
How the social_gate transfer hook tells a fomo or X-verified buy from anything else.
The buy gate is social_gate, a small Solana program that every FOMOPRIME token names as its Token-2022 transfer hook. Token-2022 calls it on every transfer of the token. It has one job: while the token is on its curve, reject any buy that did not come from the fomo app or from an X-verified FOMOPRIME account.
- 1
Do the tokens leave the curve's vault?
NoAllowed. Sells and wallet-to-wallet transfers are never checked.
- 2
Is the instruction just before the swap a FOMOPRIME approve_buy for this wallet and amount?
YesAllowed. A buy on FOMOPRIME by an X-verified account.
- 3
Did fomo's sponsor key sign the transaction, and does an instruction list it?
YesAllowed. A buy from the fomo app.
Otherwise the transfer fails with
BuyNotAllowed (6000)and the whole transaction reverts.
Why a transfer hook
A rule enforced by a website only protects people who use that website. A transfer hook is part of the token: it runs whatever app, bot or script sends the transaction, so there is no side door. And because Meteora's bonding curve supports hooked tokens natively and removes the hook at graduation, the rule lasts exactly as long as the curve and not a moment longer.
How it decides
1. Is it a buy?
On a buy, tokens leave the curve's vault, and the authority on that transfer is Meteora's pool authority. The hook checks that the call really comes from a Token-2022 transfer, then looks at the source account's owner. If it is not the pool authority, the transfer is a sell or a wallet-to-wallet move and the hook returns straight away.
2. Is there a FOMOPRIME approval?
The hook reads the transaction's instructions through the instructions sysvar. If the instruction right before the Meteora swap is an approve_buy signed by a FOMOPRIME approver key, naming this transfer's destination and allowing at least this amount, the buy passes. One approval covers exactly one swap.
approve_buy 41 bytes of instruction data
tag u8 = 6
destination [u8;32] the buyer's token account for this mint
max_amount u64 LE the most tokens this approval allows (> 0)
accounts: approver (signer, first), GateConfig PDA
must sit directly before the Meteora DBC swap it approves3. Did fomo sign it?
Otherwise, the hook looks for a sponsor key: a key that signed the transaction and appears in one of its top-level instructions. fomo's key signs every transaction the fomo app builds:
AgmLJBMDCqWynYnQiPCuj9ewsNNsBJXyzoUhD9LJzN51
4. Otherwise, reject
With no approval and no sponsor, the transfer fails with BuyNotAllowed (6000) and the whole transaction reverts. Missing or unexpected accounts fail closed the same way.
What the gate never checks
| Transfer | Checked? |
|---|---|
| Buy from the curve, before graduation | Yes |
| Sell into the curve | Never |
| Wallet to wallet | Never |
| Anything after graduation | Never. The hook has been removed from the token. |
The hook makes no calls to other programs, moves no funds and allocates no memory. It reads the transaction and returns yes or no.
Operational notes
fomo buys pass because fomo lists its signing key in the transactions it builds. That is fomo's current convention, which FOMOPRIME monitors: a watcher flags any fomo-signed buy the gate rejects, and the admin can register rotated fomo keys (up to eight sponsor keys) without redeploying anything. See Security model.
Note