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

Minor updates #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
13 changes: 6 additions & 7 deletions contracts/Bounty.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.4;
pragma solidity ^0.4.11;


import './payment/PullPayment.sol';
Expand All @@ -7,7 +7,7 @@ import './lifecycle/Killable.sol';

/*
* Bounty
*
*
* This bounty will pay out to a researcher if they break invariant logic of the contract.
*/
contract Bounty is PullPayment, Killable {
Expand All @@ -18,7 +18,7 @@ contract Bounty is PullPayment, Killable {
event TargetCreated(address createdAddress);

function() payable {
if (claimed) throw;
if (claimed) revert();
}

function createTarget() returns(Target) {
Expand All @@ -36,10 +36,10 @@ contract Bounty is PullPayment, Killable {

function claim(Target target) {
address researcher = researchers[target];
if (researcher == 0) throw;
if (researcher == 0) revert();
// Check Target contract invariants
if (target.checkInvariant()) {
throw;
revert();
}
asyncSend(researcher, this.balance);
claimed = true;
Expand All @@ -49,10 +49,9 @@ contract Bounty is PullPayment, Killable {

/*
* Target
*
*
* Your main contract should inherit from this class and implement the checkInvariant method. This is a function that should check everything your contract assumes to be true all the time. If this function returns false, it means your contract was broken in some way and is in an inconsistent state. This is what security researchers will try to acomplish when trying to get the bounty.
*/
contract Target {
function checkInvariant() returns(bool);
}

2 changes: 1 addition & 1 deletion contracts/ConvertLib.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.2;
pragma solidity ^0.4.11;

library ConvertLib{
function convert(uint amount,uint conversionRate) returns (uint convertedAmount)
Expand Down
2 changes: 1 addition & 1 deletion contracts/DayLimit.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.4;
pragma solidity ^0.4.11;


import './ownership/Shareable.sol';
Expand Down
30 changes: 15 additions & 15 deletions contracts/EscrowAdvansed.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.2;
pragma solidity ^0.4.11;


/**
Expand Down Expand Up @@ -101,13 +101,13 @@ uint16 constant internal Canceled = 2;
//--MODIFIERS---------------------------
modifier onlyOwner {
if (msg.sender != seller)
throw;
revert();
_;
}

modifier onlyArbiter {
if (msg.sender != arbiter)
throw;
revert();
_;
}
//---------------------------------------
Expand Down Expand Up @@ -167,11 +167,11 @@ function EscrowAdvansed(address _arbiter, uint _freezePeriod, uint _feePromille,
// PITFALL - probably need to change addr.call to addr.send ... ?
function safeSend(address addr, uint value) internal {

if(atomicLock) throw;
if(atomicLock) revert();
atomicLock = true;
if (!(addr.call.gas(safeGas).value(value)())) {
atomicLock = false;
throw;
revert();
}
atomicLock = false;
}
Expand Down Expand Up @@ -408,23 +408,23 @@ function start(uint _lockId, string _dataInfo, uint _version) payable {

//reject money transfers for bad status

if(status != Available) throw;
if(status != Available) revert();

if(feePromille > 1000) throw;
if(rewardPromille > 1000) throw;
if((feePromille + rewardPromille) > 1000) throw;
if(feePromille > 1000) revert();
if(rewardPromille > 1000) revert();
if((feePromille + rewardPromille) > 1000) revert();

//create default EscrowInfo struct or access existing
EscrowInfo info = escrows[_lockId];

//lock only once for a given id
if(info.lockedFunds > 0) throw;
if(info.lockedFunds > 0) revert();

//lock funds

uint fee = (msg.value * feePromille) / 1000;
//limit fees
if(fee > msg.value) throw;
if(fee > msg.value) revert();

uint funds = (msg.value - fee);
feeFunds += fee;
Expand Down Expand Up @@ -453,7 +453,7 @@ function accept(uint _lockId, string _dataInfo, uint _version) onlyOwner {

EscrowInfo info = escrows[_lockId];

// Here is could be rule for auto-accept or auto-throw
// Here is could be rule for auto-accept or auto-revert()


//Accept order to event log
Expand All @@ -463,7 +463,7 @@ function accept(uint _lockId, string _dataInfo, uint _version) onlyOwner {
function done(uint _lockId, string _dataInfo, uint _version) onlyOwner{

EscrowInfo info = escrows[_lockId];

LogEvent(_lockId, _dataInfo, _version, Done, msg.sender, info.lockedFunds);
}

Expand All @@ -472,7 +472,7 @@ function reject(uint _lockId, string _dataInfo, uint _version) onlyOwner {

EscrowInfo info = escrows[_lockId];

// Here is could be rule for auto-reject or auto-throw
// Here is could be rule for auto-reject or auto-revert()



Expand Down Expand Up @@ -505,7 +505,7 @@ function stop() {

//fallback function deny any deposits to contract
function () {
throw;
revert();
}


Expand Down
6 changes: 3 additions & 3 deletions contracts/EscrowSimple.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.2;
pragma solidity ^0.4.11;

/**

Expand Down Expand Up @@ -34,14 +34,14 @@ contract EscrowSimple {
//make payment to seller
function payoutToSeller() {
if(msg.sender == buyer || msg.sender == arbiter) {
if(!seller.send(this.balance)) throw;
if(!seller.send(this.balance)) revert();
}
}

//refund transaction
function refundToBuyer() {
if(msg.sender == seller || msg.sender == arbiter) {
if(!buyer.send(this.balance)) throw;
if(!buyer.send(this.balance)) revert();
}
}

Expand Down
8 changes: 4 additions & 4 deletions contracts/LimitBalance.sol
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
pragma solidity ^0.4.4;
pragma solidity ^0.4.11;


/**
* LimitBalance
* Simple contract to limit the balance of child contract.
* Note this doesn't prevent other contracts to send funds
* Note this doesn't prevent other contracts to send funds
* by using selfdestruct(address);
* See: https://github.com/ConsenSys/smart-contract-best-practices#remember-that-ether-can-be-forcibly-sent-to-an-account
*/
Expand All @@ -16,11 +16,11 @@ contract LimitBalance {
limit = _limit;
}

modifier limitedPayable() {
modifier limitedPayable() {
if (this.balance <= limit)
_;
else
throw;
revert();
}

}
2 changes: 1 addition & 1 deletion contracts/MetaCoin.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.2;
pragma solidity ^0.4.11;

import "./ConvertLib.sol";

Expand Down
6 changes: 3 additions & 3 deletions contracts/MultisigWallet.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.4;
pragma solidity ^0.4.11;


import "./ownership/Multisig.sol";
Expand Down Expand Up @@ -56,7 +56,7 @@ contract MultisigWallet is Multisig, Shareable, DayLimit {
SingleTransact(msg.sender, _value, _to, _data);
// yes - just execute the call.
if (!_to.call.value(_value)(_data)) {
throw;
revert();
}
return 0;
}
Expand All @@ -75,7 +75,7 @@ contract MultisigWallet is Multisig, Shareable, DayLimit {
function confirm(bytes32 _h) onlymanyowners(_h) returns (bool) {
if (txs[_h].to != 0) {
if (!txs[_h].to.call.value(txs[_h].value)(txs[_h].data)) {
throw;
revert();
}
MultiTransact(msg.sender, _h, txs[_h].value, txs[_h].to, txs[_h].data);
delete txs[_h];
Expand Down
5 changes: 2 additions & 3 deletions contracts/SafeMath.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.4;
pragma solidity ^0.4.11;


/**
Expand All @@ -23,7 +23,6 @@ contract SafeMath {
}

function assert(bool assertion) internal {
if (!assertion) throw;
if (!assertion) revert();
}
}

Loading