Introduction
Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.
I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.
I also build and publish a variety of tools, libraries, and open-source projects.
This article examines the NounsToken contract from Nouns using Bunzz's DeCipher feature.
DeCipher uses AI to generate documentation for smart contracts.
For a detailed guide to using DeCipher, see the following article.
This article is a personal exploration of DeCipher. If you find any inaccuracies, please let me know in the comments.
The DeCipher page used for this article is linked below.
The corresponding Etherscan page is available below.
Overview
The NounsToken contract is central to the Nouns DAO project. Nouns DAO is a decentralized autonomous organization (DAO) built around unique digital assets called non-fungible tokens (NFTs).
Purpose of the NounsToken contract
NounsToken is a program deployed on Ethereum. It handles the creation, ownership, and transfer of NFTs known as Nouns. Each Noun is distinguished by its unique token ID within the contract. The contract also provides a function for burning Nouns.
The contract conforms to the ERC721 standard. ERC721 defines common rules for creating and managing NFTs on Ethereum. This allows Nouns to interoperate with other contracts and platforms supporting ERC721 tokens. Examples include digital marketplaces where NFTs can be bought and sold.
Responsibilities of the NounsToken contract
1. Minting Nouns
NounsToken can create new Nouns.
Minting is controlled by the address assigned the minter role.
Only the authorized minter can invoke the public minting function.
New Nouns are therefore issued under the control of this role.
2. Ownership management
The contract tracks the owner of each Noun. When a Noun moves from one owner to another, the ownership record is updated. This keeps ownership information consistent after transfers.
3. Burning Nouns
The contract can remove a Noun from circulation. This operation is called a burn. It allows authorized removal of a Noun.
4. Locking the minter
The contract allows the minter configuration to be locked.
This prevents changes to the address authorized to mint new Nouns.
Once locked, the minter cannot be changed.
5. Configuring the descriptor and seeder
The descriptor and seeder can also be configured and locked. The descriptor generates detailed information associated with each Noun. This includes the Noun's name, description, and image. The seeder generates a seed for each Noun, which determines its visual appearance and attributes.
Together, these components provide the essential functionality for creating, managing, transferring, and burning Nouns.
Descriptor
The descriptor is a contract that generates a Noun's token URI (Uniform Resource Identifier). It receives the Noun ID and seed and generates the corresponding token URI. The token URI identifies or embeds the Noun's metadata.
Seeder The seeder is a contract that generates a Noun's seed. The seed consists of generated values that determine the Noun's traits and appearance. NounsToken uses the seeder when minting a new Noun. The seeder receives the Noun ID and descriptor and generates the seed. This introduces variation into the generation process so Nouns can have different traits.
The descriptor and seeder together control how Nouns are generated and displayed, enabling varied appearances.
Understanding NounsToken from Web3, blockchain, and dApp perspectives
Web3 perspective
Web3 encompasses decentralized applications (dApps) that use blockchain technology. The NounsToken contract provides on-chain application logic and data storage. Through Web3 interfaces, users can interact with NounsToken to carry out operations permitted by the contract, such as ownership management and authorized minting. This enables applications with transparent, decentralized state.
Blockchain perspective
NounsToken exists on Ethereum as a deployed smart contract. Ethereum is a distributed ledger that records the transactions involving NounsToken. This makes the creation, transfer, and burning of Nouns transparent and resistant to unauthorized modification.
dApp perspective
A dApp is a decentralized application with which users interact. NounsToken provides core on-chain functionality for such applications. Users can interact with NounsToken through a dApp to perform authorized operations such as minting, managing ownership, transferring, and burning Nouns. It provides core functionality for the Nouns DAO project.
Related links
Usage
The following walkthrough explains how developers interact with the NounsToken contract.
NounsToken manages minting, transfers, and burns, as well as configuration and locking of minter, descriptor, and seeder.
1. Minting
- Verify the
minteraddress and confirm that the caller is authorized to mint new Nouns. - To mint a new Noun, send a transaction invoking the relevant function.
- Once the transaction succeeds, a new Noun is created with a unique token ID.
2. Ownership management and transfer
- Use the appropriate function to check the owner of each Noun.
- To change ownership, submit an authorized transfer transaction.
- The new owner's address is then recorded.
3. Burning a Noun
- To burn a Noun, invoke the relevant function through an authorized transaction.
- Once the transaction succeeds, the Noun is removed from circulation.
4. Configuring the minter, descriptor, and seeder
- To change the
minteraddress, invoke the corresponding function through an authorized transaction. - The descriptor and seeder can likewise be changed through their configuration functions.
- These components determine how metadata and visual traits are generated.
5. Locking configuration
- To prevent changes to the minter, descriptor, or seeder, use the respective locking functions.
- Subsequent configuration changes are then prohibited.
Steps for using NounsToken
-
Set up the contract Deploy a NounsToken contract to an Ethereum network. Tools such as Truffle or Hardhat can be used for deployment.
-
Configure the Nounders DAO address Call
setNoundersDAO(address noundersDAO)with the Nounders DAO address, subject to the function's access control. This configures the Nounders DAO recipient; minting authority is configured separately. -
Configure the minter Call
setMinter(address minter)with the desired minter address. This sets the address authorized to mint Nouns. CalllockMinter()if changes to the minter should be permanently prevented. This prohibits future updates. -
Configure the descriptor Call
setDescriptor(INounsDescriptor descriptor)with the descriptor address. This sets the descriptor used to generate each Noun's token URI. CalllockDescriptor()to prevent changes to the descriptor. This prohibits future updates. -
Configure the seeder Call
setSeeder(INounsSeeder seeder)with the seeder address. This sets the seeder used to generate each Noun's seed. CalllockSeeder()to prevent changes to the seeder. This prohibits future updates. -
Mint a Noun Call
mint()from the authorized minter to issue a new Noun. The function returns the token ID of the newly minted Noun. -
Burn a Noun Call
burn(uint256 tokenId)from an authorized address, specifying the Noun ID to burn. The specified Noun is removed from circulation. -
Retrieve a Noun's data URI Call
dataURI(uint256 tokenId)with the desired Noun's token ID. The function returns the corresponding data URI.
Caution Before deploying to mainnet, test the contract and its operations on a test network to reduce the risk of errors or loss of funds.
Parameters
_noundersDAO
Address of the Nounders DAO contract.
_minter
Address authorized to mint.
_descriptor
Address of the NounsDescriptor contract.
_seeder
Address of the NounsSeeder contract.
_proxyRegistry
Address of the ProxyRegistry contract.
Contract
NounsToken
noundersDAO
noundersDAO
address public noundersDAO;Overview Contract address of the Nounders DAO.
minter
minter
address public minter;Overview Address authorized to mint Nouns.
descriptor
descriptor
INounsDescriptor public descriptor;Overview Address of the descriptor that generates Noun token URIs (metadata).
seeder
seeder
INounsSeeder public seeder;Overview Address of the seeder that generates Noun seeds.
Details This variable stores the address of the seeder responsible for generating Noun traits.
isMinterLocked
isMinterLocked
bool public isMinterLocked;Overview
Indicates whether the minter configuration is locked.
Details
This Boolean is true when the minter address is locked.
A locked minter address cannot be changed.
isDescriptorLocked
isDescriptorLocked
bool public isDescriptorLocked;Overview Indicates whether the descriptor address is locked.
Details
This Boolean is true when the descriptor address is locked.
A locked descriptor address cannot be changed.
isSeederLocked
isSeederLocked
bool public isSeederLocked;Overview Indicates whether the seeder address is locked.
Details
This Boolean is true when the seeder address is locked.
A locked seeder address cannot be changed.
seeds
seeds
mapping(uint256 => INounsSeeder.Seed) public seeds;Overview Mapping storing Noun seed information.
Details Stores the seed associated with each Noun token ID. The seed describes its generated traits and attributes.
_currentNounId
_currentNounId
uint256 private _currentNounId;Overview Current Noun ID counter.
Details This ID increases as new Nouns are minted.
_contractURIHash
_contractURIHash
string private _contractURIHash = 'QmZi1n79FqWt2tTLwCqiy6nLM6xLGRsEPQ5JmReJQKNNzX';Overview IPFS content hash of contract-level metadata.
Details Stores the IPFS content hash of metadata describing the contract as a whole. The hash identifies the detailed contract metadata.
proxyRegistry
proxyRegistry
IProxyRegistry public immutable proxyRegistry;Overview Contract address of the OpenSea Proxy Registry.
Details Stores the address of the OpenSea Proxy Registry smart contract. It was used for integration with OpenSea's NFT platform in this historical implementation.
whenMinterNotLocked
whenMinterNotLocked
modifier whenMinterNotLocked() {
require(!isMinterLocked, 'Minter is locked');
_;
}Overview Modifier checking that the minter configuration is not locked.
Details Allows function execution only while the minter is unlocked. If the minter is locked, the operation reverts.
whenDescriptorNotLocked
whenDescriptorNotLocked
modifier whenDescriptorNotLocked() {
require(!isDescriptorLocked, 'Descriptor is locked');
_;
}Overview Modifier checking that the descriptor configuration is not locked.
Details Allows function execution only while the descriptor is unlocked. If the descriptor is locked, the operation reverts.
whenSeederNotLocked
whenSeederNotLocked
modifier whenSeederNotLocked() {
require(!isSeederLocked, 'Seeder is locked');
_;
}Overview Modifier checking that the seeder configuration is not locked.
Details Allows function execution only while the seeder is unlocked. If the seeder is locked, the operation reverts.
onlyNoundersDAO
onlyNoundersDAO
modifier onlyNoundersDAO() {
require(msg.sender == noundersDAO, 'Sender is not the nounders DAO');
_;
}Overview Modifier checking that the caller is the Nounders DAO.
Details Allows execution only when the caller matches the Nounders DAO address. If the caller does not match, the operation reverts.
onlyMinter
onlyMinter
modifier onlyMinter() {
require(msg.sender == minter, 'Sender is not the minter');
_;
}Overview
Modifier checking that the caller is the minter.
Details Allows execution only when the caller matches the minter address. If the caller does not match, the operation reverts.
contractURI
contractURI
function contractURI() public view returns (string memory) {
return string(abi.encodePacked('ipfs://', _contractURIHash));
}Overview Retrieves the IPFS URI of the contract metadata.
Details Returns the contract metadata URI in IPFS URI format. The metadata provides additional information about the contract.
Return value
memory- IPFS URI of the contract metadata.
setContractURIHash
setContractURIHash
function setContractURIHash(string memory newContractURIHash) external onlyOwner {
_contractURIHash = newContractURIHash;
}Overview
Sets _contractURIHash.
Only the contract owner may call this function.
Details Sets the new IPFS content hash for contract metadata. The metadata URI is represented by its IPFS hash.
Parameters
newContractURIHash- New IPFS URI hash for the contract metadata.
Return value None.
isApprovedForAll
isApprovedForAll
function isApprovedForAll(address owner, address operator) public view override(IERC721, ERC721) returns (bool) {
if (proxyRegistry.proxies(owner) == operator) {
return true;
}
return super.isApprovedForAll(owner, operator);
}Overview Receives owner and operator addresses and checks whether the operator is the owner's registered OpenSea proxy.
Details
Returns true if the supplied operator matches the owner's registered OpenSea proxy.
Otherwise, calls the parent implementation of isApprovedForAll and returns its result.
Parameters
owner- Owner address.
operator- Operator address.
Return value
bool- Boolean indicating whether the operator is approved.
mint
mint
function mint() public override onlyMinter returns (uint256) {
if (_currentNounId <= 1820 && _currentNounId % 10 == 0) {
_mintTo(noundersDAO, _currentNounId++);
}
return _mintTo(minter, _currentNounId++);
}Overview Mints a Noun.
Details
If the current Noun ID is at most 1820 and divisible by 10, mint a Noun to the Nounders DAO.
Mint the regular Noun to the minter.
Every tenth Noun ID from 0 through 1820 is reserved for the Nounders, resulting in 183 Nounder Nouns over the approximately five-year daily auction schedule.
Return value
uint256- ID of the newly minted Noun.
burn
burn
function burn(uint256 nounId) public override onlyMinter {
_burn(nounId);
emit NounBurned(nounId);
}Overview Burns a Noun.
Details Burns the Noun identified by the specified ID. Burning removes the token from circulation, although historical on-chain records remain.
Parameters
nounId- ID of the Noun to burn.
Return value None.
tokenURI
tokenURI
function tokenURI(uint256 tokenId) public view override returns (string memory) {
require
(_exists(tokenId), 'NounsToken: URI query for nonexistent token');
return descriptor.tokenURI(tokenId, seeds[tokenId]);
}Overview Retrieves the Uniform Resource Identifier (URI) for a particular NFT.
Details Takes a token ID and returns its metadata URI. If the corresponding Noun does not exist, the operation reverts.
Parameters
tokenId- Token ID to query.
Return value
string memory- Metadata URI.
dataURI
dataURI
function dataURI(uint256 tokenId) public view override returns (string memory) {
require(_exists(tokenId), 'NounsToken: URI query for nonexistent token');
return descriptor.dataURI(tokenId, seeds[tokenId]);
}Overview Takes a token ID and returns its data URI.
Details
Similar to tokenURI, but returns a Base64-encoded data URI containing JSON directly.
If the corresponding Noun does not exist, the operation reverts.
Parameters
tokenId- Token ID to query.
Return value
string memory- Data URI.
setNoundersDAO
setNoundersDAO
function setNoundersDAO(address _noundersDAO) external override onlyNoundersDAO {
noundersDAO = _noundersDAO;
emit NoundersDAOUpdated(_noundersDAO);
}Overview Sets the Nounders DAO address. Only the current Nounders DAO may call this function.
Details
Receives a new Nounders DAO address and updates the configuration.
Emits NoundersDAOUpdated after the update.
Parameters
_noundersDAO- New Nounders DAO address.
Return value None.
setMinter
setMinter
function setMinter(address _minter) external override onlyOwner whenMinterNotLocked {
minter = _minter;
emit MinterUpdated(_minter);
}Overview
Sets the token's minter.
Only the contract owner may call this function while the minter configuration remains unlocked.
Details
Receives the new minter address and updates the configuration.
Emits MinterUpdated after the update.
Parameters
_minter- New minter address.
Return value None.
lockMinter
lockMinter
function lockMinter() external override onlyOwner whenMinterNotLocked {
isMinterLocked = true;
emit MinterLocked();
}Overview
Locks the minter configuration.
Details
Once executed, the minter is locked and cannot be changed.
Only the contract owner may call this function while the minter configuration remains unlocked.
This operation is irreversible and should be performed with care.
Emits MinterLocked after locking.
setDescriptor
setDescriptor
function setDescriptor(INounsDescriptor _descriptor) external override onlyOwner whenDescriptorNotLocked {
descriptor = _descriptor;
emit DescriptorUpdated(_descriptor);
}Overview Sets the token URI descriptor.
Details
Only the contract owner may call this function while the minter configuration remains unlocked.
Emits DescriptorUpdated after configuration.
Parameters
INounsDescriptor _descriptor- New token URI descriptor interface.
Return value None.
lockDescriptor
lockDescriptor
function lockDescriptor() external override onlyOwner whenDescriptorNotLocked {
isDescriptorLocked = true;
emit DescriptorLocked();
}Overview Locks the descriptor configuration.
Details
Once executed, the descriptor is locked and cannot be changed.
Only the contract owner may call this function while the minter configuration remains unlocked.
This operation is irreversible and should be performed with care.
Emits DescriptorLocked after locking.
Return value None.
setSeeder
setSeeder
function setSeeder(INounsSeeder _seeder) external override onlyOwner whenSeederNotLocked {
seeder = _seeder;
emit SeederUpdated(_seeder);
}Overview Sets the token seeder.
Details
Only the contract owner may call this function while the minter configuration remains unlocked.
Receives and configures the new seeder interface.
Emits SeederUpdated after configuration.
Parameters
INounsSeeder _seeder- New seeder interface.
Return value None.
lockSeeder
lockSeeder
function lockSeeder() external override onlyOwner whenSeederNotLocked {
isSeederLocked = true;
emit SeederLocked();
}Overview Locks the seeder configuration.
Details
Once executed, the seeder is locked and cannot be changed.
Only the contract owner may call this function while the minter configuration remains unlocked.
This operation is irreversible and should be performed with care.
Emits SeederLocked after locking.
Return value None.
_mintTo
_mintTo
function _mintTo(address to, uint256 nounId) internal returns (uint256) {
INounsSeeder.Seed memory seed = seeds[nounId] = seeder.generateSeed(nounId, descriptor);
_mint(owner(), to, nounId);
emit NounCreated(nounId, seed);
return nounId;
}Overview
Mints a Noun with the specified nounId to an address.
Details
Mints a Noun to the specified address.
Generates the corresponding seed and emits NounCreated.
Parameters
to- Address receiving the newly minted Noun.
nounId- ID of the Noun to mint.
Return value
uint256- ID of the newly minted Noun.
Events
ERC721Checkpointable
decimals
decimals
uint8 public constant decimals = 0;Overview Defines the number of decimal places using an ERC20-style convention.
Details
Indicates the token's decimal precision.
Although ERC20 tokens commonly support decimal precision, this implementation uses 0 decimal places for NFT voting units.
_delegates
_delegates
mapping(address => address) private _delegates;Overview Mapping recording each account's delegate.
Details Associates each account address with its delegate's address. A delegate is an account to which voting power has been assigned.
Checkpoint
詳細
struct Checkpoint {
uint32 fromBlock;
uint96 votes;
}Overview Struct representing a checkpoint of voting power at a particular block.
Details
Records changes in voting power at specific blocks.
fromBlock identifies the block number at which the checkpoint was recorded, and votes stores the voting power at that checkpoint.
checkpoints
checkpoints
mapping(address => mapping(uint32 => Checkpoint)) public checkpoints;Overview Mapping recording each account's voting checkpoints by index.
Details The account address is the outer key, and the index is the inner key identifying a checkpoint. Each checkpoint records voting power at a particular block.
Parameters
address- Account address.
uint32- Checkpoint index.
numCheckpoints
numCheckpoints
mapping(address => uint32) public numCheckpoints;Overview Mapping recording the number of voting checkpoints for each account.
Details Associates each account address with its checkpoint count. A new checkpoint increases the count when voting power changes in a new block.
Parameters
address- Account address.
DOMAIN_TYPEHASH
DOMAIN_TYPEHASH
bytes32 public constant DOMAIN_TYPEHASH =
keccak256('EIP712Domain(string name,uint256 chainId,address verifyingContract)');Overview EIP712 domain type hash.
Details EIP712 standardizes typed structured data signing. This constant is the type hash used to define the EIP712 signing domain.
DELEGATION_TYPEHASH
DELEGATION_TYPEHASH
bytes32 public constant DELEGATION_TYPEHASH =
keccak256('Delegation(address delegatee,uint256 nonce,uint256 expiry)');Overview EIP712 type hash of the delegation structure used by the contract.
Details This constant is used to construct and verify EIP712 delegation signatures. Delegation assigns an account's voting power to another account.
nonces
nonces
mapping(address => uint256) public nonces;Overview Mapping recording per-account nonces for signatures and delegation.
Details Associates each account address with its signature nonce. The nonce prevents replay of signed delegation operations.
Parameters
address- Account address.
votesToDelegate
votesToDelegate
function votesToDelegate(address delegator) public view returns (uint96)Overview Retrieves the number of votes a delegator can delegate. This corresponds to the delegator's current token balance.
Details
Retrieves the delegator's current balance and returns it as a uint96.
Parameters
delegator- Delegator address.
Return value
uint96- Number of votes the delegator can delegate.
delegates
delegates
function delegates(address delegator) public view returns (address)Overview Retrieves an account's delegate address. If no delegate is configured, returns the delegator's own address.
Parameters
- `delegator
- Delegator address.
Return value
address- Delegator address.
_beforeTokenTransfer
_beforeTokenTransfer
function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal overrideOverview Updates delegated voting power when tokens are transferred.
Details Called before a token transfer. Updates the voting power of the delegates associated with the sending and receiving addresses.
Parameters
from- Token sender address.
to- Token recipient address.
tokenId- Token ID.
Return value None.
delegate
delegate
function delegate(address delegatee) publicOverview Allows a user to delegate their voting power.
Details
Assigns the caller's voting power to the specified delegate address.
If the delegate address is 0x0, use the caller (msg.sender) as the delegate.
Parameters
delegatee- Delegate address.
Return value None.
delegateBySig
delegateBySig
function delegateBySig(
address delegatee,
uint256 nonce,
uint256 expiry,
uint8 v,
bytes32 r,
bytes32 s
) publicOverview Delegates voting power using a signature.
Details Uses a signed authorization to delegate voting power. Checks signature validity, the expected nonce, and the signature expiration.
Parameters
delegatee- Delegate address.
nonce- Signature nonce.
expiry- Signature expiration.
v- Signature recovery value.
r- ECDSA signature r value.
s- ECDSA signature s value.
Return value None.
getCurrentVotes
getCurrentVotes
function getCurrentVotes(address account) external view returns (uint96)Overview Retrieves an account's current voting power.
Details Retrieves the account's most recent voting checkpoint and returns its recorded votes.
Parameters
account- Address of the account whose voting power is queried.
Return value
uint96- Current voting power of the specified account.
getPriorVotes
getPriorVotes
function getPriorVotes(address account, uint256 blockNumber) public view returns (uint96)Overview Retrieves an account's historical voting power at a specified block number.
Details Finds the applicable historical voting checkpoint and returns its recorded votes.
Parameters
account- Address of the account whose voting power is queried.
blockNumber- Block number.
Return value
uint96- Historical voting power of the specified account at the specified block number.
_delegate
_delegate
function _delegate(address delegator, address delegatee) internalOverview Delegates a delegator's voting power.
Details Assigns the delegator's voting power to the specified delegate. Updates the voting power of the previous and new delegates.
Parameters
delegator- Delegator address.
delegatee- Delegate address.
Return value None.
_moveDelegates
_moveDelegates
function _moveDelegates(
address srcRep,
address dstRep,
uint96 amount
) internalOverview Moves voting power when the delegate changes.
Details
Transfers the corresponding voting power between delegates.
The operation occurs when the source and destination differ and the amount of voting power is greater than 0.
Parameters
srcRep- Address of the source delegate.
dstRep- Address of the destination delegate.
amount- Voting power to move.
Return value None.
_writeCheckpoint
_writeCheckpoint
function _writeCheckpoint(
address delegatee,
uint32 nCheckpoints,
uint96 oldVotes,
uint96 newVotes
) internalOverview Writes a voting checkpoint.
Details Writes a voting checkpoint for the specified delegate. Updates an existing checkpoint for the current block or creates a new checkpoint when needed.
Parameters
delegatee- Delegate address.
nCheckpoints- Number of checkpoints.
oldVotes- Previous voting power.
newVotes- Updated voting power.
Return value None.
safe32
safe32
function safe32(uint256 n, string memory errorMessage) internal pure returns (uint32)Overview
Safely converts a uint256 to a uint32.
Details
Converts the specified uint256 value to uint32.
If the value cannot be represented, reverts with the supplied error message.
Parameters
n- Value to convert.
errorMessage- Error message.
Return value
uint32- Converted value.
safe96
safe96
function safe96(uint256 n, string memory errorMessage) internal pure returns (uint96)Overview
Safely converts a uint256 to a uint96.
Details
Converts the specified uint256 value to uint96.
If the value cannot be represented, reverts with the supplied error message.
Parameters
n- Value to convert.
errorMessage- Error message.
Return value
uint96- Converted value.
add96
add96
function add96(
uint96 a,
uint96 b,
string memory errorMessage
) internal pure returns (uint96)Overview
Adds two uint96 values.
Details
Adds the two specified uint96 values.
If the sum overflows, reverts with the supplied error message.
Parameters
a- Value to add.
b- Value to add.
errorMessage- Error message.
Return value
uint96- Sum.
sub96
sub96
function sub96(
uint96 a,
uint96 b,
string memory errorMessage
) internal pure returns (uint96)Overview
Subtracts one uint96 value from another.
Details
Subtracts the specified uint96 values.
If the subtraction underflows, reverts with the supplied error message.
Parameters
a- Minuend.
b- Subtrahend.
errorMessage- Error message.
Return value
uint96- Difference.
getChainId
getChainId
function getChainId() internal view returns (uint256)Overview Retrieves the chain ID of the current chain.
Details Uses an assembly instruction to retrieve the current chain ID.
Return value
uint256- Current chain ID.
Events
Approval
Approval
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId)Overview Event emitted when a token owner approves another address to operate on a token.
Parameters
owner- Token owner address.
approved- Approved address.
tokenId- Relevant token ID.
ApprovalForAll
ApprovalForAll
event ApprovalForAll(address indexed owner, address indexed operator, bool approved)Overview Event emitted when a token owner grants or revokes an operator's approval for all tokens.
Parameters
owner- Token owner address.
operator- Operator address.
approved- Approval (
true) or revocation (false).
- Approval (
DelegateChanged
DelegateChanged
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate)Overview Event emitted when a delegate changes.
Parameters
delegator- Address changing its delegate.
fromDelegate- Previous delegate address.
toDelegate- New delegate address.
DelegateVotesChanged
DelegateVotesChanged
event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance)Overview Event emitted when a delegate's voting power changes.
Parameters
delegate- Delegate address.
previousBalance- Previous voting power.
newBalance- New voting power.
DescriptorLocked
DescriptorLocked
event DescriptorLocked()Overview Event emitted when the token URI descriptor is locked.
DescriptorUpdated
DescriptorUpdated
event DescriptorUpdated(INounsDescriptor indexed descriptor)Overview Event emitted when the token URI descriptor is updated.
Parameters
INounsDescriptor indexed descriptor- Updated descriptor.
MinterLocked
MinterLocked
event MinterLocked()Overview Event emitted when the minter is locked.
MinterUpdated
MinterUpdated
event MinterUpdated(address indexed minter)Overview
Event emitted when the minter is updated.
Parameters
minter- New
minteraddress.
- New
NounBurned
NounBurned
event NounBurned(uint256 indexed tokenId)Overview Event emitted when a token is burned.
Parameters
tokenId- ID of the burned token.
NounCreated
NounCreated
event NounCreated(uint256 indexed tokenId, INounsSeeder.Seed seed)Overview Event emitted when a new token is created.
Parameters
tokenId- ID of the newly created token.
INounsSeeder.Seed seed- Seed information used for generation.
NoundersDAOUpdated
NoundersDAOUpdated
event NoundersDAOUpdated(address indexed noundersDAO)Overview Event emitted when the Nounders DAO address is updated.
Parameters
noundersDAO- New Nounders DAO address.
OwnershipTransferred
OwnershipTransferred
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)Overview Event emitted when contract ownership is transferred.
Parameters
previousOwner- Previous owner address.
newOwner- New owner address.
SeederLocked
SeederLocked
event SeederLocked()Overview Event emitted when the seeder is locked.
SeederUpdated
SeederUpdated
event SeederUpdated(INounsSeeder indexed seeder)Overview Event emitted when the seeder is updated.
Parameters
INounsSeeder indexed seeder- New seeder address.
Transfer
Transfer
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)Overview Event emitted when token ownership is transferred.
Parameters
from- Address transferring the token.
to- Address receiving the token.
tokenId- ID of the transferred token.
Code
Base contracts
contracts/base
Interfaces
/contracts/interfaces
External contracts
/contracts/external
Conclusion
This article examined the NounsToken contract from Nouns using Bunzz's DeCipher feature. I hope it helped clarify how the contract works. I plan to continue examining specific NFTs and smart contracts.
I also publish articles on blockchain and AI on my blog and Qiita.




