Idea for funds flow when shielding ERC20 (gasless interaction)

I really like that there are two options for shielding ETH/ERC20 tokens: 1) simply an ethereum address where a user can send funds from an exchange or whatever and 2) an ability to interact with the smart contract directly.

Regarding the 1st option, I observe the flow to be:

  1. A permanent wallet address is generated and users send funds.
  2. Somehow that deposit is detected and an incognito admin wallet sends a small amount of ether to that wallet.
  3. A smart contract interaction is created to deposit the tokens to the smart contract.
  4. A very small amount of ether is leftover in the wallet.

I’ve noticed there are at least two gasless decentralized exchange options for interacting with sushiswap & uniswap. The problem they solve primarily is that the transactions do not stay pending in the mempool so frontrunning is not possible. Instead a fee/bribe is paid exactly to the miner to do these transactions.

The two I know about are: (by alchemist team) &

I’ve seen TX confirmations on etherscan and indeed zero gas is used. I don’t know how they are exactly bribing the miners but I assume you can bribe them to process any kind of transaction.

In our case perhaps it can be used to improve shielding flow.

  1. We bribe the miner to include the deposit transaction from the temporary ethereum address to the smart contract.
  2. This means that there doesn’t need to be gas in the wallet. No gas is needed to provide the temporary address the gas and there is no gas leftover from fee estimation inefficiencies as well.
  3. I’m not sure if miners accept bribes in any ERC20 but if they require eth perhaps the ETH could come from a different wallet than the temporary shielding address.

I’m not technical enough on how zero gas transactions are possible but if one can execute uniswap & sushiswap trades without gas our application should work as well. Thoughts?? (By the way, I like that you have both options for shielding coins as it would serve users in different ways.)

I found this documentation. I don’t know if the above projects are using this or if there are multiple ways do accomplish the same thing. It’s called Flashbots. It allows for gasless interaction with ERC20 tokens inside a user wallet.