Trigger some action on every icp/icrc1/icrc2 token received!

is there any way to trigger some action when canister receives icp/icrc1/icrc2 tokens?
I’m generating a deposit address for every user(randomly generated subaccount), is there any way to trigger some function/action on every token received on the address?

1 Like

No, this is not possible. The most common pattern that is used in these situations is that user deposits tokens to the canister, and then notifies the canister of the deposit with something like notify(block_height). As an example, have a look at the cycles minting canister interface

This can be moderated I think @Severin , it is probably possible but, also probably expensive. e.g. one can implement an heartbeat that continuously observe all transactions on the IC and trigger and action if one of the last transactions noticed matches a particular account identifier. But yeah, expensive therefore commonly the solution you describe is used.