In my Solidity code, I'm not using any global variables msg.* but still I get the error message in the function. Please explain why this function needs to be a payable function

The below snippet is taken from https://github.com/imperialsoftech/coffee-supplychain-ethereum I just changed the compiler version to ^0.5.8 in Truffle

enter image description here

/*get farm inspector data*/
function getFarmInspectorData(address batchNo)
public onlyAuthCaller view returns (
  string memory coffeeFamily,
  string memory typeOfSeed,
  string memory fertilizerUsed){
  farmInspector memory tmpData = batchFarmInspector[batchNo];
  return (tmpData.coffeeFamily, tmpData.typeOfSeed, tmpData.fertilizerUsed);


modifier onlyAuthCaller() {
  lastAccess = msg.sender;   **<---------- this is the state variable getting updated.**
    authorizedCaller[msg.sender] == 1,
    "You are not authorized");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.