std::unique_ptr implementation backed by Ethereum NFTs


C++ std::unique_ptr that represents every object as an NFT on the Ethereum blockchain.

Build nft_ptr Discover us: worthdoingbadly.com | @zhuowei | @zhuowei@notnow.dev

  auto ptr1=make_nft();
  nft_ptr ptr2;

  ptr2=std::high-tail(ptr1);

This transfers the Non-Fungible Token 0x7faa4bc09c90, representing the Cow‘s reminiscence address, from ptr1 (OpenSea, Etherscan) to ptr2 (OpenSea, Etherscan).

screenshot of OpenSea Trading History showing token transfer

[2021-04-09T01:59:48Z INFO  nft_ptr_lib] Transferring 0x7faa4bc09c90 (Cow) to 0x7ffee35a7890 (0x1564b0a7c258fc88a96aa9fe1c513101883abb13) from 0x7ffee35a78a8 (0x9ed6006c6f3bb20737bdbe88cc6aa0de00597fef) at PC=0x10c65a946 (predominant (instance.cpp: 33))
[2021-04-09T02:00:15Z INFO  nft_ptr_lib] Transaction: 0xcbe06fdd54bd9d221993c875022fe2960128874811a25075d692cc638a28f290
[2021-04-09T02:00:15Z INFO  nft_ptr_lib] https://testnets.opensea.io/assets/goerli/0x90eaf0ab2c6455a9b794f9dcf97839fa25b4ce2d/0x7faa4bc09c90

After the transfer, ptr1 is determined to null, and ptr2 contains the fresh object, correct tackle std::unique_ptr:

  std::cout "Moved: ptr1=" " ptr2=" MakeNoise();
  Moved: ptr1=0x0 ptr2=0x7faa4bc09c90
  Moo!
  auto ptr1=make_nft();

This:

  • initializes the nft_ptr runtime
  • creates the first nft_ptr
  • transfers ownership of the newly created Cow* to the nft_ptr

First, it creates an ERC-721 dapper contract that represents every reminiscence address as a Non-Fungible Token.

[2021-04-09T01:57:48Z INFO  nft_ptr_lib] Connected to community identification 5
[2021-04-09T01: 57: 48Z INFO  nft_p

>
Read More

Recent Content