简体   繁体   English

function 调用中的参数类型无效。 从地址到请求的应付地址的隐式转换无效。对于 msg.sender 和地址 0

[英]Invalid type for argument in function call. Invalid implicit conversion from address to address payable requested.for msg.sender and adress 0

    // create the fllow to transform the ownership of the nft
    //from the item owner(seller) to the contract that will transact to the buyer
    IERC721(nftcontract).transferFrom(msg.sender,address(this),tokenId);

    //after the marketitem is created
    //the market item creation is an event executed by this contract so we must emit it so that the details of the market item will be listned to or used
    emit MarketItemcreated(
     ItemId,
     nftcontract,//the nft because the nft contract address means the nft created
     tokenId,
     msg.sender,//seller is the msg.sender                              // we don't do payable because we emit only the details of the cretaedmarketid (what the market id contain)
     address(0),//no one yet own this nft
     price,
    false//not yet solde    
    );
}

i'am facing the problem in msg.sender and adress 0 i don't know where is the problem我在 msg.sender 和地址 0 中遇到问题 我不知道问题出在哪里

I think the issue is you are not modified the function as payable .我认为问题是您没有将 function 修改为payable You are not showing the full code, I think the code that you posted is inside a function and this function has to be marked as payable .您没有显示完整代码,我认为您发布的代码在 function 中,而这个 function 必须标记为payable if this is not the case, share the full function code please.如果不是这种情况,请分享完整的 function 代码。 A common mistake is not to wrap msg.sender with payable(msg.sender) .一个常见的错误是没有用payable(msg.sender)包装msg.sender because since solidity 0.6.0 msg.sender is not payable any more.因为自从 solidity 0.6.0 msg.sender不再需要支付。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何解决错误“function 调用中的参数类型无效。请求的地址到应付地址的隐式转换无效” - How to resolve the error "Invalid type for argument in function call. Invalid implicit conversion from address to address payable requested" 从应付地址到请求的字节内存的隐式转换无效。 此函数需要一个字节参数 - Invalid implicit conversion from address payable to bytes memory requested. This function requires a single bytes argument TypeError:function 调用中的参数类型无效。 从字符串内存[3] memory 到字符串内存[] memory 的无效隐式转换请求 - TypeError: Invalid type for argument in function call. Invalid implicit conversion from string memory[3] memory to string memory[] memory requested ParserError:应为“;” 但得到了“事件”——solidity 0.8 address payable(msg.sender) - ParserError: Expected ';' but got 'event' -- solidity 0.8 address payable(msg.sender) 撤回 function 发送仅适用于“应付地址”类型的对象 - Withdraw function send is only available for objects of type "address payable" Msg.sender在“视图”功能中不起作用,为什么? 有解决方法吗? - Msg.sender does not work inside a “view” function, why? Is there a workaround? 无法从智能合约向 msg.sender 发送以太币 - Not able to send ether to msg.sender from smart contract Solidity - 我如何从另一个合约转移到 msg.sender - Solidity - how do i transfer from another contract to msg.sender Solidity 基础知识:“msg.sender”代表什么 - Solidity basics: what "msg.sender" stands for 类型地址不能隐式转换为预期类型地址 payable - Type address is not implicitly convertible to expected type address payable
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM