ubiquity / ubiquibot

Putting the 'A' in 'DAO'
https://github.com/marketplace/ubiquibot
MIT License
17 stars 60 forks source link

Gnosis Chain for L2 payouts #287

Open rndquu opened 1 year ago

rndquu commented 1 year ago

Discussed in https://github.com/ubiquity/bounty-bot/discussions/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](https://etherscan.io/tx/0x406103f63104f248ba874cadcd4d1d0403205a3edc5c9e1ef382006bdf8cf718) 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](https://github.com/ubiquity/bounty-bot/issues/274). 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](https://github.com/ubiquity/bounty-bot/issues/274) to work with multiple chains
0x4007 commented 1 year ago

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 commented 1 year ago

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. https://github.com/ubiquity/bounty-bot/issues/283
  2. https://github.com/ubiquity/pay.ubq.fi/issues/59

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

devpanther commented 1 year ago

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 commented 1 year ago

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

devpanther commented 1 year ago

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

rndquu commented 1 year ago

@devpanther

We could consolidate the following tasks into a single issue:

0x4007 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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