从应付地址到请求的字符串内存的无效隐式转换
Invalid implicit conversion from address payable to string memory requested
我遇到编译错误 Invalid implicit conversion from address payable to string memory requested
下面的代码使用 solidity 0.6.6
不是很懂
mapping(string => mapping(uint => Sell)) public sells;
mapping(string => uint) public sold;
function sell (string memory _good, string memory _date) public {
uint sellsCount = sold[_date] ++;
sells[_date][sellsCount] = Sell(_date, msg.sender, _good, false);
}
似乎在您定义 Sell
结构时,您将地址类型作为字符串传递。在 Solidity 的早期版本中,msg.sender
被认为是 address payable
。在Sell
结构中,你应该设置它的类型地址payable
我遇到编译错误 Invalid implicit conversion from address payable to string memory requested
下面的代码使用 solidity 0.6.6
不是很懂
mapping(string => mapping(uint => Sell)) public sells;
mapping(string => uint) public sold;
function sell (string memory _good, string memory _date) public {
uint sellsCount = sold[_date] ++;
sells[_date][sellsCount] = Sell(_date, msg.sender, _good, false);
}
似乎在您定义 Sell
结构时,您将地址类型作为字符串传递。在 Solidity 的早期版本中,msg.sender
被认为是 address payable
。在Sell
结构中,你应该设置它的类型地址payable