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 all commits
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

@@ -14,7 +14,7 @@
"clean:install": "yarn clean && yarn",
"docs": "wsrun --exclude-missing docs",
"lint": "wsrun --exclude-missing lint",
"build": "wsrun --exclude-missing --stages build",
"build": "wsrun --exclude-missing --fast-exit --stages build",
"test": "wsrun --exclude-missing test",
"test:ci": "wsrun --exclude-missing --fast-exit test:ci",
"contracts:test:ci": "yarn workspace @kosu/system-contracts contracts:test:ci",
@@ -34,13 +34,34 @@
"dependencies": {},
"private": true,
"devDependencies": {
"@0x/dev-utils": "^2.2.2",
"@babel/cli": "^7.4.4",
"@babel/core": "^7.4.4",
"@babel/plugin-proposal-class-properties": "^7.4.4",
"@babel/plugin-proposal-object-rest-spread": "^7.4.4",
"@babel/preset-env": "^7.4.5",
"@kosu/tslint-config": "^0.0.4",
"@types/chai": "^4.1.7",
"@types/chai-as-promised": "^7.1.0",
"@types/ethereumjs-abi": "^0.6.3",
"@types/ethereumjs-util": "^5.2.0",
"@types/expect": "^1.20.4",
"@types/mocha": "^5.2.6",
"@types/node": "^12.0.7",
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"lerna": "^3.13.4",
"mocha": "^6.1.4",
"npm-run-all": "^4.1.5",
"prettier": "^1.17.0",
"run-p": "^0.0.0",
"shx": "^0.3.2",
"tslint": "^5.16.0",
"typescript": "^3.4.5",
"webpack": "^4.29.5",
"webpack-cli": "^3.2.3",
"webpack-dev-middleware": "^3.6.0",
"webpack-dev-server": "^3.3.1",
"wsrun": "^3.6.5"
}
}
@@ -17,20 +17,13 @@
"@0x/subproviders": "^4.0.6",
"@kosu/kosu.js": "^0.1.5",
"@kosu/tsc-config": "^0.1.0",
"web3": "1.0.0-beta.37"
"web3": "1.2.0"
},
"devDependencies": {
"@babel/cli": "^7.4.4",
"@babel/core": "^7.4.5",
"@babel/plugin-proposal-class-properties": "^7.4.4",
"@babel/plugin-proposal-object-rest-spread": "^7.4.4",
"@babel/preset-env": "^7.4.5",
"@babel/preset-typescript": "^7.3.3",
"babel-loader": "^8.0.6",
"jsdoc-babel": "^0.5.0",
"jsdoc-to-markdown": "^5.0.0",
"typescript": "^3.5.1",
"webpack": "^4.32.2"
"jsdoc-to-markdown": "^5.0.0"
},
"files": [
"lib/*",
@@ -126,7 +126,7 @@ class Create {
const rawRes = await fetch("https://ethgasstation.info/json/ethgasAPI.json");
const parsed = await rawRes.json();
const gasPriceGwei = parsed["safeLow"] ? parsed["safeLow"].toString() : "5";
this.gasPriceWei = new BigNumber(this.web3.utils.toWei(gasPriceGwei, "Gwei"));
this.gasPriceWei = new BigNumber(this.web3.utils.toWei(gasPriceGwei, "Gwei").toString());

this.initialized = true;
}
@@ -306,7 +306,7 @@ class Create {
* create.convertToWei(100) // > "100000000000000000000" (BigNumber)
* ```
*/
convertToWei(etherAmount: string | BigNumber): Promise<string> {
convertToWei(etherAmount: string | BigNumber): string {
return this.web3.utils.toWei(etherAmount.toString());
}

@@ -323,7 +323,7 @@ class Create {
* create.convertToWei(100000000000000000000) // > "100" (BigNumber)
* ```
*/
convertFromWei(weiAmount: string | BigNumber): Promise<string> {
convertFromWei(weiAmount: string | BigNumber): string {
return this.web3.utils.fromWei(weiAmount.toString());
}

@@ -16,9 +16,7 @@
},
"devDependencies": {
"@kosu/system-contracts": "^0.1.0-alpha.1",
"ganache-cli": "^6.4.3",
"node-docker-api": "^1.1.22",
"npm": "^6.9.0",
"tar-fs": "^2.0.0"
},
"publishConfig": {
@@ -10,7 +10,7 @@
"abigen": "jq '.compilerOutput.abi' node_modules/@kosu/system-contracts/generated-artifacts/EventEmitter.json | abigen --abi - --pkg witness --type EventEmitter -out witness/event_emitter.go"
},
"config": {},
"devDependencies": {
"dependencies": {
"@kosu/system-contracts": "^0.1.1"
}
}
@@ -17,24 +17,14 @@
"bignumber.js": "8.0.2",
"browser-cookies": "^1.2.0",
"events": "^3.0.0",
"web3": "1.0.0-beta.37"
"web3": "1.2.0"
},
"devDependencies": {
"@babel/cli": "^7.4.4",
"@babel/core": "^7.4.5",
"@babel/plugin-proposal-class-properties": "^7.4.4",
"@babel/plugin-proposal-object-rest-spread": "^7.4.4",
"@babel/preset-env": "^7.4.5",
"@babel/preset-typescript": "^7.3.3",
"@types/node": "^12.0.7",
"babel-loader": "^8.0.6",
"jsdoc-babel": "^0.5.0",
"jsdoc-to-markdown": "^5.0.0",
"ts-loader": "^6.0.2",
"typescript": "^3.5.1",
"webpack": "^4.32.2",
"webpack-cli": "^3.3.2",
"webpack-dev-server": "^3.4.1"
"ts-loader": "^6.0.2"
},
"files": [
"lib/",
@@ -244,7 +244,7 @@ class Gov {
public challenges: Map<StoreChallenge>;
public proposals: Map<Proposal>;

public networkId: string;
public networkId: number;
public coinbase: string;

public kosu: Kosu;
@@ -11,8 +11,6 @@
},
"devDependencies": {
"@vuepress/plugin-google-analytics": "^1.0.0-alpha.0",
"vuepress": "^0.14.8",
"webpack": "^4.29.6",
"webpack-dev-middleware": "^3.6.0"
"vuepress": "^0.14.8"
}
}
@@ -1,7 +1,8 @@
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma
// tslint:disable:whitespace no-unbound-method no-trailing-whitespace
// tslint:disable:no-unused-variable
// tslint:disable:no-unbound-method
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
import { schemas } from '@0x/json-schemas';
import {
BlockParam,
BlockParamLiteral,
@@ -18,6 +19,7 @@ import {
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { assert } from '@0x/assert';
import * as ethers from 'ethers';
// tslint:enable:no-unused-variable

@@ -43,7 +45,7 @@ export enum {{contractName}}Events {
// tslint:disable:no-parameter-reassignment
// tslint:disable-next-line:class-name
export class {{contractName}}Contract extends BaseContract {
public txReceipt?: TransactionReceiptWithDecodedLogs;
txReceipt: TransactionReceiptWithDecodedLogs
{{#each methods}}
{{#this.constant}}
{{> call contractName=../contractName}}
@@ -58,6 +60,11 @@ public txReceipt?: TransactionReceiptWithDecodedLogs;
txDefaults: Partial<TxData>,
{{> typed_params inputs=ctor.inputs}}
): Promise<{{contractName}}Contract> {
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
schemas.addressSchema,
schemas.numberSchema,
schemas.jsNumber,
]);
if (artifact.compilerOutput === undefined) {
throw new Error('Compiler output not found in the artifact file');
}
@@ -73,6 +80,12 @@ public txReceipt?: TransactionReceiptWithDecodedLogs;
txDefaults: Partial<TxData>,
{{> typed_params inputs=ctor.inputs}}
): Promise<{{contractName}}Contract> {
assert.isHexString('bytecode', bytecode);
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
schemas.addressSchema,
schemas.numberSchema,
schemas.jsNumber,
]);
const provider = providerUtils.standardizeOrThrow(supportedProvider);
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
[{{> params inputs=ctor.inputs}}] = BaseContract._formatABIDataItemList(
@@ -93,14 +106,47 @@ public txReceipt?: TransactionReceiptWithDecodedLogs;
logUtils.log(`transactionHash: ${txHash}`);
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
logUtils.log(`{{contractName}} successfully deployed at ${txReceipt.contractAddress}`);
const contractInstance = new {{contractName}}Contract(abi, txReceipt.contractAddress as string, provider, txDefaults);
const contractInstance = new {{contractName}}Contract(txReceipt.contractAddress as string, provider, txDefaults);
contractInstance.constructorArgs = [{{> params inputs=ctor.inputs}}];
contractInstance.txReceipt = txReceipt;
contractInstance.txReceipt = txReceipt
return contractInstance;
}
constructor(abi: ContractAbi, address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>) {
super('{{contractName}}', abi, address, supportedProvider, txDefaults);
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', 'abi', '_web3Wrapper']);


/**
* @returns The contract ABI
*/
public static ABI(): ContractAbi {
const abi = [
{{#each ABI}}
{ {{#if (isDefined this.constant)}}
constant: {{constant}},{{/if}}{{#if (isDefined this.anonymous)}}
anonymous: {{anonymous}},{{/if}}
inputs: [
{{#each inputs}}
{{> abi_type this}}
{{/each}}
],{{#this.name}}
name: '{{{this}}}',{{/this.name}}
outputs: [
{{#each outputs}}
{{> abi_type this}}
{{/each}}
],{{#if (isDefined this.payable)}}
payable: {{payable}},{{/if}}{{#this.stateMutability}}
stateMutability: '{{this}}',{{/this.stateMutability}}
type: '{{type}}',
},
{{/each}}
] as ContractAbi;
return abi;
}
} // tslint:disable:max-file-line-count
// tslint:enable:no-unbound-method
constructor(address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>) {
super('{{contractName}}', {{contractName}}Contract.ABI(), address, supportedProvider, txDefaults);
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', '_web3Wrapper']);
}
}

// tslint:disable:max-file-line-count
// tslint:enable:no-unbound-method no-parameter-reassignment no-consecutive-blank-lines ordered-imports align
// tslint:enable:trailing-comma whitespace no-trailing-whitespace

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.