From cb93d544465973590391d0b07092bb6aeb5042c6 Mon Sep 17 00:00:00 2001 From: Jordi Baylina Date: Tue, 23 May 2017 20:41:48 +0200 Subject: [PATCH] Fix tests for prices changed --- contracts/DynamicCeiling.sol | 5 ++--- migrations/1_initial_migration.js | 5 +++++ test/contribution.js | 10 +++++----- 3 files changed, 12 insertions(+), 8 deletions(-) create mode 100644 migrations/1_initial_migration.js diff --git a/contracts/DynamicCeiling.sol b/contracts/DynamicCeiling.sol index 91e0aba..102b079 100644 --- a/contracts/DynamicCeiling.sol +++ b/contracts/DynamicCeiling.sol @@ -37,7 +37,7 @@ contract DynamicCeiling is SafeMath { bool revealed; } - address creator; + address public creator; uint public revealedPoints; bool public allRevealed; CurvePoint[] public points; @@ -55,9 +55,8 @@ contract DynamicCeiling is SafeMath { function setHiddenPoints(bytes32[] _pointHashes) { if (msg.sender != creator) throw; if (points.length > 0) throw; - uint i; points.length = _pointHashes.length; - for (i=0; i< _pointHashes.length; i = safeAdd(i,1)) { + for (uint i=0; i< _pointHashes.length; i = safeAdd(i,1)) { points[i].hash = _pointHashes[i]; } } diff --git a/migrations/1_initial_migration.js b/migrations/1_initial_migration.js new file mode 100644 index 0000000..4d5f3f9 --- /dev/null +++ b/migrations/1_initial_migration.js @@ -0,0 +1,5 @@ +var Migrations = artifacts.require("./Migrations.sol"); + +module.exports = function(deployer) { + deployer.deploy(Migrations); +}; diff --git a/test/contribution.js b/test/contribution.js index 33e5074..af3e729 100644 --- a/test/contribution.js +++ b/test/contribution.js @@ -124,7 +124,7 @@ contract("StatusContribution", (accounts) => { const balance = await snt.balanceOf(accounts[ 0 ]); - assert.equal(web3.fromWei(balance).toNumber(), 1000); + assert.equal(web3.fromWei(balance).toNumber(), 10000); }); it("Should return the remaining in the last transaction ", async () => { @@ -185,7 +185,7 @@ contract("StatusContribution", (accounts) => { const balance1 = await snt.balanceOf(accounts[ 1 ]); - assert.equal(web3.fromWei(balance1), 7000); + assert.equal(web3.fromWei(balance1).toNumber(), 70000); const spended = web3.fromWei(initailBalance.sub(finalBalance)).toNumber(); assert.isAbove(spended, 7); @@ -213,8 +213,8 @@ contract("StatusContribution", (accounts) => { const balance7 = await snt.balanceOf(accounts[ 7 ]); const balance8 = await snt.balanceOf(accounts[ 8 ]); - assert.equal(web3.fromWei(balance7).toNumber(), 1000); - assert.equal(web3.fromWei(balance8).toNumber(), 2000); + assert.equal(web3.fromWei(balance7).toNumber(), 10000); + assert.equal(web3.fromWei(balance8).toNumber(), 20000); }); it("Should finalize", async () => { @@ -222,7 +222,7 @@ contract("StatusContribution", (accounts) => { const totalSupply = await snt.totalSupply(); - assert.equal(web3.fromWei(totalSupply).toNumber(), 18000 / 0.46); + assert.isBelow(web3.fromWei(totalSupply).toNumber() - (180000 / 0.46), 0.01); const balanceSGT = await snt.balanceOf(sgtExchanger.address); assert.equal(balanceSGT.toNumber(), totalSupply.mul(0.05).toNumber());