function setBasicDetails(string memory _registrationNo,
string memory _farmerName,
string memory _farmAddress,
string memory _exporterName,
string memory _importerName
) public onlyAuthCaller returns(address) {
uint tmpData = uint(keccak256(msg.sender));
address batchNo = address(tmpData);
basicDetailsData.registrationNo = _registrationNo;
basicDetailsData.farmerName = _farmerName;
basicDetailsData.farmAddress = _farmAddress;
basicDetailsData.exporterName = _exporterName;
basicDetailsData.importerName = _importerName;
batchBasicDetails[batchNo] = basicDetailsData;
nextAction[batchNo] = 'FARM_INSPECTION';
return batchNo;
}
this is my solidity function code and i have error here's code
uint tmpData = uint(keccak256(msg.sender));
address batchNo = address(tmpData);
error msg:Invalid type for argument in function call. Invalid implicit conversion from address payable to bytes memory requested. This function requires a single bytes argument. Use abi.encodePacked(...) to obtain the pre-0.5.0 behaviour or abi.encode(...) to use ABI encoding.
If that is the only error in your code ()
keccak256
will return 32 bytes hash. but the address is 20 bytes. so instead of uint you should be usinguint160