Skip to content

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
stanacton committed Jan 17, 2018
1 parent 77cfd91 commit 253ae94
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 12 deletions.
2 changes: 2 additions & 0 deletions src/bitcoin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
.idea/
2 changes: 1 addition & 1 deletion src/dapp/public/address.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"PreICO":{"address":"0x9c93e04b548f85c84f59b99a8a492a7b08432357"}}
{"PreICO":{"address":"0x7089715e4ac29a50bdade2a640d74a212064c1cd"}}
2 changes: 1 addition & 1 deletion src/truffle/contracts/DelegateOwner.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ contract DelegateOwner is Ownable {
return true;
}

function removeDelegate(address delegate) returns (bool) {
function removeDelegate(address delegate) onlyOwner returns (bool) {
delete delegates[delegate];
return true;
}
Expand Down
1 change: 1 addition & 0 deletions src/truffle/contracts/PreICO.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ contract PreICO is DelegateableOwnerToken {
}

function claimOwnership() onlyPendingOwner public {
// TODO: Check ORDER!!!!
uint256 ownerBalance = balances[owner];
balances[owner] = 0;
balances[pendingOwner] = ownerBalance;
Expand Down
4 changes: 2 additions & 2 deletions src/truffle/test/DelegateOwner.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ contract("DelegateOwner", function (accounts) {
it("should fail if it's not the owner", async function() {
var error = false;
try {
await ico.addDelegate(user, { from: account[1] });
await ico.addDelegate(user, { from: accounts[1] });
} catch(e) {
error = true;
}
Expand All @@ -47,7 +47,7 @@ contract("DelegateOwner", function (accounts) {
it("should fail if it's not the owner", async function() {
var error = false;
try {
await ico.removeDelegate(user, { from: account[1] });
await ico.removeDelegate(user, { from: accounts[1] });
} catch(e) {
error = true;
}
Expand Down
4 changes: 2 additions & 2 deletions src/truffle/test/DelegateableOwnerToken.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ contract("DelegatableOwnerToken", function (accounts) {
it("should fail if it's not the owner", async function() {
var error = false;
try {
await ico.addDelegate(user, { from: account[1] });
await ico.addDelegate(user, { from: accounts[1] });
} catch(e) {
error = true;
}
Expand All @@ -48,7 +48,7 @@ contract("DelegatableOwnerToken", function (accounts) {
it("should fail if it's not the owner", async function() {
var error = false;
try {
await ico.removeDelegate(user, { from: account[1] });
await ico.removeDelegate(user, { from: accounts[1] });
} catch(e) {
error = true;
}
Expand Down
15 changes: 9 additions & 6 deletions src/truffle/test/Whitelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,19 +118,22 @@ contract("Whitelist", function(accounts) {

it("should fail calling transfer", async function () {
var error = false;
await ico.enableWhitelist({ from: owner });
await ico.removeFromWhitelist(userAddress);
try {
ico.transfer(account[3], 33, { from: userAddress });
await ico.transfer(accounts[3], 33, { from: userAddress });
console.log("I did ok");
} catch(e) {
error = true;
}

assert.isTrue(error, "an exception should have been thrown");
});

it("should fail calling transferFrom", async function () {
var error = false;
try {
ico.transferFrom(account[3], account[3], 33, { from: userAddress });
await ico.transferFrom(accounts[3], accounts[3], 33, { from: userAddress });
} catch(e) {
error = true;
}
Expand All @@ -141,7 +144,7 @@ contract("Whitelist", function(accounts) {
it("should fail calling approve", async function () {
var error = false;
try {
ico.transferFrom(account[3], 33, { from: userAddress });
await ico.transferFrom(accounts[3], 33, { from: userAddress });
} catch(e) {
error = true;
}
Expand All @@ -152,7 +155,7 @@ contract("Whitelist", function(accounts) {
it("should fail calling increaseApproval", async function () {
var error = false;
try {
ico.increaseApproval(account[3], 33, { from: userAddress });
await ico.increaseApproval(accounts[3], 33, { from: userAddress });
} catch(e) {
error = true;
}
Expand All @@ -163,7 +166,7 @@ contract("Whitelist", function(accounts) {
it("should fail calling decreaseApproval", async function () {
var error = false;
try {
ico.decreaseApproval(account[3], 33, { from: userAddress });
await ico.decreaseApproval(accounts[3], 33, { from: userAddress });
} catch(e) {
error = true;
}
Expand Down

0 comments on commit 253ae94

Please sign in to comment.