8000 Support for additional Token22 extensions by Ikrk · Pull Request #3701 · solana-foundation/anchor · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Support for additional Token22 extensions #3701

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Ikrk
Copy link
@Ikrk Ikrk commented May 10, 2025

Hello,
this PR extends the original Token22 Extensions PR #2789 and adds support for additional token mint extensions, namely:

  • transfer fee
  • interest bearing
  • non-transferable
  • default account state

An example of initialization:

const BASIS_POINTS: u16 = 100;
const MAX_FEE: u64 = 10000;
const RATE: i16 = 100;

#[account(
    init,
    ...
    extensions::non_transferable,
    extensions::transfer_fee::config_authority = authority,
    extensions::transfer_fee::withheld_authority = authority,
    extensions::transfer_fee::basis_points = BASIS_POINTS,
    extensions::transfer_fee::max_fee = MAX_FEE,
    extensions::interest_bearing::authority = authority,
    extensions::interest_bearing::rate = RATE,
    extensions::default_account_state::state = AccountState::Frozen,
)]
pub mint: Box<InterfaceAccount<'info, Mint>>,

An example of constraints check:

#[account(
    extensions::non_transferable,
    extensions::transfer_fee::config_authority = authority,
    extensions::transfer_fee::withheld_authority = authority,
    extensions::interest_bearing::authority = authority,
    extensions::default_account_state::state = AccountState::Frozen,
)]
pub mint: Box<InterfaceAccount<'info, Mint>>,

Checking of constraints extensions::transfer_fee::basis_points, extensions::transfer_fee::max_fee and extensions::interest_bearing::rate is currently not supported.

Also I was wondering if it would not be better to have ex. extensions::non_transferable = false instead of only being able to check if the non-transferable extension is enabled?

Fixes #3088.

Let me know what you think. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to define extensions non_transferable?
1 participant
0