微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

编译智能合约时出现“TypeError: Member “checkAirlineRegistered” not found or not visible after argument-dependent lookup

如何解决编译智能合约时出现“TypeError: Member “checkAirlineRegistered” not found or not visible after argument-dependent lookup

所以我制作了 2 个智能合约,一个用于应用程序的逻辑,一个用于存储数据。 App 逻辑智能合约会调用存储数据的智能合约中的函数。其中一个函数用作检查已放入映射数据中的数据的方法。但是当我执行“truffle compile”来编译智能合约时,我收到了这个错误

类型错误:在类型(合同 FlightSuretyData)中进行依赖于参数的查找后,未找到成员“checkAirlineRegistered”或不可见。

require(FlightSuretyData.checkAirlineRegistered(msg.sender),"来电者 不是注册

错误显示在我的修改器上。这是我的应用逻辑智能合约的代码

pragma solidity ^0.5.0;
import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./FlightSuretyData.sol";


contract FlightSuretyApp {
    using SafeMath for uint256;

modifier requireRegisteredAirlines()
    {
        require(FlightSuretyData.checkAirlineRegistered(msg.sender),"Caller is not registered Airline");                                       //calling the registered airline from data contract
        _;
    }
}

这里是存储智能合约的数据

pragma solidity ^0.5.0;

import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";

contract FlightSuretyData {
    using SafeMath for uint256;

   bool private operational = true; 

   struct Airline {
        address airline;
        bool isRegistered;
        uint256 feePaid;
        uint256 regIndex;
        bool isFunded;
        //mapping(address => bool) isVoted;
        uint numVotes;
    }

mapping(address => Airline) public registeredAirlines;          //used for storing registering Airlines data

 modifier requireIsOperational() 
    {
        require(operational,"Contract is currently not operational");
        _;  // All modifiers require an "_" which indicates where the function body will be added
    }

function checkAirlineRegistered(address checkAirline) external view returns(bool success) {
        return registeredAirlines[checkAirline].isRegistered;
    }

}

希望这些片段足以让您理解。

Here is the link to my repo for more context

谢谢

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。