Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated version of Solidity to 0.4.24 #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 40 additions & 39 deletions MultiSigWalletWithDailyLimit.sol
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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();
_;
}

Expand All @@ -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);
}

/*
Expand All @@ -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;
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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);
}

Expand All @@ -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.
Expand All @@ -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;
}
}
}
Expand Down Expand Up @@ -273,7 +274,7 @@ contract MultiSigWallet {
executed: false
});
transactionCount += 1;
Submission(transactionId);
emit Submission(transactionId);
}

/*
Expand Down Expand Up @@ -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)
{
Expand All @@ -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.
Expand All @@ -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;
}
}
}
Expand Down Expand Up @@ -458,4 +459,4 @@ contract MultiSigWalletWithDailyLimit is MultiSigWallet {
return 0;
return dailyLimit - spentToday;
}
}
}