From 427a8c530751dfbcfc251aa9333e54e53b537de0 Mon Sep 17 00:00:00 2001 From: Doug Crescenzi Date: Mon, 9 Jul 2018 16:11:16 -0400 Subject: [PATCH] Updated version of Solidity to 0.4.24 --- MultiSigWalletWithDailyLimit.sol | 79 ++++++++++++++++---------------- 1 file changed, 40 insertions(+), 39 deletions(-) diff --git a/MultiSigWalletWithDailyLimit.sol b/MultiSigWalletWithDailyLimit.sol index b2c9f15..d7084d3 100644 --- a/MultiSigWalletWithDailyLimit.sol +++ b/MultiSigWalletWithDailyLimit.sol @@ -1,4 +1,4 @@ -pragma solidity 0.4.10; +pragma solidity 0.4.24; /// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution. @@ -33,49 +33,49 @@ contract MultiSigWallet { modifier onlyWallet() { if (msg.sender != address(this)) - throw; + revert(); _; } modifier ownerDoesNotExist(address owner) { if (isOwner[owner]) - throw; + revert(); _; } modifier ownerExists(address owner) { if (!isOwner[owner]) - throw; + revert(); _; } modifier transactionExists(uint transactionId) { if (transactions[transactionId].destination == 0) - throw; + revert(); _; } modifier confirmed(uint transactionId, address owner) { if (!confirmations[transactionId][owner]) - throw; + revert(); _; } modifier notConfirmed(uint transactionId, address owner) { if (confirmations[transactionId][owner]) - throw; + revert(); _; } modifier notExecuted(uint transactionId) { if (transactions[transactionId].executed) - throw; + revert(); _; } modifier notNull(address _address) { if (_address == 0) - throw; + revert(); _; } @@ -84,16 +84,17 @@ contract MultiSigWallet { || _required > ownerCount || _required == 0 || ownerCount == 0) - throw; + revert(); _; } /// @dev Fallback function allows to deposit ether. function() payable + public { if (msg.value > 0) - Deposit(msg.sender, msg.value); + emit Deposit(msg.sender, msg.value); } /* @@ -102,13 +103,13 @@ contract MultiSigWallet { /// @dev Contract constructor sets initial owners and required number of confirmations. /// @param _owners List of initial owners. /// @param _required Number of required confirmations. - function MultiSigWallet(address[] _owners, uint _required) + constructor(address[] _owners, uint _required) public validRequirement(_owners.length, _required) { for (uint i=0; i<_owners.length; i++) { if (isOwner[_owners[i]] || _owners[i] == 0) - throw; + revert(); isOwner[_owners[i]] = true; } owners = _owners; @@ -126,7 +127,7 @@ contract MultiSigWallet { { isOwner[owner] = true; owners.push(owner); - OwnerAddition(owner); + emit OwnerAddition(owner); } /// @dev Allows to remove an owner. Transaction has to be sent by wallet. @@ -145,7 +146,7 @@ contract MultiSigWallet { owners.length -= 1; if (required > owners.length) changeRequirement(owners.length); - OwnerRemoval(owner); + emit OwnerRemoval(owner); } /// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet. @@ -164,8 +165,8 @@ contract MultiSigWallet { } isOwner[owner] = false; isOwner[newOwner] = true; - OwnerRemoval(owner); - OwnerAddition(newOwner); + emit OwnerRemoval(owner); + emit OwnerAddition(newOwner); } /// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet. @@ -176,7 +177,7 @@ contract MultiSigWallet { validRequirement(owners.length, _required) { required = _required; - RequirementChange(_required); + emit RequirementChange(_required); } /// @dev Allows an owner to submit and confirm a transaction. @@ -201,7 +202,7 @@ contract MultiSigWallet { notConfirmed(transactionId, msg.sender) { confirmations[transactionId][msg.sender] = true; - Confirmation(msg.sender, transactionId); + emit Confirmation(msg.sender, transactionId); executeTransaction(transactionId); } @@ -214,7 +215,7 @@ contract MultiSigWallet { notExecuted(transactionId) { confirmations[transactionId][msg.sender] = false; - Revocation(msg.sender, transactionId); + emit Revocation(msg.sender, transactionId); } /// @dev Allows anyone to execute a confirmed transaction. @@ -224,13 +225,13 @@ contract MultiSigWallet { notExecuted(transactionId) { if (isConfirmed(transactionId)) { - Transaction tx = transactions[transactionId]; - tx.executed = true; - if (tx.destination.call.value(tx.value)(tx.data)) - Execution(transactionId); + Transaction storage txn = transactions[transactionId]; + txn.executed = true; + if (txn.destination.call.value(txn.value)(txn.data)) + emit Execution(transactionId); else { - ExecutionFailure(transactionId); - tx.executed = false; + emit ExecutionFailure(transactionId); + txn.executed = false; } } } @@ -273,7 +274,7 @@ contract MultiSigWallet { executed: false }); transactionCount += 1; - Submission(transactionId); + emit Submission(transactionId); } /* @@ -383,7 +384,7 @@ contract MultiSigWalletWithDailyLimit is MultiSigWallet { /// @param _owners List of initial owners. /// @param _required Number of required confirmations. /// @param _dailyLimit Amount in wei, which can be withdrawn without confirmations on a daily basis. - function MultiSigWalletWithDailyLimit(address[] _owners, uint _required, uint _dailyLimit) + constructor(address[] _owners, uint _required, uint _dailyLimit) public MultiSigWallet(_owners, _required) { @@ -397,7 +398,7 @@ contract MultiSigWalletWithDailyLimit is MultiSigWallet { onlyWallet { dailyLimit = _dailyLimit; - DailyLimitChange(_dailyLimit); + emit DailyLimitChange(_dailyLimit); } /// @dev Allows anyone to execute a confirmed transaction or ether withdraws until daily limit is reached. @@ -406,19 +407,19 @@ contract MultiSigWalletWithDailyLimit is MultiSigWallet { public notExecuted(transactionId) { - Transaction tx = transactions[transactionId]; + Transaction storage txn = transactions[transactionId]; bool confirmed = isConfirmed(transactionId); - if (confirmed || tx.data.length == 0 && isUnderLimit(tx.value)) { - tx.executed = true; + if (confirmed || txn.data.length == 0 && isUnderLimit(txn.value)) { + txn.executed = true; if (!confirmed) - spentToday += tx.value; - if (tx.destination.call.value(tx.value)(tx.data)) - Execution(transactionId); + spentToday += txn.value; + if (txn.destination.call.value(txn.value)(txn.data)) + emit Execution(transactionId); else { - ExecutionFailure(transactionId); - tx.executed = false; + emit ExecutionFailure(transactionId); + txn.executed = false; if (!confirmed) - spentToday -= tx.value; + spentToday -= txn.value; } } } @@ -458,4 +459,4 @@ contract MultiSigWalletWithDailyLimit is MultiSigWallet { return 0; return dailyLimit - spentToday; } -} +} \ No newline at end of file