Skip to main content

Optmistic DEX - “Leechswap”

This is an example of a dApp that takes advantage of Coinweb’s ability to read and react to events on the underlying blockchains and the decoupling of computation from the underlying consensus in the form of low computational costs. The initial version for Dev net 0.1 is relatively simple, but the concept can be implemented to work across more complex DEX aggregators as well as cross-chain DEXes and bridges.

The idea behind it is quite simple. Current DEXes are implemented as smart contracts that are executed on-chain. The cost of executing these smart contracts comes in addition to the transaction costs associated with the actual transfer of the funds. Leechswap takes advantage of this, and instead of using the smart contracts on the L1 DEXes to do the actual exchange operations, it monitors the price ratio of the different trading pairs. This monitoring is done by the Leechswap smart contract running on Coinweb. The Leechswap smart contract also holds the collateral for participating market makers. After depositing collateral in the Leechwap smart contract on Coinweb, Leechswap market makers can commit to executing trades on chosen trading pairs on the monitored L1 dex with certain rate guarantees, typically lower or equal to that of the L1 DEX. Users of Leechswap send the funds directly to the market maker account, and the market makers send the exchanged funds back to the users’ accounts at the guaranteed rate. If the market maker fails to complete the committed trade, the market maker’s collateral is slashed, and the user is compensated from the slashed collateral of the market maker. ( Would typically be the original amount plus a penalty fee).

In short: Leechswap works for the same L1 assets as the monitored DEX, but instead of using the DEX smart contracts, exchanges are executed as direct sends between users and market makers, circumventing the gas fees of the L1 DEX. The exchange operations are secured by market makers depositing collateral in the Leechswap smart contracts on Coinweb.