Code Monkey home page Code Monkey logo

0xsauce's Introduction


0xSauce
0xSauce

A guard to the future NFT financialization. Let's get saucy with your NFTs!! ->WebSite.

Gitter

Key FeaturesIntegrationSubgraph and DuneDeploymentRoadmapLicense

Recording 2022-09-24 at 15 29 48

Key Features

With the emergence of more and more decentralized NFT financialization protocols such as NFT AMM, NFT loan, or NFT fractionalization, there is a solid need to source the NFT before a user can trade or perform other financialization tasks. Otherwise, blacklisted NFT will flow into the permissionless decentralized protocols and cause unfair trading for the user. To address the issue above, 0xsauce will provides three services:

  1. An on-chain NFT source oracle that saves blacklisted NFT item ID with its collection address.
  2. A website( 0xsauce.xyz) that can allow users to check if a specific NFT item is tagged as suspicious.
  3. A EPNS message notifier that updates the newest blacklisted NFT item information to address who enables the notification setting.

Note To learn more about 0xSauce, see this Medium Guide

Integration

Smart Contract

pragma solidity ^0.8.0;

pragma experimental ABIEncoderV2;

interface IProofRegistry {
    function verify(address collection, uint256 tokenId, uint256 isBlock, bytes32[] calldata merkleProof) external view returns (bool);
}

contract SwapGuard {

    struct SwapItem {
        address collection;
        uint256 tokenId;
        uint256 isBlock;
        bytes32[] merkleProof;
    }

    IProofRegistry public proofRegistry;

    constructor(address proofRegistry_) public {
        proofRegistry = IProofRegistry(proofRegistry_);
    }

    function swap(SwapItem[] memory items) public {
        uint256 numSwaps = items.length;
        for (uint256 i; i < numSwaps; ) {
            bool isBlockd = proofRegistry.verify(
                items[i].collection,
                items[i].tokenId,
                items[i].isBlock,
                items[i].merkleProof
            );
            require(!isBlockd, "token blocked");
            // keep swap
        }
    }
}

Retrieve Proof

From API

async function fetchProof(collection, tokenId) {
    const req = await fetch(`https://api.0xsauce.xyz/api/getProof?collection=${collection}&tokenId=${tokenId}`);
    const res = await req.json();
    return res.results ? res.results[0] : null
};

const proof = await fetchProof('0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d', 1);
console.log('proof', proof)

From IPFS

const prooRegistry = new ethers.Contract(registryAddr, RegistryABI, provider);
const proof = await prooRegistry.getProof(collection);
console.log('ipfs proof', proof.url)

Swap

const swapWithGuard = new ethers.Contract(SwapGuardAddr, SwapGuardABI, provider);

const tokenId = 1;
const collection = = "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d";

// retrieve proof
const proof = await fetchProof(collection, tokenId);

// take with proof
await swapWithGuard.swap(
    [
        {
            collection,
            tokenId,
            proof.isBlock,
            proof.merkleProof
        }
    ]
)

Subgraph And Dune Analysis

[Subgraph] : https://thegraph.com/hosted-service/subgraph/lljxx1/0xsauce-dev

[stolen tokens] as caller in blacklist : https://dune.com/queries/1252677

[stolen token] as receiver in blacklist : https://dune.com/queries/1252680

Deployment

  • Rinkeby: 0xBcD3e73d06E1F2B546cca0BA0686c466Ac396192
  • Polygon: 0xBcD3e73d06E1F2B546cca0BA0686c466Ac396192
  • Optimistic: 0xBcD3e73d06E1F2B546cca0BA0686c466Ac396192
  • Mainnet: 0x3a5B93f8A8Fd444705F091fAb90EE45f5eEA5963

Roadmap

Data Source

  • Opensea Snapshot
  • Onchain-monitor with phishing address (Provide by ScamSniffer, SlowMist)
  • EPNS Notification
  • Cross-validation on multiple data sources

Smart Contract

  • Proof Registry
  • Example: onchain-verify && swap

Backend

  • Proof Generate / Query
  • Offchain-report: upload IPFS / update proof registry

Oracle Status

  • subgraph index proof-change
  • dune-analysis

Frontend

  • visualize collections
  • visualize oracle status
  • query onchain Proof
  • swap example

License

MIT

fun0.eth  ·  tztztz.eth  ·  GitHub @lljxx1  ·  GitHub @yrao3  · 

(back to top)

0xsauce's People

Contributors

lljxx1 avatar yrao3 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.