Diamond Cut

Diamond Cut


The diamond cut action is an advanced action. It is only relevant for members who have thorough knowledge of smart contract programming and diamonds (ERC-2535). It is not possible to create a proposal with a diamond cut action using the DAO webapp.

What is a diamond cut?

A diamond cut is a way of changing the functionality of the DAO. It can be used to add, replace or remove functionality from the DAO. For example, you could create a diamond cut to change the current ERC-20 (opens in a new tab) based voting to ERC-721 (opens in a new tab) (NFTs). For this to work you would have to write an ERC-721 governance structure facet smart contract.

As this action can have huge consequences if not considered carefully, this action can only be created using smart contract calls. This serves as a first test to see if you know enough about smart contracts to create a good diamond cut. Helper functions to create a proposal with a diamond cut action are provided in the Diamond Governance repository (opens in a new tab). Follow the guide below to add your own diamond cut proposal to the DAO.

Note that, although creating a propsal with a diamond cut action is not supported in the webapp, viewing a proposal with a diamond cut action is supported. This means that you can create a proposal with a diamond cut action using the steps below and then view it in the webapp like any other action. This means voters will know what action is attached to the proposal. It is the responsibility of the creator of the diamond cut action to provide adequate context and explanation to the proposal metadata, such that members can make an informed decision for their vote.

Diamond cut proposal guide

Clone the Diamond Governance repository

Start by cloning the Diamond Governance repository (opens in a new tab) from GitHub. This repository contains helpful functions for creating a proposal with a diamond cut action.

Build the Diamond Governance project

Follow the instructions provided in the readme's setup section (opens in a new tab) to build the project. This will generate a dist folder containing the compiled smart contracts.

Create the .env file

Make a copy of the .env.sample file and rename it to .env. Fill in the required properties, which typically include your private key for the desired network.

Configure the proposal generator script

Open the scripts/GenerateDiamondCutProposal.ts file and provide the necessary settings such as the diamond address, cut, and proposal metadata.

Run the proposal generator script

Execute the proposal generator script by running the following command:

npx hardhat run ./scripts/GenerateDiamondCutProposal.ts --network {your desired network name}

You're all set!

Congratulations! You should now be able to view the proposal you created in the webapp (opens in a new tab) and see a diamond cut action attached to it.