Concepts
Recipes
Promises worth copying.
A swap with a floor
You swap 1 SOL for about 150 USDC. Watch your wallet and your USDC account.
watched: [ your wallet, your USDC account ] checks: sol(0, -1_000_000_000) // lose at most 1 SOL token(1, +148_500_000) // receive at least 148.5 USDC (1 % tolerance)
Refused if the output lands in someone else's account, if the pool takes more, or if anything else drains.
A sell, and no side effects
checks: token(1, -100_000_000) // lose at most 100 USDC sol(0, 0) // SOL must not go down
A hidden Approve in the same transaction is refused by default.
A claim
watched: [ your wallet, the AIR account ] checks: sol(0, -50_000_000) token(1, +2_000_000_000)
"Just sign this to verify"
watched: [ your wallet, your main token account ] checks: (none)
Nothing should change at all. A SetAuthority or an Assign is refused by the defaults.
An app that really needs a delegate
checks: delegate(1, 400_000_000) // at most 400 USDC can be spent by whoever it names
Guard what you hold
Put your wallet and your three biggest token accounts on the watch list and write no check at all: spending needs a check, everything else is refused.