Skip to content

marketplace contracts to get familiar with clarity concepts and stacks SIPs

Notifications You must be signed in to change notification settings

tintash/nft-marketplace

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

3x3x3 Cube arrangements

On a 3x3x3 cube, there are 6 faces, 8 corners and 12 edges. This gives us finite number of permutations or possible arrangements equal to 519,024,039,293,878,272,000. But due to fixed center pieces, corner and edge arrangements; only 43,252,003,274,489,856,000 arrangements can be achieved on a solvable/legal cube. Each of these arrangements will represent an NFT.

Users can create a random arrangement, upload it and if its a unique yet valid image, they can mint an NFT with image hash as metadata.

Because there are ONLY 43,252,003,274,489,856,000 of them, users can buy and sell existing cube arrangements.

Image hash details

Consider the following image of an unfolded cube. unfolded cube image

There are 54 total positions on a 3x3x3 cube, these are all assigned ascending numbers in a 'row first' manner starting from top left of front face. Faces are ordered as front, top, bottom, left, right and back.

For example the top left piece of front is 1 and second piece is 2. Similarly top left piece of top face is 10 then 11 and onwards.

On a 3x3x3 cube, six different colors are used for six faces. Each color is assigned a unique prime number in range of 53 to 5407.

prime number choice is purely arbitrary

example weightages can be:

Color weightage
Red 73
Green 79
Blue 83
White 89
Yellow 97
Orange 101

Colors weightage is multiplied to its position number and resulting numbers are added up to generate a uint.

Eventually this number is passed to (hash160 uint) which generates a unique hash value for combination.

Above image hash calculation should look something like this.

(hash160 (+ (* 73 1) (* 101 2) (* 79 3) ...))

Validating the arrangement

Before minting a token for a cube arrangement, we need to make sure that its a legal / solvable cube. This is a TODO...

Sources

TODOs

  • Market
    • Listings
    • Sale / Purchase
    • Collections
  • test cases
  • Upgradability
  • Bidding
  • Web work
  • Legal cube?

About

marketplace contracts to get familiar with clarity concepts and stacks SIPs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Clarity 83.1%
  • TypeScript 16.9%