rearrange folders

pull/132/head
Manuel Araoz 8 years ago
parent ac6f9288a8
commit ca8f2f2362
  1. 4
      contracts/Bounty.sol
  2. 2
      contracts/DayLimit.sol
  3. 4
      contracts/MultisigWallet.sol
  4. 23
      contracts/examples/BadArrayUse.sol
  5. 17
      contracts/examples/BadFailEarly.sol
  6. 23
      contracts/examples/BadPushPayments.sol
  7. 25
      contracts/examples/GoodArrayUse.sol
  8. 15
      contracts/examples/GoodFailEarly.sol
  9. 27
      contracts/examples/GoodPullPayments.sol
  10. 38
      contracts/examples/ProofOfExistence.sol
  11. 20
      contracts/examples/PullPaymentBid.sol
  12. 26
      contracts/examples/StoppableBid.sol
  13. 2
      contracts/lifecycle/Killable.sol
  14. 2
      contracts/lifecycle/Migrations.sol
  15. 2
      contracts/lifecycle/Stoppable.sol
  16. 0
      contracts/ownership/Claimable.sol
  17. 0
      contracts/ownership/DelayedClaimable.sol
  18. 0
      contracts/ownership/Multisig.sol
  19. 0
      contracts/ownership/Ownable.sol
  20. 0
      contracts/ownership/Shareable.sol
  21. 0
      contracts/payment/PullPayment.sol
  22. 2
      contracts/test-helpers/PullPaymentMock.sol
  23. 2
      contracts/test-helpers/ShareableMock.sol
  24. 2
      contracts/test-helpers/StoppableMock.sol

@ -1,8 +1,8 @@
pragma solidity ^0.4.4;
import './PullPayment.sol';
import './Killable.sol';
import './payment/PullPayment.sol';
import './lifecycle/Killable.sol';
/*

@ -1,7 +1,7 @@
pragma solidity ^0.4.4;
import './Shareable.sol';
import './ownership/Shareable.sol';
/*

@ -1,8 +1,8 @@
pragma solidity ^0.4.4;
import "./Multisig.sol";
import "./Shareable.sol";
import "./ownership/Multisig.sol";
import "./ownership/Shareable.sol";
import "./DayLimit.sol";

@ -1,23 +0,0 @@
pragma solidity ^0.4.4;
import '../PullPayment.sol';
// UNSAFE CODE, DO NOT USE!
contract BadArrayUse is PullPayment {
address[] employees;
function payBonus() {
for (var i = 0; i < employees.length; i++) {
address employee = employees[i];
uint bonus = calculateBonus(employee);
asyncSend(employee, bonus);
}
}
function calculateBonus(address employee) returns (uint) {
// some expensive computation...
}
}

@ -1,17 +0,0 @@
pragma solidity ^0.4.4;
// UNSAFE CODE, DO NOT USE!
contract BadFailEarly {
uint constant DEFAULT_SALARY = 50000;
mapping(string => uint) nameToSalary;
function getSalary(string name) constant returns (uint) {
if (bytes(name).length != 0 && nameToSalary[name] != 0) {
return nameToSalary[name];
} else {
return DEFAULT_SALARY;
}
}
}

@ -1,23 +0,0 @@
pragma solidity ^0.4.4;
// UNSAFE CODE, DO NOT USE!
contract BadPushPayments {
address highestBidder;
uint highestBid;
function bid() payable {
if (msg.value < highestBid) throw;
if (highestBidder != 0) {
// return bid to previous winner
if (!highestBidder.send(highestBid)) {
throw;
}
}
highestBidder = msg.sender;
highestBid = msg.value;
}
}

@ -1,25 +0,0 @@
pragma solidity ^0.4.4;
import '../PullPayment.sol';
contract GoodArrayUse is PullPayment {
address[] employees;
mapping(address => uint) bonuses;
function payBonus() {
for (uint i = 0; i < employees.length; i++) {
address employee = employees[i];
uint bonus = bonuses[employee];
asyncSend(employee, bonus);
}
}
function calculateBonus(address employee) returns (uint) {
uint bonus = 0;
// some expensive computation...
bonuses[employee] = bonus;
}
}

@ -1,15 +0,0 @@
pragma solidity ^0.4.4;
contract GoodFailEarly {
uint constant DEFAULT_SALARY = 50000;
mapping(string => uint) nameToSalary;
function getSalary(string name) constant returns (uint) {
if (bytes(name).length == 0) throw;
if (nameToSalary[name] == 0) throw;
return nameToSalary[name];
}
}

@ -1,27 +0,0 @@
pragma solidity ^0.4.4;
contract GoodPullPayments {
address highestBidder;
uint highestBid;
mapping(address => uint) refunds;
function bid() external payable {
if (msg.value < highestBid) throw;
if (highestBidder != 0) {
refunds[highestBidder] += highestBid;
}
highestBidder = msg.sender;
highestBid = msg.value;
}
function withdrawBid() external {
uint refund = refunds[msg.sender];
refunds[msg.sender] = 0;
if (!msg.sender.send(refund)) {
refunds[msg.sender] = refund;
}
}
}

@ -1,38 +0,0 @@
pragma solidity ^0.4.4;
/*
* Proof of Existence example contract
* see https://medium.com/zeppelin-blog/the-hitchhikers-guide-to-smart-contracts-in-ethereum-848f08001f05
*/
contract ProofOfExistence {
mapping (bytes32 => bool) public proofs;
// store a proof of existence in the contract state
function storeProof(bytes32 proof) {
proofs[proof] = true;
}
// calculate and store the proof for a document
function notarize(string document) {
var proof = calculateProof(document);
storeProof(proof);
}
// helper function to get a document's sha256
function calculateProof(string document) constant returns (bytes32) {
return sha256(document);
}
// check if a document has been notarized
function checkDocument(string document) constant returns (bool) {
var proof = calculateProof(document);
return hasProof(proof);
}
// returns true if proof is stored
function hasProof(bytes32 proof) constant returns (bool) {
return proofs[proof];
}
}

@ -1,20 +0,0 @@
pragma solidity ^0.4.4;
import '../PullPayment.sol';
contract PullPaymentBid is PullPayment {
address public highestBidder;
uint public highestBid;
function bid() external payable {
if (msg.value <= highestBid) throw;
if (highestBidder != 0) {
asyncSend(highestBidder, highestBid);
}
highestBidder = msg.sender;
highestBid = msg.value;
}
}

@ -1,26 +0,0 @@
pragma solidity ^0.4.4;
import '../PullPayment.sol';
import '../Stoppable.sol';
contract StoppableBid is Stoppable, PullPayment {
address public highestBidder;
uint public highestBid;
function bid() external payable stopInEmergency {
if (msg.value <= highestBid) throw;
if (highestBidder != 0) {
asyncSend(highestBidder, highestBid);
}
highestBidder = msg.sender;
highestBid = msg.value;
}
function withdraw() onlyInEmergency {
selfdestruct(owner);
}
}

@ -1,7 +1,7 @@
pragma solidity ^0.4.4;
import "./Ownable.sol";
import "../ownership/Ownable.sol";
/*

@ -1,7 +1,7 @@
pragma solidity ^0.4.4;
import './Ownable.sol';
import '../ownership/Ownable.sol';
contract Migrations is Ownable {

@ -1,7 +1,7 @@
pragma solidity ^0.4.4;
import "./Ownable.sol";
import "../ownership/Ownable.sol";
/*

@ -1,7 +1,7 @@
pragma solidity ^0.4.4;
import '../PullPayment.sol';
import '../payment/PullPayment.sol';
// mock class using PullPayment

@ -1,5 +1,5 @@
pragma solidity ^0.4.4;
import "../Shareable.sol";
import "../ownership/Shareable.sol";
contract ShareableMock is Shareable {

@ -1,7 +1,7 @@
pragma solidity ^0.4.4;
import '../Stoppable.sol';
import '../lifecycle/Stoppable.sol';
// mock class using Stoppable

Loading…
Cancel
Save