8000 eth/pol: Gasless redemptions using account abstraction by martonp · Pull Request #3175 · decred/dcrdex · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

eth/pol: Gasless redemptions using account abstraction #3175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

martonp
Copy link
Collaborator
@martonp martonp commented Jan 31, 2025
  • 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.

- **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.

# Conflicts:
#	dex/lexi/table.go
#	dex/networks/eth/tokens.go
#	dex/testing/eth/harness.sh
#	dex/testing/polygon/harness.sh
@buck54321
Copy link
Member

This all looks very reasonable. Love that lexi upgrade.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0