L2NFTBridgeand has a counterpart L1StandardERC721 registered
L2NFTBridgeis as a base Network "L2"
withdraw()on L2NFTBridge with the params - ERC721Address and tokenId (see below note below)
withdrawWithExtraData()instead, to transport underivable metadata to the other layer along with the bridging. In such cases, we recommend to check for the metadata form of the ERC721 once, and if it is of the general form (tokenURI = baseURI + tokenId), call the withdraw() method for all instance of the contract. Otherwise, the marketplace can default to calling
withdrawWithExtraData()for every bridging instead (which covers all tokens) but will not be gas-efficient.
/contracts/SampleERC721.sol- feel free to select your own ERC721 that you fancy. (For special ERC721s which might not be cost-effective to transport with the complete metadata - we offer some gas effective solutions with the bridges. Do not worry about this now - follow this section for reference later).
tokenURI()data will be encoded and passed on to the L1StandardERC721 for it to receive and handle it
bridgeExtraData, if this method is implemented on your native ERC721 contracts and returns some data that you would need to bridge to the other layer, the bridge will prioritize this over
tokenURIpotentially allowing to bridge seed data for generation on the L1 side.
bridgeExtraData()on your contract. This can encode one/many unique seed data to be transported over to the other layer while bridging. For example, an on-chain contract that requires three unique integers to be transported for each tokenId can expose the data in a way similar to:
withdrawWithExtraDatato bridge an NFT to L1, would mean, on this order of priority:
bridgeExtraData()method, if it does transport the return of this method as data
tokenURI()along with each token while bridging, your contract does not need to implement any extra method! If you want your NFTs to transport other generative(shorter) data along with each token instead, implement the
bridgeExtraData(uint256 tokenId)and expose the extraData for each token.