|
@@ -1,4 +1,4 @@
|
|
|
-pragma solidity ^0.4.24;
|
|
|
+pragma solidity ^0.5.0;
|
|
|
|
|
|
import "../access/roles/SignerRole.sol";
|
|
|
import "../cryptography/ECDSA.sol";
|
|
@@ -48,7 +48,7 @@ contract SignatureBouncer is SignerRole {
|
|
|
/**
|
|
|
* @dev requires that a valid signature of a signer was provided
|
|
|
*/
|
|
|
- modifier onlyValidSignature(bytes signature) {
|
|
|
+ modifier onlyValidSignature(bytes memory signature) {
|
|
|
require(_isValidSignature(msg.sender, signature));
|
|
|
_;
|
|
|
}
|
|
@@ -56,7 +56,7 @@ contract SignatureBouncer is SignerRole {
|
|
|
/**
|
|
|
* @dev requires that a valid signature with a specifed method of a signer was provided
|
|
|
*/
|
|
|
- modifier onlyValidSignatureAndMethod(bytes signature) {
|
|
|
+ modifier onlyValidSignatureAndMethod(bytes memory signature) {
|
|
|
require(_isValidSignatureAndMethod(msg.sender, signature));
|
|
|
_;
|
|
|
}
|
|
@@ -64,7 +64,7 @@ contract SignatureBouncer is SignerRole {
|
|
|
/**
|
|
|
* @dev requires that a valid signature with a specifed method and params of a signer was provided
|
|
|
*/
|
|
|
- modifier onlyValidSignatureAndData(bytes signature) {
|
|
|
+ modifier onlyValidSignatureAndData(bytes memory signature) {
|
|
|
require(_isValidSignatureAndData(msg.sender, signature));
|
|
|
_;
|
|
|
}
|
|
@@ -73,7 +73,7 @@ contract SignatureBouncer is SignerRole {
|
|
|
* @dev is the signature of `this + sender` from a signer?
|
|
|
* @return bool
|
|
|
*/
|
|
|
- function _isValidSignature(address account, bytes signature) internal view returns (bool) {
|
|
|
+ function _isValidSignature(address account, bytes memory signature) internal view returns (bool) {
|
|
|
return _isValidDataHash(keccak256(abi.encodePacked(address(this), account)), signature);
|
|
|
}
|
|
|
|
|
@@ -81,7 +81,7 @@ contract SignatureBouncer is SignerRole {
|
|
|
* @dev is the signature of `this + sender + methodId` from a signer?
|
|
|
* @return bool
|
|
|
*/
|
|
|
- function _isValidSignatureAndMethod(address account, bytes signature) internal view returns (bool) {
|
|
|
+ function _isValidSignatureAndMethod(address account, bytes memory signature) internal view returns (bool) {
|
|
|
bytes memory data = new bytes(_METHOD_ID_SIZE);
|
|
|
for (uint i = 0; i < data.length; i++) {
|
|
|
data[i] = msg.data[i];
|
|
@@ -94,7 +94,7 @@ contract SignatureBouncer is SignerRole {
|
|
|
* @notice the signature parameter of the method being validated must be the "last" parameter
|
|
|
* @return bool
|
|
|
*/
|
|
|
- function _isValidSignatureAndData(address account, bytes signature) internal view returns (bool) {
|
|
|
+ function _isValidSignatureAndData(address account, bytes memory signature) internal view returns (bool) {
|
|
|
require(msg.data.length > _SIGNATURE_SIZE);
|
|
|
|
|
|
bytes memory data = new bytes(msg.data.length - _SIGNATURE_SIZE);
|
|
@@ -110,7 +110,7 @@ contract SignatureBouncer is SignerRole {
|
|
|
* and then recover the signature and check it against the signer role
|
|
|
* @return bool
|
|
|
*/
|
|
|
- function _isValidDataHash(bytes32 hash, bytes signature) internal view returns (bool) {
|
|
|
+ function _isValidDataHash(bytes32 hash, bytes memory signature) internal view returns (bool) {
|
|
|
address signer = hash.toEthSignedMessageHash().recover(signature);
|
|
|
|
|
|
return signer != address(0) && isSigner(signer);
|