From 55ad0385ce5c6ab4cdc018569c94c85606299569 Mon Sep 17 00:00:00 2001 From: Andy Tudhope Date: Thu, 11 Apr 2019 17:24:53 +0200 Subject: [PATCH] Adds overflow test and better protection given limitations --- test/dappstore_spec.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/dappstore_spec.js b/test/dappstore_spec.js index 2a2645a..5408b60 100644 --- a/test/dappstore_spec.js +++ b/test/dappstore_spec.js @@ -630,7 +630,8 @@ contract("DAppStore", function () { let max = await DAppStore.methods.max().call(); // Choose a safeMax 1% higher than is currently set let safe = await DAppStore.methods.safeMax().call(); - let amount = parseInt(max, 10) * (parseInt(safe, 10) + 1); + let percent = (safe/max * 100) + 1; + let amount = parseInt(max, 10) * percent; await SNT.methods.generateTokens(accounts[0], amount).send(); const encodedCall = DAppStore.methods.createDApp(id,amount).encodeABI();