3 TypeError: Return argument type function () view external returns (uint256) is not implicitly convertible to expected type (type of first return variable) uint256.

TypeError: Return argument type function () view external returns (uint256) is not implicitly convertible to expected type (type of first return variable) uint256.

提示这个错误 我在一个合约里面导入了另一个合约 我的函数是这样写的

function testGetRandom(RandomNumberConsumer _random) public returns (uint256){
        uint res = uint(_random.randomResult);
        return res;
    }

另一个合约里面定义了全局变量 为什么显示转换后依然抱错呢不能理解

contract RandomNumberConsumer is VRFConsumerBase {

    bytes32 internal keyHash;
    uint256 internal fee;

    uint256 public randomResult;
请先 登录 后评论

最佳答案 2021-10-27 15:31

testGetRandom 函数里, 应该调用函数 randomResult() , 部署读取属性。

请先 登录 后评论

其它 0 个回答

  • 1 关注
  • 0 收藏,2236 浏览
  • kindle1994 提出于 2021-10-27 12:40

相似问题