This is the general concept of the Fedimint project. It works in production today, but very little adoption… most likely because it doesn’t have a native shitcoin for VC wealth extraction.
I believe you can execute any arbitrary code/logic within a Fedimint “smart contract”