Bläddra i källkod

limitfunds and fixes

Manuel Araoz 9 år sedan
förälder
incheckning
fa8fd3044b
4 ändrade filer med 16 tillägg och 12 borttagningar
  1. 2 6
      contracts/Bounty.sol
  2. 2 6
      contracts/GoodFailEarly.sol
  3. 11 0
      contracts/LimitFunds.sol
  4. 1 0
      migrations/2_deploy_contracts.js

+ 2 - 6
contracts/Bounty.sol

@@ -13,9 +13,7 @@ contract Bounty is PullPaymentCapable {
   mapping(address => address) public researchers;
 
   function() {
-    if (claimed) {
-      throw;
-    }
+    if (claimed) throw;
   }
 
   function createTarget() returns(Token) {
@@ -26,9 +24,7 @@ contract Bounty is PullPaymentCapable {
 
   function claim(Token target) {
     address researcher = researchers[target];
-    if (researcher == 0) {
-      throw;
-    }
+    if (researcher == 0) throw;
     // check Token contract invariants
     if (target.totalSupply() == target.balance) {
       throw;

+ 2 - 6
contracts/GoodFailEarly.sol

@@ -4,12 +4,8 @@ contract GoodFailEarly {
   mapping(string => uint) nameToSalary;
 
   function getSalary(string name) constant returns (uint) {
-    if (bytes(name).length == 0) {
-      throw;
-    }
-    if (nameToSalary[name] == 0) {
-      throw;
-    }
+    if (bytes(name).length == 0) throw;
+    if (nameToSalary[name] == 0) throw;
 
     return nameToSalary[name];
   }

+ 11 - 0
contracts/LimitFunds.sol

@@ -0,0 +1,11 @@
+contract LimitFunds {
+
+  uint LIMIT = 5000;
+
+  function() { throw; }
+
+  function deposit() {
+    if (this.balance > LIMIT) throw;
+  }
+
+}

+ 1 - 0
migrations/2_deploy_contracts.js

@@ -2,4 +2,5 @@ module.exports = function(deployer) {
   deployer.deploy(PullPaymentBid);
   deployer.deploy(BadArrayUse);
   deployer.deploy(Bounty);
+  deployer.deploy(LimitFunds);
 };