dcrdex
dcrdex copied to clipboard
eth/pol: Gasless redemptions using account abstraction
-
Overview:
- Uses ERC-4337 for account abstraction in gasless redemptions.
- Users can now perform gasless redemptions by specifying a bundler endpoint in wallet settings.
- If insufficient balance, redemption transactions are handled via user operations sent to the bundler, which then submits to the network and takes a fee.
-
Changes in
dex/networks/eth:- Updated V1 ETH swap contract to support account abstraction via the
IAccountinterface. - Added functions:
validateUserOp: Validates user operations and prepays gas for redemption.redeemAA: Executes the redemption.
- Updated V1 ETH swap contract to support account abstraction via the
-
Changes in
client/asset/eth:ReserveNRedemptionsupdated to return 0 without error if there is insufficient funds for redemption, but a bundler is configured.- Added
GaslessRedeemfunction for bundler-based redemptions whenReserveNRedemptionsreturns 0. - Updated
txDBto order transactions by timestamp instead of nonce, now using lexi instead of raw badgerDB. - Added logic to keep track of pending user operations, and confirming redemptions done using account abstraction.
-
Changes in
client/core:- Calling
GaslessRedeeminstead ofRedeemifReserveNRedemptionsreturns 0. - Post-redeem actions:
- For
Redeem, immediately sends a redeem message to the server. - For
GaslessRedeem, waits forConfirmRedemptionto ensure submission before messaging the server with the updated coin ID (now includes both user op ID and tx hash).
- For
- Calling
-
Changes in
server/asset/eth:- Added support for validating redemptions submitted by a bundler. The bundler must have submitted a transaction before the server is notified.
-
Changes in
server/market:- Update balance checking for redemptions of EVM base assets to no longer require a balance. Token redemptions still require a balance.
I have tested using Alchemy on testnet, and it works well. I have also tested with Pimlico, but there are some issues. I'm in contact with their support to resolve them. I will keep testing other bundler providers.
This all looks very reasonable. Love that lexi upgrade.
It seems there are still conflicts.