Skip to content

Latest commit

 

History

History
144 lines (94 loc) · 10.8 KB

README.md

File metadata and controls

144 lines (94 loc) · 10.8 KB

⛓️ Oh Snap!

🫰 Always falling for rugs and scams? Afraid to claim airdrops because you're unsure if the contract is safe? Oh Snap! provides context about a contract, before a transaction. The context can show if a contract is malicious or safe, or provide other insightful information. What is shown is based on notes that are linked to an address, and voted on by the community. The voting logic is a slightly simplified version on Twitter/X's voting algorithm of Community Notes and we used Vitalik's blog post for guidance. We have set the contract up in such a way so that we can easily implement the full algorithm with some offchain computing when we continue after the hackathon.

⚙️ Built using NextJS, Foundry, Metamask Snap, World ID and Filecoin/IPFS.

  • User friendly UX: Our Metamask Snap shows the most useful note/context before the user approves a transaction, to ensure the user does not interact with any malicious contracts.
  • 🧱 Sybil resistant: Using Worldcoin WorldID ensures that every person can only vote once on a note.
  • 🖥️ Tamper Proof Data: Using IPFS, we make sure to store the notes about all contracts cheaply and tamper proof. Hence, IPFS was the obvious choice for important Oh Snap data
  • ⛓️ Available on all chains: Oh Snap! is available on all EVM chains!

Diagram

dashboard 1

Screenshots

Create note Worldcoin pop-up
dashboard 1 dashboard 2
View notes Metamask Snap pop-up
dashboard 3 dashboard 4

Smart Contracts overview ⌨️

We closely analyzed Vitalik Buterin's blog post to understand the implementation of the x dot com algorithm and created a simplified version for our smart contracts. Our system has two types of participants: NoteAuthors and NoteVoters. Each author can vote on a contract only once, and each voter can vote on a note only once. The available voting options are SOMEWHAT_HELPFUL, HELPFUL, and NOT_HELPFUL.

Notes can be tagged as consideredHelpful similar to x dot com's community notes. A note needs a score of 40 or more, with over 10 votes, to be tagged as such. The score is calculated using the following formula:

((x * 80) + (y * 40)) / z

Where:

x = amount of HELPFUL votes y = amount of SOMEWHAT_HELPFUL votes z = total amount of votes

If a note's score falls below 10 after being tagged as consideredHelpful, the tag will be removed. We may adjust these values in the future, but for now, this serves as our MVP. Only consideredHelpful notes are displayed on the dashboard, and the highest voted note is shown in the MetaMask snap.

We also track each user's positive vs. negative ratio to potentially implement a voting prediction system similar to x dot com's, which would require some off-chain computation.

For chains that support World ID, it serves as an identification layer for writing and voting on notes.

The note text is stored on IPFS, with only the URI stored within the contract.

Bounties 😎

Worldcoin

Our app uses zero-knowledge proofs using World ID for identity verification for both note authors as well as note voters. We think that this tool is needed in order expect an elevated level of quality of notes and votes, since it will be attatched to your identity. The protocol would not hold much value if it was spamable and World ID is the perfect tool to prevent this.

Metamask Linea

This project was designed and built from the ground up with snaps in mind. We saw snaps being the perfect medium of communication these community notes in a easy way for users. We envisioned this project to be a helpful tool for people new to DeFi in order to mitigate the risk of interacting with, for example, phising Uniswap links. With this project being a snap, the information will be shown to the user right before the transaction is signed, and potentially saving new users their money. We created a metamask snap (in a seperate repo) and deployed to Linea testnet.

Filecoin

Since these written notes are long string, it is not an option to store them on an evm chain. We didn't want to opt into centralized hosting for this either since we wanted to build a decantralized and tamperproof system. Because of this, we took inspiration from erc721's usage of IPFS and deployed our notes, along with some more data, as JSON to IPFS, and are only storing the ipfs URI on chain as a note identification on what to retrieve for the snap. We decided early on this would be the most logical way to do it, and are very happy with this design. Check our other repo for the implementation for this

Base

Our dApp is deployed on Base testnet. Our dApp provides community provided context to contracts before approving a transaction, which can be used to warn users about malicious contracts, as well as ensuring users they are communicating with the contract they expect. We think this is a great improvement to UX, since it's not intrusive and keeps users informed and safe. It was also the perfect chain to deploy to since it supports world ID, which makes it the perfect chain to showcase the fully featured app.

Arbitrum

Deployed our project on Arbitrum testnet. We thinks this fits the DeSoc narrative mentioned in the bounty descriptions because we view this app as adding a social layer, of contract and wallet reputations, on top of the blockchain borrowing from social media concepts from x dot com.

Morph

We deployed our contracts on Morph Holesky and manually added the config for the frontend, since this is not available yet in viem and scaffold. Bridging tokens to Morph and deploying was very straightforward. Only hickup we encountered was that we had to manually add network config on the frontend.

Scroll

We deployed our contracts to scroll network. Deployment and contract verification was smooth very smooth with our tech stack which is something we truly appreciated. Really no issues with developping on scroll, which is really good!

ApeCoin

We deployed our contracts to the ApeChain. Also we added custom config for the network on the frontend, since it was not available in viem and scaffold by default.

Zerion

We deployed our contracts on Zero testnet. Also we added custom config for the network on the frontend, since it was not available in viem and scaffold by default.

Zircuit

We deployed our contracts on Zircuit and manually added the config for the frontend, since this is not available yet in viem and scaffold. Getting testnet tokens and deploying on Zircuit was very smooth. Only hickup we encountered was that we had to manually add network config on the frontend.

Blockscout

We used blockscout for some of the chains we used, so when you click on a address link or tx link in our dApp, it takes you to the blockscout page.

Links

Deployed contracts

References

Team