Inspiration
Development on web3 is quite a paradigm shift from other sectors of computer science, all new functionalities are permanently added to a blockchain in the form of a smart contract, and if that contract has a bug or is not maintained it just remains there as unused infrastructure. On the other hand, navigating through the projects that are maintained and have active traffic is still challenging as one must deal with lots of non-human readable addresses to move around and understand lots of low level details about the project in order to interact with it. So development in web3 is like driving through a landscape of ghost towns and following directions in the form of 40 characters hexadecimal signals.
A lot of this complexity can be abstracted away to allow other developers to build by just focusing on the functionalities instead of in the smart contracts that provide those functionalities. To do this we would have to make lots of contracts for each protocol and a set of tools for calling them in the right format.
What it does
The protocol we built allows users to call functions without having to think about addresses or formatting, all while using a smart contract account as a vehicle for the web3 landscape. A user using this smart account can perform swaps (in this first demo) or any other number of functionalities in a seamless way. On the other hand, the main contract of our protocol is expected to receive new functionalities from the community to cover all existing protocols of interest and create new ones by combining existing functions of the protocol.
How we built it
Our protocol is built around ERC-2535 or Diamond standard, which consists in a main contract (the diamond) surrounded by proxy contracts called 'facets' which hold the logic for interacting with protocols, e.g. Uniswap. The diamond receives a call from a smart account created by one of its facets which asks to perform a function, the diamond then points to the right facet to perform the action desired by the user of the smart account. The smart account is the vehicle and the diamond is the GPS, making a lot easier the navigation process.
Challenges we ran into
The most challenging part was that of working with the diamond standard as it requires a deep understanding of how storage and delegatecalls work in EVM. Thankfully, there are lots of docs online and the creator Nick Mudge has done an excellent job explaining it and providing examples. Another significant challenge was establishing efficient communication between the smart account and the diamond, requiring the conversion of user instructions into a byte stream – a process we optimized offchain to conserve gas.
Accomplishments that we're proud of
We're particularly proud of our demo, which appears as a standard smart wallet dApp yet showcases advanced connectivity between smart accounts and the diamond. Our thorough testing suite confirms this interaction's efficacy. The SFS registry integration is another notable accomplishment, potentially unlocking additional revenue streams.
What's next for Fungi Protocol
We aim to expand the protocol by adding more facets to streamline interactions across various protocols, including lending, liquidity provision, asset bridging, and more. Concurrently, we plan to develop tools enhancing the community's ability to engage with and build upon the diamond standard. A major focus will be establishing a balance between rapid development and stringent security, necessitating a standardized pipeline for auditing and testing as we integrate an ever-growing array of facets.
Built With
- ethers
- foundry
- next
- react
- solidity
- typescript
- viem
- wagmi
Log in or sign up for Devpost to join the conversation.