Skip to content

lljxx1/0xsauce

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


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)