Commit dc05d82
committed
token-2022 cpi-guard: add pinocchio example
Ports the cpi-guard Token-2022 example to Pinocchio (the anchor example has
no native sibling). Unlike the other extension examples, CpiGuard cannot be
enabled or disabled through a CPI, so the program cannot initialize it;
instead the program exposes a cpi_transfer instruction (a Token-2022
TransferChecked CPI, reading the mint's decimals from account data) and the
example demonstrates the guard's effect.
The litesvm test creates a source account with CpiGuard enabled (client-side)
and funded, then shows the program's CPI transfer is rejected while the guard
is on and succeeds once it is disabled, asserting the destination balance.
Matches the kit + litesvm template of the other token-2022 pinocchio examples.1 parent 73219fe commit dc05d82
12 files changed
Lines changed: 3311 additions & 0 deletions
File tree
- tokens/token-2022/cpi-guard/pinocchio
- program
- src
- instructions
- tests
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| 76 | + | |
76 | 77 | | |
77 | 78 | | |
78 | 79 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
0 commit comments