1

Is it possible to write a Transfer hook program that can redirect the Transfer fee to two or more wallets? e.g. if the Transfer fee is set to 2%, can we make a Transfer hook program that can transfer half of that to one wallet and another half to a different wallet?

I guess for such functionality we should be only enabling transfer hooks but not the transfer fee for the mint token as the transfer fee can go to only one wallet, with just Transfer hooks enabled the fee portion of splitting and sending that fee to two different wallets part can be done with program?

Please provide any sample if possible

1 Answer 1

3

It won't be possible to split the transfer fee in a transfer hook unfortunately. That behavior would require for token-2022 to call into the transfer hook program, which then calls back into token-2022.

The Solana runtime prohibits re-entrancy, so you can't call back up into a previous program.

3
  • What About Not using the Transfer-fee extension, but rather making the user pay the transfer fee in the token they are sending, just like what transfer hook is designed for i.e. pay some amount of SOL for any NFT transfer? so instead of charging SOL can we charge Token itsleft when making a trainsaction.
    – Sol Addict
    Commented May 2 at 19:18
  • 1
    If you just use the transfer hook extension, you run into the same problem, since you can't do re-entrancy back into token-2022 to move tokens. You can only charge transfer fees in a transfer hook in non-token-2022 tokens (ie SOL and USDC), since in those cases, token-2022 calls into your transfer hook program, which calls into the token program.
    – Jon C
    Commented May 4 at 13:00
  • 1
    thanks for the explanation. I think the only solution is to manually do that when harvesting those withheld fees
    – Sol Addict
    Commented May 4 at 16:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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