Skip to content

Commit

Permalink
Update Solidity syntax in EIP-191 specs (#1547)
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulRBerg authored and nicksavers committed Mar 8, 2019
1 parent 31dafbe commit a8ac72d
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions EIPS/eip-191.md
Expand Up @@ -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

Expand Down

0 comments on commit a8ac72d

Please sign in to comment.