From a8ac72dda50b23cdb0434ad462e52acf7c61c25f Mon Sep 17 00:00:00 2001 From: Paul Berg Date: Fri, 8 Mar 2019 13:34:09 +0000 Subject: [PATCH] Update Solidity syntax in EIP-191 specs (#1547) --- EIPS/eip-191.md | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/EIPS/eip-191.md b/EIPS/eip-191.md index 63b53ea5..f3b79ae5 100644 --- a/EIPS/eip-191.md +++ b/EIPS/eip-191.md @@ -59,19 +59,23 @@ Using `0x19` thus makes it possible to extend the scheme by defining a version ` ### Example - function submitTransactionPreSigned(address destination, uint value, bytes data, uint nonce, uint8 v, bytes32 r, bytes32 s) - public - returns (bytes32 transactionHash) - { - // Arguments when calculating hash to validate - // 1: byte(0x19) - the initial 0x19 byte - // 2: byte(0) - the version byte - // 3: this - the validator address - // 4-7 : Application specific data - transactionHash = keccak256(byte(0x19),byte(0),this,destination, value, data, nonce); - sender = ecrecover(transactionHash, v, r, s); - // ... - } +The following snippet has been written in Solidity 0.5.0. + +```solidity +function submitTransactionPreSigned(address destination, uint value, bytes data, uint nonce, uint8 v, bytes32 r, bytes32 s) + public + returns (bytes32 transactionHash) +{ + // Arguments when calculating hash to validate + // 1: byte(0x19) - the initial 0x19 byte + // 2: byte(0) - the version byte + // 3: this - the validator address + // 4-7 : Application specific data + transactionHash = keccak256(abi.encodePacked(byte(0x19),byte(0),address(this),destination, value, data, nonce)); + sender = ecrecover(transactionHash, v, r, s); + // ... +} +``` ## Copyright