I am trying to compile following code:
pragma solidity 0.5.9;
contract test{
//https://github.com/ethereum/solidity/issues/3469
address payable owner;
mapping (address => bool) pd;
uint public sS;
function lnA(address addr) public view returns(uint n) {
// 1 in 8 chance
n = uint(keccak256(uint(addr), sS)[0]) % 8;
}
}
solc keccakSyntaxerr.sol
keccakSyntaxerr.sol:10:18: Error: Wrong argument count for function call: 2 arguments given but expected 1. 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.
n = uint(keccak256(uint(addr), sS)[0]) % 8; ^-----------------------^ keccakSyntaxerr.sol:10:13: Error: Explicit type conversion not allowed from "bytes1" to "uint256". n = uint(keccak256(uint(addr), sS)[0]) % 8; ^--------------------------------^
How to convert the above syntax into lastest Solidity versions? Somebody please guide me.
Zulfi.