Skip to content
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

Gnosis Chain for L2 payouts #287

Open
4 of 5 tasks
rndquu opened this issue May 3, 2023 Discussed in #276 · 9 comments
Open
4 of 5 tasks

Gnosis Chain for L2 payouts #287

rndquu opened this issue May 3, 2023 Discussed in #276 · 9 comments

Comments

@rndquu
Copy link
Member

rndquu commented May 3, 2023

Discussed in #276

Originally posted by rndquu April 28, 2023
Ethereum gas prices are high again and withdrawing payouts becomes more and more expensive.

Some folks are already complaining:
Screenshot 2023-04-28 at 18 01 25

There are many options for L2 solutions (here the term "L2" also includes sidechains). I think we can select any L2 solution which meets the following criteria:

  1. Widely adopted solution
  2. Low gas prices
  3. Fast bridging Eth mainnet <=> L2

Gnosis Chain is not widely adopted but meets other criteria.

How fast is the bridge

Bridge website: https://bridge.gnosischain.com

It takes 20 block confirmations on ethereum mainnet (~4 minutes) to transfer DAI from ethereum mainnet to gnosis chain. Technically ethereum mainnet's DAI are converted to XDAI on gnosis chain (XDAI is used for gas payments on gnosis chain, 1 XDAI = 1 DAI).

It takes 20 block confirmations on gnosis chain (~2 minutes) to transfer XDAI from gnosis chain to DAI on ethereum mainnet. It requires 2 transactions: 1st transfer transaction is on gnosis chain and 2nd claim transaction is on ethereum chain (which is pretty expensive right now)

Codebase

Right now we support payouts in ERC20 DAI on ethereum mainnet. XDAI in gnosis chain is not a plain ERC20 token, it is used for gas payments (the same way as ETH is used in ethereum chain). While it seems to be natural to support XDAI (which is pegged to DAI) for payouts in gnosis chain it also requires us to maintain 2 codebases for permit2 and gnosis safe payouts. By "2 codebases" I mean supporting payouts in ERC20 and native gas tokens which adds complexity. That is why it is better to use WXDAI in gnosis chain which is a plain ERC20 token.

In short ERC20 DAI in ethereum = ERC20 WXDAI in gnosis chain. So bounty hunter payouts are going to be in WXDAI in gnosis chain and in DAI on ethereum mainnet.

Bounty hunter flow

From a bounty hunter's view everything is the same. He posts /wallet 0x01 and solves an issue. Payouts (permit2 URLs or automatic safe transactions) are performed in a chain that would be set in partner's config.

Partner flow

Partner would need to add a CHAIN_ID parameter to the bot's config. So partner will be able to use either ethereum mainnet either gnosis chain.

Also notice that while it is technically possible to create 2 gnosis safes with the same address (on mainnet and in gnosis chain) current gnosis safe web UI does not support this feature. From https://help.safe.global/en/articles/5267779-i-sent-assets-to-a-safe-address-on-the-wrong-network-any-chance-to-recover:

existing Safe addresses on Eth mainnet re-created on L2/sidechains (and vice versa) do not load up within our UI

How to migrate on the bot's side

Basically we need to:

  1. Read CHAIN_ID from a partner's config
  2. Make permit2 to work with multiple chains
  3. Make gnosis safe transactions to work with multiple chains
@0x4007
Copy link
Member

0x4007 commented May 4, 2023

This is an excellent specification. However I would consolidate the small and similar tasks (i.e. add chain ID) into a single bounty.

Thanks for this.

@rndquu
Copy link
Member Author

rndquu commented May 4, 2023

This is an excellent specification. However I would consolidate the small and similar tasks (i.e. add chain ID) into a single bounty.

Thanks for this.

These are chainId related tasks:

  1. Add chainId to bot's config #283
  2. Add chainId to auto generated config pay.ubq.fi#59

Although they are similar they correspond to different repositories so it is better to keep them apart.

@devpanther
Copy link
Contributor

This is going to take a while, it's broken into several small issues worth just 12 USD, gas for the claim is worth more than that right now

@0x4007
Copy link
Member

0x4007 commented May 5, 2023

You could consider registering a dedicated claims wallet and queue up all your claim transactions with low gas speeds.

@devpanther
Copy link
Contributor

Would take forever but that's the only way for now

@rndquu
Copy link
Member Author

rndquu commented May 5, 2023

@devpanther

We could consolidate the following tasks into a single issue:

@0x4007
Copy link
Member

0x4007 commented May 19, 2023

According to the checklist it appears that we can start already issuing permits on gnosis chain. We should merge to main asap @0xcodercrane @Draeieg

@rndquu
Copy link
Member Author

rndquu commented May 19, 2023

According to the checklist it appears that we can start already issuing permits on gnosis chain. We should merge to main asap @0xcodercrane @Draeieg

I put checkmarks for tasks with ready to review PRs.

In order to start issuing permits on gnosis chain we need to merge the following PRs:

@Draeieg
Copy link
Contributor

Draeieg commented May 19, 2023

According to the checklist it appears that we can start already issuing permits on gnosis chain. We should merge to main asap @0xcodercrane @Draeieg

I put checkmarks for tasks with ready to review PRs.

In order to start issuing permits on gnosis chain we need to merge the following PRs:

alright as soon as the PRs get merged I'll kill two birds and test #267 at the same time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Passed
Development

No branches or pull requests

4 participants