BSC 合同 Remix 上的类型错误

TypeError on Remix for BSC Contract

我有这个错误“TypeError:Return 参数类型地址不能隐式转换为预期类型(第一个 return 变量的类型)应付地址。--> Driven.sol: 233:16: | 233 | return msg.sender; | ^^^^^^^^^^"

对于以下函数

abstract contract Context {
    function _msgSender() internal view virtual returns (address payable) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

请帮忙!

从 Solidity 0.8 开始,msg.sender 不再是 payable。您需要先将其转换为 payable

function _msgSender() internal view virtual returns (address payable) {
    return payable(msg.sender); // added payable
}

或者您可以 return 只是 address(不支付):

function _msgSender() internal view virtual returns (address) {  // removed payable
    return msg.sender;
}