【发布时间】:2021-12-09 19:37:40
【问题描述】:
我正在尝试调用部署在以太坊上的 NFT 合约中的一个函数,以及 Remix 中的另一个合约,旨在将其部署在 Polygon 上。
这是我要调用的 NFT 函数:
function allGenzeesOfWallet(address owner)
public
view
returns (uint256[] memory)
{
uint256 tokenCount = balanceOf(owner);
uint256[] memory tokensId = new uint256[](tokenCount);
for (uint256 i; i < tokenCount; i++) {
tokensId[i] = tokenOfOwnerByIndex(owner, i);
}
return tokensId;
}
这是我正在写的与它互动的新合同:
interface IGenzees {
function allGenzeesOfWallet(address owner) external view returns(uint[] memory);
}
contract CallNFT {
IGenzees public NFTcontract;
constructor () {
NFTcontract = IGenzees(0x201675fBFAAAC3A51371E4C31FF73Ac14ceE2A5A);
}
function getNoNFTsOwned(address user) public view returns(uint[] memory) {
return NFTcontract.allGenzeesOfWallet(user);
}
function setNFTcontract(address addr) external { // Set NFT contract
NFTcontract = IGenzees(addr);
}
}
但是当我调用 getNoNFTsOwned 函数时,控制台会说:
call to CallNFT.getNoNFTsOwned errored: VM error: revert.
我做错了什么?
【问题讨论】:
标签: solidity