-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add example nft bridge contract for exist ERC721 contracts
- Loading branch information
Showing
2 changed files
with
26 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import "./public_data_storage.sol"; | ||
import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; | ||
|
||
contract NFTBridge is IERCPublicDataContract { | ||
IERC721 nftAddress; | ||
|
||
mapping (bytes32 => uint) hashToTokenId; | ||
|
||
constructor(IERC721 _nftAddress) { | ||
nftAddress = _nftAddress; | ||
} | ||
|
||
function addTokenId(bytes32[] calldata dataMixedHash, uint256[] calldata tokenId) public { | ||
for (uint i = 0; i < dataMixedHash.length; i++) { | ||
hashToTokenId[dataMixedHash[i]] = tokenId[i]; | ||
} | ||
} | ||
|
||
function getDataOwner(bytes32 dataMixedHash) public view returns (address) { | ||
return nftAddress.ownerOf(tokenId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters