首页 > 解决方案 > Solidity ParserError 应为“,”但得到“数字”

问题描述

在 Remix 上编译以下代码时:

pragma solidity ^0.5.7;

    function canWithdraw(uint256 tokenId) public view returns (bool) {
    if (auctions[tokenId].open && 
        (
            (
                now >= auctions[tokenId].auctionEnd &&
                auctions[tokenId].highestBid > 0 &&
                auctions[tokenId].highestBid 0) {
        (bool success, ) = auctions[tokenId].highestBidder.call.value(auctions[tokenId].highestBid)("");
        require(success, "Transfer failed.");
    }

我收到此错误:

Re.sol:1508:50: ParserError: Expected ',' but got 'Number'
auctions[tokenId].highestBid 0) {
^

你认为它可能是什么?我该如何解决?

谢谢!

标签: solidity

解决方案


function canWithdraw(uint256 tokenId) public view returns (bool) {
    if (
        auctions[tokenId].open &&
        now >= auctions[tokenId].auctionEnd &&
        auctions[tokenId].highestBid > 0
    ) {
        (bool success, ) = auctions[tokenId].highestBidder.call.value(
            auctions[tokenId].highestBid
        )("");
        require(success, "Transfer failed.");
    }
}

推荐阅读