Skip to content

Latest commit

 

History

History

punks

10 000 Punks - The Facet (Dumb) Contract Edition V1 / V2

The idea:

let's use the (bug fixed) cryptopunks v1 contract here -> https://github.com/cryptopunksnotdead/punks.contracts/blob/master/punks-v1/CryptoPunks.sol or the cryptopunks v2 contract here -> https://github.com/cryptopunksnotdead/punks.contracts/blob/master/punks-v2/CryptoPunksMarket.sol and yes, why not? let's convert to a (dumb) contract and deploy on facet. that may be the world's 1st punk collection AND built-in market on facet! and yes, like the historic punks (anno 2017) - the "facet" punks (anno 2023) are free to claim (only pay calldata / inscription gas transaction fees) comments? questions?

ps: to avoid trademark / copyright claims - let's change the image hash to a new 10 000 punk (or phunk) image / set.

Comments:

we would have to change the image hash because all 10k Cryptopunks and cryptophunks have been inscribed onchain. These can't be duplicated. We can't use the originals and mint those and flipping them left won't work because CryptoPhunks are already fully etched online.

More:

ha. that's the beauty of (dumb) contracts or the punk (dumb) contract. the composite all-in-one image will be "off-chain". thus, no worries about duplicates. if you get a punk via the (dumb) contract than you get a token with an index (e.g. 0,1,2,3, etc.) like in the original (anno 2017)! and every inscription is a (dumb) contract inscription (no image ever etched). back to the future!

and yes, of course the idea is to generate a new 10 000 punks set anyway that automagically has a new hash.

10 000 punks candidates - all human in 10 skin tones, with ethscribe green skin tone, or neon light sketches, and more

i have done many (new!) 10 000 punk series already. a great candidate might be the human series with 10 skin tones (using the google skin tone research sponsored dr. ellis monk skin tones - see https://skintone.google/ ) and the script to generate all 10 000 (human) punks (no aliens, zombies, apes) -> https://github.com/cryptopunksnotdead/punks.sandbox/blob/master/humans/generate_10000.rb and here's an image preview of the first two hundred

or maybe using an ethscribe neon (ethscribe) green skin tone ;-) ->

or maybe using a neon effect on a black & white sketch - the (bitcon) orange preview here to be changed to green ;-) ->

anyways, for sure no 1:1 copy or a reshuffle or left-right flip.

Punk (Dumb) Contract

Todos

  • change to rubidity / rubysol
  • change image hash
  • change known bug - fix bug! or use v2?
  • change ether (eth) to bridged ether or erc-20 token?
  • maybe make into (standard) erc-721 token (no wrapper needed) - why? why not?

Aside - What's the bug in the v1 contract?

When CryptoPunks launched (June 9, 2017 @ Block #3842489), the contract was exploitable. Sellers didn't get paid (buyers got both the punk and the ETH refunded). Matt & John (LarvaLabs) quickly launched a fixed version of the contract (June 22, 2017 @ Block #3914495), which everyone uses.

But the V1 "first-deploy" tokens are still out there.

The bug (the details)

The bug:

Inside the buyPunk function the line that executes the function punkNoLongerForSale(punkIndex) deserves some attention:

It updates the punksOfferedForSale array by its new values, which seem to be legit: the position belonging to the acquired Punk with index punkIndex gets reassigned with the new Offfer: the punk is now no longer for sale, it obtains now the address of the sender msg.sender as its owner, and since it is no longer for sale, the minValue can be set to zero.

Lets find the bug: Actually, things go wrong in punkNoLongerForSale(punkIndex). Why?!

We request a withdrawal for offer.seller. And actually offer.seller is the seller field of offer and offer is a reference to punksOfferedForSale[punkIndex]. But we reassigned punksOfferedForSale[punkIndex] in punkNoLongerForSale with the value: punksOfferedForSale[punkIndex] = Offer(false, punkIndex, msg.sender, 0, 0x0), hence offer.sender had already been overwritten by the address msg.sender, so finally the Contract authorizes a withdrawal to the senders (=buyers) address instead to the sellers address!

The underlying reason why this happened, is that by design Solidity doesn't assign structs by values but by reference.

It's easier to understand if you see the code "unrolled" like this:

function buyPunk(uint punkIndex) {

   Offer offer = punksOfferedForSale[punkIndex];
   //...

   // unroll call to punkNoLongerForSale(punkIndex)
     punksOfferedForSale[punkIndex].isForSale  = false;
     punksOfferedForSale[punkIndex].punkIndex  = punkIndex;
     punksOfferedForSale[punkIndex].seller     = msg.sender;  // bug !!!!
     punksOfferedForSale[punkIndex].minValue   = 0; 
     punksOfferedForSale[punkIndex].onlySellTo = 0x0;

   // bug - offser.seller is changed to msg.sender (= buyer!) 
   pendingWithdrawals[offer.seller] += msg.value;
   //...
}

For the work-in-progress (dumb) contract V1, see PunksV1.rb »

Aside - What's news in the v2 contract?

  • fixes the v1 bug ;-).
  • adds bids to punks e.g. enterBidForPunk (and withdrawBidForPunk) and acceptBidForPunk

For the work-in-progress (dumb) contract V2, see PunksV2.rb »

The Best of Both Contracts V1 & V2 - Punks For All

  • lets you claim punks for free - V1 mechanics
  • reserve for deployer / owner - V1 mechanics
  • incl. bug fix (use seller instead of order.seller)
  • adds bids from V2
  • pass in image hash in constructor
  • pass in name/symbol/totalSupply in constructor
  • add support for erc-721 standard (no wrappers needed) - why? why not?

For the work-in-progress (dumb) contract, see Punks.rb

Timeline

  • This (minimum) requires struct support in Rubidity! Wen?
  • This (dumb) contracts needs to get accepted to the curated (trusted) contract set for going live / deployment on mainnet. Wen?

More Ideas

  • pass-in the image hash in the constructor? let's anyone deploy a new (punk) collection reusing the contract code!

Questions? Comments?

Join us in the Rubidity & Rubysol (community) discord (chat server). Yes you can. Your questions and commentary welcome.