@marka_eth on Twitter
Time for Another Contrac...
time for another contract review by an average coder this time, the Infinity contract by jalil, explaining how he succinctly generates the on-chain artwork and as always, included easter eggs, quotes & other amusing elements within π§΅π https://t.co/IKw53VIahN

the first you'll notice about the contract is the address notice what it begins with? 0x008... nothing is by chance with @visualizevalue 8 (infinity symbol rotated) will be a recurring theme how? contract address can be deterministically created using CREATE2 2/β

i won't go into all of the functions and the mechanics of the project @onnnnnnnion already covered a lot of the code here https://t.co/VmI15tuUJQ 3/β (View Tweet)
and @mattob_eth did an excellent overview of the collection in terms of infinite supply, fixed price and refund mechanic https://t.co/PsWLMYX4cn (View Tweet)
onion discussed generate() which creates a random, very long token ids as you'll see in the collection this will become important later for the easter egg _randomId() uses an interesting block.prevandao opcode which I didn't know about : search EIP-4399 to know more 4/β

now let's get into the art & metadata the main contract imports in 4 libraries to do this and these are ERC1155s because multiple "copies" of the same token can be generated 5/β

all of the data is stored in InfiniteBags jalil thinks this is funny - imo pretty funny too the Token struct holds all the token data with a Symbol and Color struct 6/β

the tokenURI function in InfiniteMetadata is very similar to other on-chain contracts, and what jalil implemented for Checks i covered that in this thread back in Feb if you want to know more https://t.co/3mlVsziQtm 7/β (View Tweet)
however, things get interesting with tokenData that is provided to the tokenURI function InfiniteGenerator hold 17 colours : 16 distinct & 1 "void" with 4 shades of each the data.light line is notable... β/β

this gets the tokenId, which if you remember is a random "infinite" number e.g. 60944477694000143992499554242964755739924451343112920352918255151771937376279 and it uses the modulo operator, %, which returns the remainder of a division, this being divide by 4096 why 4096? 9/β

4,096 is the number of checks that need to be composited in order to achieve the infamous Black Check you can read more about that in my linked thread above and remember what the function was called when it was "programmed" feb 12th? yes... you got it: infinity 10/β

i believe @jackbutcher is writing a thread on this as we speak so i'll let him explain this in more detail but i believe they didn't know the visual connection between the check & infinity symbols at this time... or did they? 11/β (View Tweet)
so what happens when that calculation is true? data.light: true when the colours are being calculated, there's a if to set all colours to be #080808: almost black there's our 8's also notice the "skittles" & the comment: @beeple isn't the only one hiding Opepen in his work 12

data.light is also used in renderNoise() jalil uses noise again like he brilliantly used in Elements and more 8's and above, a light background is used like with token #0 giving us... 13/β

any tokenId divisible by 4,096 , including 0, will be a monochromatic easter egg hinted by jack yesterday and we've had 1 revealed so far https://t.co/qLSd5r4lch 14/β (View Tweet)
one more thing that made me smile was the allColors() function jalil uses the HSL colour standard: Hue, Saturation, & Lightness the hue & lightness are dynamic but the saturation is hardcoded to ... 88 giving us those beautiful bright saturated colours 15/β

now to the art itself glancing at the collection, it's amazing to think that literally one shape, or path, is used to create all those incredible designs just fΜΆoΜΆuΜΆrΜΆ ΜΆcΜΆuΜΆbΜΆeΜΆsΜΆ one path - what went wrong? https://t.co/OYDg3ZTMQl 16/β (View Tweet)
you can view the svg image for any token by going to this url and changing the 0 near the end https://t.co/A5W5E7SqQ0 and here's that path yep, the same as the left eye of the opepen 17/β

if you view the svg and inspect it, you'll see jalil's use of defs the path (loop) is transformed: scale(-1,1) this gives the infinity group and the infinity group is just then just repeated and rotated to form this so beautifully simple 18/β


the renderDefs function in InfinityArt uses this path with the renderSymbol and renderSymbols outputting them based on the token data 19/β


i think this thread is long enough so i'll leave it at that i love the art side of vv and code == art @jalil_eth is a master at work & it's an honour to review his work - thanks for the inspiration ser 20/β (View Tweet)
@jalil_eth as always, a like/comment/retweet of the op helps get it seen - ty π https://t.co/SVyuZzrupO (View Tweet)
oh and I forgot one other fascinating use of 8 and not sure if it's been mentioned... look at the date the first Infinity Check was generated - mon dieu, they really don't miss

a question posed by @Fluke4326 can we have the inverse colours to tokenID 0? getFormIdx() implies to my tired brain... no if statement for tokenId 0 to return the "infinity flower" but here's what it would look like & yes, now I want it badly too


