0

I have a problem like this. I am very new to solidity stuff. I have created two contracts and I have called a one contract function inside another contract. Here I am providing my contracts.

This is my main contract.

pragma solidity ^0.4.17;

contract TrafficFine{
    struct Officer {
        string firstName ;
        string lastName;
        address account;
    }

    address public manager;
    uint public numberOfOffiers;


    mapping(address=>Officer) public officers;

    modifier restricted(){
        require(msg.sender == manager);      
        _;
    }

    constructor () public{
        manager = msg.sender;
    }



    function addOfficer(
        string firstName,
        string lastName,
        address officer) public  restricted{

        require(officer!=officers[officer].account);

        Officer  memory newOfficer = Officer({
            firstName:firstName,
            lastName:lastName,
            account:officer
        });

        officers[officer] = newOfficer;
        numberOfOffiers++;
    }



    function getofficer(address officer) public view returns(address){
        address officer1= officers[officer].account;
        return officer1;
    }


}

This is my second contract.

contract DriverProfile{
    address watch_adrs=0x8c1eD7e19abAa9f23c476dA86Dc1577F1Ef401f5;

     function doFine(uint offenceID,string location,address officer) public{
         TrafficFine trafficfine = TrafficFine(watch_adrs);
         require(officer==trafficfine.getOfficer(officer));
     }

}

contract TrafficFine{
    function addOfficer(string firstName,string lastName,address officer) public;
    function getOfficer(address officer) public;
}

When I compile the second DriverProfille contract it gives me an error like this.

eror

Can someone help me to solve this problem?. I search a lot to find a solution to this problem. But I was unable to do nothing to this problem. Thank you!!

1 Answer 1

1

Your second implementation of TrafficFine does not specify the return value.

Try changing:

function getOfficer(address officer) public;

to:

function getOfficer(address officer) public view returns (address);
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.