Commit 5ec4fbeb by Manuel Aráoz Committed by GitHub

Merge pull request #26 from currymj/minor-fixes

Minor fixes
parents 570d6cb9 a9d030ac
import './PullPaymentCapable.sol'; pragma solidity ^0.4.0;
import './PullPayment.sol';
import './Token.sol'; import './Token.sol';
/* /*
...@@ -7,7 +8,7 @@ import './Token.sol'; ...@@ -7,7 +8,7 @@ import './Token.sol';
* to be lower than its totalSupply, which would mean that it doesn't * to be lower than its totalSupply, which would mean that it doesn't
* have sufficient ether for everyone to withdraw. * have sufficient ether for everyone to withdraw.
*/ */
contract Bounty is PullPaymentCapable { contract Bounty is PullPayment {
bool public claimed; bool public claimed;
mapping(address => address) public researchers; mapping(address => address) public researchers;
......
pragma solidity ^0.4.0;
contract ERC20 { contract ERC20 {
function totalSupply() constant returns (uint); function totalSupply() constant returns (uint);
function balanceOf(address who) constant returns (uint); function balanceOf(address who) constant returns (uint);
......
pragma solidity ^0.4.0;
import "./Ownable.sol"; import "./Ownable.sol";
/* /*
......
pragma solidity ^0.4.0;
contract LimitFunds { contract LimitFunds {
uint LIMIT = 5000; uint LIMIT = 5000;
......
pragma solidity ^0.4.0;
contract Migrations { contract Migrations {
address public owner; address public owner;
uint public last_completed_migration; uint public last_completed_migration;
modifier restricted() { modifier restricted() {
if (msg.sender == owner) _ if (msg.sender == owner) _;
} }
function Migrations() { function Migrations() {
......
pragma solidity ^0.4.0;
/* /*
* Ownable * Ownable
* Base contract with an owner * Base contract with an owner
...@@ -11,7 +12,7 @@ contract Ownable { ...@@ -11,7 +12,7 @@ contract Ownable {
modifier onlyOwner() { modifier onlyOwner() {
if (msg.sender == owner) if (msg.sender == owner)
_ _;
} }
function transfer(address newOwner) onlyOwner { function transfer(address newOwner) onlyOwner {
......
pragma solidity ^0.4.0;
/* /*
* PullPaymentCapable * PullPayment
* Base contract supporting async send for pull payments. * Base contract supporting async send for pull payments.
* Inherit from this contract and use asyncSend instead of send. * Inherit from this contract and use asyncSend instead of send.
*/ */
contract PullPaymentCapable { contract PullPayment {
mapping(address => uint) public payments; mapping(address => uint) public payments;
// store sent amount as credit to be pulled, called by payer // store sent amount as credit to be pulled, called by payer
......
pragma solidity ^0.4.0;
/* /*
* Rejector * Rejector
* Base contract for rejecting direct deposits. * Base contract for rejecting direct deposits.
......
pragma solidity ^0.4.0;
/* /*
* Stoppable * Stoppable
* Abstract contract that allows children to implement an * Abstract contract that allows children to implement an
...@@ -7,8 +8,8 @@ contract Stoppable { ...@@ -7,8 +8,8 @@ contract Stoppable {
address public curator; address public curator;
bool public stopped; bool public stopped;
modifier stopInEmergency { if (!stopped) _ } modifier stopInEmergency { if (!stopped) _; }
modifier onlyInEmergency { if (stopped) _ } modifier onlyInEmergency { if (stopped) _; }
function Stoppable(address _curator) { function Stoppable(address _curator) {
if (_curator == 0) throw; if (_curator == 0) throw;
......
pragma solidity ^0.4.0;
// Source: https://github.com/nexusdev/erc20 // Source: https://github.com/nexusdev/erc20
// Flat file implementation of `dappsys/token/base.sol::DSTokenBase` // Flat file implementation of `dappsys/token/base.sol::DSTokenBase`
......
import '../PullPaymentCapable.sol'; pragma solidity ^0.4.0;
import '../PullPayment.sol';
// UNSAFE CODE, DO NOT USE! // UNSAFE CODE, DO NOT USE!
contract BadArrayUse is PullPaymentCapable { contract BadArrayUse is PullPayment {
address[] employees; address[] employees;
function payBonus() { function payBonus() {
......
pragma solidity ^0.4.0;
// UNSAFE CODE, DO NOT USE! // UNSAFE CODE, DO NOT USE!
contract BadFailEarly { contract BadFailEarly {
......
pragma solidity ^0.4.0;
// UNSAFE CODE, DO NOT USE! // UNSAFE CODE, DO NOT USE!
contract BadPushPayments { contract BadPushPayments {
......
import '../PullPaymentCapable.sol'; pragma solidity ^0.4.0;
import '../PullPayment.sol';
contract GoodArrayUse is PullPaymentCapable { contract GoodArrayUse is PullPayment {
address[] employees; address[] employees;
mapping(address => uint) bonuses; mapping(address => uint) bonuses;
......
pragma solidity ^0.4.0;
contract GoodFailEarly { contract GoodFailEarly {
uint constant DEFAULT_SALARY = 50000; uint constant DEFAULT_SALARY = 50000;
......
pragma solidity ^0.4.0;
contract GoodPullPayments { contract GoodPullPayments {
address highestBidder; address highestBidder;
uint highestBid; uint highestBid;
......
pragma solidity ^0.4.0;
import "../Rejector.sol"; import "../Rejector.sol";
/* /*
......
import '../PullPaymentCapable.sol'; pragma solidity ^0.4.0;
contract PullPaymentBid is PullPaymentCapable { import '../PullPayment.sol';
contract PullPaymentBid is PullPayment {
address public highestBidder; address public highestBidder;
uint public highestBid; uint public highestBid;
......
import '../PullPaymentCapable.sol'; pragma solidity ^0.4.0;
// Example class using PullPaymentCapable import '../PullPayment.sol';
contract PullPaymentCapableExample is PullPaymentCapable {
// Example class using PullPayment
contract PullPaymentExample is PullPayment {
// test helper function to call asyncSend // test helper function to call asyncSend
function callSend(address dest, uint amount) external { function callSend(address dest, uint amount) external {
asyncSend(dest, amount); asyncSend(dest, amount);
......
import '../PullPaymentCapable.sol'; pragma solidity ^0.4.0;
import '../PullPayment.sol';
import '../Stoppable.sol'; import '../Stoppable.sol';
contract StoppableBid is Stoppable, PullPaymentCapable { contract StoppableBid is Stoppable, PullPayment {
address public highestBidder; address public highestBidder;
uint public highestBid; uint public highestBid;
function StoppableBid(address _curator) function StoppableBid(address _curator)
Stoppable(_curator) Stoppable(_curator)
PullPaymentCapable() {} PullPayment() {}
function bid() external stopInEmergency { function bid() external stopInEmergency {
if (msg.value <= highestBid) throw; if (msg.value <= highestBid) throw;
......
pragma solidity ^0.4.0;
import '../PullPayment.sol'; import '../PullPayment.sol';
// mock class using PullPayment // mock class using PullPayment
......
contract('PullPaymentCapable', function(accounts) { contract('PullPaymentExample', function(accounts) {
it("can't call asyncSend externally", function(done) { it("can't call asyncSend externally", function(done) {
var ppc; var ppc;
return PullPaymentCapableExample.new() return PullPaymentExample.new()
.then(function(ppc) { .then(function(ppc) {
assert.isUndefined(ppc.asyncSend); assert.isUndefined(ppc.asyncSend);
}) })
...@@ -12,7 +12,7 @@ contract('PullPaymentCapable', function(accounts) { ...@@ -12,7 +12,7 @@ contract('PullPaymentCapable', function(accounts) {
it("can record an async payment correctly", function(done) { it("can record an async payment correctly", function(done) {
var ppce; var ppce;
var AMOUNT = 100; var AMOUNT = 100;
return PullPaymentCapableExample.new() return PullPaymentExample.new()
.then(function(_ppce) { .then(function(_ppce) {
ppce = _ppce; ppce = _ppce;
ppce.callSend(accounts[0], AMOUNT) ppce.callSend(accounts[0], AMOUNT)
......
pragma solidity ^0.4.0;
import "truffle/Assert.sol"; import "truffle/Assert.sol";
import "truffle/DeployedAddresses.sol"; import "truffle/DeployedAddresses.sol";
import "../contracts/Ownable.sol"; import "../contracts/Ownable.sol";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment