Minor style tweaks
This commit is contained in:
@@ -34,6 +34,6 @@ contract MSignatureValidator is
|
||||
Validator, // 0x06
|
||||
PreSigned, // 0x07
|
||||
Trezor, // 0x08
|
||||
NSignatureTypes // 0x09, always leave at end.
|
||||
NSignatureTypes // 0x09, number of signature types. Always leave at end.
|
||||
}
|
||||
}
|
||||
|
@@ -33,7 +33,7 @@ contract TestValidator is
|
||||
validSigner = _validSigner;
|
||||
}
|
||||
|
||||
/// @dev Verifies that a signature is valid.
|
||||
/// @dev Verifies that a signature is valid.
|
||||
/// @param hash Message hash that is signed.
|
||||
/// @param signer Address that should have signed the given hash.
|
||||
/// @param signature Proof of signing.
|
||||
|
@@ -40,24 +40,24 @@ contract TestWallet is
|
||||
/// @dev Validates an EIP712 signature.
|
||||
/// The signer must match the signer of this wallet.
|
||||
/// @param hash Message hash that is signed.
|
||||
/// @param eip721Signature Proof of signing.
|
||||
/// @param eip712Signature Proof of signing.
|
||||
/// @return Validity of order signature.
|
||||
function isValidSignature(
|
||||
bytes32 hash,
|
||||
bytes eip721Signature
|
||||
bytes eip712Signature
|
||||
)
|
||||
external
|
||||
view
|
||||
returns (bool isValid)
|
||||
{
|
||||
require(
|
||||
eip721Signature.length == 65,
|
||||
eip712Signature.length == 65,
|
||||
LENGTH_65_REQUIRED
|
||||
);
|
||||
|
||||
uint8 v = uint8(eip721Signature[0]);
|
||||
bytes32 r = readBytes32(eip721Signature, 1);
|
||||
bytes32 s = readBytes32(eip721Signature, 33);
|
||||
uint8 v = uint8(eip712Signature[0]);
|
||||
bytes32 r = readBytes32(eip712Signature, 1);
|
||||
bytes32 s = readBytes32(eip712Signature, 33);
|
||||
address recoveredAddress = ecrecover(hash, v, r, s);
|
||||
isValid = walletOwner == recoveredAddress;
|
||||
return isValid;
|
||||
|
Reference in New Issue
Block a user