Merge pull request #26 from currymj/minor-fixes

Minor fixes
pull/25/head
Manuel Aráoz 8 years ago committed by GitHub
commit 5ec4fbeb45
  1. 5
      contracts/Bounty.sol
  2. 1
      contracts/ERC20.sol
  3. 1
      contracts/Killable.sol
  4. 1
      contracts/LimitFunds.sol
  5. 3
      contracts/Migrations.sol
  6. 3
      contracts/Ownable.sol
  7. 5
      contracts/PullPayment.sol
  8. 1
      contracts/Rejector.sol
  9. 5
      contracts/Stoppable.sol
  10. 1
      contracts/Token.sol
  11. 5
      contracts/examples/BadArrayUse.sol
  12. 1
      contracts/examples/BadFailEarly.sol
  13. 1
      contracts/examples/BadPushPayments.sol
  14. 5
      contracts/examples/GoodArrayUse.sol
  15. 2
      contracts/examples/GoodFailEarly.sol
  16. 1
      contracts/examples/GoodPullPayments.sol
  17. 2
      contracts/examples/ProofOfExistence.sol
  18. 6
      contracts/examples/PullPaymentBid.sol
  19. 8
      contracts/examples/PullPaymentExample.sol
  20. 8
      contracts/examples/StoppableBid.sol
  21. 1
      contracts/test-helpers/PullPaymentMock.sol
  22. 6
      test/PullPayment.js
  23. 1
      test/TestOwnable.sol

@ -1,4 +1,5 @@
import './PullPaymentCapable.sol';
pragma solidity ^0.4.0;
import './PullPayment.sol';
import './Token.sol';
/*
@ -7,7 +8,7 @@ import './Token.sol';
* to be lower than its totalSupply, which would mean that it doesn't
* have sufficient ether for everyone to withdraw.
*/
contract Bounty is PullPaymentCapable {
contract Bounty is PullPayment {
bool public claimed;
mapping(address => address) public researchers;

@ -1,3 +1,4 @@
pragma solidity ^0.4.0;
contract ERC20 {
function totalSupply() constant returns (uint);
function balanceOf(address who) constant returns (uint);

@ -1,3 +1,4 @@
pragma solidity ^0.4.0;
import "./Ownable.sol";
/*

@ -1,3 +1,4 @@
pragma solidity ^0.4.0;
contract LimitFunds {
uint LIMIT = 5000;

@ -1,9 +1,10 @@
pragma solidity ^0.4.0;
contract Migrations {
address public owner;
uint public last_completed_migration;
modifier restricted() {
if (msg.sender == owner) _
if (msg.sender == owner) _;
}
function Migrations() {

@ -1,3 +1,4 @@
pragma solidity ^0.4.0;
/*
* Ownable
* Base contract with an owner
@ -11,7 +12,7 @@ contract Ownable {
modifier onlyOwner() {
if (msg.sender == owner)
_
_;
}
function transfer(address newOwner) onlyOwner {

@ -1,9 +1,10 @@
pragma solidity ^0.4.0;
/*
* PullPaymentCapable
* PullPayment
* Base contract supporting async send for pull payments.
* Inherit from this contract and use asyncSend instead of send.
*/
contract PullPaymentCapable {
contract PullPayment {
mapping(address => uint) public payments;
// store sent amount as credit to be pulled, called by payer

@ -1,3 +1,4 @@
pragma solidity ^0.4.0;
/*
* Rejector
* Base contract for rejecting direct deposits.

@ -1,3 +1,4 @@
pragma solidity ^0.4.0;
/*
* Stoppable
* Abstract contract that allows children to implement an
@ -7,8 +8,8 @@ contract Stoppable {
address public curator;
bool public stopped;
modifier stopInEmergency { if (!stopped) _ }
modifier onlyInEmergency { if (stopped) _ }
modifier stopInEmergency { if (!stopped) _; }
modifier onlyInEmergency { if (stopped) _; }
function Stoppable(address _curator) {
if (_curator == 0) throw;

@ -1,3 +1,4 @@
pragma solidity ^0.4.0;
// Source: https://github.com/nexusdev/erc20
// Flat file implementation of `dappsys/token/base.sol::DSTokenBase`

@ -1,8 +1,9 @@
import '../PullPaymentCapable.sol';
pragma solidity ^0.4.0;
import '../PullPayment.sol';
// UNSAFE CODE, DO NOT USE!
contract BadArrayUse is PullPaymentCapable {
contract BadArrayUse is PullPayment {
address[] employees;
function payBonus() {

@ -1,3 +1,4 @@
pragma solidity ^0.4.0;
// UNSAFE CODE, DO NOT USE!
contract BadFailEarly {

@ -1,3 +1,4 @@
pragma solidity ^0.4.0;
// UNSAFE CODE, DO NOT USE!
contract BadPushPayments {

@ -1,6 +1,7 @@
import '../PullPaymentCapable.sol';
pragma solidity ^0.4.0;
import '../PullPayment.sol';
contract GoodArrayUse is PullPaymentCapable {
contract GoodArrayUse is PullPayment {
address[] employees;
mapping(address => uint) bonuses;

@ -1,3 +1,5 @@
pragma solidity ^0.4.0;
contract GoodFailEarly {
uint constant DEFAULT_SALARY = 50000;

@ -1,3 +1,4 @@
pragma solidity ^0.4.0;
contract GoodPullPayments {
address highestBidder;
uint highestBid;

@ -1,3 +1,5 @@
pragma solidity ^0.4.0;
import "../Rejector.sol";
/*

@ -1,6 +1,8 @@
import '../PullPaymentCapable.sol';
pragma solidity ^0.4.0;
contract PullPaymentBid is PullPaymentCapable {
import '../PullPayment.sol';
contract PullPaymentBid is PullPayment {
address public highestBidder;
uint public highestBid;

@ -1,7 +1,9 @@
import '../PullPaymentCapable.sol';
pragma solidity ^0.4.0;
// Example class using PullPaymentCapable
contract PullPaymentCapableExample is PullPaymentCapable {
import '../PullPayment.sol';
// Example class using PullPayment
contract PullPaymentExample is PullPayment {
// test helper function to call asyncSend
function callSend(address dest, uint amount) external {
asyncSend(dest, amount);

@ -1,13 +1,15 @@
import '../PullPaymentCapable.sol';
pragma solidity ^0.4.0;
import '../PullPayment.sol';
import '../Stoppable.sol';
contract StoppableBid is Stoppable, PullPaymentCapable {
contract StoppableBid is Stoppable, PullPayment {
address public highestBidder;
uint public highestBid;
function StoppableBid(address _curator)
Stoppable(_curator)
PullPaymentCapable() {}
PullPayment() {}
function bid() external stopInEmergency {
if (msg.value <= highestBid) throw;

@ -1,3 +1,4 @@
pragma solidity ^0.4.0;
import '../PullPayment.sol';
// mock class using PullPayment

@ -1,8 +1,8 @@
contract('PullPaymentCapable', function(accounts) {
contract('PullPaymentExample', function(accounts) {
it("can't call asyncSend externally", function(done) {
var ppc;
return PullPaymentCapableExample.new()
return PullPaymentExample.new()
.then(function(ppc) {
assert.isUndefined(ppc.asyncSend);
})
@ -12,7 +12,7 @@ contract('PullPaymentCapable', function(accounts) {
it("can record an async payment correctly", function(done) {
var ppce;
var AMOUNT = 100;
return PullPaymentCapableExample.new()
return PullPaymentExample.new()
.then(function(_ppce) {
ppce = _ppce;
ppce.callSend(accounts[0], AMOUNT)

@ -1,3 +1,4 @@
pragma solidity ^0.4.0;
import "truffle/Assert.sol";
import "truffle/DeployedAddresses.sol";
import "../contracts/Ownable.sol";

Loading…
Cancel
Save