Giter VIP home page Giter VIP logo

diamond-etherscan's Introduction

etherscan diamond

Diamond Etherscan
Make your EIP-2535 diamond etherscan compatible.
Generate your dummy diamond at etherscan.diamonds.dev

Motivation

EIP-2535 Diamond Standard is really cool. But etherscan (the most popular block explorer) doesn't support diamonds yet. Louper is a great tool that solves this issue, but many users have more experience with etherscan and might prefer to interact with the contract there.

And so, we are left with diamond etherscan, a workaround to support etherscan interactions with diamonds.

How it works

Diamond Etherscan has two components.

The first is a script to generate a "Dummy Implementation" of your diamond located at scripts/runGenerateDummy.ts. This uses the etherscan API to grab all of your facets' ABI and then generates a noop mock of your whole diamond. Note this will only work for verified facets.

The second is a Facet called DiamondEtherscanFacet.sol that implements EIP-1967 so you can point your diamond proxy to the dummy implementation. Because all of your diamond function signatures are implemented in the dummy, etherscan which knows about EIP-1967 will be able to appropriately display functions for interaction.

How to support etherscan in your diamond

  1. Generate your dummy implementation (via the website / cli or manually)
  2. Deploy your dummy implementation
  3. Add the EtherscanFacet to your diamond
  4. Set the proxy implementation to point to the deployed dummy
  5. Repeat any time you update the diamond

Generating your dummy implementation

We have built a few tools to make it easier to generate a dummy implementation of your diamond.

(New!) Via the Website UI:

Screen Shot 2022-11-13 at 10 52 54 PM

  1. Input your diamond address and network on the diamond etherscan website
  2. Generate your dummy diamond implementation

Via the CLI

First you will need to rename .env.example to .env and add the appropriate block explorer / infura api keys. We use [UPPERCASE_NETWORK_NAME]_EXPLORER_API_KEY.

git clone https://github.com/zdenham/diamond-etherscan.git
yarn install
yarn run generate-dummy [0xyourdiamondaddress] [yourNetwork]

The dummy contract will be written to contracts/dummy/DummyDiamondImplementation.sol

Example

Here is a live example contract deployed to rinkeby.

diamond-etherscan's People

Contributors

zdenham 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.