1

The SPL token program has support for a freeze/thaw authority where the authority can block any transaction involving a given account.

How can I lock only some tokens in an account? E.g. a token account with 100 tokens would be frozen for only 30 tokens, while free to send the other 70.

One way to do this would be to create separate token accounts for the same token, e.g. 70 in one account and 30 in another (frozen), though this is not the best in terms of UX.

Any other suggestions?

2 Answers 2

2

The only way to do this is with separate token accounts. the SPL token program's freeze and thaw instruction don't support partial (or amount based) restrictions.

-2

You would have to create your own instruction, and an on-chain struct for the amount you want to freeze.

Freeze the account. Your custom ix accepts the freeze authority (probably a PDA) and owner. It will unfreeze the token account, execute the transfer, then re-freeze the account.

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.