Closed shafiquejamal closed 4 years ago
Hi @shafiquejamal, one of the main breaking changes introduced from Solidity version 0.5.0 was a change in arguments accepted by the keccak256() and sha256() functions, among others. These 2 functions no longer accept multiple arguments as shown in the course code Lottery smart contract example. Instead they now accept a single bytes
argument, a change that according to the Solidity docs, was made to make more explicit and clear how the arguments are concatenated.
The abi.encodePacked() function performs packed encoding of the given arguments and returns a value of type (bytes memory
). See https://solidity.readthedocs.io/en/v0.5.15/abi-spec.html#abi-packed-mode for more details on this.
The consequence of this breaking change was that every call to keccak256(a, b, c)
now required a change to keccak256(abi.encodePacked(a, b, c))
.
Hi @shafiquejamal I hope I was able to adequately answer your question (I'm going to assume I did based on your thumbs-up :)). I'm going to pin this issue for the benefit of others.
Happy new year and all the best in your endeavours!
Hello @owanhunte, yes you answered my question very well, thanks! Happy new year and all the best to you too!
Hello, many thanks for providing this repo! Would you be able to explain why you used abi.encodePacked ?
Thanks,