Gasless Swaps

Gasless Swaps are an important feature of the Aurox platform.

The basic premise behind gasless swaps is that they enable users on the platform to perform a fully decentralized swap between two supported currencies without paying that blockchain's native gas fee while using current decentralized exchange (DEX) infrastructure.

Currently, Aurox Gasless Swaps is designed to support the Ethereum network but with plans to expand on other networks.

Terminology

  • Origin Currency - the currency that is held by the user and is being traded for the desired end currency or destination currency

  • Destination Currency - the currency that the origin currency is being converted to; the desired output or end currency

How it Works

Gasless swaps work by using an intermediary or sponsored contract developed by Aurox to handle a decentralized transaction that settles through a DEX like Uniswap. The user interacts with Aurox's Sponsored Proxy Swap Contract through a web3 interface available on Aurox's platform, such as the Aurox Wallet or Aurox Terminal.

Through this interface, the user can select the two currencies they wish to swap in and out of. An approximation of the gas fee, denominated in the origin currency is displayed. It is important to note that this is where the UI would differ from a typical DEX where the gas fee is denominated in that blockchain's native token such as ETH for Ethereum or BNB for BNB Smart Chain. In Aurox's UI, the gas fee can be in any tradable currency listed on Uniswap or in the future, other DEXs. The gas fee is calculated by Aurox and converted over to the origin currency being traded.

Submitting a Transaction

When the user is ready to perform the transaction, they click to submit the transaction using Aurox's web2 user interface. At this moment they are required to sign two transactions, an approval transaction as well a signature transaction for the executeProxySwap transaction. These two transactions, themselves requiring ETH to process, are also sponsored transactions, requiring no ETH up front to process.

Transaction Validation and Processing

Once a transaction is submitted, a request is made to Aurox's backend to validate the transaction and assure that it is not malfeasant, spammed, or otherwise inputted erroneously. Once the transaction has been appropriately validated, the transaction is processed by the Sponsored Proxy Swap contract.

Since EIP-1559 transactions must include a gasPrice that is equal to at least the baseFee set by the Ethereum network, a 0-gas transaction is technically not possible. Additionally, beyond the baseFee, a market-rate processing fee must be added to the baseFee otherwise a transaction may become "stuck" in the mempool and eventually error out.

Transaction Finality

Once the transaction is submitted and completed by the DEX it is routed through, the origin currency is successfully swapped to the destination currency. Our Sponsored Proxy Swap contract then relays the destination currency back to the user's wallet address, thereby completing the transaction. From the end-user's perspective, no ETH was used to pay the gas fee.

Fees

Fees must be calculated correctly in order for the transaction to process successfully. We implement several functions to perform return fee calculations:

uint256 feePercentage = 0.05 ether;

// Using an oracle get the exchange rate
uint256 rate = returnPriceFeed(_fromToken, Denominations.ETH);

// Calculate what the amount would be without the fee, as we want to exclude the gasRefund
amount from the fee calculation.
uint256 amountWithoutFee = _swapParams.amount - (_gasRefund * rate);

// The feeTotal
uint256 feeTotal = _gasRefund + (amountWithoutFee * feePercentage / 1 ether);

// Slippage
uint256 slippage = 0.10 ether;

// Fee total in ETH
uint256 feeTotal = returnFeeTotal();

// Associated amount of tokens in _fromToken
uint256 rate = returnPriceFeed(_fromToken, Denominations.ETH);

// From token total including slippage
uint256 fromTokenLimit = (rate * feeTotal) * slippage / 1 ether;
uint256 fromTokenUsedTotal = swapToExactETH(_fromToken, feeTotal, fromTokenLimit);

Aurox plans to charge a processing fee in addition to the standard blockchain gas fee. Initially, this fee will be waived.

Enhanced Privacy

Gasless Swaps bring newfound convenience to decentralized traders.

New wallets can be used without seeding them with ETH, removing a cumbersome extra step, while also providing far more privacy to the end-user. Since seeding a wallet with ETH also reveals the donor wallet which funded the transaction, new wallet identities are often betrayed by the need to fund them with ETH to process swaps or even move the funds out. Using Gasless Swaps allows a user to fund a wallet using the origin currency by itself, perform swaps, or even convert to ETH to have new gas funds that are no longer associated with another wallet.

Last updated