This package contains the smart contracts for the NOMO Nouns protocol.
yarn
Copy .env.example
to .env
and fill in fields
# Compile Solidity
yarn build
# Deploy (Testnet/Mainnet)
yarn deploy --network [network]
The project includes scripts for deploying smart contracts to various networks. These scripts are located in the tasks
folder.
-
Set up environment variables:
Create a
.env
file in this directory with the necessary private keys and API keys:PRIVATE_KEY=your_private_key ETHERSCAN_API_KEY=your_etherscan_api_key OPTIMISM_API_KEY=your_optimism_api_key
-
Configure network settings:
Update the network configuration in
hardhat.config.js
if needed.
The contracts must be deployed in a specific order, as later contracts depend on the addresses of previously deployed contracts. Follow this sequence:
-
Deploy NFT Descriptor Library:
npx hardhat deploy-nft-descriptor --network optimismSepolia
Save the deployed address for use in the next step.
-
Deploy Seeder Contract:
npx hardhat deploy-seeder --network optimismSepolia
Save the deployed address for use in later steps.
-
Deploy Token Contract:
npx hardhat deploy-token --network optimismSepolia --seeder SEEDER_ADDRESS --descriptor DESCRIPTOR_ADDRESS --treasury TREASURY_ADDRESS --minter MINTER_ADDRESS
Replace the placeholder addresses with your actual addresses:
SEEDER_ADDRESS
: The address of the seeder contract deployed in step 2DESCRIPTOR_ADDRESS
: This will be set later, use a temporary address for nowTREASURY_ADDRESS
: The address that will receive funds from auctionsMINTER_ADDRESS
: The address authorized to mint tokens
Save the deployed token address for use in later steps.
-
Deploy Descriptor Contract:
npx hardhat deploy-descriptor --network optimismSepolia --art ART_ADDRESS --renderer RENDERER_ADDRESS --nomoToken TOKEN_ADDRESS --nftdescriptor NFT_DESCRIPTOR_ADDRESS
Replace the placeholder addresses with your actual addresses:
ART_ADDRESS
: The address of the art contractRENDERER_ADDRESS
: The address of the renderer contractTOKEN_ADDRESS
: The address of the token contract deployed in step 3NFT_DESCRIPTOR_ADDRESS
: The address of the NFT descriptor library deployed in step 1
-
Update Token Contract with Descriptor:
After deploying the descriptor, you need to update the token contract to use it:
# Call the setDescriptor function on the token contract npx hardhat run scripts/set-descriptor.js --network optimismSepolia
Make sure to update the script with the correct token and descriptor addresses.
-
Deploy Auction House (if needed):
npx hardhat deploy-mock-auction --network optimismSepolia
After deployment, verify your contracts on the block explorer:
# Verify NFT Descriptor
npx hardhat verify --network optimismSepolia NFT_DESCRIPTOR_ADDRESS
# Verify Seeder
npx hardhat verify --network optimismSepolia SEEDER_ADDRESS
# Verify Token
npx hardhat verify --network optimismSepolia TOKEN_ADDRESS SEEDER_ADDRESS DESCRIPTOR_ADDRESS TREASURY_ADDRESS MINTER_ADDRESS
# Verify Descriptor (this requires libraries)
npx hardhat verify --network optimismSepolia --libraries NomoNFTDescriptor:NFT_DESCRIPTOR_ADDRESS DESCRIPTOR_ADDRESS ART_ADDRESS RENDERER_ADDRESS TOKEN_ADDRESS
To sign messages for minting tokens:
npx hardhat sign-mint --network optimismSepolia --verifyingContract TOKEN_ADDRESS --nounId NOUN_ID --blockNumber BLOCK_NUMBER --signerPrivateKey PRIVATE_KEY
Replace the placeholders with your actual values:
TOKEN_ADDRESS
: The address of your deployed token contractNOUN_ID
: The ID of the Noun who originated the current NomoBLOCK_NUMBER
: The block number used for the Nomo seedPRIVATE_KEY
: The private key of the authorized signer
After deploying the contracts, you need to:
- Update the contract addresses in the SDK configuration (see contract-sdks README)
- Update the ABIs in the SDK if they've changed
- Build and publish the updated SDK
- Update the functions project to use the new SDK
You can interact with deployed contracts using Hardhat tasks:
# Example: Mint a token on Optimism Sepolia
npx hardhat mint --network optimismSepolia --to 0xYourAddress
For more detailed information on available tasks, run:
npx hardhat --help