ethereum-optimism / ecosystem-contributions

Find ways to contribute to the Optimism Collective
MIT License
306 stars 119 forks source link

šŸ”“ Ecosystem Project Idea: L2 NFT Gift Cards #34

Closed smartcontracts closed 7 months ago

smartcontracts commented 1 year ago

What is an Ecosystem Project Idea?

An Ecosystem Project Idea is an idea for a project that someone could build within the Optimism ecosystem. As opposed to an Ecosystem Concept or an Ecosystem Idea, an Ecosystem Project is generally more fleshed out and corresponds to a relatively clear product to be built.


Summary

Bridging UX today is a blocker to more people onboarding onto L2s. Weā€™ve heard this especially for NFT users, who tend to be less technical and daring with random interfaces that take their tokens. Gift cards are a great way to get someone into the L2 ecosystem.

From the Bridge Pass Mirror post:

What if we took the gift card metaphor to make collectible NFT editions that, when minted, automatically bridge funds to an L2?

Instead of bridging to L2 through a boring ā€œswapā€ UX, what if users could buy a cool looking NFT! Under the hood, the purchaser receives the collectible NFT on L1, while the funds are bridged and made available on L2.

Create a gift card NFT that contains a special note for the recipient and can be redeemed for a certain amount of ETH or OP on OP Mainnet. The gift cards could live either on L1 or on L2.

Possible Features

Impact

abarthell commented 1 year ago

I'll try working on this!

smartcontracts commented 1 year ago

@abarthell sick! Let me know if you have any questions

abarthell commented 1 year ago

@smartcontracts Am I on the right track for the NFT smart contract? (this is my first time using solidity)

Additionally, I have a few questions:

  1. What address should I be using for the bridge contract? I was looking at this: L1StandardBridge.sol
  2. Is this the correct way to call depositETHTo from this contract? I was reading about function selectors
  3. What should I set _l2Gas to when I call depositETHTo? I read that the first 1.92 million gas on L2 is free

Also, if you have another faster way I can communicate during this project, do let me know; I'll certainly have some more questions šŸ˜„ Otherwise, I can just post here too if that's preferred

jaymeh13 commented 1 year ago

We built a prototype of bridge pass on Maindrop.xyz about a year ago. We didn't see a ton of demand then but maybe we should revisit on OP at some point. image

0xV4L3NT1N3 commented 1 year ago

Caught my attention while I was scrolling this in Starbucks, here's my implementation on OP Goerli using NFTs as "bridge passes".

Try it out or ping me to send you a pass for 0.25 goETH!

Contract address

https://goerli.etherscan.io/address/0x87554f0f593982a3ca3764dca4e209d68c331d7c

Some quick thoughts on this

abarthell commented 1 year ago

@0xV4L3NT1N3 do you wanna collab on this? I'm also experimenting with account abstraction on the side

0xV4L3NT1N3 commented 1 year ago

The contract is verified, source code is open source to be built upon! What do you think account abstraction can help with ?

0xkkonrad commented 1 year ago

Project Proposal

The Squirrel Labs team would like to build Optimism Giftcards. We will provide an app and SDK for end-users to buy a gift card on mainnet that can be redeemed for oEth and OP. In other words, Alice can send a gift card to Bob, such that Alice pays for it on mainnet with ETH or USDC, and Bob can redeem the equivalent value on optimism in oEth or OP. Alice could be an individual, the Optimism Foundation, or any other party.

End users create a gift card that contains a special note for the recipient and can be redeemed for a certain amount of ETH or OP on OP Mainnet.

Here is a proposal of how this would work.

To make this work, the following parts are necessary:

Peanut Protocol Deck 1.0 (1).jpg

Gift Card Mechanism

Gift cards should be easy to send. Gift cards have a redeeming mechanism which makes them suitable in scenarios where the recipientā€™s address is not known. Currently, sending tokens, even on one chain, requires a back-and-forth between Alice and Bob, even if keystore contracts are implemented:

*Alice: I want to send you $1 on optimism Bob: How do I check my optimism address? Alice: Do you have an EOA or a SC address? Bob: I donā€™t know. I have this thing with the fox. Alice: Oh, thatā€™s an EOA then. So your address will be the same. Click the fox and copy the long thing starting 0xā€¦ Bob: OK, here it is 0x4f73235220371e3f2dde9c8afc1c310bca7889f3 Alice: OK, Iā€™ve sent you $1 in oEth. Bob: I donā€™t see it. How can I check? Alice: You have to select the Optimism network on MetaMask and then click Assets. Here is the receipt https://optimistic.etherscan.io/tx/0x6ba58320977e5ee8133d9a328e842e4bcb4fd5f5db188cb4723e3a2345d8b4d2 Bob: This is hard. I donā€™t want to bother you anymore, so I will read some tutorials on how to do this next week.

  • Bob might or might not be converted to an Optimism user **

Instead, we propose a gift card mechanism that relies on claiming tokens from a QR code or token. In other words, Alice deposits funds and sends a URL or QR that lets Bob withdraw the funds. The frontend ensures that Bob is connected to Optimism and adds Optimism if it has not been added. In effect, here is what gifting tokens this would look like this:

*Alice: I am sending you $1 in oEth to get you started on OptimismĀ https://peanut.to/claim?c=opt&v=v3&i=1401&p=5MagiC6PZq2Dwrp7 **

Bob: Ok, thanks! šŸæļø

How does it work?

So how does it work? The link is simply a user-friendly way of sending an off-chain message. All it is an array of parameters: For instance this Peanut linkĀ https://peanut.to/claim?c=3&v=v3&i=1251&p=twLDK7YWL9tOZi9AĀ is actually just a medium for the following information:

{
  "chain-id": 3,
  "version": "v3",
  "transfer-id": 1251,
  "secret": "twLDK7YWL9tOZi9A"
}

The claim function on the frontend then ensures that that this array is relayed to an RPC.

Why links?

If itā€™s just an array of data, why use links? Because links will have a frontend that will deliver the JSON to the right place. Without such a frontend, each app would have to integrate a receive and send functionality within their app. URLs are already compatible with all devices, dapps, messengers and wallets without requiring any integration. The crazy thing is: everyone with internet access can already use this cutting-edge decentralised protocol called HTTPS, without any onboarding. This means links are compatible with a web2 audience too. In such a case, the frontend can guide a crypto newbie through the onboarding process, which with account abstraction will be a few clicks.

Bridging with Axelar and Squid

Alice should be able to buy a gift card on mainnet that can be redeemed on Optimism by Bob.

To do this, funds are deposited into Peanut Protocol on mainnet and then bridged to oEth on Optimism using Axelar and Squid. That is, Alice deposits $1 in Eth to Peanut Protocol on mainnet, and sends the gift card to Bob. As soon as Bob connects his wallet and reveals his Optimism wallet address, the mainnet Peanut Protocol smart contract routes the funds to Squid for bridging. Bob can click claim and no further action is required. The release of the funds will be triggered and gas will be paid by a paymaster from a gas pool for optimism onboarding.

Keep in mind that Alice and Bob could be the same person, making this useful also for onboarding oneself, rather than others.

Additional Features in the Future

Contact

Optimism folks, if you're interested, let's chat some more! @0xkkonrad or mail konrad at peanut.to

0xkkonrad commented 1 year ago

@smartcontracts lmk whether it makes sense to do this!

dimsome commented 1 year ago

@0xkkonrad I've been experimenting with a similiar concept, how far along are you?

0xkkonrad commented 10 months ago

we're live :)