windingtree / videre-contracts

Videre Protocol smart contracts 📃
GNU General Public License v3.0
0 stars 2 forks source link

feat: non-crypto to crypto payments #14

Open mfw78 opened 2 years ago

mfw78 commented 2 years ago

Use ramp.network, or Mt Pelerin to do credit/debit card to crypto (xDai).

The rough process would be something like:

  1. Run normal checkout procedure and get to payment.
  2. Generate a random private key in browser, prompt the user to either save this somewhere, or write it down.
  3. Pre-sign a transaction with this randomly generated wallet that would purchase the new stay. Send this pre-signed transaction to an API.
  4. Have same API receive a webhook from ramp or Mt Pelerin that the credit card flow worked. At this point, broadcast the pre-signed transaction.

Risks may be setting too low a max base fee which could result in volatile gas price movements, and at the same have insufficient funds (by a few Wei) to cover the transaction / purchase.

mfw78 commented 2 years ago

If using Mt Perelin, it could be opted to use USDC for that method (Mt Perelin supports USDC on Gnosis Chain).

As USDC on Gnosis Chain is a standard bridged token, the contract supports and implements the EIP2612 standard.

With this, instead of generating a signed TX in the above flow, a Permit hash could instead be signed, then send this to a relayer service to facilitate payment on behalf of the user.

This would require refactoring of the smart contract so new stays could be paid for on behalf of another user (as is the case with the relayer which would be msg.sender).

UX issues:

Ramp.network does support the USA, though perhaps they can be approached to facilitate payment of USDC on Gnosis Chain.