Graeme

Posted on Aug 24, 2021Read on Mirror.xyz

NounsDAO

NounsDAO is an NFT project that combines pseudorandom image generation with auctioning, community governance, and a novel rendering technique. Each NFT is called a Noun, and one Noun is minted every day, indefinitely.

All Nouns are auctioned, and sales revenue goes into a treasury. NounsDAO has adapted governance protocols from DeFi to allow owners of Nouns to create and vote on proposals over treasury funds and protocol upgrades.

At time of writing, there is 2,074.0122 ETH (~$6.88m) in the treasury, and the project has been running for 15 days. The first treasury proposal is to donate 30 ETH (~$100k) to various charities.

There are four mechanisms worth highlighting in the NounsDAO protocol, each of which contains some innovation: auctioning, trait generation, rendering, and governance.

Examples of three nouns, rendered in SVG - each Noun has a unique background, body, head, and accessory.

Auctioning a Noun

The lifecycle of a Noun begins with the creation of an auction; the auction house mints the Noun. This auction house is a simplified version of Zora/Mirror's that only accepts bids in ETH.

Only one auction is run at a time, and each runs for a minimum of one day. When an auction is closed, a new one is immediately created. This means that there is always exactly one Noun on auction at any time.

Each auction has a reserve price, but it is currently set to a negligible 1 wei. New bids must increment the current bid by at least 2%, otherwise they revert. Nouns are typically being sold for between 100 and 150 ETH (~between $300k and $500k).

If a bid is made within the last 5 minutes, the auction is extended by 5 minutes. When the auction is over, the noun is transferred from the auction contract to the highest bidder.

Noun Generation

A Noun is composed of 5 traits: background, body, accessory, head, glasses.

When a Noun is created, the protocol generates a random integer to represent each of these traits, distinguishing it from other Nouns. The theoretical maximum value of each trait is 2^48 - 1, but in practice it is limited by the number of images that have been uploaded to the protocol for that trait.

Every Noun has a unique ID that can be used to view its traits. Traits are stored on the core contract called NounsToken, which also holds user balances. The actual image rendering of these traits is decoupled, and lives on a contract called the descriptor. This contract can be swapped out through a governance proposal (unless governance has chosen to make this locked).

The traits for each Noun is publicly viewable on the core NounsToken contract.

Rendering a Noun

This is where NounsDAO is technically very interesting.

The integer generated for each trait is a reference to an image stored in another contract called NounsDescriptor. Images are stored as string of bytes in a lossless data compression format called RLE, which are ultimately renderable by the contract as SVG!

When the UI calls the tokenURI method, the contract returns the SVG derived from these compressed RLE data. This is innovative and worth considering for any new blockchain art project.

The tokenURI method returns all data required to render a high-fidelity image, without needing to reference anything off-chain.

Because Noun rendering is decoupled from the core Noun contract itself, this functionality can be improved and swapped if a new compression or rendering technique is proposed.

Governance

NounsDAO is community-governed through a modification of Compound's Governor Bravo contract. It is primarily modified to use ERC721 balances instead of ERC20 balances for voting.

The first governance proposal has been to "Donate 5 ETH each to 6 Charities", which looks like it will pass with unanimous consent.

There are two other subtle technical differences NounsDAO made to Governor Bravo:

  • During token transfer, delegation is moved via a hook, rather than in the transfer method itself.
  • The function that returns an account’s delegates will return the account itself if that account hasn't delegated. This is probably an improvement.

Technical Evaluation

The NounDAO code is cleanly written, using well-known open-source libraries and modern Solidity. Methods are expressed simply, but also contain a few well-executed innovations.

Upgradability is achieved through decoupling functionality into separate contracts and making the pointers to those contracts governable, rather than through proxy-delegation methods. This keeps things simple while still allowing peripheral parts of the architecture - like Noun rendering - to be updated.

The rendering method itself is very innovative and worth understanding. NounsDAO has figured out a way to render somewhat sophisticated images entirely on-chain via SVGs, which improves on most other NFT projects including CryptoPunks.

I've read every line of code in this project, and did not find any bugs. This doesn't mean there aren't any, and it might still be worthwhile to have a formal audit. Overall, I was impressed by the smart contracts created by this DAO, and by the innovation of the product as a whole.