Commit e1c64d8
committed
token-2022 interest-bearing: add pinocchio example
Ports the interest-bearing Token-2022 example to Pinocchio (the anchor
example has no native sibling), matching the token-2022 pinocchio template
(kit + litesvm, official @solana-program packages, real Rent::get()).
The program hand-rolls three Token-2022 CPIs to create a mint with the
InterestBearingConfig extension: it initializes the rate config to 0% before
InitializeMint, then (mirroring the anchor example) updates it to 1% via
UpdateRate, which the rate authority signs. The payer is the rate authority.
Unlike a COption, the rate authority is an OptionalNonZeroPubkey (a bare
32-byte key, no tag byte), and the rate is a signed i16. Mint size is 222
bytes (a 52-byte InterestBearingConfig TLV value). The litesvm test decodes
the mint with the official Token-2022 codec and asserts the rate authority
and the current 1% rate.1 parent 4f90945 commit e1c64d8
12 files changed
Lines changed: 3325 additions & 0 deletions
File tree
- tokens/token-2022/interest-bearing/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 | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
Lines changed: 25 additions & 0 deletions
| 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 | + | |
| 25 | + | |
0 commit comments