@@ -21,7 +21,6 @@ contract GnosisSafe
2121
2222 using GnosisSafeMath for uint256 ;
2323
24- string public constant NAME = "Gnosis Safe " ;
2524 string public constant VERSION = "1.2.0 " ;
2625
2726 // keccak256(
@@ -117,7 +116,7 @@ contract GnosisSafe
117116 function execTransaction (
118117 address to ,
119118 uint256 value ,
120- bytes memory data ,
119+ bytes calldata data ,
121120 Enum.Operation operation ,
122121 uint256 safeTxGas ,
123122 uint256 baseGas ,
@@ -155,7 +154,7 @@ contract GnosisSafe
155154 }
156155 // We require some gas to emit the events (at least 2500) after the execution and some to perform code until the execution (500)
157156 // We also include the 1/64 in the check that is not send along with a call to counteract potential shortings because of EIP-150
158- require (gasleft () >= (safeTxGas * 64 / 63 ).max (safeTxGas + 2500 ) + 500 , "Not enough gas to execute safe transaction " );
157+ require (gasleft () >= (safeTxGas * 64 / 63 ).max (safeTxGas + 2500 ) + 500 , "GS010 " );
159158 // Use scope here to limit variable lifetime and prevent `stack too deep` errors
160159 {
161160 uint256 gasUsed = gasleft ();
@@ -189,10 +188,10 @@ contract GnosisSafe
189188 // For ETH we will only adjust the gas price to not be higher than the actual used gas price
190189 payment = gasUsed.add (baseGas).mul (gasPrice < tx .gasprice ? gasPrice : tx .gasprice );
191190 // solium-disable-next-line security/no-send
192- require (receiver.send (payment), "Could not pay gas costs with ether " );
191+ require (receiver.send (payment), "GS011 " );
193192 } else {
194193 payment = gasUsed.add (baseGas).mul (gasPrice);
195- require (transferToken (gasToken, receiver, payment), "Could not pay gas costs with token " );
194+ require (transferToken (gasToken, receiver, payment), "GS012 " );
196195 }
197196 }
198197
@@ -209,9 +208,9 @@ contract GnosisSafe
209208 // Load threshold to avoid multiple storage loads
210209 uint256 _threshold = threshold;
211210 // Check that a threshold is set
212- require (_threshold > 0 , "Threshold needs to be defined! " );
211+ require (_threshold > 0 , "GS001 " );
213212 // Check that the provided signature data is not too short
214- require (signatures.length >= _threshold.mul (65 ), "Signatures data too short " );
213+ require (signatures.length >= _threshold.mul (65 ), "GS020 " );
215214 // There cannot be an owner with address 0.
216215 address lastOwner = address (0 );
217216 address currentOwner;
@@ -229,18 +228,18 @@ contract GnosisSafe
229228 // Check that signature data pointer (s) is not pointing inside the static part of the signatures bytes
230229 // This check is not completely accurate, since it is possible that more signatures than the threshold are send.
231230 // Here we only check that the pointer is not pointing inside the part that is being processed
232- require (uint256 (s) >= _threshold.mul (65 ), "Invalid contract signature location: inside static part " );
231+ require (uint256 (s) >= _threshold.mul (65 ), "GS021 " );
233232
234233 // Check that signature data pointer (s) is in bounds (points to the length of data -> 32 bytes)
235- require (uint256 (s).add (32 ) <= signatures.length , "Invalid contract signature location: length not present " );
234+ require (uint256 (s).add (32 ) <= signatures.length , "GS022 " );
236235
237236 // Check if the contract signature is in bounds: start of data is s + 32 and end is start + signature length
238237 uint256 contractSignatureLen;
239238 // solium-disable-next-line security/no-inline-assembly
240239 assembly {
241240 contractSignatureLen := mload (add (add (signatures, s), 0x20 ))
242241 }
243- require (uint256 (s).add (32 ).add (contractSignatureLen) <= signatures.length , "Invalid contract signature location: data not complete " );
242+ require (uint256 (s).add (32 ).add (contractSignatureLen) <= signatures.length , "GS023 " );
244243
245244 // Check signature
246245 bytes memory contractSignature;
@@ -249,13 +248,13 @@ contract GnosisSafe
249248 // The signature data for contract signatures is appended to the concatenated signatures and the offset is stored in s
250249 contractSignature := add (add (signatures, s), 0x20 )
251250 }
252- require (ISignatureValidator (currentOwner).isValidSignature (data, contractSignature) == EIP1271_MAGIC_VALUE, "Invalid contract signature provided " );
251+ require (ISignatureValidator (currentOwner).isValidSignature (data, contractSignature) == EIP1271_MAGIC_VALUE, "GS024 " );
253252 // If v is 1 then it is an approved hash
254253 } else if (v == 1 ) {
255254 // When handling approved hashes the address of the approver is encoded into r
256255 currentOwner = address (uint160 (uint256 (r)));
257256 // Hashes are automatically approved by the sender of the message or when they have been pre-approved via a separate transaction
258- require (msg .sender == currentOwner || approvedHashes[currentOwner][dataHash] != 0 , "Hash has not been approved " );
257+ require (msg .sender == currentOwner || approvedHashes[currentOwner][dataHash] != 0 , "GS025 " );
259258 } else if (v > 30 ) {
260259 // To support eth_sign and similar we adjust v and hash the messageHash with the Ethereum message prefix before applying ecrecover
261260 currentOwner = ecrecover (keccak256 (abi.encodePacked ("\x19Ethereum Signed Message:\n32 " , dataHash)), v - 4 , r, s);
@@ -265,7 +264,7 @@ contract GnosisSafe
265264 }
266265 require (
267266 currentOwner > lastOwner && owners[currentOwner] != address (0 ) && currentOwner != SENTINEL_OWNERS,
268- "Invalid owner provided "
267+ "GS026 "
269268 );
270269 lastOwner = currentOwner;
271270 }
@@ -300,7 +299,7 @@ contract GnosisSafe
300299 function approveHash (bytes32 hashToApprove )
301300 external
302301 {
303- require (owners[msg .sender ] != address (0 ), "Only owners can approve a hash " );
302+ require (owners[msg .sender ] != address (0 ), "GS030 " );
304303 approvedHashes[msg .sender ][hashToApprove] = 1 ;
305304 emit ApproveHash (hashToApprove, msg .sender );
306305 }
@@ -366,7 +365,7 @@ contract GnosisSafe
366365 function encodeTransactionData (
367366 address to ,
368367 uint256 value ,
369- bytes memory data ,
368+ bytes calldata data ,
370369 Enum.Operation operation ,
371370 uint256 safeTxGas ,
372371 uint256 baseGas ,
@@ -400,7 +399,7 @@ contract GnosisSafe
400399 function getTransactionHash (
401400 address to ,
402401 uint256 value ,
403- bytes memory data ,
402+ bytes calldata data ,
404403 Enum.Operation operation ,
405404 uint256 safeTxGas ,
406405 uint256 baseGas ,
0 commit comments