Update Solidity syntax in EIP-191 specs (#1547)

This commit is contained in:
Paul Berg 2019-03-08 13:34:09 +00:00 committed by Nick Savers
parent 31dafbec20
commit a8ac72dda5
1 changed files with 17 additions and 13 deletions

View File

@ -59,19 +59,23 @@ Using `0x19` thus makes it possible to extend the scheme by defining a version `
### Example ### Example
function submitTransactionPreSigned(address destination, uint value, bytes data, uint nonce, uint8 v, bytes32 r, bytes32 s) The following snippet has been written in Solidity 0.5.0.
public
returns (bytes32 transactionHash) ```solidity
{ function submitTransactionPreSigned(address destination, uint value, bytes data, uint nonce, uint8 v, bytes32 r, bytes32 s)
// Arguments when calculating hash to validate public
// 1: byte(0x19) - the initial 0x19 byte returns (bytes32 transactionHash)
// 2: byte(0) - the version byte {
// 3: this - the validator address // Arguments when calculating hash to validate
// 4-7 : Application specific data // 1: byte(0x19) - the initial 0x19 byte
transactionHash = keccak256(byte(0x19),byte(0),this,destination, value, data, nonce); // 2: byte(0) - the version byte
sender = ecrecover(transactionHash, v, r, s); // 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 ## Copyright