solidity - 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) {
^
你认为它可能是什么?我该如何解决?
谢谢!
解决方案
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.");
}
}
推荐阅读
- monit - 有没有办法阻止 monit 发送监控和取消监控电子邮件
- javascript - Boostrap 多选条件(如果选中)
- reactjs - Sublime 没有语法高亮 React 函数吗?
- javascript - VueJS DOM 未在组件中更新
- python - Windows:获取 python 项目使用的所有模块/包
- vb.net - 得到错误“表达式不产生值”
- graphql - GraphQL 条件必填字段指令
- bash - 使用 sed 计算跳过标题和尾记录的行数的 shell 脚本(文件的 n-2 行)
- ruby-on-rails-5 - Rails 5 - fields_for 和更新操作 - 无法理解如何更新/保存
- java - Maven 存储库有一个无效的 java.lang.IllegalStateException