-
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.
- Loading branch information
Showing
4 changed files
with
90 additions
and
56 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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,33 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import "@openzeppelin/contracts/access/Ownable.sol"; | ||
import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; | ||
|
||
contract NFTBridge is Ownable { | ||
struct NFTInfo { | ||
address nftContract; | ||
uint256 tokenId; | ||
} | ||
mapping (bytes32 => address) initOwnerData; | ||
mapping (bytes32 => NFTInfo) nftInfos; | ||
|
||
constructor() Ownable(msg.sender) { | ||
} | ||
|
||
function setOwnerData(bytes32 dataMixedHash, address owner) public onlyOwner { | ||
initOwnerData[dataMixedHash] = owner; | ||
} | ||
|
||
function setNFTInfo(bytes32 dataMixedHash, address nftContract, uint256 tokenId) public onlyOwner { | ||
nftInfos[dataMixedHash] = NFTInfo(nftContract, tokenId); | ||
} | ||
|
||
function getOwner(bytes32 dataMixedHash) public view returns (address) { | ||
address owner = initOwnerData[dataMixedHash]; | ||
if (owner == address(0)) { | ||
owner = IERC721(nftInfos[dataMixedHash].nftContract).ownerOf(nftInfos[dataMixedHash].tokenId); | ||
} | ||
return owner; | ||
} | ||
} |
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