Add Token-2022 basics Pinocchio example - #705
Conversation
Greptile SummaryThe PR adds a Pinocchio implementation of the Token-2022 basics example, covering mint creation, token-account creation, associated accounts, minting, and checked transfers.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Important Files Changed
Reviews (2): Last reviewed commit: "token-2022 basics: reject oversized toke..." | Re-trigger Greptile |
|
Good catch — pushed 766e743: |
|
@amilz could you take a look at this one when you get a chance? No open review threads left on it, so it is ready for maintainer review. It is one of 23 open Pinocchio ports I have up — they are independent and self-contained, so they can be reviewed and merged in any order: https://github.com/solana-developers/program-examples/pulls/MarkFeder |
Ports the anchor
tokens/token-2022/basicsexample to Pinocchio.Exposes the same five instructions, dispatched on a leading discriminator byte:
[b"token-2022-token", signer, token_name]PDA, signed by the PDA; signer is the mint authority, no freeze authority.[b"token-2022-token-account", signer, mint]PDA (the anchor example's non-ATA reference path).pinocchio-associated-token-account(program-agnostic; the Token-2022 program is passed through).MintToandTransferChecked; transfer creates the recipient's ATA idempotently first.There is no Pinocchio crate for Token-2022, so its instructions (
InitializeMint2,InitializeAccount3,MintTo,TransferChecked) are built by hand and CPI'd — matching the siblingimmutable-owner/groupexamples.A single LiteSVM test drives all five instructions end to end and asserts balances, account sizes, and owners with the official Token-2022 codec.