Atomic messaging

Has anyone thought about how to enable atomic cross-canister messaging? Would be cool if there was a system-level way to do this, likely with higher fees.

This has many applications, but in the financial space there are two big ones:

  • Atomic cross-canister asset swaps without a centralized custodian
  • Flash loans, which allow uncollateralized loans (in Ethereum, all “loans” are permissionless but require posting 100%+ collateral). In a flash loan, borrowers receive and repay assets in one single transaction, allowing them to use the loaned asset for other profitable opportunities. If they cannot repay the debt, the whole transaction simply reverts

I think inter-canister calls are atomic. If a sub call fails, the whole call tree is reverted.