Matcha prides itself on gasless exchanges, where the fees for exchange transactions are effectively paid for with one of the tokens involved, sidestepping the pre-requisite of having an ETH balance.
currently, this is limited to WETH pairs, uses separate liquidity pools, is unavailable over a certain trade size, and has a major shortcoming I will expand on later.
a truly gasless exchange experience would yield the following benefits:
- someone who is paid exclusively in a token (a common use case is stablecoin payments) wouldn’t need to turn to a third party to additionally procure ETH to be able to use their funds. they could just exchange some of it to ETH and then proceed to use any functionality on Ethereum.
- the same scenario, but even if the user has ETH on a different address, they wouldn’t need to link their addresses via on-chain transaction trails. this is highly desirable because it preserves privacy. e.g. when Bob is paid in LUSD by Alice for his work, he wouldn’t have to transfer ETH from his spending address to his salary payout address and thus reveal his spending habits to his employer.
in my experience, this UX pattern is currently completely untapped across the Ethereum ecosystem (read: I couldn’t find a single DEX that lets me do this).
truly gasless exchanges are difficult to realize because even if the exchanging itself is gasless, most tokens need a spending approval transaction before exchanging, which requires having ETH. this is currently the case with Matcha’s gasless trading. however…
permit() to the rescue! this is a function in token contracts that allow spending by another party solely with a signature from the owner, without the need to have ETH at all. (the use case assumes relayer(s) that submit the transaction to the mempool in exchange for a fee.) most of the popular stablecoins have had
permit() in their contracts for years:
- dai: dss/dai.sol at master · makerdao/dss · GitHub
- relayer (DACH) and UI implementation: GitHub - MrChico/stablecoin.services: A gas free offering of common Dai and Chai operations
- USDC: centre-tokens/FiatTokenV2.sol at master · centrehq/centre-tokens · GitHub
- announcement: Centre Consortium Announces Release of USD Coin Version 2.0 | by Centre Consortium | Centre blog | Medium
- gas abstraction tests: centre-tokens/test/v2/GasAbstraction at master · centrehq/centre-tokens · GitHub
- a gasless swap implementation: ethereum-token-contracts/TokenEscrow.sol at main · LocalCoinSwap/ethereum-token-contracts · GitHub
- LUSD: dev/LUSDToken.sol at main · liquity/dev · GitHub
- rai: geb/Coin.sol at master · reflexer-labs/geb · GitHub
the stablecon.services implementation, although its deployment is no longer maintained, already proved that it’s possible to use this function for truly gasless exchanges via Uniswap.
I was glad to see the willingness of the Matcha team to move in this direction, and encourage them to tap into the potential that
permit() offers. it would fill an essential gap in the ecosystem and make Matcha the go-to place for these types of transactions.