Web: As a user who is contributing to Gitcoin Grants, I want to do so via a L2, so I can avoid high gas costs.

Created on 21 Jul 2020  Â·  17Comments  Â·  Source: gitcoinco/web

User Story

As a user who is contributing to Gitcoin Grants, I want to do so via a L2, so I can avoid high gas costs.

Why Is this Needed

Summary:
Gas costs are too high with bulk checkout, according to vitalik "the tech is ready"

Description

Type:
Feature

Current Behavior

Bulk Checkout

Expected Behavior

  • Checkout via L2 (probably Loopring, maybe xDAI or another Optimistic Rollup type scheme)
  • grants.models.contribution.update_tx_status() is able to see what txns on the L2 have been validated, so they can count for CLR

Definition of Done

See above

Data Requirements

How many ppl opt to checkout via each checkout tech?

Additional Information

grants_round_7

Most helpful comment

Sound about right!

  • Upon clicking "Pay via Loopring":

    • Sign 1st transaction (275k gwei) to "get a Loopring account"
    • Sign 2nd transaction (100k gwei + grant amount) to "deposit funds to Loopring"
    • Sign 3rd transaction to "send funds to grant owners"
    • Total 3 transactions?

Step 1 and 2 or course only when necessary for the user. For step 2 the user will also have to approve our contract for the amount that's going to be deposited for everything except ETH.

If step 1 and 2 are both necessary then they can also be combined in a single Ethereum tx using updateAccountAndDeposit, with the total cost around the same as just creating a new account separately.

For creating accounts it will also be necessary to let users first the "log in" message, because to create an account the public keys for the account need to be set. So step 3 should be done first in that case.

Upon clicking "Pay via Loopring":

  • Sign the "log in" message to generate the keypair for the account (only depends on the user's Ethereum address)
  • If the user doesn't have an account yet: Create the account and deposit the necessary amount of funds. Call ERC20.approve + loopring.updateAccountAndDeposit.
  • If the user has an account but not enough funds: Call ERC20.approve + loopring.deposit (you could also call loopring.updateAccountAndDeposit here as well if that makes your life easier, I don't think it makes a big difference in gas cost if the user already has an account, and it will just do the deposit as well).
  • Keypair necessary to do transfer on layer 2 already created, simply sign all the necessary rollup transactions to the recipients.

All 17 comments

loopring chat w @ceresstation and @Brechtpd :

  • for grant owners/donors; 275k gwei to enter rollup environment
  • for donors, they need to deposit assets into loopring environment, 100k gwei
  • no (or negligible) gas cost to remove assets from loopring environment

API call docs https://docs.loopring.io/en/

@PixelantDesign we'll probably need to have two checkout payment options on grants checkout (akin to choosing to pay with amazon checkout, paypal, in a normal e-commerce checkout flow)

Yes many L2 tech like Loopring, matic, celr can be tested also any Gitcoin Grants related to gas economics and reduction of gas can be funded.

My idea is very simple ---
Transactions must be categorized ,
A transaction must have some code or marker in it telling which type of transaction is it
A) monetary transactions like trading etc, sending payments
B) Non monetary transactions , playing games and using non financial dapps
For second category a minimum fixed near zero fee can be used and for first category as usual depends on demand and supply.
Miners have to accept minimum 50% non monetary transactions ,
So miners will get two income stream
1- Variable with financial transactions
2- fixed with near zero transactions ( huge number of transaction will slowly accumulate to significant fees) .

I'm thinking XDAI is probably the lowest lift but im not too familiar with the others, but XDAI is pretty simple. Would we need to support 2 flows here? a) someone has all funds on L1, checkout process automates L1->L2 and then onto destination b) someone already has L2 funds and can skip the first portion.

I opened this issue #6905 in a while to adopt the L2 looping protocol, my short term solution strategy and insert the gitcoin community into L2 seriously enabled or loopring a TIP wheel from townsquare.

so we will have 80% of gitcoin users signed on the network to do loopring.

When September comes, a curve for the use of L2 will be minimal.

but it is interesting to have other protocols available and tag the buttons to see which one is being used most in Grants

Yes experimenting with all the L2 solution and integrate with it would be good idea and recommending the best one according to user responses or testing , with time only very good L2 options can be shown and rest can be removed. MATIC,LOOPRING,OMISEGO,CELER and there are other L2 solutions to look up for... The important thing to remember is to integrate in such a way that if there comes any problem in L2 solution we can decoupled from it or show legacy option also ( for e.g if some users faces bags , he should get the option to transact via old way as we are doing now )

from @apbendi

The private key for your loop ring account is derived from a signature made with your MetaMask account. So I believe we’d have to prompt them for that signature, but after that, we’d have the private key in memory and be able to use it for as many signatures as we wanted.

@brechtpd do you know if this is true? is there any way we can avoid having to prompt the user for N transaction signatures to send N grant payments on the grants checkout page?

To clarify, @owocki, I think we'd only need 1 signature, then we'd have the pk. But I'm not 100% on that, so I'd love your input @Brechtpd

The private key for your loop ring account is derived from a signature made with your MetaMask account. So I believe we’d have to prompt them for that signature, but after that, we’d have the private key in memory and be able to use it for as many signatures as we wanted.

That's exactly right @apbendi @owocki, that's how we currently do things on loopring.io as well. Users "log in" by signing the message, and then they can create as many orders they want with us signing those transactions in the background with the generated private key.

In the future with MetaMask plugins we'll be able to do this even without needing this "log in" (and the pk used for signing the transactions never leaves MetaMask), but seems very unlikely MetaMask plugins will be ready for round 7.

then they can create as many orders they want with us signing those transactions in the background with the generated private key.

got it; so only 1 or 2 metamask confirmations per checkout?

thats huge. awesome!

Just 1, assuming the person already has the necessary funds on Loopring of course.

Thinking about the rough flows from my understanding, assuming owners and donors don't have a Loopring account:

Grant owners

  • There will be an option on https://gitcoin.co/grants/new to enable grant donations via Loopring

    • We need to inform them that not all tokens are available on Loopring

  • If they select that option, upon creating a grant, they will be asked to sign a transaction (275k gwei) to "get a Loopring account".

Grant donors

  • For grants that accept Loopring, there will be a "Pay via Loopring" button on https://gitcoin.co/grants/cart
  • Upon clicking "Pay via Loopring":

    • Sign 1st transaction (275k gwei) to "get a Loopring account"

    • Sign 2nd transaction (100k gwei + grant amount) to "deposit funds to Loopring"

    • Sign 3rd transaction to "send funds to grant owners"

    • Total 3 transactions?

Are these correct? Let me know if I missed anything 🙂

Sound about right!

  • Upon clicking "Pay via Loopring":

    • Sign 1st transaction (275k gwei) to "get a Loopring account"
    • Sign 2nd transaction (100k gwei + grant amount) to "deposit funds to Loopring"
    • Sign 3rd transaction to "send funds to grant owners"
    • Total 3 transactions?

Step 1 and 2 or course only when necessary for the user. For step 2 the user will also have to approve our contract for the amount that's going to be deposited for everything except ETH.

If step 1 and 2 are both necessary then they can also be combined in a single Ethereum tx using updateAccountAndDeposit, with the total cost around the same as just creating a new account separately.

For creating accounts it will also be necessary to let users first the "log in" message, because to create an account the public keys for the account need to be set. So step 3 should be done first in that case.

Upon clicking "Pay via Loopring":

  • Sign the "log in" message to generate the keypair for the account (only depends on the user's Ethereum address)
  • If the user doesn't have an account yet: Create the account and deposit the necessary amount of funds. Call ERC20.approve + loopring.updateAccountAndDeposit.
  • If the user has an account but not enough funds: Call ERC20.approve + loopring.deposit (you could also call loopring.updateAccountAndDeposit here as well if that makes your life easier, I don't think it makes a big difference in gas cost if the user already has an account, and it will just do the deposit as well).
  • Keypair necessary to do transfer on layer 2 already created, simply sign all the necessary rollup transactions to the recipients.

Hey Kevin, is this issue still open, Fuel would like to chat @owocki

Yes pls! @SilentCicero wanna email me to set soemthing up? [email protected]

On it @owocki

Grant owners

  • There will be an option on https://gitcoin.co/grants/new to enable grant donations via Loopring

    • We need to inform them that not all tokens are available on Loopring
  • If they select that option, upon creating a grant, they will be asked to sign a transaction (275k gwei) to "get a Loopring account".

Should there be a temporary button on existing grants to allow those who want to create a loopring account for their grant?

Yep, I’ll email you.

On Tue, Sep 1, 2020 at 9:45 AM Walid Mujahid وليد مجاهد <
[email protected]> wrote:

>
>
>
>

Grant owners

-

There will be an option on https://gitcoin.co/grants/new to enable
grant donations via Loopring

  - We need to inform them that not all tokens are available on
  Loopring

-

If they select that option, upon creating a grant, they will be asked
to sign a transaction (275k gwei) to "get a Loopring account".

Should there be a temporary button on existing grants to allow those who
want to create a loopring account for their grant?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/gitcoinco/web/issues/7127#issuecomment-684864781, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/ACK2CXQYULDUT6FCVZGIAATSDT3HNANCNFSM4PDTMDSA
.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

abitrolly picture abitrolly  Â·  4Comments

christianbundy picture christianbundy  Â·  3Comments

pelsasser picture pelsasser  Â·  4Comments

frankchen07 picture frankchen07  Â·  4Comments

uluhonolulu picture uluhonolulu  Â·  3Comments