Giter VIP home page Giter VIP logo

diamond-foundry's Introduction

Diamond Proxy Template for Foundry

All Contributors

Description

This is a reference implementation for EIP-2535 Diamonds by Nick Mudge translated for use in foundry . To learn about other implementations go here: https://github.com/mudgen/diamond

Note: The loupe functions in DiamondLoupeFacet.sol MUST be added to a diamond and are required by the EIP-2535 Diamonds standard.

Note: In this implementation the loupe functions are NOT gas optimized. The facets, facetFunctionSelectors, facetAddresses loupe functions are not meant to be called on-chain and may use too much gas or run out of gas when called in on-chain transactions. In this implementation these functions should be called by off-chain software like websites and Javascript libraries etc., where gas costs do not matter.

Dependencies

Installation Instructions

  • clone the repo
       $ git clone https://www.github.com/ArcStreetCapital/Diamond-Foundry.git
  • install all of the dependencies via
       $ forge install

Testing

To run all of the tests use the command

   $ forge test --ffi --match-path test/DiamondTests.t.sol

Deployment

To deploy diamond with standard facets, create .env, start anvil and use command

   $ forge script script/deployDiamond.s.sol:DeployScript --fork-url http://localhost:8545 --broadcast --ffi

Or deploy to testnet, for example

   $ forge script script/deployDiamond.s.sol:DeployScript --rpc-url $GOERLI_RPC_URL --broadcast --verify -vvvv --ffi

Contributing

Feel free to create issues and contribute by cloning the repo and adding your changes to your own branch.

Authors

Contributors

J.D. Bertron
J.D. Bertron

💻

diamond-foundry's People

Contributors

rsundar avatar allcontributors[bot] avatar jdbertron avatar teamo0 avatar

Stargazers

Michał avatar  avatar shaneson.eth avatar Felipe Novaes F Rocha avatar Alex Babits avatar Lucas Oliveira avatar lordofshadow avatar  avatar dingo avatar Biliqis Onikoyi avatar Caleb avatar  avatar  avatar Dreski avatar CryptoADam avatar Koray Koska avatar Asante Ntiro avatar  avatar Michael Demarais avatar Etch avatar Giuseppe Rodriguez avatar Onile-ere Victor avatar Noy avatar Steve Tomi avatar Macrombi Lux avatar  avatar  avatar Daniel Zarifpour avatar William X avatar sivaolee avatar Pavel Ivanov avatar  avatar Ujang avatar  avatar Saurabh avatar Rodrigo Gaona avatar Scott Sunarto avatar highskore avatar Panagiotis Ganelis avatar  avatar Joe Jordan avatar Marwan Hilmi avatar Oluwatosin Serah avatar Nicolás Bevilacqua avatar izayl avatar webstar avatar Sandalots avatar Haythem Sellami avatar  avatar slot1024 avatar Georgios Konstantopoulos avatar John McClure (pickleback) avatar Ahmed Ihsan Tawfeeq avatar Alan Höng avatar code46ash avatar Security.eth avatar EGOD avatar Vadim Urlin avatar DadlessNsad avatar Neokry avatar Stephen Caudill avatar Kevin Park avatar Async avatar sarhaan avatar Ankur Dubey avatar Keshav Mundhra avatar 0xhatsume avatar  avatar Shun Kakinoki avatar Febby avatar longcpp avatar Hyunmin Lee avatar sudo rm -rf --no-preserve-root / avatar Ahmed Ali avatar nowonder avatar Zero Ekkusu avatar  avatar

Watchers

 avatar  avatar

diamond-foundry's Issues

generateSelectors fails to generate one of the results from forge inspect facet methods

I'm testing my ERC-2535 Diamond with forge.
The deployment works fine, I can call functions in several facets from within my tests.
But for some reason, one of the functions in one of the facets isn't found by the diamond.
I looked at how the selectors are being added during facet deployment, and it looks like the code for generateSelectors issues a forge inspect facet methods and then works on the list.
When I console out the values after generateSelectors, one of my facet selectors is missing. (7eeb5bdf)
When I issue the forge inspect command from the command line, it's the first one in the list that ends up missing.

{
  "getActiveChain(address)": "7eeb5bdf",
  "getActivePuzzle(address)": "3fed202d",
  "getPuzzle(uint256)": "1f2d8b46",
  "hasActivePuzzle(address)": "df1f4175",
  "puzzleKey(bytes,bytes,uint256)": "1652896a",
  "sweepFunds()": "a8d6fe04",
  "version()": "54fd4d50"
}

Turning on RUST_LOG=forge causes generateSelectors to fail

The invocation of forge inspect methods inherits the RUST_LOG=forge environment , which causes the parsing to fail.
This means the RUST_LOG=forge debugging can't be used with this diamond.
I tried passing cmd[0] = "RUST_LOG=" to see if it would null out the setting for that invocation, but it didn't work.

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.