Deploying a token with Token Extensions

To answer the question: How do you migrate existing tokens to token extensions?

As the owner of an existing token with many holders, unfortunately, directly migrating existing tokens to token extensions isn't currently possible. However, there is a workaround for token owners:

  1. Create a new mint with token extensions enabled.

  2. Run a program that:

    • Burns the old tokens held by users.

    • Transfers an equivalent amount of new tokens with extensions to users through a secure escrow account.

Example: As a Blockchain Developer, deploy a token that charges a .25% fee with every transfer.

The opt-in feature of token extensions allows you to create an implementation on-chain by simply specifying a tag at the end of your deployment script.

Here’s the code:

$spl-token--program-id~ TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb~ create-token~--transfer-fee251000000

Note:

  1. Transfer Fee Flag: This flag signifies that the token utilizes a separate interface to determine the transfer fee.

  2. Transfer Fee Basis Points (25): This parameter sets the transfer fee at 25 basis points, which translates to 0.25% of the transferred tokens.

  3. Maximum Transfer Fee: This parameter defines the highest amount of tokens allowed to be paid as a transfer fee.

Last updated