Skip to content

Commit

Permalink
Update to lastest solc changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rmeissner committed Nov 21, 2018
1 parent e237ceb commit 1449542
Show file tree
Hide file tree
Showing 29 changed files with 1,889 additions and 2,046 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ cache:
directories:
- node_modules
before_script:
- cd node_modules/truffle && npm install [email protected]
- truffle compile
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ solidity_flattener contracts/modules/SocialRecoveryModule.sol --output build/fla
solidity_flattener contracts/modules/StateChannelModule.sol --output build/flattened_contracts/StateChannelModule.sol --solc-paths="="
solidity_flattener contracts/modules/WhitelistModule.sol --output build/flattened_contracts/WhitelistModule.sol --solc-paths="="
solidity_flattener contracts/proxies/ProxyFactory.sol --output build/flattened_contracts/ProxyFactory.sol
find build/flattened_contracts -name '*.sol' -exec sed -i '' 's/pragma solidity ^0.4.13;/pragma solidity ^0.4.24;/g' {} \;
find build/flattened_contracts -name '*.sol' -exec sed -i '' 's/pragma solidity ^0.4.13;/pragma solidity ^0.5.0;/g' {} \;
```

Zeppelin OS
Expand Down
53 changes: 8 additions & 45 deletions contracts/GnosisSafe.sol
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;
import "./base/BaseSafe.sol";
import "./common/MasterCopy.sol";
import "./common/SignatureDecoder.sol";
import "./common/SecuredTokenTransfer.sol";
import "./interfaces/ISignatureValidator.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "./external/SafeMath.sol";

/// @title Gnosis Safe - A multisignature wallet with support for confirmations using signed messages based on ERC191.
/// @author Stefan George - <[email protected]>
Expand Down Expand Up @@ -67,22 +67,15 @@ contract GnosisSafe is MasterCopy, BaseSafe, SignatureDecoder, SecuredTokenTrans
/// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin).
/// @param signatures Packed signature data ({bytes32 r}{bytes32 s}{uint8 v})
function execTransaction(
<<<<<<< HEAD
address to,
uint256 value,
bytes data,
bytes memory data,
Enum.Operation operation,
=======
address to,
uint256 value,
bytes memory data,
Enum.Operation operation,
>>>>>>> dd768ad... Fix solidity 0.5.0 errors
uint256 safeTxGas,
uint256 dataGas,
uint256 gasPrice,
address gasToken,
address refundReceiver,
address payable refundReceiver,
bytes memory signatures
)
public
Expand Down Expand Up @@ -115,13 +108,13 @@ contract GnosisSafe is MasterCopy, BaseSafe, SignatureDecoder, SecuredTokenTrans
uint256 dataGas,
uint256 gasPrice,
address gasToken,
address refundReceiver
address payable refundReceiver
)
private
{
uint256 amount = startGas.sub(gasleft()).add(dataGas).mul(gasPrice);
// solium-disable-next-line security/no-tx-origin
address receiver = refundReceiver == address(0) ? tx.origin : refundReceiver;
address payable receiver = refundReceiver == address(0) ? tx.origin : refundReceiver;
if (gasToken == address(0)) {
// solium-disable-next-line security/no-send
require(receiver.send(amount), "Could not pay gas costs with ether");
Expand Down Expand Up @@ -231,13 +224,8 @@ contract GnosisSafe is MasterCopy, BaseSafe, SignatureDecoder, SecuredTokenTrans
/**
* @dev Marks a message as signed
* @param _data Arbitrary length data that should be marked as signed on the behalf of address(this)
<<<<<<< HEAD
*/
function signMessage(bytes _data)
=======
*/
function signMessage(bytes memory _data)
>>>>>>> dd768ad... Fix solidity 0.5.0 errors
public
authorized
{
Expand All @@ -249,13 +237,8 @@ contract GnosisSafe is MasterCopy, BaseSafe, SignatureDecoder, SecuredTokenTrans
* @param _data Arbitrary length data signed on the behalf of address(this)
* @param _signature Signature byte array associated with _data
* @return a bool upon valid or invalid signature with corresponding _data
<<<<<<< HEAD
*/
function isValidSignature(bytes _data, bytes _signature)
=======
*/
function isValidSignature(bytes memory _data, bytes memory _signature)
>>>>>>> dd768ad... Fix solidity 0.5.0 errors
public
returns (bool isValid)
{
Expand Down Expand Up @@ -299,23 +282,13 @@ contract GnosisSafe is MasterCopy, BaseSafe, SignatureDecoder, SecuredTokenTrans
/// @param _nonce Transaction nonce.
/// @return Transaction hash bytes.
function encodeTransactionData(
<<<<<<< HEAD
address to,
uint256 value,
bytes data,
Enum.Operation operation,
uint256 safeTxGas,
uint256 dataGas,
uint256 gasPrice,
=======
address to,
uint256 value,
bytes memory data,
Enum.Operation operation,
uint256 safeTxGas,
uint256 dataGas,
uint256 gasPrice,
>>>>>>> dd768ad... Fix solidity 0.5.0 errors
uint256 gasPrice,
address gasToken,
address refundReceiver,
uint256 _nonce
Expand Down Expand Up @@ -343,23 +316,13 @@ contract GnosisSafe is MasterCopy, BaseSafe, SignatureDecoder, SecuredTokenTrans
/// @param _nonce Transaction nonce.
/// @return Transaction hash.
function getTransactionHash(
<<<<<<< HEAD
address to,
uint256 value,
bytes data,
Enum.Operation operation,
uint256 safeTxGas,
uint256 dataGas,
uint256 gasPrice,
=======
address to,
uint256 value,
bytes memory data,
Enum.Operation operation,
uint256 safeTxGas,
uint256 dataGas,
uint256 gasPrice,
>>>>>>> dd768ad... Fix solidity 0.5.0 errors
uint256 gasPrice,
address gasToken,
address refundReceiver,
uint256 _nonce
Expand Down
2 changes: 1 addition & 1 deletion contracts/base/BaseSafe.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;
import "./Module.sol";
import "./ModuleManager.sol";
import "./OwnerManager.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/base/Executor.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;
import "../common/Enum.sol";
import "../common/EtherPaymentFallback.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/base/Module.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;
import "../common/MasterCopy.sol";
import "./ModuleManager.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/base/ModuleManager.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;
import "../common/Enum.sol";
import "../common/SelfAuthorized.sol";
import "./Executor.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/base/OwnerManager.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;
import "../common/SelfAuthorized.sol";

/// @title OwnerManager - Manages a set of owners and a threshold to perform actions.
Expand Down
2 changes: 1 addition & 1 deletion contracts/common/Enum.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;


/// @title Enum - Collection of enums
Expand Down
2 changes: 1 addition & 1 deletion contracts/common/EtherPaymentFallback.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;


/// @title EtherPaymentFallback - A contract that has a fallback to accept ether payments
Expand Down
2 changes: 1 addition & 1 deletion contracts/common/MasterCopy.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;
import "./SelfAuthorized.sol";


Expand Down
2 changes: 1 addition & 1 deletion contracts/common/SecuredTokenTransfer.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;


/// @title SecuredTokenTransfer - Secure token transfer
Expand Down
2 changes: 1 addition & 1 deletion contracts/common/SelfAuthorized.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;


/// @title SelfAuthorized - authorizes current contract to perform actions
Expand Down
2 changes: 1 addition & 1 deletion contracts/common/SignatureDecoder.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;


/// @title SignatureDecoder - Decodes signatures that a encoded as bytes
Expand Down
66 changes: 66 additions & 0 deletions contracts/external/SafeMath.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
pragma solidity ^0.5.0;

/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
* TODO: remove once open zeppelin update to solc 0.5.0
*/
library SafeMath {

/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}

uint256 c = a * b;
require(c / a == b);

return c;
}

/**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0); // Solidity only automatically asserts when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold

return c;
}

/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;

return c;
}

/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);

return c;
}

/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
2 changes: 1 addition & 1 deletion contracts/interfaces/ISignatureValidator.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;

contract ISignatureValidator {
/**
Expand Down
2 changes: 1 addition & 1 deletion contracts/libraries/CreateAndAddModules.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;
import "../base/Module.sol";


Expand Down
2 changes: 1 addition & 1 deletion contracts/libraries/MultiSend.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;


/// @title Multi Send - Allows to batch multiple transactions into one.
Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/Token.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.23;
pragma solidity ^0.5.0;
import "@gnosis.pm/mock-contract/contracts/MockContract.sol";
contract Token {
function transfer(address _to, uint value) public returns (bool);
Expand Down
2 changes: 1 addition & 1 deletion contracts/modules/DailyLimitModule.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;
import "../base/Module.sol";
import "../base/ModuleManager.sol";
import "../base/OwnerManager.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/modules/SocialRecoveryModule.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;
import "../base/Module.sol";
import "../base/ModuleManager.sol";
import "../base/OwnerManager.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/modules/StateChannelModule.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;
import "../base/Module.sol";
import "../base/OwnerManager.sol";
import "../common/SignatureDecoder.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/modules/WhitelistModule.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;
import "../base/Module.sol";
import "../base/ModuleManager.sol";
import "../base/OwnerManager.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/proxies/DelegateConstructorProxy.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;
import "./Proxy.sol";


Expand Down
4 changes: 2 additions & 2 deletions contracts/proxies/PayingProxy.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;
import "../common/SecuredTokenTransfer.sol";
import "./DelegateConstructorProxy.sol";

Expand All @@ -13,7 +13,7 @@ contract PayingProxy is DelegateConstructorProxy, SecuredTokenTransfer {
/// @param funder Address that should be paid for the execution of this call
/// @param paymentToken Token that should be used for the payment (0 is ETH)
/// @param payment Value that should be paid
constructor(address _masterCopy, bytes memory initializer, address funder, address paymentToken, uint256 payment)
constructor(address _masterCopy, bytes memory initializer, address payable funder, address paymentToken, uint256 payment)
DelegateConstructorProxy(_masterCopy, initializer)
public
{
Expand Down
2 changes: 1 addition & 1 deletion contracts/proxies/Proxy.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;


/// @title Proxy - Generic proxy contract allows to execute all transactions applying the code of a master contract.
Expand Down
2 changes: 1 addition & 1 deletion contracts/proxies/ProxyFactory.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;
import "./Proxy.sol";


Expand Down
Loading

0 comments on commit 1449542

Please sign in to comment.