Request form
Cookbook may introduce a token in the future. Share and contribute to be eligible for future airdrops.
close icon
relevant tag icon
Nouns Art Storage Contract
copy icon
Nouns-DAO
• version 1.0.0
Utility
ERC721

Nouns Art Storage Contract

Nouns contract which allows specific metadata to be stored on-chain

*Visit desktop site to download or deploy

Version

1.0.0

Creator

Nouns-DAO

Recent Use

🍞 0x68AB downloaded

Last Publish

10/17/2022
Any contract you deploy is yours.
Fully owned and controlled by your wallet.
Documentation
Source Code
setDescriptor(address) :
This function sets a new descriptor address for the contract. It takes an address as an argument and sets it as the new descriptor address. It also emits an event, DescriptorUpdated, which contains the old descriptor address and the new descriptor address. This function can only be called by the descriptor address. (autogenerated documentation)
setInflator() :
This function sets the Inflator contract for the current contract. It takes an IInflator contract as an argument and stores it in the inflator variable. It then emits an InflatorUpdated event, passing in the old Inflator address and the new Inflator address. (autogenerated documentation)
getBodiesTrait() :
This function is an external view function that returns the memory variable "bodiesTrait". This variable is used to store information about the bodies trait of a particular contract. This function allows external users to view the stored information about the bodies trait of the contract. (autogenerated documentation)
getAccessoriesTrait() :
This function is an external view override that returns the accessoriesTrait memory variable. It is used to retrieve the accessoriesTrait from the smart contract, which contains information about the accessories associated with a particular product. (autogenerated documentation)
getHeadsTrait() :
This function is an external view override that returns the memory variable "headsTrait". This variable is used to store the trait of the head of the family, which is used to determine the family's eligibility for certain benefits. The function works by retrieving the value stored in the "headsTrait" memory variable and returning it to the caller. (autogenerated documentation)
getGlassesTrait() :
This function is an external view override that returns the glassesTrait memory variable. It is used to retrieve the glassesTrait value from the smart contract, allowing external users to access the data stored in the contract. (autogenerated documentation)
addManyBackgrounds() :
This function adds multiple backgrounds to a contract. It takes an array of strings as an argument and loops through the array, calling the _addBackground function for each string in the array. Finally, it emits an event to indicate that the backgrounds have been added. (autogenerated documentation)
addBackground(string) :
This function adds a background to the contract. It takes a string as an argument, which is the background to be added. The function then calls the _addBackground() internal function to add the background to the contract. Finally, it emits an event called BackgroundsAdded with a value of 1. (autogenerated documentation)
setPalette(uint8) :
This function sets a palette at a given index in the palettesPointers array. It takes in a paletteIndex and a calldata palette as parameters. It first checks to make sure that the palette is not empty, and that the length of the palette is divisible by 3 and is not greater than 768. If these conditions are met, it stores the palette in the SSTORE2 storage and emits a PaletteSet event with the paletteIndex. (autogenerated documentation)
addBodies(uint80,uint16) :
This function adds a set of bodies to the contract. It takes in three parameters: an encoded and compressed byte array, a decompressed length, and an image count. It then calls the addPage function with the bodiesTrait, the encodedCompressed byte array, the decompressed length, and the image count. Finally, it emits an event to indicate that the bodies have been added. (autogenerated documentation)
addAccessories(uint80,uint16) :
This function adds accessories to a product descriptor. It takes in three parameters: a bytes calldata encodedCompressed, a uint80 decompressedLength, and a uint16 imageCount. It then calls the addPage function with the accessoriesTrait, encodedCompressed, decompressedLength, and imageCount parameters. Finally, it emits an AccessoriesAdded event with the imageCount parameter. (autogenerated documentation)
addHeads(uint80,uint16) :
This function adds a set of heads to the contract. It takes in three parameters: a bytes calldata encodedCompressed, a uint80 decompressedLength, and a uint16 imageCount. The function then calls the addPage function with the headsTrait, encodedCompressed, decompressedLength, and imageCount parameters. Finally, it emits a HeadsAdded event with the imageCount parameter. (autogenerated documentation)
addGlasses(uint80,uint16) :
This function adds a new set of glasses to the contract. It takes in three parameters: a byte array containing the compressed image data, the decompressed length of the image, and the number of images in the set. It then calls the addPage function to add the glasses to the contract, and emits an event to signal that the glasses have been added. (autogenerated documentation)
setPalettePointer(uint8,address) :
This function sets the pointer for a given palette index in the palettesPointers array. It takes two parameters, a uint8 paletteIndex and an address pointer. The function is marked as external, meaning it can be called from outside the contract, and override onlyDescriptor, meaning it can only be called by the contract's descriptor. When the function is called, the pointer for the given paletteIndex is set to the given address pointer. Finally, an event is emitted to signal that the palette has been set. (autogenerated documentation)
addBodiesFromPointer(address,uint80,uint16) :
This function adds a page of bodies to the descriptor contract. It takes an address pointer, a decompressed length, and an image count as parameters. The function then calls the addPage() function, passing in the bodiesTrait, the pointer, the decompressed length, and the image count. Finally, the function emits an event to indicate that the bodies have been added. (autogenerated documentation)
addAccessoriesFromPointer(address,uint80,uint16) :
This function adds accessories to a product descriptor on the blockchain. It takes in an address pointer, a decompressed length, and an image count as parameters. The function then calls the addPage() function to add the accessories to the product descriptor. Finally, it emits an AccessoriesAdded event to indicate that the accessories have been added. (autogenerated documentation)
addHeadsFromPointer(address,uint80,uint16) :
This function adds a page of heads to the descriptor contract. It takes in an address pointer, a decompressed length, and an image count as parameters. The function then calls the addPage() function to add the page of heads to the descriptor contract. Finally, it emits an event to signal that the heads have been added. (autogenerated documentation)
addGlassesFromPointer(address,uint80,uint16) :
This function adds a new set of glasses to the glassesTrait. It takes in three parameters: an address pointer, a decompressed length, and an image count. The address pointer is used to locate the glasses data, the decompressed length is used to determine the size of the data, and the image count is used to determine the number of images associated with the glasses. The function then calls the addPage function to add the glasses data to the glassesTrait. Finally, it emits an event to notify that the glasses have been added. (autogenerated documentation)
backgroundsCount() :
This function returns the number of backgrounds stored in the contract. It works by looping through the backgrounds array and counting the number of elements in the array. (autogenerated documentation)
heads(uint256) :
This function is used to retrieve the bytes memory of an image from the headsTrait array. It takes in an index as an argument and returns the bytes memory of the image at that index in the array. (autogenerated documentation)
bodies(uint256) :
This function is used to retrieve the body of a given image from the bodiesTrait array. It takes an index as an argument and returns the body of the image at that index as a byte array. The function is marked as public and view, meaning that it can be called by any external account and does not modify the state of the contract. (autogenerated documentation)
accessories(uint256) :
This function is used to retrieve an image from the accessoriesTrait array based on the index provided. It returns the image as a byte array. The function is declared as public and view, meaning that it can be called by anyone and does not modify the state of the blockchain. (autogenerated documentation)
glasses(uint256) :
This function is used to retrieve a byte array representing an image from a glassesTrait array. The function takes an index as an argument and returns the corresponding image from the array. (autogenerated documentation)
palettes(uint8) :
This function retrieves the palette data associated with a given palette index. It first checks if the palette index is valid by checking if the corresponding pointer in the palettesPointers array is not equal to 0. If it is valid, it returns the palette data stored at the address pointed to by the pointer. (autogenerated documentation)
_addBackground(string) :
This function adds a background to the backgrounds array. It takes a string as an argument and pushes it to the backgrounds array. (autogenerated documentation)
addPage(uint80,uint16) :
This function adds a page to the storage trait. It takes four parameters: a storage trait, an encoded and compressed byte array, a decompressed length, and an image count. It first checks to make sure that the encoded and compressed byte array is not empty, then it writes the byte array to the storage trait using the SSTORE2.write() function. Finally, it calls the addPage() function with the trait, pointer, decompressed length, and image count as parameters. This adds the page to the storage trait. (autogenerated documentation)
addPage(address,uint80,uint16) :
This function adds a new page to a storage trait. It takes four parameters: a storage trait, an address pointer, a decompressed length, and an image count. It checks that the decompressed length and image count are not zero, and then adds a new NounArtStoragePage to the storagePages array of the storage trait, with the given parameters. It also increments the storedImagesCount of the storage trait by the given image count. (autogenerated documentation)
imageByIndex(uint256) :
This function retrieves an image from a storage page based on its index. It first uses the getPage() function to retrieve the storage page and the index of the image within the page. It then uses the decompressAndDecode() function to decompress and decode the page, and finally returns the image at the specified index. (autogenerated documentation)
getPage(uint256) :
This function is used to retrieve a specific page from an array of storage pages. It takes an index as an argument and returns the page and the index of the image within the page. It iterates through the array of storage pages and keeps track of the index of the first image in each page. When the index passed in is less than the index of the first image in the current page, it returns the page and the index of the image within the page. If the index is not found, it reverts. (autogenerated documentation)
decompressAndDecode() :
This function is used to decompress and decode data stored in a NounsArt.NounArtStoragePage storage page. It first reads the compressed data from the storage page using the SSTORE2.read() function, then uses the inflator.puff() function to decompress the data, and finally uses the abi.decode() function to decode the decompressed data into an array of bytes. (autogenerated documentation)

Get Cookin'
share iconShare

copy iconDownload Source
copy iconnpx cookbookdev i nouns-art-storage
copy icon

Recent Use

🍞 0x68AB downloaded

Last Publish

10/17/2022

Version

1.0.0

Creator

Nouns-DAO

Cookbook is free.
Any contract you deploy is yours.
Your contract is owned and controlled by you.