Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/dependencies #198

Merged
merged 22 commits into from Jul 31, 2019
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Running prettier

  • Loading branch information
Freydal committed Jul 30, 2019
commit c9d0d08dd0ef1da5e948466e27dde6d1a58d25c4
@@ -29,10 +29,7 @@ if (args["test-mnemonic"] || !mnemonic) {

const networkId = await web3.eth.net.getId();

const kosuToken = new KosuTokenContract(
DeployedAddresses[networkId].KosuToken,
provider,
);
const kosuToken = new KosuTokenContract(DeployedAddresses[networkId].KosuToken, provider);
const addresses = await web3.eth.getAccounts();

for (const account of addresses) {
@@ -1,7 +1,7 @@
import { BlockchainLifecycle } from "@0x/dev-utils";
import { MnemonicWalletSubprovider, RPCSubprovider } from "@0x/subproviders";
import { providerUtils } from "@0x/utils";
import {provider} from 'web3-providers';
import { provider } from "web3-providers";
import { Web3Wrapper } from "@0x/web3-wrapper";
import fs from "fs";
import safeRequire from "safe-node-require";
@@ -35,7 +35,7 @@ if (args["test-mnemonic"] || !mnemonic) {
providerEngine.addProvider(rpcSubprovider);
providerUtils.startProviderEngine(providerEngine);

const web3 = new Web3(providerEngine as unknown as provider);
const web3 = new Web3((providerEngine as unknown) as provider);

const normalizedFromAddress = await web3.eth.getCoinbase().then((x: string) => x.toLowerCase());

@@ -1,4 +1,4 @@
const Decoder: any = require('web3-eth-abi');
const Decoder: any = require("web3-eth-abi");
import { hexToNumberString, soliditySha3 } from "web3-utils";

import * as EventEmitter from "../generated-artifacts/EventEmitter.json";
@@ -94,7 +94,9 @@ before(async () => {
txDefaults,
JSON.stringify(argumentsJson),
);
contracts.kosuToken.bondTokens.awaitTransactionSuccessAsync(TestValues.zero, { value: TestValues.oneEther.times(85) });
contracts.kosuToken.bondTokens.awaitTransactionSuccessAsync(TestValues.zero, {
value: TestValues.oneEther.times(85),
});
if (!useGeth) {
web3.eth.personal.importRawKey(
"0xf2f48ee19680706196e2e339e5da3491186e0c4c5030670656b0e0164837257d",
@@ -47,8 +47,8 @@ describe("PosterRegistry", () => {
.callAsync(from)
.then(x => x.toString())
.should.eventually.eq("0");
await posterRegistry.registerTokens.awaitTransactionSuccessAsync(TestValues.oneHundredEther, { from }).should.eventually.be
.rejected;
await posterRegistry.registerTokens.awaitTransactionSuccessAsync(TestValues.oneHundredEther, { from })
.should.eventually.be.rejected;
});

it("should require an approval greater or equal to the amount registered", async () => {
@@ -65,7 +65,8 @@ describe("PosterRegistry", () => {
.callAsync(from, treasury.address)
.then(x => x.toString())
.should.eventually.eq("0");
await posterRegistry.registerTokens.awaitTransactionSuccessAsync(TestValues.oneHundredEther).should.eventually.be.rejected;
await posterRegistry.registerTokens.awaitTransactionSuccessAsync(TestValues.oneHundredEther).should
.eventually.be.rejected;
});

it("should increase tokensContributed and tokensRegisteredFor by the amount", async () => {
@@ -832,8 +832,12 @@ describe("ValidatorRegistry", async () => {
.toString(),
);

await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), { from: accounts[1] });
await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), { from: accounts[2] });
await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), {
from: accounts[1],
});
await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), {
from: accounts[2],
});

await testHelpers.clearTreasury(accounts[1]);
await testHelpers.clearTreasury(accounts[2]);
@@ -891,8 +895,12 @@ describe("ValidatorRegistry", async () => {
.toString()
.should.eq(await testHelpers.toStakeholderCut(minimumBalance));

await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), { from: accounts[1] });
await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), { from: accounts[2] });
await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), {
from: accounts[1],
});
await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), {
from: accounts[2],
});

await testHelpers.clearTreasury(accounts[1]);
await testHelpers.clearTreasury(accounts[2]);
@@ -953,8 +961,12 @@ describe("ValidatorRegistry", async () => {
.toString(),
);

await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), { from: accounts[1] });
await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), { from: accounts[2] });
await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), {
from: accounts[1],
});
await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), {
from: accounts[2],
});

await testHelpers.clearTreasury(accounts[0]);
await testHelpers.clearTreasury(accounts[1]);
@@ -1013,8 +1025,12 @@ describe("ValidatorRegistry", async () => {
.toString()
.should.eq(await testHelpers.toStakeholderCut(minimumBalance));

await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), { from: accounts[1] });
await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), { from: accounts[2] });
await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), {
from: accounts[1],
});
await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), {
from: accounts[2],
});

await testHelpers.clearTreasury(accounts[1]);
await testHelpers.clearTreasury(accounts[2]);
@@ -1061,8 +1077,9 @@ describe("ValidatorRegistry", async () => {

await validatorRegistry.resolveChallenge.awaitTransactionSuccessAsync(tendermintPublicKey).should.eventually
.be.fulfilled;
await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), { from: accounts[5] })
.should.eventually.be.fulfilled;
await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), {
from: accounts[5],
}).should.eventually.be.fulfilled;

const finalVoterSystemBalance = await treasury.systemBalance.callAsync(accounts[5]);
const finalVoterCurrentBalance = await treasury.currentBalance.callAsync(accounts[5]);
@@ -1076,8 +1093,12 @@ describe("ValidatorRegistry", async () => {
.toString()
.should.eq("0");

await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), { from: accounts[1] });
await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), { from: accounts[2] });
await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), {
from: accounts[1],
});
await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), {
from: accounts[2],
});

await testHelpers.clearTreasury(accounts[0]);
await testHelpers.clearTreasury(accounts[1]);
@@ -1122,8 +1143,9 @@ describe("ValidatorRegistry", async () => {

await validatorRegistry.resolveChallenge.awaitTransactionSuccessAsync(tendermintPublicKey).should.eventually
.be.fulfilled;
await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), { from: accounts[5] })
.should.eventually.be.fulfilled;
await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), {
from: accounts[5],
}).should.eventually.be.fulfilled;

const finalVoterSystemBalance = await treasury.systemBalance.callAsync(accounts[5]);
const finalVoterCurrentBalance = await treasury.currentBalance.callAsync(accounts[5]);
@@ -1137,8 +1159,12 @@ describe("ValidatorRegistry", async () => {
.toString()
.should.eq("0");

await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), { from: accounts[1] });
await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), { from: accounts[2] });
await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), {
from: accounts[1],
});
await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), {
from: accounts[2],
});

await testHelpers.clearTreasury(accounts[0]);
await testHelpers.clearTreasury(accounts[1]);
@@ -1183,8 +1209,9 @@ describe("ValidatorRegistry", async () => {

await validatorRegistry.resolveChallenge.awaitTransactionSuccessAsync(tendermintPublicKey).should.eventually
.be.fulfilled;
await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), { from: accounts[5] })
.should.eventually.be.fulfilled;
await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), {
from: accounts[5],
}).should.eventually.be.fulfilled;

const finalVoterSystemBalance = await treasury.systemBalance.callAsync(accounts[5]);
const finalVoterCurrentBalance = await treasury.currentBalance.callAsync(accounts[5]);
@@ -1198,8 +1225,12 @@ describe("ValidatorRegistry", async () => {
.toString()
.should.eq(minimumBalance.minus(await testHelpers.toStakeholderCut(minimumBalance)).toString());

await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), { from: accounts[1] });
await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), { from: accounts[2] });
await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), {
from: accounts[1],
});
await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), {
from: accounts[2],
});

await testHelpers.clearTreasury(accounts[0]);
await testHelpers.clearTreasury(accounts[5]);
@@ -1242,8 +1273,9 @@ describe("ValidatorRegistry", async () => {
const initialListingHolderSystemBalance = await treasury.systemBalance.callAsync(accounts[0]);
const initialListingHolderCurrentBalance = await treasury.currentBalance.callAsync(accounts[0]);

await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), { from: accounts[5] })
.should.eventually.be.fulfilled;
await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), {
from: accounts[5],
}).should.eventually.be.fulfilled;

const finalChallengerSystemBalance = await treasury.systemBalance.callAsync(accounts[1]);
const finalListingHolderSystemBalance = await treasury.systemBalance.callAsync(accounts[0]);
@@ -1266,8 +1298,12 @@ describe("ValidatorRegistry", async () => {
.toString(),
);

await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), { from: accounts[1] });
await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), { from: accounts[2] });
await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), {
from: accounts[1],
});
await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), {
from: accounts[2],
});

await testHelpers.clearTreasury(accounts[0]);
await testHelpers.clearTreasury(accounts[1]);
@@ -1306,12 +1342,17 @@ describe("ValidatorRegistry", async () => {
from: accounts[5],
});

await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), { from: accounts[5] })
.should.eventually.be.rejected;
await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), {
from: accounts[5],
}).should.eventually.be.rejected;

await testHelpers.skipChallengePeriod(blockNumber);
await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), { from: accounts[1] });
await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), { from: accounts[2] });
await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), {
from: accounts[1],
});
await validatorRegistry.claimWinnings.awaitTransactionSuccessAsync(new BigNumber(challengeId), {
from: accounts[2],
});

await testHelpers.clearTreasury(accounts[0]);
await testHelpers.clearTreasury(accounts[1]);
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.