# on my loot-based erc-721 collection for filmmaker dao

By [bt3gl's symposium](https://paragraph.com/@go-outside) · 2023-06-12

---

tl; dr
------

today i go over the [smart contract](https://etherscan.io/address/0x9213256fe89fa0428e8546910a8d78180dbbdc38) i created two years ago for a [nft collection](https://opensea.io/collection/storyteller-card) celebrating the sunset of **filmmaker dao**.

it was called the **“storytelling card”**, and folks were able to generate their unique nfts _on the fly_ by inputting an `int` up to 1337:

![.the collection is still alive at generativestory.com.](https://storage.googleapis.com/papyrus_images/ba8224c7ef01546a7b599f63bd78e99b2d35f7e8a1964bdc3cfeeca7f22631b0.png)

.the collection is still alive at generativestory.com.

my contract was loosely based on the [loot project](https://www.lootproject.com/), and it deployed a (sort of) generative erc-721 collection in the ethereum mainnet (for the cost of ~$2k or so). [here is the source code](https://github.com/autistic-symposium/loot-storyteller-nft-collection-sol).

![.377 peeps hold my nft; that was pretty cool.](https://storage.googleapis.com/papyrus_images/696d42b05183508b07800b96c1414e1ebf1b39d3a96efb63d0b52880eb426853.png)

.377 peeps hold my nft; that was pretty cool.

it was a fun project 😊…

* * *

🎶 today’s mood
---------------

[https://open.spotify.com/track/5NFZLpFoP4fVWjmc007A5k?si=cc2f1c312fcb4a32](https://open.spotify.com/track/5NFZLpFoP4fVWjmc007A5k?si=cc2f1c312fcb4a32)

* * *

can you guess how these nfts were generated on-chain?
-----------------------------------------------------

the idea of this collection was to create unique, randomized, and limitless narratives generated and stored on-chain, as a novel approach to storytelling.

here are some of my favorites:

![](https://storage.googleapis.com/papyrus_images/778f6c4c95db183cade0bb20eac6b1d6771c9c6f36ffd160bfa0c69496b056db.png)

![](https://storage.googleapis.com/papyrus_images/728035c2a00f367fb71eb1e6d16a3f5470e21eb1327b8864c86706e01aff1895.png)

![](https://storage.googleapis.com/papyrus_images/d34e47f7a96d35fb3f8e7d9db95af20d6fdc6b5d69f464b06dbedcc1e44b0885.png)

![](https://storage.googleapis.com/papyrus_images/b2c957a4487b199f3a679975352f02f027dc9716fc936352cfa4bbaabbbccdb0.png)

![](https://storage.googleapis.com/papyrus_images/a85ace1c5ae6c0b529dc6605d8c29f50205ead1e6c31344a2f194a78a742fc25.png)

![](https://storage.googleapis.com/papyrus_images/3b6f6e1985f75ac6bcc2b2df06ce34eb3908e5eb6342f542f8df467fe3e725f9.png)

![](https://storage.googleapis.com/papyrus_images/5ba3c84cfd3e51d2fbbd3180904857f358d71391eb212b86be49602d8ef38e2d.png)

![](https://storage.googleapis.com/papyrus_images/fcad7f249e9a97b4eabac1399eaa36db164abe1ab92392fc4999bee156ae9220.png)

![](https://storage.googleapis.com/papyrus_images/533796e84eac47e7e72b030a2bd7dece92f5d71bced47ddd2cdae74042283c92.png)

do you see the pattern?

if you are an engineer, could you guess how these cards were (pseudo-)randomly generated?

the smart contract
------------------

long story short, the dao was about to dissolve because our investor backed off. so this project was my farewell token for the community.

for this reason, i wanted the contract to be immutable and self-contained. there was no reason to deploy it on a proxy, because it wasn’t supposed to be upgraded. and… there was no payable function.

yeap, you read it right: the contract was not for profit. part of the narrative was that it was never meant to be cashed out (sort of an **easter egg** - but also the sort of thing you only do once in life and during a bull market…).

![.mev burning.](https://storage.googleapis.com/papyrus_images/1f11d6fb3ba3379778e605c2f5eaf70e2b6954ff1065d86758a2e0d70cb74594.png)

.mev burning.

i also remember that the contract size limit hit hard during my first attempt to deploy it to the ethereum mainnet (or when i was testing it on rinkeby). i had to move things around to fit the size limit of **24577 bytes.** i customized (and consequently, prettified) every canonical library before everything was imported.

![.note to self: stop slacking with the commit messages.](https://storage.googleapis.com/papyrus_images/3401ebdf950244cd23d591f01717d62e0c00fc6edd3d48f29c34779b2f94b648.png)

.note to self: stop slacking with the commit messages.

and, off-course, i needed a nice intro =p:

![](https://storage.googleapis.com/papyrus_images/428b642fd00e5ed9898efc7b0fc0291e6b26265fd2d9cfa0b90ce506f243a481.png)

now, the contract was a pretty straightforward erc-721 instance, with the sale price intentionally hard-coded:

![](https://storage.googleapis.com/papyrus_images/587ab3a9cdd96589105e205658f861e142fe750f35d7b74d88b93d46e02acea9.png)

the magick trick was carried out by ten arrays that would mesh together, creating the narratives: genres, medium, cities, archetypes, verbs, objects, titles, adjectives, locations, and, of course, colors.

![](https://storage.googleapis.com/papyrus_images/e55352e3d0fb4350c6ce9bd1df0117e526fa256ec19486b2f71700ad322b319e.png)

the pseudo-random function was very simple and predictable, with the `tokenID` as the input string:

![](https://storage.googleapis.com/papyrus_images/8d354c2fe5fe2c463d3545bd627e16118c52ab8878bf66b123cfcd3004e85ee6.png)

to create a card’s generative SVG image on-chain, a function called `tokenURI` was crafted, outputting an array composed of one element of each of the sets above, plus some image customization (this part needed some work):

![](https://storage.googleapis.com/papyrus_images/d1e3f909cfbcd6b23f57fc67dd4dc5870cc7e46b930c451aaf2eca07c63e6e03.png)

the last pieces of the contract were the `mintCard` and `ownerClaim` methods:

![](https://storage.googleapis.com/papyrus_images/b51ddce7cd825271d69d78c8fd15761876fbc394bbc3b063b30eb21c44ccab40.png)

* * *

deploying the contract
----------------------

at that time, [foundry](https://github.com/foundry-rs/foundry) wasn’t a thing, so i used [hardhat](https://hardhat.org/).

here was the `config` file (with `PRIVATE_KEY` , `API_ENDPOINT`, `API_ETHERSCAN` in an `.env` file):

![](https://storage.googleapis.com/papyrus_images/1059a040ae3feb37fb6d33d000ba063f659d2f07a8e65f2c643a281faac9b9bc.png)

if you are not a blockchain developer, don’t worry, all you would need to do to compile the contract was:

    npx hardhat compile
    

and then deploy with a simple javascript script:

    npx hardhat run scripts/deploy.js
    

![](https://storage.googleapis.com/papyrus_images/49f170491ac888617944c651f05191831fca37678657811c60dfef78c4e255b0.png)

* * *

another easter egg
------------------

all right, here is some _teasing_, my dear anon.

if you are puzzled about how i ended up writing this collection for filmmaker dao, here is how everything started, during the bull of summer’21…

[https://vimeo.com/638007916](https://vimeo.com/638007916)

[https://story.mirror.xyz/gbwXf\_IOm4BkUNmWYWz5M-47Te8ELuQngClR8iHFxDU](https://story.mirror.xyz/gbwXf_IOm4BkUNmWYWz5M-47Te8ELuQngClR8iHFxDU)

crypto can be wild…

* * *

**◻️ motherofbots.eth**
-----------------------

---

*Originally published on [bt3gl's symposium](https://paragraph.com/@go-outside/on-my-loot-based-erc-721-collection-for-filmmaker-dao)*
