dcrdex icon indicating copy to clipboard operation
dcrdex copied to clipboard

eth/pol: Gasless redemptions using account abstraction

Open martonp opened this issue 10 months ago • 1 comments

  • 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 IAccount interface.
    • Added functions:
      • validateUserOp: Validates user operations and prepays gas for redemption.
      • redeemAA: Executes the redemption.
  • Changes in client/asset/eth:

    • ReserveNRedemptions updated to return 0 without error if there is insufficient funds for redemption, but a bundler is configured.
    • Added GaslessRedeem function for bundler-based redemptions when ReserveNRedemptions returns 0.
    • Updated txDB to 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 GaslessRedeem instead of Redeem if ReserveNRedemptions returns 0.
    • Post-redeem actions:
      • For Redeem, immediately sends a redeem message to the server.
      • For GaslessRedeem, waits for ConfirmRedemption to ensure submission before messaging the server with the updated coin ID (now includes both user op ID and tx hash).
  • 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.

martonp avatar Jan 31 '25 19:01 martonp

This all looks very reasonable. Love that lexi upgrade.

buck54321 avatar Feb 27 '25 13:02 buck54321

It seems there are still conflicts.

JoeGruffins avatar Aug 11 '25 04:08 JoeGruffins