From e33ff86c290097c41840d386de77a478b7a4210a Mon Sep 17 00:00:00 2001 From: Henry Harder Date: Wed, 28 Aug 2019 12:32:31 -0700 Subject: [PATCH 01/13] fix curve parameterization --- packages/kosu-system-contracts/contracts/lib/KosuToken.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/kosu-system-contracts/contracts/lib/KosuToken.sol b/packages/kosu-system-contracts/contracts/lib/KosuToken.sol index 614af287..17b501c5 100644 --- a/packages/kosu-system-contracts/contracts/lib/KosuToken.sol +++ b/packages/kosu-system-contracts/contracts/lib/KosuToken.sol @@ -14,7 +14,7 @@ contract KosuToken is ERC20, Authorizable { string public symbol = "KOSU"; uint8 public decimals = 18; uint private _weiPaid = 0; - uint32 constant private r = 850000; // ppm + uint32 constant private r = 290000; // ppm /** @dev Deploy a new ERC20 Token @notice Deploy a new ERC20 Token From 55cc43a55570a44fdfc65578fd4d3f917a25e224 Mon Sep 17 00:00:00 2001 From: Henry Harder Date: Wed, 28 Aug 2019 12:32:55 -0700 Subject: [PATCH 02/13] separate scripts for delivering tokens --- packages/kosu-system-contracts/package.json | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/kosu-system-contracts/package.json b/packages/kosu-system-contracts/package.json index b4a8cb8c..9a7e98bf 100644 --- a/packages/kosu-system-contracts/package.json +++ b/packages/kosu-system-contracts/package.json @@ -22,14 +22,16 @@ "lint": "tslint -p .", "truffle:clean": "shx rm -rf build/contracts", "contracts:clean": "shx rm -rf generated-artifacts generated-wrappers", + "deliver:kosu:zaidan": "ts-node --files src/bin/deliver_tokens.ts --test-mnemonic --rpc-url=https://ethnet.zaidan.io/kosu", + "deliver:kosu:ci": "ts-node --files src/bin/deliver_tokens.ts --test-mnemonic --rpc-url=${WEB3_URI}", "deploy:ropsten": "ts-node -T src/bin/migrate.ts --rpc-url=https://eth-ropsten.alchemyapi.io/jsonrpc/KUnSgCMXUSlgavPAznIBDCKhPhpgk8XA", - "deploy:kosu": "ts-node -T src/bin/migrate.ts --test-mnemonic --rpc-url=https://ethnet.zaidan.io/kosu && ts-node --files src/bin/deliver_tokens.ts --test-mnemonic --rpc-url=https://ethnet.zaidan.io/kosu && yarn prettier:deployedAddresses", - "deploy:kosu:ci": "ts-node -T src/bin/migrate.ts --test-mnemonic --rpc-url=${WEB3_URI} && ts-node --files src/bin/deliver_tokens.ts --test-mnemonic --rpc-url=${WEB3_URI} && yarn prettier:deployedAddresses", - "deploy:0x:kosu": "0x-migrate --rpc-url https://ethnet.zaidan.io/kosu --from 0x5409ED021D9299bf6814279A6A1411A7e866A631", - "deploy:0x:kosu:ci": "0x-migrate --rpc-url ${WEB3_URI} --from 0x5409ed021d9299bf6814279a6a1411a7e866a631", + "deploy:kosu:zaidan": "ts-node -T src/bin/migrate.ts --test-mnemonic --rpc-url=https://ethnet.zaidan.io/kosu && yarn prettier:deployedAddresses", + "deploy:kosu:ci": "ts-node -T src/bin/migrate.ts --test-mnemonic --rpc-url=${WEB3_URI} && yarn prettier:deployedAddresses", + "deploy:0x:zaidan": "0x-migrate --rpc-url https://ethnet.zaidan.io/kosu --from 0x5409ED021D9299bf6814279A6A1411A7e866A631", + "deploy:0x:ci": "0x-migrate --rpc-url ${WEB3_URI} --from 0x5409ed021d9299bf6814279a6a1411a7e866a631", "migrate:ropsten": "run-s deploy:ropsten generate:readme", - "migrate:zaidan": "run-s deploy:kosu deploy:0x:kosu generate:readme", - "migrate:ci": "run-s deploy:kosu:ci deploy:0x:kosu:ci", + "migrate:zaidan": "run-s deploy:kosu:zaidan deploy:0x:zaidan generate:readme deliver:kosu:zaidan", + "migrate:ci": "run-s deploy:kosu:ci deploy:0x:ci deliver:kosu:ci", "prettier:deployedAddresses": "prettier --write src/deployedAddresses.json --config ../../.prettierrc", "ganache_rpc": "docker run --rm -p 8545:8545 ${npm_package_config_kosu_ganache_image}", "ganache_rpc:detached": "docker run --rm -d -p 8545:8545 ${npm_package_config_kosu_ganache_image}", @@ -90,4 +92,4 @@ "tsconfig.json", "tslint.json" ] -} +} \ No newline at end of file From 3abd65963ec2ec967f2343d477c9dc473a5a4154 Mon Sep 17 00:00:00 2001 From: Nick Freyaldenhoven Date: Wed, 28 Aug 2019 14:48:51 -0500 Subject: [PATCH 03/13] Refactoring to have non parameterization tests use the global token --- .../kosu-system-contracts/test/kosu_token.ts | 62 ++++++++++--------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/packages/kosu-system-contracts/test/kosu_token.ts b/packages/kosu-system-contracts/test/kosu_token.ts index 353b32b3..c32c2b88 100644 --- a/packages/kosu-system-contracts/test/kosu_token.ts +++ b/packages/kosu-system-contracts/test/kosu_token.ts @@ -4,7 +4,7 @@ import { fromWei } from "web3-utils"; import { artifacts, KosuTokenContract } from ".."; describe("KosuToken", () => { - let token, from; + let token, from, kosuToken; before(async () => { token = await KosuTokenContract.deployFrom0xArtifactAsync( @@ -14,6 +14,7 @@ describe("KosuToken", () => { "0x0000000000000000000000000000000000000000", ); from = accounts[0]; + kosuToken = contracts.kosuToken; }); describe("bonding", () => { @@ -40,20 +41,21 @@ describe("KosuToken", () => { .should.eq(endingEther.toString()); }); + describe("fallback", () => { it("should generate tokens with fallback function", async () => { - const startingBalance = await token.balanceOf.callAsync(from); - const startingSupply = await token.totalSupply.callAsync(); - const startingEther = await web3Wrapper.getBalanceInWeiAsync(token.address); - const estimate = await token.estimateEtherToToken.callAsync(TestValues.oneEther); + const startingBalance = await kosuToken.balanceOf.callAsync(from); + const startingSupply = await kosuToken.totalSupply.callAsync(); + const startingEther = await web3Wrapper.getBalanceInWeiAsync(kosuToken.address); + const estimate = await kosuToken.estimateEtherToToken.callAsync(TestValues.oneEther); await web3Wrapper - .sendTransactionAsync({ to: token.address, value: TestValues.oneEther, from }) + .sendTransactionAsync({ to: kosuToken.address, value: TestValues.oneEther, from }) .then(txHash => web3Wrapper.awaitTransactionSuccessAsync(txHash)); - const finalBalance = await token.balanceOf.callAsync(from); - const finalSupply = await token.totalSupply.callAsync(); - const endingEther = await web3Wrapper.getBalanceInWeiAsync(token.address); + const finalBalance = await kosuToken.balanceOf.callAsync(from); + const finalSupply = await kosuToken.totalSupply.callAsync(); + const endingEther = await web3Wrapper.getBalanceInWeiAsync(kosuToken.address); startingBalance .plus(estimate) @@ -71,17 +73,17 @@ describe("KosuToken", () => { }); describe("bondTokens", () => { - it("should generate tokens with fallback function", async () => { - const startingBalance = await token.balanceOf.callAsync(from); - const startingSupply = await token.totalSupply.callAsync(); - const startingEther = await web3Wrapper.getBalanceInWeiAsync(token.address); - const estimate = await token.estimateEtherToToken.callAsync(TestValues.oneEther); + it("should generate tokens with bondTokens", async () => { + const startingBalance = await kosuToken.balanceOf.callAsync(from); + const startingSupply = await kosuToken.totalSupply.callAsync(); + const startingEther = await web3Wrapper.getBalanceInWeiAsync(kosuToken.address); + const estimate = await kosuToken.estimateEtherToToken.callAsync(TestValues.oneEther); - await token.bondTokens.awaitTransactionSuccessAsync(TestValues.zero, { value: TestValues.oneEther }); + await kosuToken.bondTokens.awaitTransactionSuccessAsync(TestValues.zero, { value: TestValues.oneEther }); - const finalBalance = await token.balanceOf.callAsync(from); - const finalSupply = await token.totalSupply.callAsync(); - const endingEther = await web3Wrapper.getBalanceInWeiAsync(token.address); + const finalBalance = await kosuToken.balanceOf.callAsync(from); + const finalSupply = await kosuToken.totalSupply.callAsync(); + const endingEther = await web3Wrapper.getBalanceInWeiAsync(kosuToken.address); startingBalance .plus(estimate) @@ -100,16 +102,16 @@ describe("KosuToken", () => { describe("releaseTokens", () => { it("should sell tokens on the curve", async () => { - const startingBalance = await token.balanceOf.callAsync(from); - const startingSupply = await token.totalSupply.callAsync(); - const startingEther = await web3Wrapper.getBalanceInWeiAsync(token.address); - const estimate = await token.estimateTokenToEther.callAsync(TestValues.oneEther); + const startingBalance = await kosuToken.balanceOf.callAsync(from); + const startingSupply = await kosuToken.totalSupply.callAsync(); + const startingEther = await web3Wrapper.getBalanceInWeiAsync(kosuToken.address); + const estimate = await kosuToken.estimateTokenToEther.callAsync(TestValues.oneEther); - await token.releaseTokens.awaitTransactionSuccessAsync(TestValues.oneEther); + await kosuToken.releaseTokens.awaitTransactionSuccessAsync(TestValues.oneEther); - const finalBalance = await token.balanceOf.callAsync(from); - const finalSupply = await token.totalSupply.callAsync(); - const endingEther = await web3Wrapper.getBalanceInWeiAsync(token.address); + const finalBalance = await kosuToken.balanceOf.callAsync(from); + const finalSupply = await kosuToken.totalSupply.callAsync(); + const endingEther = await web3Wrapper.getBalanceInWeiAsync(kosuToken.address); startingBalance .minus(TestValues.oneEther) @@ -126,11 +128,11 @@ describe("KosuToken", () => { }); it("should empty the contract", async () => { - await token.releaseTokens.awaitTransactionSuccessAsync(await token.balanceOf.callAsync(from)); + await kosuToken.releaseTokens.awaitTransactionSuccessAsync(await kosuToken.balanceOf.callAsync(from)); - const finalBalance = await token.balanceOf.callAsync(from); - const finalSupply = await token.totalSupply.callAsync(); - const endingEther = await web3Wrapper.getBalanceInWeiAsync(token.address); + const finalBalance = await kosuToken.balanceOf.callAsync(from); + const finalSupply = await kosuToken.totalSupply.callAsync(); + const endingEther = await web3Wrapper.getBalanceInWeiAsync(kosuToken.address); "0".should.eq(finalBalance.toString()); "0".should.eq(finalSupply.toString()); From ec92e7d41a5aa5e72827f77b444c70d090a8618c Mon Sep 17 00:00:00 2001 From: Nick Freyaldenhoven Date: Wed, 28 Aug 2019 15:19:33 -0500 Subject: [PATCH 04/13] Adding token config validation. --- .../src/test-helpers/test_values.ts | 1 + .../kosu-system-contracts/test/init_test.ts | 1 + .../kosu-system-contracts/test/kosu_token.ts | 35 ++++++++++++++++++- 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/packages/kosu-system-contracts/src/test-helpers/test_values.ts b/packages/kosu-system-contracts/src/test-helpers/test_values.ts index bfb68ea7..8c7b2546 100644 --- a/packages/kosu-system-contracts/src/test-helpers/test_values.ts +++ b/packages/kosu-system-contracts/src/test-helpers/test_values.ts @@ -13,6 +13,7 @@ export const TestValues = { sixEther: new BigNumber(toWei("6")), tenEther: new BigNumber(toWei("10")), oneHundredEther: new BigNumber(toWei("100")), + fourHundredEther: new BigNumber(toWei("400")), fiveHundredEther: new BigNumber(toWei("500")), maxUint: new BigNumber(2).pow(new BigNumber(256)).minus(new BigNumber(1)), }; diff --git a/packages/kosu-system-contracts/test/init_test.ts b/packages/kosu-system-contracts/test/init_test.ts index 5b1295cd..c1411a83 100644 --- a/packages/kosu-system-contracts/test/init_test.ts +++ b/packages/kosu-system-contracts/test/init_test.ts @@ -59,6 +59,7 @@ before(async () => { const ganacheSubprovider = new GanacheSubprovider({ mnemonic: process.env.npm_package_config_test_mnemonic, network_id: 6175, + default_balance_ether: TestValues.fiveHundredEther.multipliedBy(10), }); provider.addProvider(ganacheSubprovider); } diff --git a/packages/kosu-system-contracts/test/kosu_token.ts b/packages/kosu-system-contracts/test/kosu_token.ts index c32c2b88..a8286b8c 100644 --- a/packages/kosu-system-contracts/test/kosu_token.ts +++ b/packages/kosu-system-contracts/test/kosu_token.ts @@ -17,7 +17,12 @@ describe("KosuToken", () => { kosuToken = contracts.kosuToken; }); - describe("bonding", () => { + describe("parameterization", () => { + it("should fail with incorrect initial deposit", async () => { + await web3Wrapper + .sendTransactionAsync({ to: token.address, value: TestValues.twoEther, from }).should.eventually.be.rejected; + }); + it("should have expected initial output with parameterization", async () => { await web3Wrapper .sendTransactionAsync({ to: token.address, value: TestValues.twoEther.div("10"), from }) @@ -41,6 +46,26 @@ describe("KosuToken", () => { .should.eq(endingEther.toString()); }); + it("should have expected tokens balance at given ether balance", async () => { + await web3Wrapper + .sendTransactionAsync({ to: token.address, value: TestValues.fourHundredEther.minus(await web3Wrapper.getBalanceInWeiAsync(token.address)), from }) + .then(txHash => web3Wrapper.awaitTransactionSuccessAsync(txHash)); + + const finalBalance = await token.balanceOf.callAsync(from); + const finalSupply = await token.totalSupply.callAsync(); + const endingEther = await web3Wrapper.getBalanceInWeiAsync(token.address); + + "90635575928012811022820" + .should.eq(finalBalance.toString()); + "90635575928012811022820" + .should.eq(finalSupply.toString()); + TestValues.fourHundredEther + .toString() + .should.eq(endingEther.toString()); + }); + }); + + describe("bonding", () => { describe("fallback", () => { it("should generate tokens with fallback function", async () => { @@ -98,6 +123,14 @@ describe("KosuToken", () => { .toString() .should.eq(endingEther.toString()); }); + + // it("should fail with payout below minPayout", async () => { + // const estimate = await kosuToken.estimateEtherToToken.callAsync(TestValues.oneEther); + // + // const error = (await kosuToken.bondTokens.awaitTransactionSuccessAsync(estimate.plus(TestValues.oneEther), { value: TestValues.oneEther }).should.eventually.be.rejected)//.message.should.contains("payout below requested minimum"); + // console.log(error.message); + // console.log(await web3Wrapper.getTransactionReceiptIfExistsAsync(error.message.split(":")[1].trim())); + // }); }); describe("releaseTokens", () => { From 4d7364c8660e0315edd74cf6c1aec9966eee9d92 Mon Sep 17 00:00:00 2001 From: Nick Freyaldenhoven Date: Wed, 28 Aug 2019 15:26:21 -0500 Subject: [PATCH 05/13] running prettier. --- packages/kosu-system-contracts/package.json | 2 +- .../kosu-system-contracts/test/kosu_token.ts | 33 ++++++++----------- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/packages/kosu-system-contracts/package.json b/packages/kosu-system-contracts/package.json index 9a7e98bf..2562c9e0 100644 --- a/packages/kosu-system-contracts/package.json +++ b/packages/kosu-system-contracts/package.json @@ -92,4 +92,4 @@ "tsconfig.json", "tslint.json" ] -} \ No newline at end of file +} diff --git a/packages/kosu-system-contracts/test/kosu_token.ts b/packages/kosu-system-contracts/test/kosu_token.ts index a8286b8c..3acd078a 100644 --- a/packages/kosu-system-contracts/test/kosu_token.ts +++ b/packages/kosu-system-contracts/test/kosu_token.ts @@ -19,8 +19,8 @@ describe("KosuToken", () => { describe("parameterization", () => { it("should fail with incorrect initial deposit", async () => { - await web3Wrapper - .sendTransactionAsync({ to: token.address, value: TestValues.twoEther, from }).should.eventually.be.rejected; + await web3Wrapper.sendTransactionAsync({ to: token.address, value: TestValues.twoEther, from }).should + .eventually.be.rejected; }); it("should have expected initial output with parameterization", async () => { @@ -48,25 +48,24 @@ describe("KosuToken", () => { it("should have expected tokens balance at given ether balance", async () => { await web3Wrapper - .sendTransactionAsync({ to: token.address, value: TestValues.fourHundredEther.minus(await web3Wrapper.getBalanceInWeiAsync(token.address)), from }) + .sendTransactionAsync({ + to: token.address, + value: TestValues.fourHundredEther.minus(await web3Wrapper.getBalanceInWeiAsync(token.address)), + from, + }) .then(txHash => web3Wrapper.awaitTransactionSuccessAsync(txHash)); const finalBalance = await token.balanceOf.callAsync(from); const finalSupply = await token.totalSupply.callAsync(); const endingEther = await web3Wrapper.getBalanceInWeiAsync(token.address); - "90635575928012811022820" - .should.eq(finalBalance.toString()); - "90635575928012811022820" - .should.eq(finalSupply.toString()); - TestValues.fourHundredEther - .toString() - .should.eq(endingEther.toString()); + "90635575928012811022820".should.eq(finalBalance.toString()); + "90635575928012811022820".should.eq(finalSupply.toString()); + TestValues.fourHundredEther.toString().should.eq(endingEther.toString()); }); }); describe("bonding", () => { - describe("fallback", () => { it("should generate tokens with fallback function", async () => { const startingBalance = await kosuToken.balanceOf.callAsync(from); @@ -104,7 +103,9 @@ describe("KosuToken", () => { const startingEther = await web3Wrapper.getBalanceInWeiAsync(kosuToken.address); const estimate = await kosuToken.estimateEtherToToken.callAsync(TestValues.oneEther); - await kosuToken.bondTokens.awaitTransactionSuccessAsync(TestValues.zero, { value: TestValues.oneEther }); + await kosuToken.bondTokens.awaitTransactionSuccessAsync(TestValues.zero, { + value: TestValues.oneEther, + }); const finalBalance = await kosuToken.balanceOf.callAsync(from); const finalSupply = await kosuToken.totalSupply.callAsync(); @@ -123,14 +124,6 @@ describe("KosuToken", () => { .toString() .should.eq(endingEther.toString()); }); - - // it("should fail with payout below minPayout", async () => { - // const estimate = await kosuToken.estimateEtherToToken.callAsync(TestValues.oneEther); - // - // const error = (await kosuToken.bondTokens.awaitTransactionSuccessAsync(estimate.plus(TestValues.oneEther), { value: TestValues.oneEther }).should.eventually.be.rejected)//.message.should.contains("payout below requested minimum"); - // console.log(error.message); - // console.log(await web3Wrapper.getTransactionReceiptIfExistsAsync(error.message.split(":")[1].trim())); - // }); }); describe("releaseTokens", () => { From 177bd8223bfbe275335d38344baa4cc693acbb09 Mon Sep 17 00:00:00 2001 From: Nick Freyaldenhoven Date: Wed, 28 Aug 2019 16:16:54 -0500 Subject: [PATCH 06/13] Fixing a geth issue. --- packages/kosu-system-contracts/test/kosu_token.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/kosu-system-contracts/test/kosu_token.ts b/packages/kosu-system-contracts/test/kosu_token.ts index 3acd078a..1e1e1729 100644 --- a/packages/kosu-system-contracts/test/kosu_token.ts +++ b/packages/kosu-system-contracts/test/kosu_token.ts @@ -19,8 +19,8 @@ describe("KosuToken", () => { describe("parameterization", () => { it("should fail with incorrect initial deposit", async () => { - await web3Wrapper.sendTransactionAsync({ to: token.address, value: TestValues.twoEther, from }).should - .eventually.be.rejected; + (await web3Wrapper.sendTransactionAsync({ to: token.address, value: TestValues.twoEther, from }) + .then(txHash => web3Wrapper.awaitTransactionMinedAsync(txHash))).status.should.eq(0); }); it("should have expected initial output with parameterization", async () => { From 299c9ea1d27268b8f62df3c662731d5b58ceac1d Mon Sep 17 00:00:00 2001 From: Nick Freyaldenhoven Date: Wed, 28 Aug 2019 16:24:30 -0500 Subject: [PATCH 07/13] Adding constructor back that now is causing a failure --- .../contracts/external/OrderGateway.sol | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/kosu-system-contracts/contracts/external/OrderGateway.sol b/packages/kosu-system-contracts/contracts/external/OrderGateway.sol index 4f1b8c93..02b7c9d7 100644 --- a/packages/kosu-system-contracts/contracts/external/OrderGateway.sol +++ b/packages/kosu-system-contracts/contracts/external/OrderGateway.sol @@ -8,6 +8,12 @@ import "@kosu/subcontract-sdk/contracts/SubContract.sol"; */ contract OrderGateway { + /** @dev Creates a new OrderGateway + @notice Creates a new OrderGateway + */ + constructor() public { + } + /** @dev Forwards function calls of participate to the provided subContract address. @notice Forwards function calls of participate to the provided subContract address. @param subContract Address of contract implementing the SubContract interface. From 3cc0b8012a00b17c0d9a02290fa3d6cf6aac106c Mon Sep 17 00:00:00 2001 From: Nick Freyaldenhoven Date: Wed, 28 Aug 2019 16:25:36 -0500 Subject: [PATCH 08/13] Running prettier. --- packages/kosu-system-contracts/test/kosu_token.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/kosu-system-contracts/test/kosu_token.ts b/packages/kosu-system-contracts/test/kosu_token.ts index 1e1e1729..dcb61958 100644 --- a/packages/kosu-system-contracts/test/kosu_token.ts +++ b/packages/kosu-system-contracts/test/kosu_token.ts @@ -19,7 +19,8 @@ describe("KosuToken", () => { describe("parameterization", () => { it("should fail with incorrect initial deposit", async () => { - (await web3Wrapper.sendTransactionAsync({ to: token.address, value: TestValues.twoEther, from }) + (await web3Wrapper + .sendTransactionAsync({ to: token.address, value: TestValues.twoEther, from }) .then(txHash => web3Wrapper.awaitTransactionMinedAsync(txHash))).status.should.eq(0); }); From 11c15757f0c3147383ed725c7aeaf1caaa100978 Mon Sep 17 00:00:00 2001 From: Nick Freyaldenhoven Date: Wed, 28 Aug 2019 16:32:31 -0500 Subject: [PATCH 09/13] Refactoring to work with ganache and geth --- packages/kosu-system-contracts/test/kosu_token.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/kosu-system-contracts/test/kosu_token.ts b/packages/kosu-system-contracts/test/kosu_token.ts index dcb61958..1492102d 100644 --- a/packages/kosu-system-contracts/test/kosu_token.ts +++ b/packages/kosu-system-contracts/test/kosu_token.ts @@ -19,9 +19,9 @@ describe("KosuToken", () => { describe("parameterization", () => { it("should fail with incorrect initial deposit", async () => { - (await web3Wrapper + await web3Wrapper .sendTransactionAsync({ to: token.address, value: TestValues.twoEther, from }) - .then(txHash => web3Wrapper.awaitTransactionMinedAsync(txHash))).status.should.eq(0); + .then(txHash => web3Wrapper.awaitTransactionSuccessAsync(txHash)).should.eventually.be.rejected; }); it("should have expected initial output with parameterization", async () => { From 6ef5fdb691e2ce1454dbd04fa0a81dc97130776c Mon Sep 17 00:00:00 2001 From: Nick Freyaldenhoven Date: Wed, 28 Aug 2019 16:47:20 -0500 Subject: [PATCH 10/13] Removing change I was tricked into changing. --- .../contracts/external/OrderGateway.sol | 6 ------ 1 file changed, 6 deletions(-) diff --git a/packages/kosu-system-contracts/contracts/external/OrderGateway.sol b/packages/kosu-system-contracts/contracts/external/OrderGateway.sol index 02b7c9d7..4f1b8c93 100644 --- a/packages/kosu-system-contracts/contracts/external/OrderGateway.sol +++ b/packages/kosu-system-contracts/contracts/external/OrderGateway.sol @@ -8,12 +8,6 @@ import "@kosu/subcontract-sdk/contracts/SubContract.sol"; */ contract OrderGateway { - /** @dev Creates a new OrderGateway - @notice Creates a new OrderGateway - */ - constructor() public { - } - /** @dev Forwards function calls of participate to the provided subContract address. @notice Forwards function calls of participate to the provided subContract address. @param subContract Address of contract implementing the SubContract interface. From 4997140f23e797011a19d217de573708a8348e8a Mon Sep 17 00:00:00 2001 From: Nick Freyaldenhoven Date: Wed, 28 Aug 2019 16:47:44 -0500 Subject: [PATCH 11/13] Using the local token for the test. --- packages/kosu-system-contracts/test/kosu_token.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/kosu-system-contracts/test/kosu_token.ts b/packages/kosu-system-contracts/test/kosu_token.ts index 1492102d..5859466f 100644 --- a/packages/kosu-system-contracts/test/kosu_token.ts +++ b/packages/kosu-system-contracts/test/kosu_token.ts @@ -155,11 +155,14 @@ describe("KosuToken", () => { }); it("should empty the contract", async () => { - await kosuToken.releaseTokens.awaitTransactionSuccessAsync(await kosuToken.balanceOf.callAsync(from)); - - const finalBalance = await kosuToken.balanceOf.callAsync(from); - const finalSupply = await kosuToken.totalSupply.callAsync(); - const endingEther = await web3Wrapper.getBalanceInWeiAsync(kosuToken.address); + if ((await token.balanceOf.callAsync(from)).eq("0")) { + throw new Error(".only issue"); + } + await token.releaseTokens.awaitTransactionSuccessAsync(await token.balanceOf.callAsync(from)); + + const finalBalance = await token.balanceOf.callAsync(from); + const finalSupply = await token.totalSupply.callAsync(); + const endingEther = await web3Wrapper.getBalanceInWeiAsync(token.address); "0".should.eq(finalBalance.toString()); "0".should.eq(finalSupply.toString()); From 9a2e13a4235fb1e69b2ad945c7d0c116db79aa23 Mon Sep 17 00:00:00 2001 From: Nick Freyaldenhoven Date: Wed, 28 Aug 2019 17:04:56 -0500 Subject: [PATCH 12/13] Increase the magnitude so that tokens burned will be greater than the full amount. --- packages/kosu-system-contracts/test/validator_registry.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/kosu-system-contracts/test/validator_registry.ts b/packages/kosu-system-contracts/test/validator_registry.ts index f552a00d..a8d7ec2b 100644 --- a/packages/kosu-system-contracts/test/validator_registry.ts +++ b/packages/kosu-system-contracts/test/validator_registry.ts @@ -1484,7 +1484,7 @@ describe("ValidatorRegistry", async () => { }); it("should burn up to all the staked balance", async () => { - const burn = new BigNumber(TestValues.oneEther).times(new BigNumber("-1")); + const burn = new BigNumber(TestValues.oneEther).times(new BigNumber("-5")); const tokenBurnAmount = await kosuToken.estimateEtherToToken.callAsync(burn.multipliedBy("-1")); await kosuToken.approve.awaitTransactionSuccessAsync( treasury.address, From b9b5afc4c304fa56d4740c87babbed88e05cea54 Mon Sep 17 00:00:00 2001 From: Nick Freyaldenhoven Date: Wed, 28 Aug 2019 17:39:34 -0500 Subject: [PATCH 13/13] bonding more tokens. --- packages/kosu-system-contracts/test/init_test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/kosu-system-contracts/test/init_test.ts b/packages/kosu-system-contracts/test/init_test.ts index c1411a83..87426c38 100644 --- a/packages/kosu-system-contracts/test/init_test.ts +++ b/packages/kosu-system-contracts/test/init_test.ts @@ -96,7 +96,7 @@ before(async () => { JSON.stringify(argumentsJson), ); contracts.kosuToken.bondTokens.awaitTransactionSuccessAsync(TestValues.zero, { - value: TestValues.oneEther.times(85), + value: TestValues.oneEther.times(200), }); if (!useGeth) { web3.eth.personal.importRawKey(