编译智能合约时出现“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 (将#修改为@)