A decentralized exchange is a blockchain-based platform that enables peer-to-peer asset trades without a central custodian. Smart contracts…