Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Token 2022 upgrade #12

Open
wants to merge 5 commits into
base: spl-gov-plugin
Choose a base branch
from
Open

Token 2022 upgrade #12

wants to merge 5 commits into from

Conversation

jgur-psyops
Copy link
Collaborator

@jgur-psyops jgur-psyops commented Apr 2, 2024

Adds support for Token 2022.

All accounts in the program should use either 2022 or Token classic, you can't mix and match.

Changes:

  • All ATAs must be derived with TOKEN_2022_PROGRAM_ID, e.g.
      const reward1TokenAccount = getAssociatedTokenAddressSync(
        rewardMint1,
        program.provider.publicKey,
        undefined,
        TOKEN_2022_PROGRAM_ID
      );
  • All instructions must pass TOKEN_2022_PROGRAM_ID when tokenProgram is an account if using Token2022
  • Governance integration does not work as the governance program currently does not support Token2022, however all 2022 features can be used if no registrar was enabled. If a registrar is enabled, nobody will able to create voter weight records, and thus can deposit but never withdraw.
  • InitializeStakePool unchanged (other than the above)
  • AddRewardPool adds reward_mint account
  • Deposit adds mint account (same as stakePool.mint)
  • Withdraw adds mint account (same as ClaimBase.stakePool.mint)
  • When using Token2022, Claimbase and Withdraw also requiring passing the Mint in remaining accounts, like:
{
         pubkey: rewardVaultKey,
         isWritable: true,
         isSigner: false,
       },
       {
         pubkey: depositorReward1AccountKey,
         isWritable: true,
         isSigner: false,
       },
       {
         pubkey: rewardMint,
         isWritable: false,
         isSigner: false,
       },
/// next set of 3, etc.

Classic Token still passes accounts in pairs (rewardVault, DepositorAccount, rewardVault2, DepositorAccount2, etc)

@jgur-psyops jgur-psyops added the enhancement New feature or request label Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant