How does the equivalent of solidity's fallback function look like in plutus?

So I just want a function without name or parameters what is called every time when someone simply just send any token to my contract.
Can you write a simple smart contract example with a function like that or give me some source about that? It would help a lot!

On-chain Plutus code does not support the concept of a fallback function. Off-chain code could watch for transactions that send a token to a contract, and then the off-chain code could construct and submit a transaction that on-chain Plutus code would validate.

Lectures 6 & 7 of the Plutus Pioneer Program, and the accompanying source code, might give you an idea of how off-chain code can watch on-chain activity and create+submit transactions that are validated on-chain.

2 Likes