2

I understand now that the token-2022 standard allows transfer fees but does this also allow a fee that only enforces itself when the coin is being sold just like on Ethereum.

1 Answer 1

1

The transfer-fee extension in token-2022 works on all transfers, not just on "sales", since those are hard to define at the core protocol level.

If you want to enforce additional behavior during transfers, however, you can use the transfer-hook extension. That way, you can run any logic that you want.

Keep in mind that you won't be able to assess transfer fees in the same token in the transfer-hook case.

Docs on transfer fees at https://spl.solana.com/token-2022/extensions#transfer-fees and transfer hooks at https://spl.solana.com/token-2022/extensions#transfer-hook

3
  • is it possible for the solona smart contract to tell the difference between smart contract and a normal wallet so I can enforce a fee when the person sells into al liquidity pool just like how it works on ETH or is that just not possible at all
    – lolswag
    Commented Nov 20, 2023 at 5:15
  • This is what chatgpt told me. is it valid? It is possible for the token smart contract to tell the difference between a regular wallet and a smart contract wallet by using the account data and program ID, as I explained in my previous response. A regular wallet is an account that is controlled by a private key and has the system program as its program ID, while a smart contract wallet is an account that is controlled by a smart contract and has a different program ID.
    – lolswag
    Commented Nov 20, 2023 at 7:35
  • It isn't correct in all cases, but yes, you can check and see if the wallet address is a program derived address by using the Pubkey::is_on_curve check github.com/solana-labs/solana/blob/master/sdk/program/src/… just beware that it's a bit crude and will shut out legitimate use-cases
    – Jon C
    Commented Nov 20, 2023 at 18:25

Not the answer you're looking for? Browse other questions tagged or ask your own question.