Migrate ERC721 metadata to ERC1155

Henrique asked on Telegram

Hi I am trying to migrate an ERC721 to ERC1155 but I am struggling in how can I keep content in IPFS if the token metadata is identified by his ID. Just would like to do some tests
Their metadata would be generated and inserted in IPFS in the act of minting, works with ERC721 but I do not know how to make it work in ERC1155 (was thinking in IPNS but would like to avoid it). Thank you

OpenZeppelin Contracts v3.1 included ERC1155.

The OpenZeppelin Contracts implementation uses a single uri for the contract. The uri can include the string {id} which clients must replace with the actual token ID, in lowercase hexadecimal (with no 0x prefix) and leading zero padded to 64 hex characters.

This is done to reduce gas costs. Though it means that unlike in ERC721 where we could specify ipfs://ipfs/QmTy8w65yBXgyfG2ZBg5TrfB2hPjrDQH3RCQFJGkARStJb we need to use a URI that supports the {id} replacement scheme.

1 Like