Restricting ICRC2 Token Transfers to Whitelisted Principals Across All Platforms

Hello everyone,

I am using an ICRC2 ledger and want to ensure that only specific principals from my whitelist are allowed to receive my ICRC2 tokens. However, I don’t want these restrictions to apply only within my dApp—I want them to be enforced across all platforms, including ICP Swap and NNS.

Is it possible to implement such a restriction? If so, how can it be achieved?

isn’t this a duplicate of How to Restrict Specific Actions in an ICRC2 Ledger to Certain Principals? ?

why a new thread? can we continue the discussion over there? then I could close this thread.

No this is different one, the other one was only for the dapp restrictions and that no one can send tokens , but this one is different.

/meme it’s the same picture.

Can you be more specific? The code I gave you in the other thread gives you an allow list your app canister can manage and only the people on that list can move tokens around via transfer or approve.

If you want your dapp to be gated by a balance on that ledger you would just use balance of. If the code is not clear or you would like to adapt the strategy, please ask a question and I’ll be happy to help.

1 Like

Thank you for the clarification! What I’m asking is whether this code will also enforce my restriction outside of my dApp (like in nns if I send my token there)—preventing people from receiving tokens unless they are on the whitelist—or if the restriction only applies within my dApp.

The code is for a token canister. The canister will only transfer and approve to accounts on the whitelist. Your dapp can trade those tokens but only if they are on the whitelist. Other apps can only trade those if they are on the whitelist,

I got it but is there a Rust version of this code available?

Nope. You can poke around in DFINITY’s ledger, but you’ll need to do all the implementation.

1 Like