# 實作 - 透過合約驗證他人是否持有某合約的NFT #### solidity 解法: ```solidity= // SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import "@openzeppelin/contracts/interfaces/IERC721.sol"; contract verifyIfHaveSomeNFT { function walletHoldsToken(address _wallet, address _contract) public view returns (bool) { return IERC721(_contract).balanceOf(_wallet) > 0 ; } } ``` <br> #### 概念: 透過要查詢的NFT Token合約地址去調用 IERC721 的 interface 即可利用規範的 "balanceOf" function 查詢是否持有 >0 個 token ###### tags: `Lab 研究`
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up