Skip to content

Instantly share code, notes, and snippets.

View GNSPS's full-sized avatar
❤️
Spreading the love

Gonçalo Sá GNSPS

❤️
Spreading the love
View GitHub Profile
@alex-miller-0
alex-miller-0 / metaNFT.md
Created March 6, 2018 00:41
Meta-Non-Fungible Token

Meta-Non-Fungible Token

Non-fungible tokens (NFTs) are all the rage these days, but their current manifestation (ERC721) is inefficient. It is not possible to move multiple tokens at the same time or package multiple tokens for e.g. deposit into a plasma child chain.

Contract pseudocode

The following is a new design for an NFT token that allows aggregation of assets. The rest of the functionality can be inherited from ERC721.

contract NFT {
 tokens mapping(address => mapping(bytes32 => uint));
@izqui
izqui / forwarder.sol
Last active October 21, 2021 04:24
Very cheap to deploy (66k gas) forwarder contracts that can clone any contract and still have their own storage
// Bytecode origin https://www.reddit.com/r/ethereum/comments/6ic49q/any_assembly_programmers_willing_to_write_a/dj5ceuw/
// Modified version of Vitalik's https://www.reddit.com/r/ethereum/comments/6c1jui/delegatecall_forwarders_how_to_save_5098_on/
// Credits to Jordi Baylina for this way of deploying contracts https://gist.github.com/jbaylina/e8ac19b8e7478fd10cf0363ad1a5a4b3
// Forwarder is slightly modified to only return 256 bytes (8 normal returns)
// Deployed Factory in Kovan: https://kovan.etherscan.io/address/0xaebc118657099e2110c90494f48b3d21329b23eb
// Example of a Forwarder deploy using the Factory: https://kovan.etherscan.io/tx/0xe995dd023c8336685cb819313d933ae8938009f9c8c0e1af6c57b8be06986957
// Just 66349 gas per contract