How Decentralized Exchanges Work