Fix linter issues
This commit is contained in:
@@ -16,7 +16,7 @@
|
|||||||
"prebuild": "run-s clean generate_contract_wrappers",
|
"prebuild": "run-s clean generate_contract_wrappers",
|
||||||
"build": "run-p build:umd:prod build:commonjs; exit 0;",
|
"build": "run-p build:umd:prod build:commonjs; exit 0;",
|
||||||
"generate_contract_wrappers": "node ../abi-gen/lib/index.js --abis 'src/compact_artifacts/@(Exchange|Token|TokenTransferProxy|EtherToken|TokenRegistry|DummyToken).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers/generated --backend ethers && prettier --write 'src/contract_wrappers/generated/**.ts'",
|
"generate_contract_wrappers": "node ../abi-gen/lib/index.js --abis 'src/compact_artifacts/@(Exchange|Token|TokenTransferProxy|EtherToken|TokenRegistry|DummyToken).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers/generated --backend ethers && prettier --write 'src/contract_wrappers/generated/**.ts'",
|
||||||
"lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'",
|
"lint": "tslint --project .",
|
||||||
"test:circleci": "run-s test:coverage",
|
"test:circleci": "run-s test:coverage",
|
||||||
"test": "run-s clean test:commonjs",
|
"test": "run-s clean test:commonjs",
|
||||||
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
|
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
"types": "lib/index.d.ts",
|
"types": "lib/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build:watch": "tsc -w",
|
"build:watch": "tsc -w",
|
||||||
"lint": "tslint --project . 'src/**/*.ts'",
|
"lint": "tslint --project .",
|
||||||
"clean": "shx rm -rf lib scripts",
|
"clean": "shx rm -rf lib scripts",
|
||||||
"build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts",
|
"build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts",
|
||||||
"manual:postpublish": "yarn build; node ./scripts/postpublish.js"
|
"manual:postpublish": "yarn build; node ./scripts/postpublish.js"
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
"build:watch": "tsc -w",
|
"build:watch": "tsc -w",
|
||||||
"build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
|
"build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
|
||||||
"clean": "shx rm -rf lib test_temp scripts",
|
"clean": "shx rm -rf lib test_temp scripts",
|
||||||
"lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'",
|
"lint": "tslint --project .",
|
||||||
"run_mocha": "mocha lib/test/**/*_test.js --exit",
|
"run_mocha": "mocha lib/test/**/*_test.js --exit",
|
||||||
"prepublishOnly": "run-p build",
|
"prepublishOnly": "run-p build",
|
||||||
"test": "run-s clean build run_mocha",
|
"test": "run-s clean build run_mocha",
|
||||||
|
|||||||
@@ -48,12 +48,13 @@ export class BaseContract {
|
|||||||
if (!_.isUndefined(constructorAbiIfExists)) {
|
if (!_.isUndefined(constructorAbiIfExists)) {
|
||||||
return constructorAbiIfExists;
|
return constructorAbiIfExists;
|
||||||
} else {
|
} else {
|
||||||
return {
|
const defaultConstructorAbi: ConstructorAbi = {
|
||||||
type: AbiType.Constructor,
|
type: AbiType.Constructor,
|
||||||
stateMutability: 'nonpayable',
|
stateMutability: 'nonpayable',
|
||||||
payable: false,
|
payable: false,
|
||||||
inputs: [],
|
inputs: [],
|
||||||
};
|
};
|
||||||
|
return defaultConstructorAbi;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
protected static _bnToBigNumber(type: string, value: any): any {
|
protected static _bnToBigNumber(type: string, value: any): any {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
"build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
|
"build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
|
||||||
"clean": "shx rm -rf lib test_temp scripts",
|
"clean": "shx rm -rf lib test_temp scripts",
|
||||||
"copy_test_fixtures": "copyfiles -u 2 './test/fixtures/**/*.json' ./lib/test/fixtures",
|
"copy_test_fixtures": "copyfiles -u 2 './test/fixtures/**/*.json' ./lib/test/fixtures",
|
||||||
"lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'",
|
"lint": "tslint --project .",
|
||||||
"run_mocha": "mocha lib/test/**/*_test.js --exit",
|
"run_mocha": "mocha lib/test/**/*_test.js --exit",
|
||||||
"test": "run-s clean build copy_test_fixtures run_mocha",
|
"test": "run-s clean build copy_test_fixtures run_mocha",
|
||||||
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
|
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
|
||||||
|
|||||||
@@ -5,9 +5,9 @@
|
|||||||
// tslint:disable:no-consecutive-blank-lines
|
// tslint:disable:no-consecutive-blank-lines
|
||||||
// tslint:disable-next-line:no-unused-variable
|
// tslint:disable-next-line:no-unused-variable
|
||||||
import { BaseContract } from '@0xproject/base-contract';
|
import { BaseContract } from '@0xproject/base-contract';
|
||||||
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, DataItem, MethodAbi, Provider, TxData, TxDataPayable } from '@0xproject/types';
|
|
||||||
import { BigNumber, classUtils, promisify } from '@0xproject/utils';
|
|
||||||
import { ContractArtifact } from '@0xproject/sol-compiler';
|
import { ContractArtifact } from '@0xproject/sol-compiler';
|
||||||
|
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, DataItem, MethodAbi, Provider, TxData, TxDataPayable } from '@0xproject/types';
|
||||||
|
import { BigNumber, classUtils, logUtils, promisify } from '@0xproject/utils';
|
||||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
import * as ethers from 'ethers';
|
import * as ethers from 'ethers';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
@@ -40,7 +40,7 @@ export class {{contractName}}Contract extends BaseContract {
|
|||||||
{{> tx contractName=../contractName}}
|
{{> tx contractName=../contractName}}
|
||||||
{{/this.constant}}
|
{{/this.constant}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
public static async deploy0xArtifactAsync(
|
public static async deployFrom0xArtifactAsync(
|
||||||
artifact: ContractArtifact,
|
artifact: ContractArtifact,
|
||||||
provider: Provider,
|
provider: Provider,
|
||||||
defaults: Partial<TxData>,
|
defaults: Partial<TxData>,
|
||||||
@@ -71,9 +71,9 @@ export class {{contractName}}Contract extends BaseContract {
|
|||||||
web3Wrapper.estimateGasAsync.bind(web3Wrapper),
|
web3Wrapper.estimateGasAsync.bind(web3Wrapper),
|
||||||
);
|
);
|
||||||
const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||||
console.log(`transactionHash: ${txHash}`);
|
logUtils.log(`transactionHash: ${txHash}`);
|
||||||
const txReceipt = await web3Wrapper.awaitTransactionMinedAsync(txHash);
|
const txReceipt = await web3Wrapper.awaitTransactionMinedAsync(txHash);
|
||||||
console.log(`{{contractName}} successfully deployed at ${txReceipt.contractAddress}`);
|
logUtils.log(`{{contractName}} successfully deployed at ${txReceipt.contractAddress}`);
|
||||||
const contractInstance = new {{contractName}}Contract(abi, txReceipt.contractAddress as string, provider, defaults);
|
const contractInstance = new {{contractName}}Contract(abi, txReceipt.contractAddress as string, provider, defaults);
|
||||||
contractInstance.constructorArgs = [{{> params inputs=ctor.inputs}}];
|
contractInstance.constructorArgs = [{{> params inputs=ctor.inputs}}];
|
||||||
return contractInstance;
|
return contractInstance;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
"compile": "node ../sol-compiler/lib/src/cli.js",
|
"compile": "node ../sol-compiler/lib/src/cli.js",
|
||||||
"clean": "shx rm -rf ./lib",
|
"clean": "shx rm -rf ./lib",
|
||||||
"generate_contract_wrappers": "node ../abi-gen/lib/index.js --abis ${npm_package_config_abis} --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers/generated --backend ethers && prettier --write 'src/contract_wrappers/generated/**.ts'",
|
"generate_contract_wrappers": "node ../abi-gen/lib/index.js --abis ${npm_package_config_abis} --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers/generated --backend ethers && prettier --write 'src/contract_wrappers/generated/**.ts'",
|
||||||
"lint": "tslint --project . 'migrations/**/*.ts' 'test/**/*.ts' 'util/**/*.ts' 'deploy/**/*.ts'",
|
"lint": "tslint --project .",
|
||||||
"coverage:report:text": "istanbul report text",
|
"coverage:report:text": "istanbul report text",
|
||||||
"coverage:report:html": "istanbul report html && open coverage/index.html",
|
"coverage:report:html": "istanbul report html && open coverage/index.html",
|
||||||
"coverage:report:lcov": "istanbul report lcov",
|
"coverage:report:lcov": "istanbul report lcov",
|
||||||
@@ -60,6 +60,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"0x.js": "^0.37.2",
|
"0x.js": "^0.37.2",
|
||||||
|
"@0xproject/base-contract": "^0.3.1",
|
||||||
"@0xproject/sol-compiler": "^0.4.3",
|
"@0xproject/sol-compiler": "^0.4.3",
|
||||||
"@0xproject/types": "^0.6.3",
|
"@0xproject/types": "^0.6.3",
|
||||||
"@0xproject/typescript-typings": "^0.3.1",
|
"@0xproject/typescript-typings": "^0.3.1",
|
||||||
@@ -68,7 +69,7 @@
|
|||||||
"bn.js": "^4.11.8",
|
"bn.js": "^4.11.8",
|
||||||
"ethereumjs-abi": "^0.6.4",
|
"ethereumjs-abi": "^0.6.4",
|
||||||
"ethereumjs-util": "^5.1.1",
|
"ethereumjs-util": "^5.1.1",
|
||||||
"ethers-contracts": "^2.2.1",
|
"ethers": "^3.0.15",
|
||||||
"lodash": "^4.17.4",
|
"lodash": "^4.17.4",
|
||||||
"web3": "^0.20.0"
|
"web3": "^0.20.0"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ describe('EtherToken', () => {
|
|||||||
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
||||||
account = accounts[0];
|
account = accounts[0];
|
||||||
|
|
||||||
const etherToken = await WETH9Contract.deploy0xArtifactAsync(artifacts.EtherToken, provider, defaults);
|
const etherToken = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.EtherToken, provider, defaults);
|
||||||
etherTokenAddress = etherToken.address;
|
etherTokenAddress = etherToken.address;
|
||||||
zeroEx = new ZeroEx(provider, {
|
zeroEx = new ZeroEx(provider, {
|
||||||
gasPrice,
|
gasPrice,
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ describe('Exchange', () => {
|
|||||||
maker = accounts[0];
|
maker = accounts[0];
|
||||||
[tokenOwner, taker, feeRecipient] = accounts;
|
[tokenOwner, taker, feeRecipient] = accounts;
|
||||||
[rep, dgd, zrx] = await Promise.all([
|
[rep, dgd, zrx] = await Promise.all([
|
||||||
DummyTokenContract.deploy0xArtifactAsync(
|
DummyTokenContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.DummyToken,
|
artifacts.DummyToken,
|
||||||
provider,
|
provider,
|
||||||
defaults,
|
defaults,
|
||||||
@@ -66,7 +66,7 @@ describe('Exchange', () => {
|
|||||||
constants.DUMMY_TOKEN_DECIMALS,
|
constants.DUMMY_TOKEN_DECIMALS,
|
||||||
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
|
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
|
||||||
),
|
),
|
||||||
DummyTokenContract.deploy0xArtifactAsync(
|
DummyTokenContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.DummyToken,
|
artifacts.DummyToken,
|
||||||
provider,
|
provider,
|
||||||
defaults,
|
defaults,
|
||||||
@@ -75,7 +75,7 @@ describe('Exchange', () => {
|
|||||||
constants.DUMMY_TOKEN_DECIMALS,
|
constants.DUMMY_TOKEN_DECIMALS,
|
||||||
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
|
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
|
||||||
),
|
),
|
||||||
DummyTokenContract.deploy0xArtifactAsync(
|
DummyTokenContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.DummyToken,
|
artifacts.DummyToken,
|
||||||
provider,
|
provider,
|
||||||
defaults,
|
defaults,
|
||||||
@@ -85,12 +85,12 @@ describe('Exchange', () => {
|
|||||||
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
|
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
|
||||||
),
|
),
|
||||||
]);
|
]);
|
||||||
tokenTransferProxy = await TokenTransferProxyContract.deploy0xArtifactAsync(
|
tokenTransferProxy = await TokenTransferProxyContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.TokenTransferProxy,
|
artifacts.TokenTransferProxy,
|
||||||
provider,
|
provider,
|
||||||
defaults,
|
defaults,
|
||||||
);
|
);
|
||||||
exchange = await ExchangeContract.deploy0xArtifactAsync(
|
exchange = await ExchangeContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.Exchange,
|
artifacts.Exchange,
|
||||||
provider,
|
provider,
|
||||||
defaults,
|
defaults,
|
||||||
@@ -713,7 +713,7 @@ describe('Exchange', () => {
|
|||||||
|
|
||||||
it('should throw if getBalance or getAllowance attempts to change state and \
|
it('should throw if getBalance or getAllowance attempts to change state and \
|
||||||
shouldThrowOnInsufficientBalanceOrAllowance = false', async () => {
|
shouldThrowOnInsufficientBalanceOrAllowance = false', async () => {
|
||||||
const maliciousToken = await MaliciousTokenContract.deploy0xArtifactAsync(
|
const maliciousToken = await MaliciousTokenContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.MaliciousToken,
|
artifacts.MaliciousToken,
|
||||||
provider,
|
provider,
|
||||||
defaults,
|
defaults,
|
||||||
|
|||||||
@@ -40,18 +40,18 @@ describe('Exchange', () => {
|
|||||||
before(async () => {
|
before(async () => {
|
||||||
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
||||||
[maker, feeRecipient] = accounts;
|
[maker, feeRecipient] = accounts;
|
||||||
const tokenRegistry = await TokenRegistryContract.deploy0xArtifactAsync(
|
const tokenRegistry = await TokenRegistryContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.TokenRegistry,
|
artifacts.TokenRegistry,
|
||||||
provider,
|
provider,
|
||||||
defaults,
|
defaults,
|
||||||
);
|
);
|
||||||
const tokenTransferProxy = await TokenTransferProxyContract.deploy0xArtifactAsync(
|
const tokenTransferProxy = await TokenTransferProxyContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.TokenTransferProxy,
|
artifacts.TokenTransferProxy,
|
||||||
provider,
|
provider,
|
||||||
defaults,
|
defaults,
|
||||||
);
|
);
|
||||||
const [rep, dgd, zrx] = await Promise.all([
|
const [rep, dgd, zrx] = await Promise.all([
|
||||||
DummyTokenContract.deploy0xArtifactAsync(
|
DummyTokenContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.DummyToken,
|
artifacts.DummyToken,
|
||||||
provider,
|
provider,
|
||||||
defaults,
|
defaults,
|
||||||
@@ -60,7 +60,7 @@ describe('Exchange', () => {
|
|||||||
constants.DUMMY_TOKEN_DECIMALS,
|
constants.DUMMY_TOKEN_DECIMALS,
|
||||||
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
|
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
|
||||||
),
|
),
|
||||||
DummyTokenContract.deploy0xArtifactAsync(
|
DummyTokenContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.DummyToken,
|
artifacts.DummyToken,
|
||||||
provider,
|
provider,
|
||||||
defaults,
|
defaults,
|
||||||
@@ -69,7 +69,7 @@ describe('Exchange', () => {
|
|||||||
constants.DUMMY_TOKEN_DECIMALS,
|
constants.DUMMY_TOKEN_DECIMALS,
|
||||||
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
|
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
|
||||||
),
|
),
|
||||||
DummyTokenContract.deploy0xArtifactAsync(
|
DummyTokenContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.DummyToken,
|
artifacts.DummyToken,
|
||||||
provider,
|
provider,
|
||||||
defaults,
|
defaults,
|
||||||
@@ -79,7 +79,7 @@ describe('Exchange', () => {
|
|||||||
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
|
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
|
||||||
),
|
),
|
||||||
]);
|
]);
|
||||||
const exchange = await ExchangeContract.deploy0xArtifactAsync(
|
const exchange = await ExchangeContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.Exchange,
|
artifacts.Exchange,
|
||||||
provider,
|
provider,
|
||||||
defaults,
|
defaults,
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ describe('Exchange', () => {
|
|||||||
tokenOwner = accounts[0];
|
tokenOwner = accounts[0];
|
||||||
[maker, taker, feeRecipient] = accounts;
|
[maker, taker, feeRecipient] = accounts;
|
||||||
[rep, dgd, zrx] = await Promise.all([
|
[rep, dgd, zrx] = await Promise.all([
|
||||||
DummyTokenContract.deploy0xArtifactAsync(
|
DummyTokenContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.DummyToken,
|
artifacts.DummyToken,
|
||||||
provider,
|
provider,
|
||||||
defaults,
|
defaults,
|
||||||
@@ -65,7 +65,7 @@ describe('Exchange', () => {
|
|||||||
constants.DUMMY_TOKEN_DECIMALS,
|
constants.DUMMY_TOKEN_DECIMALS,
|
||||||
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
|
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
|
||||||
),
|
),
|
||||||
DummyTokenContract.deploy0xArtifactAsync(
|
DummyTokenContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.DummyToken,
|
artifacts.DummyToken,
|
||||||
provider,
|
provider,
|
||||||
defaults,
|
defaults,
|
||||||
@@ -74,7 +74,7 @@ describe('Exchange', () => {
|
|||||||
constants.DUMMY_TOKEN_DECIMALS,
|
constants.DUMMY_TOKEN_DECIMALS,
|
||||||
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
|
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
|
||||||
),
|
),
|
||||||
DummyTokenContract.deploy0xArtifactAsync(
|
DummyTokenContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.DummyToken,
|
artifacts.DummyToken,
|
||||||
provider,
|
provider,
|
||||||
defaults,
|
defaults,
|
||||||
@@ -84,13 +84,17 @@ describe('Exchange', () => {
|
|||||||
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
|
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
|
||||||
),
|
),
|
||||||
]);
|
]);
|
||||||
tokenRegistry = await TokenRegistryContract.deploy0xArtifactAsync(artifacts.TokenRegistry, provider, defaults);
|
tokenRegistry = await TokenRegistryContract.deployFrom0xArtifactAsync(
|
||||||
tokenTransferProxy = await TokenTransferProxyContract.deploy0xArtifactAsync(
|
artifacts.TokenRegistry,
|
||||||
|
provider,
|
||||||
|
defaults,
|
||||||
|
);
|
||||||
|
tokenTransferProxy = await TokenTransferProxyContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.TokenTransferProxy,
|
artifacts.TokenTransferProxy,
|
||||||
provider,
|
provider,
|
||||||
defaults,
|
defaults,
|
||||||
);
|
);
|
||||||
exchange = await ExchangeContract.deploy0xArtifactAsync(
|
exchange = await ExchangeContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.Exchange,
|
artifacts.Exchange,
|
||||||
provider,
|
provider,
|
||||||
defaults,
|
defaults,
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ describe('MultiSigWalletWithTimeLock', () => {
|
|||||||
describe('changeTimeLock', () => {
|
describe('changeTimeLock', () => {
|
||||||
describe('initially non-time-locked', async () => {
|
describe('initially non-time-locked', async () => {
|
||||||
before('deploy a wallet', async () => {
|
before('deploy a wallet', async () => {
|
||||||
multiSig = await MultiSigWalletWithTimeLockContract.deploy0xArtifactAsync(
|
multiSig = await MultiSigWalletWithTimeLockContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.MultiSigWalletWithTimeLock,
|
artifacts.MultiSigWalletWithTimeLock,
|
||||||
provider,
|
provider,
|
||||||
defaults,
|
defaults,
|
||||||
@@ -142,7 +142,7 @@ describe('MultiSigWalletWithTimeLock', () => {
|
|||||||
});
|
});
|
||||||
describe('initially time-locked', async () => {
|
describe('initially time-locked', async () => {
|
||||||
before('deploy a wallet', async () => {
|
before('deploy a wallet', async () => {
|
||||||
multiSig = await MultiSigWalletWithTimeLockContract.deploy0xArtifactAsync(
|
multiSig = await MultiSigWalletWithTimeLockContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.MultiSigWalletWithTimeLock,
|
artifacts.MultiSigWalletWithTimeLock,
|
||||||
provider,
|
provider,
|
||||||
defaults,
|
defaults,
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ describe('MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress', () => {
|
|||||||
owners = [accounts[0], accounts[1]];
|
owners = [accounts[0], accounts[1]];
|
||||||
[authorizedAddress, unauthorizedAddress] = accounts;
|
[authorizedAddress, unauthorizedAddress] = accounts;
|
||||||
const initialOwner = accounts[0];
|
const initialOwner = accounts[0];
|
||||||
tokenTransferProxy = await TokenTransferProxyContract.deploy0xArtifactAsync(
|
tokenTransferProxy = await TokenTransferProxyContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.TokenTransferProxy,
|
artifacts.TokenTransferProxy,
|
||||||
provider,
|
provider,
|
||||||
defaults,
|
defaults,
|
||||||
@@ -54,7 +54,7 @@ describe('MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress', () => {
|
|||||||
await tokenTransferProxy.addAuthorizedAddress.sendTransactionAsync(authorizedAddress, {
|
await tokenTransferProxy.addAuthorizedAddress.sendTransactionAsync(authorizedAddress, {
|
||||||
from: initialOwner,
|
from: initialOwner,
|
||||||
});
|
});
|
||||||
multiSig = await MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddressContract.deploy0xArtifactAsync(
|
multiSig = await MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddressContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress,
|
artifacts.MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress,
|
||||||
provider,
|
provider,
|
||||||
defaults,
|
defaults,
|
||||||
@@ -109,7 +109,7 @@ describe('MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should throw if tx destination is not the tokenTransferProxy', async () => {
|
it('should throw if tx destination is not the tokenTransferProxy', async () => {
|
||||||
const invalidTokenTransferProxy = await TokenTransferProxyContract.deploy0xArtifactAsync(
|
const invalidTokenTransferProxy = await TokenTransferProxyContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.TokenTransferProxy,
|
artifacts.TokenTransferProxy,
|
||||||
provider,
|
provider,
|
||||||
defaults,
|
defaults,
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ describe('TokenRegistry', () => {
|
|||||||
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
||||||
owner = accounts[0];
|
owner = accounts[0];
|
||||||
notOwner = accounts[1];
|
notOwner = accounts[1];
|
||||||
tokenReg = await TokenRegistryContract.deploy0xArtifactAsync(artifacts.TokenRegistry, provider, defaults);
|
tokenReg = await TokenRegistryContract.deployFrom0xArtifactAsync(artifacts.TokenRegistry, provider, defaults);
|
||||||
tokenRegWrapper = new TokenRegWrapper(tokenReg);
|
tokenRegWrapper = new TokenRegWrapper(tokenReg);
|
||||||
});
|
});
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ describe('TokenTransferProxy', () => {
|
|||||||
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
||||||
owner = address = accounts[0];
|
owner = address = accounts[0];
|
||||||
notOwner = accounts[1];
|
notOwner = accounts[1];
|
||||||
tokenTransferProxy = await TokenTransferProxyContract.deploy0xArtifactAsync(
|
tokenTransferProxy = await TokenTransferProxyContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.TokenTransferProxy,
|
artifacts.TokenTransferProxy,
|
||||||
provider,
|
provider,
|
||||||
defaults,
|
defaults,
|
||||||
|
|||||||
@@ -32,12 +32,12 @@ describe('TokenTransferProxy', () => {
|
|||||||
before(async () => {
|
before(async () => {
|
||||||
accounts = await web3Wrapper.getAvailableAddressesAsync();
|
accounts = await web3Wrapper.getAvailableAddressesAsync();
|
||||||
owner = notAuthorized = accounts[0];
|
owner = notAuthorized = accounts[0];
|
||||||
tokenTransferProxy = await TokenTransferProxyContract.deploy0xArtifactAsync(
|
tokenTransferProxy = await TokenTransferProxyContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.TokenTransferProxy,
|
artifacts.TokenTransferProxy,
|
||||||
provider,
|
provider,
|
||||||
defaults,
|
defaults,
|
||||||
);
|
);
|
||||||
rep = await DummyTokenContract.deploy0xArtifactAsync(
|
rep = await DummyTokenContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.DummyToken,
|
artifacts.DummyToken,
|
||||||
provider,
|
provider,
|
||||||
defaults,
|
defaults,
|
||||||
|
|||||||
@@ -40,8 +40,8 @@ describe('Arbitrage', () => {
|
|||||||
const INITIAL_BALANCE = ZeroEx.toBaseUnitAmount(new BigNumber(10000), 18);
|
const INITIAL_BALANCE = ZeroEx.toBaseUnitAmount(new BigNumber(10000), 18);
|
||||||
const INITIAL_ALLOWANCE = ZeroEx.toBaseUnitAmount(new BigNumber(10000), 18);
|
const INITIAL_ALLOWANCE = ZeroEx.toBaseUnitAmount(new BigNumber(10000), 18);
|
||||||
|
|
||||||
let weth: Web3.ContractInstance;
|
let weth: DummyTokenContract;
|
||||||
let zrx: Web3.ContractInstance;
|
let zrx: DummyTokenContract;
|
||||||
let arbitrage: ArbitrageContract;
|
let arbitrage: ArbitrageContract;
|
||||||
let etherDelta: EtherDeltaContract;
|
let etherDelta: EtherDeltaContract;
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ describe('Arbitrage', () => {
|
|||||||
before(async () => {
|
before(async () => {
|
||||||
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
||||||
[coinbase, maker, edMaker, edFrontRunner] = accounts;
|
[coinbase, maker, edMaker, edFrontRunner] = accounts;
|
||||||
weth = await DummyTokenContract.deploy0xArtifactAsync(
|
weth = await DummyTokenContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.DummyToken,
|
artifacts.DummyToken,
|
||||||
provider,
|
provider,
|
||||||
defaults,
|
defaults,
|
||||||
@@ -67,7 +67,7 @@ describe('Arbitrage', () => {
|
|||||||
constants.DUMMY_TOKEN_DECIMALS,
|
constants.DUMMY_TOKEN_DECIMALS,
|
||||||
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
|
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
|
||||||
);
|
);
|
||||||
zrx = await DummyTokenContract.deploy0xArtifactAsync(
|
zrx = await DummyTokenContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.DummyToken,
|
artifacts.DummyToken,
|
||||||
provider,
|
provider,
|
||||||
defaults,
|
defaults,
|
||||||
@@ -76,7 +76,7 @@ describe('Arbitrage', () => {
|
|||||||
constants.DUMMY_TOKEN_DECIMALS,
|
constants.DUMMY_TOKEN_DECIMALS,
|
||||||
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
|
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
|
||||||
);
|
);
|
||||||
const accountLevels = await AccountLevelsContract.deploy0xArtifactAsync(
|
const accountLevels = await AccountLevelsContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.AccountLevels,
|
artifacts.AccountLevels,
|
||||||
provider,
|
provider,
|
||||||
defaults,
|
defaults,
|
||||||
@@ -85,7 +85,7 @@ describe('Arbitrage', () => {
|
|||||||
const edMakerFee = new BigNumber(0);
|
const edMakerFee = new BigNumber(0);
|
||||||
const edTakerFee = new BigNumber(0);
|
const edTakerFee = new BigNumber(0);
|
||||||
const edFeeRebate = new BigNumber(0);
|
const edFeeRebate = new BigNumber(0);
|
||||||
etherDelta = await EtherDeltaContract.deploy0xArtifactAsync(
|
etherDelta = await EtherDeltaContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.EtherDelta,
|
artifacts.EtherDelta,
|
||||||
provider,
|
provider,
|
||||||
defaults,
|
defaults,
|
||||||
@@ -96,12 +96,12 @@ describe('Arbitrage', () => {
|
|||||||
edTakerFee,
|
edTakerFee,
|
||||||
edFeeRebate,
|
edFeeRebate,
|
||||||
);
|
);
|
||||||
const tokenTransferProxy = await TokenTransferProxyContract.deploy0xArtifactAsync(
|
const tokenTransferProxy = await TokenTransferProxyContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.TokenTransferProxy,
|
artifacts.TokenTransferProxy,
|
||||||
provider,
|
provider,
|
||||||
defaults,
|
defaults,
|
||||||
);
|
);
|
||||||
const exchange = await ExchangeContract.deploy0xArtifactAsync(
|
const exchange = await ExchangeContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.Exchange,
|
artifacts.Exchange,
|
||||||
provider,
|
provider,
|
||||||
defaults,
|
defaults,
|
||||||
@@ -129,7 +129,7 @@ describe('Arbitrage', () => {
|
|||||||
takerFee: new BigNumber(0),
|
takerFee: new BigNumber(0),
|
||||||
};
|
};
|
||||||
orderFactory = new OrderFactory(zeroEx, defaultOrderParams);
|
orderFactory = new OrderFactory(zeroEx, defaultOrderParams);
|
||||||
arbitrage = await ArbitrageContract.deploy0xArtifactAsync(
|
arbitrage = await ArbitrageContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.Arbitrage,
|
artifacts.Arbitrage,
|
||||||
provider,
|
provider,
|
||||||
defaults,
|
defaults,
|
||||||
@@ -142,26 +142,26 @@ describe('Arbitrage', () => {
|
|||||||
await arbitrage.setAllowances.sendTransactionAsync(zrx.address, { from: coinbase });
|
await arbitrage.setAllowances.sendTransactionAsync(zrx.address, { from: coinbase });
|
||||||
|
|
||||||
// Give some tokens to arbitrage contract
|
// Give some tokens to arbitrage contract
|
||||||
await weth.setBalance(arbitrage.address, takerTokenAmount, { from: coinbase });
|
await weth.setBalance.sendTransactionAsync(arbitrage.address, takerTokenAmount, { from: coinbase });
|
||||||
|
|
||||||
// Fund the maker on exchange side
|
// Fund the maker on exchange side
|
||||||
await zrx.setBalance(maker, makerTokenAmount, { from: coinbase });
|
await zrx.setBalance.sendTransactionAsync(maker, makerTokenAmount, { from: coinbase });
|
||||||
// Set the allowance for the maker on Exchange side
|
// Set the allowance for the maker on Exchange side
|
||||||
await zrx.approve(tokenTransferProxy.address, INITIAL_ALLOWANCE, { from: maker });
|
await zrx.approve.sendTransactionAsync(tokenTransferProxy.address, INITIAL_ALLOWANCE, { from: maker });
|
||||||
|
|
||||||
amountGive = ZeroEx.toBaseUnitAmount(new BigNumber(2), 18);
|
amountGive = ZeroEx.toBaseUnitAmount(new BigNumber(2), 18);
|
||||||
// Fund the maker on EtherDelta side
|
// Fund the maker on EtherDelta side
|
||||||
await weth.setBalance(edMaker, amountGive, { from: coinbase });
|
await weth.setBalance.sendTransactionAsync(edMaker, amountGive, { from: coinbase });
|
||||||
// Set the allowance for the maker on EtherDelta side
|
// Set the allowance for the maker on EtherDelta side
|
||||||
await weth.approve(etherDelta.address, INITIAL_ALLOWANCE, { from: edMaker });
|
await weth.approve.sendTransactionAsync(etherDelta.address, INITIAL_ALLOWANCE, { from: edMaker });
|
||||||
// Deposit maker funds into EtherDelta
|
// Deposit maker funds into EtherDelta
|
||||||
await etherDelta.depositToken.sendTransactionAsync(weth.address, amountGive, { from: edMaker });
|
await etherDelta.depositToken.sendTransactionAsync(weth.address, amountGive, { from: edMaker });
|
||||||
|
|
||||||
amountGet = makerTokenAmount;
|
amountGet = makerTokenAmount;
|
||||||
// Fund the front runner on EtherDelta side
|
// Fund the front runner on EtherDelta side
|
||||||
await zrx.setBalance(edFrontRunner, amountGet, { from: coinbase });
|
await zrx.setBalance.sendTransactionAsync(edFrontRunner, amountGet, { from: coinbase });
|
||||||
// Set the allowance for the front-runner on EtherDelta side
|
// Set the allowance for the front-runner on EtherDelta side
|
||||||
await zrx.approve(etherDelta.address, INITIAL_ALLOWANCE, { from: edFrontRunner });
|
await zrx.approve.sendTransactionAsync(etherDelta.address, INITIAL_ALLOWANCE, { from: edFrontRunner });
|
||||||
// Deposit front runner funds into EtherDelta
|
// Deposit front runner funds into EtherDelta
|
||||||
await etherDelta.depositToken.sendTransactionAsync(zrx.address, amountGet, { from: edFrontRunner });
|
await etherDelta.depositToken.sendTransactionAsync(zrx.address, amountGet, { from: edFrontRunner });
|
||||||
});
|
});
|
||||||
@@ -228,11 +228,11 @@ describe('Arbitrage', () => {
|
|||||||
from: coinbase,
|
from: coinbase,
|
||||||
});
|
});
|
||||||
const res = await zeroEx.awaitTransactionMinedAsync(txHash);
|
const res = await zeroEx.awaitTransactionMinedAsync(txHash);
|
||||||
const postBalance = await weth.balanceOf(arbitrage.address);
|
const postBalance = await weth.balanceOf.callAsync(arbitrage.address);
|
||||||
expect(postBalance).to.be.bignumber.equal(amountGive);
|
expect(postBalance).to.be.bignumber.equal(amountGive);
|
||||||
});
|
});
|
||||||
it('should fail and revert if front-runned', async () => {
|
it('should fail and revert if front-runned', async () => {
|
||||||
const preBalance = await weth.balanceOf(arbitrage.address);
|
const preBalance = await weth.balanceOf.callAsync(arbitrage.address);
|
||||||
// Front-running transaction
|
// Front-running transaction
|
||||||
await etherDelta.trade.sendTransactionAsync(
|
await etherDelta.trade.sendTransactionAsync(
|
||||||
tokenGet,
|
tokenGet,
|
||||||
@@ -252,7 +252,7 @@ describe('Arbitrage', () => {
|
|||||||
await expect(
|
await expect(
|
||||||
arbitrage.makeAtomicTrade.sendTransactionAsync(addresses, values, v, r, s, { from: coinbase }),
|
arbitrage.makeAtomicTrade.sendTransactionAsync(addresses, values, v, r, s, { from: coinbase }),
|
||||||
).to.be.rejectedWith(constants.REVERT);
|
).to.be.rejectedWith(constants.REVERT);
|
||||||
const postBalance = await weth.balanceOf(arbitrage.address);
|
const postBalance = await weth.balanceOf.callAsync(arbitrage.address);
|
||||||
expect(preBalance).to.be.bignumber.equal(postBalance);
|
expect(preBalance).to.be.bignumber.equal(postBalance);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ describe('UnlimitedAllowanceToken', () => {
|
|||||||
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
||||||
owner = accounts[0];
|
owner = accounts[0];
|
||||||
spender = accounts[1];
|
spender = accounts[1];
|
||||||
token = await DummyTokenContract.deploy0xArtifactAsync(
|
token = await DummyTokenContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.DummyToken,
|
artifacts.DummyToken,
|
||||||
provider,
|
provider,
|
||||||
defaults,
|
defaults,
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ describe('ZRXToken', () => {
|
|||||||
zeroEx = new ZeroEx(provider, {
|
zeroEx = new ZeroEx(provider, {
|
||||||
networkId: constants.TESTRPC_NETWORK_ID,
|
networkId: constants.TESTRPC_NETWORK_ID,
|
||||||
});
|
});
|
||||||
zrx = await ZRXTokenContract.deploy0xArtifactAsync(artifacts.ZRX, provider, defaults);
|
zrx = await ZRXTokenContract.deployFrom0xArtifactAsync(artifacts.ZRX, provider, defaults);
|
||||||
zrxAddress = zrx.address;
|
zrxAddress = zrx.address;
|
||||||
MAX_UINT = zeroEx.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS;
|
MAX_UINT = zeroEx.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
|
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
|
||||||
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
|
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
|
||||||
"clean": "shx rm -rf lib scripts",
|
"clean": "shx rm -rf lib scripts",
|
||||||
"lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'",
|
"lint": "tslint --project .",
|
||||||
"manual:postpublish": "yarn build; node ./scripts/postpublish.js"
|
"manual:postpublish": "yarn build; node ./scripts/postpublish.js"
|
||||||
},
|
},
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
|||||||
@@ -15,8 +15,7 @@ export const coverage = {
|
|||||||
_getCoverageSubprovider(): CoverageSubprovider {
|
_getCoverageSubprovider(): CoverageSubprovider {
|
||||||
const artifactsPath = '../migrations/artifacts/1.0.0';
|
const artifactsPath = '../migrations/artifacts/1.0.0';
|
||||||
const contractsPath = 'src/contracts';
|
const contractsPath = 'src/contracts';
|
||||||
const networkId = 50;
|
|
||||||
const defaultFromAddress = constants.TESTRPC_FIRST_ADDRESS;
|
const defaultFromAddress = constants.TESTRPC_FIRST_ADDRESS;
|
||||||
return new CoverageSubprovider(artifactsPath, contractsPath, networkId, defaultFromAddress);
|
return new CoverageSubprovider(artifactsPath, contractsPath, defaultFromAddress);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
"types": "lib/src/index.d.ts",
|
"types": "lib/src/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build:watch": "tsc -w",
|
"build:watch": "tsc -w",
|
||||||
"lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'",
|
"lint": "tslint --project .",
|
||||||
"test": "run-s clean build run_mocha",
|
"test": "run-s clean build run_mocha",
|
||||||
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
|
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
|
||||||
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
|
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { ContractArtifact } from '@0xproject/sol-compiler';
|
|
||||||
import { BlockchainLifecycle, devConstants } from '@0xproject/dev-utils';
|
import { BlockchainLifecycle, devConstants } from '@0xproject/dev-utils';
|
||||||
|
import { ContractArtifact } from '@0xproject/sol-compiler';
|
||||||
import { LogWithDecodedArgs } from '@0xproject/types';
|
import { LogWithDecodedArgs } from '@0xproject/types';
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber } from '@0xproject/utils';
|
||||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
@@ -23,7 +23,7 @@ describe('Metacoin', () => {
|
|||||||
const ownerAddress = devConstants.TESTRPC_FIRST_ADDRESS;
|
const ownerAddress = devConstants.TESTRPC_FIRST_ADDRESS;
|
||||||
const INITIAL_BALANCE = new BigNumber(10000);
|
const INITIAL_BALANCE = new BigNumber(10000);
|
||||||
before(async () => {
|
before(async () => {
|
||||||
metacoin = await MetacoinContract.deploy0xArtifactAsync(artifact, provider, config.defaults);
|
metacoin = await MetacoinContract.deployFrom0xArtifactAsync(artifact, provider, config.defaults);
|
||||||
web3Wrapper.abiDecoder.addABI(metacoin.abi);
|
web3Wrapper.abiDecoder.addABI(metacoin.abi);
|
||||||
});
|
});
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
|
|||||||
@@ -15,6 +15,6 @@ export const coverage = {
|
|||||||
},
|
},
|
||||||
_getCoverageSubprovider(): CoverageSubprovider {
|
_getCoverageSubprovider(): CoverageSubprovider {
|
||||||
const defaultFromAddress = devConstants.TESTRPC_FIRST_ADDRESS;
|
const defaultFromAddress = devConstants.TESTRPC_FIRST_ADDRESS;
|
||||||
return new CoverageSubprovider(config.artifactsDir, config.contractsDir, config.networkId, defaultFromAddress);
|
return new CoverageSubprovider(config.artifactsDir, config.contractsDir, defaultFromAddress);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
"copy_artifacts": "copyfiles -u 4 'artifacts/1.0.0/**/*' ./lib/src/artifacts",
|
"copy_artifacts": "copyfiles -u 4 'artifacts/1.0.0/**/*' ./lib/src/artifacts",
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"clean": "shx rm -rf lib",
|
"clean": "shx rm -rf lib",
|
||||||
"lint": "tslint --project . 'src/**/*.ts'",
|
"lint": "tslint --project .",
|
||||||
"migrate": "run-s build compile script:migrate",
|
"migrate": "run-s build compile script:migrate",
|
||||||
"script:migrate": "node ./lib/migrate.js",
|
"script:migrate": "node ./lib/migrate.js",
|
||||||
"copy_artifacts": "copyfiles 'artifacts/1.0.0/**/*' ./lib",
|
"copy_artifacts": "copyfiles 'artifacts/1.0.0/**/*' ./lib",
|
||||||
@@ -35,6 +35,7 @@
|
|||||||
"@0xproject/base-contract": "^0.3.1",
|
"@0xproject/base-contract": "^0.3.1",
|
||||||
"@0xproject/utils": "^0.6.1",
|
"@0xproject/utils": "^0.6.1",
|
||||||
"@0xproject/web3-wrapper": "^0.6.3",
|
"@0xproject/web3-wrapper": "^0.6.3",
|
||||||
|
"ethers": "^3.0.15",
|
||||||
"lodash": "^4.17.4"
|
"lodash": "^4.17.4"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ export const artifacts = {
|
|||||||
MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress: (MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress as any) as ContractArtifact,
|
MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress: (MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress as any) as ContractArtifact,
|
||||||
};
|
};
|
||||||
|
|
||||||
const ARTIFACTS_DIR = '../artifacts/1.0.0';
|
|
||||||
export class ArtifactWriter {
|
export class ArtifactWriter {
|
||||||
private _artifactsDir: string;
|
private _artifactsDir: string;
|
||||||
private _networkId: number;
|
private _networkId: number;
|
||||||
|
|||||||
@@ -18,33 +18,33 @@ import { tokenInfo } from './utils/token_info';
|
|||||||
* Custom migrations should be defined in this function. This will be called with the CLI 'migrate' command.
|
* Custom migrations should be defined in this function. This will be called with the CLI 'migrate' command.
|
||||||
* Migrations could be written to run in parallel, but if you want contract addresses to be created deterministically,
|
* Migrations could be written to run in parallel, but if you want contract addresses to be created deterministically,
|
||||||
* the migration should be written to run synchronously.
|
* the migration should be written to run synchronously.
|
||||||
* @param provider Provider instance.
|
* @param provider Web3 provider instance.
|
||||||
* @param artifactsDir The directory with artifact files.
|
* @param artifactsDir The directory with compiler artifact files.
|
||||||
* @param defaults Default transaction values to use.
|
* @param defaults Default transaction values to use when deploying contracts.
|
||||||
*/
|
*/
|
||||||
export const runMigrationsAsync = async (provider: Provider, artifactsDir: string, defaults: Partial<TxData>) => {
|
export const runMigrationsAsync = async (provider: Provider, artifactsDir: string, defaults: Partial<TxData>) => {
|
||||||
const web3Wrapper = new Web3Wrapper(provider);
|
const web3Wrapper = new Web3Wrapper(provider);
|
||||||
const networkId = await web3Wrapper.getNetworkIdAsync();
|
const networkId = await web3Wrapper.getNetworkIdAsync();
|
||||||
const artifactsWriter = new ArtifactWriter(artifactsDir, networkId);
|
const artifactsWriter = new ArtifactWriter(artifactsDir, networkId);
|
||||||
const tokenTransferProxy = await TokenTransferProxyContract.deploy0xArtifactAsync(
|
const tokenTransferProxy = await TokenTransferProxyContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.TokenTransferProxy,
|
artifacts.TokenTransferProxy,
|
||||||
provider,
|
provider,
|
||||||
defaults,
|
defaults,
|
||||||
);
|
);
|
||||||
artifactsWriter.saveArtifact(tokenTransferProxy);
|
artifactsWriter.saveArtifact(tokenTransferProxy);
|
||||||
const zrxToken = await ZRXTokenContract.deploy0xArtifactAsync(artifacts.ZRX, provider, defaults);
|
const zrxToken = await ZRXTokenContract.deployFrom0xArtifactAsync(artifacts.ZRX, provider, defaults);
|
||||||
artifactsWriter.saveArtifact(zrxToken);
|
artifactsWriter.saveArtifact(zrxToken);
|
||||||
|
|
||||||
const etherToken = await WETH9Contract.deploy0xArtifactAsync(artifacts.EtherToken, provider, defaults);
|
const etherToken = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.EtherToken, provider, defaults);
|
||||||
artifactsWriter.saveArtifact(etherToken);
|
artifactsWriter.saveArtifact(etherToken);
|
||||||
const tokenReg = await TokenRegistryContract.deploy0xArtifactAsync(artifacts.TokenRegistry, provider, defaults);
|
const tokenReg = await TokenRegistryContract.deployFrom0xArtifactAsync(artifacts.TokenRegistry, provider, defaults);
|
||||||
artifactsWriter.saveArtifact(tokenReg);
|
artifactsWriter.saveArtifact(tokenReg);
|
||||||
|
|
||||||
const accounts: string[] = await web3Wrapper.getAvailableAddressesAsync();
|
const accounts: string[] = await web3Wrapper.getAvailableAddressesAsync();
|
||||||
const owners = [accounts[0], accounts[1]];
|
const owners = [accounts[0], accounts[1]];
|
||||||
const confirmationsRequired = new BigNumber(2);
|
const confirmationsRequired = new BigNumber(2);
|
||||||
const secondsRequired = new BigNumber(0);
|
const secondsRequired = new BigNumber(0);
|
||||||
const exchange = await ExchangeContract.deploy0xArtifactAsync(
|
const exchange = await ExchangeContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.Exchange,
|
artifacts.Exchange,
|
||||||
provider,
|
provider,
|
||||||
defaults,
|
defaults,
|
||||||
@@ -52,7 +52,7 @@ export const runMigrationsAsync = async (provider: Provider, artifactsDir: strin
|
|||||||
tokenTransferProxy.address,
|
tokenTransferProxy.address,
|
||||||
);
|
);
|
||||||
artifactsWriter.saveArtifact(exchange);
|
artifactsWriter.saveArtifact(exchange);
|
||||||
const multiSig = await MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddressContract.deploy0xArtifactAsync(
|
const multiSig = await MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddressContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress,
|
artifacts.MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress,
|
||||||
provider,
|
provider,
|
||||||
defaults,
|
defaults,
|
||||||
@@ -101,7 +101,7 @@ export const runMigrationsAsync = async (provider: Provider, artifactsDir: strin
|
|||||||
);
|
);
|
||||||
for (const token of tokenInfo) {
|
for (const token of tokenInfo) {
|
||||||
const totalSupply = new BigNumber(100000000000000000000);
|
const totalSupply = new BigNumber(100000000000000000000);
|
||||||
const dummyToken = await DummyTokenContract.deploy0xArtifactAsync(
|
const dummyToken = await DummyTokenContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.DummyToken,
|
artifacts.DummyToken,
|
||||||
provider,
|
provider,
|
||||||
defaults,
|
defaults,
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
"types": "lib/index.d.ts",
|
"types": "lib/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build:watch": "tsc -w",
|
"build:watch": "tsc -w",
|
||||||
"lint": "tslint --project . 'src/**/*.ts'",
|
"lint": "tslint --project .",
|
||||||
"clean": "shx rm -rf lib",
|
"clean": "shx rm -rf lib",
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"test:publish": "run-s build script:publish",
|
"test:publish": "run-s build script:publish",
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"version": "0.0.11",
|
"version": "0.0.11",
|
||||||
"description": "An example app using react-docs",
|
"description": "An example app using react-docs",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "tslint --project . 'ts/**/*.ts' 'ts/**/*.tsx'",
|
"lint": "tslint --project .",
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"build:example": "NODE_ENV=production webpack",
|
"build:example": "NODE_ENV=production webpack",
|
||||||
"build:watch": "tsc -w",
|
"build:watch": "tsc -w",
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"types": "lib/index.d.ts",
|
"types": "lib/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "tslint --project . 'src/**/*.ts' 'src/**/*.tsx'",
|
"lint": "tslint --project .",
|
||||||
"build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts",
|
"build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts",
|
||||||
"build:watch": "tsc -w",
|
"build:watch": "tsc -w",
|
||||||
"clean": "shx rm -rf lib scripts",
|
"clean": "shx rm -rf lib scripts",
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"types": "lib/index.d.ts",
|
"types": "lib/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "tslint --project . 'src/**/*.ts' 'src/**/*.tsx'",
|
"lint": "tslint --project .",
|
||||||
"build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts",
|
"build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts",
|
||||||
"build:watch": "tsc -w",
|
"build:watch": "tsc -w",
|
||||||
"clean": "shx rm -rf lib scripts",
|
"clean": "shx rm -rf lib scripts",
|
||||||
|
|||||||
0
packages/sol-compiler/coverage/.gitkeep
Normal file
0
packages/sol-compiler/coverage/.gitkeep
Normal file
@@ -14,7 +14,7 @@
|
|||||||
"compile": "npm run build; node lib/src/cli.js compile",
|
"compile": "npm run build; node lib/src/cli.js compile",
|
||||||
"clean": "shx rm -rf lib scripts",
|
"clean": "shx rm -rf lib scripts",
|
||||||
"migrate": "npm run build; node lib/src/cli.js migrate",
|
"migrate": "npm run build; node lib/src/cli.js migrate",
|
||||||
"lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'",
|
"lint": "tslint --project .",
|
||||||
"test:circleci": "yarn test:coverage",
|
"test:circleci": "yarn test:coverage",
|
||||||
"docs:stage": "yarn build && node ./scripts/stage_docs.js",
|
"docs:stage": "yarn build && node ./scripts/stage_docs.js",
|
||||||
"manual:postpublish": "yarn build; node ./scripts/postpublish.js",
|
"manual:postpublish": "yarn build; node ./scripts/postpublish.js",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
// We need the above pragma since this script will be run as a command-line tool.
|
// We need the above pragma since this script will be run as a command-line tool.
|
||||||
|
|
||||||
import { BigNumber } from '@0xproject/utils';
|
import { BigNumber, logUtils } from '@0xproject/utils';
|
||||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
@@ -38,4 +38,7 @@ const SEPARATOR = ',';
|
|||||||
};
|
};
|
||||||
const compiler = new Compiler(opts);
|
const compiler = new Compiler(opts);
|
||||||
await compiler.compileAsync();
|
await compiler.compileAsync();
|
||||||
})();
|
})().catch(err => {
|
||||||
|
logUtils.log(err);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ describe('#Compiler', function() {
|
|||||||
const exchangeArtifactString = await fsWrapper.readFileAsync(exchangeArtifactPath, opts);
|
const exchangeArtifactString = await fsWrapper.readFileAsync(exchangeArtifactPath, opts);
|
||||||
const exchangeArtifact: ContractArtifact = JSON.parse(exchangeArtifactString);
|
const exchangeArtifact: ContractArtifact = JSON.parse(exchangeArtifactString);
|
||||||
// The last 43 bytes of the binaries are metadata which may not be equivalent
|
// The last 43 bytes of the binaries are metadata which may not be equivalent
|
||||||
const unlinkedBinaryWithoutMetadata = exchangeArtifact.compilerOutput.evm.bytecode.object.slice(0, -86);
|
const unlinkedBinaryWithoutMetadata = exchangeArtifact.compilerOutput.evm.bytecode.object.slice(2, -86);
|
||||||
const exchangeBinaryWithoutMetadata = exchange_binary.slice(0, -86);
|
const exchangeBinaryWithoutMetadata = exchange_binary.slice(0, -86);
|
||||||
expect(unlinkedBinaryWithoutMetadata).to.equal(exchangeBinaryWithoutMetadata);
|
expect(unlinkedBinaryWithoutMetadata).to.equal(exchangeBinaryWithoutMetadata);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
"types": "lib/src/index.d.ts",
|
"types": "lib/src/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build:watch": "tsc -w",
|
"build:watch": "tsc -w",
|
||||||
"lint": "tslint --project . 'src/**/*.ts'",
|
"lint": "tslint --project .",
|
||||||
"test": "run-s clean build compile_test run_mocha",
|
"test": "run-s clean build compile_test run_mocha",
|
||||||
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
|
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
|
||||||
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
|
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
|
||||||
@@ -54,10 +54,9 @@
|
|||||||
"solidity-parser-antlr": "^0.2.8"
|
"solidity-parser-antlr": "^0.2.8"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0xproject/sol-compiler": "^0.3.5",
|
|
||||||
"@0xproject/monorepo-scripts": "^0.1.19",
|
"@0xproject/monorepo-scripts": "^0.1.19",
|
||||||
"@0xproject/tslint-config": "^0.4.17",
|
"@0xproject/tslint-config": "^0.4.17",
|
||||||
"@types/istanbul": "^0.4.29",
|
"@types/istanbul": "^0.4.30",
|
||||||
"@types/mocha": "^2.2.42",
|
"@types/mocha": "^2.2.42",
|
||||||
"@types/node": "^8.0.53",
|
"@types/node": "^8.0.53",
|
||||||
"chai": "^4.0.1",
|
"chai": "^4.0.1",
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import * as path from 'path';
|
|||||||
|
|
||||||
import { ContractData } from './types';
|
import { ContractData } from './types';
|
||||||
|
|
||||||
export const collectContractsData = (artifactsPath: string, sourcesPath: string, networkId: number) => {
|
export const collectContractsData = (artifactsPath: string, sourcesPath: string) => {
|
||||||
const artifactsGlob = `${artifactsPath}/**/*.json`;
|
const artifactsGlob = `${artifactsPath}/**/*.json`;
|
||||||
const artifactFileNames = glob.sync(artifactsGlob, { absolute: true });
|
const artifactFileNames = glob.sync(artifactsGlob, { absolute: true });
|
||||||
const contractsData: ContractData[] = [];
|
const contractsData: ContractData[] = [];
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { addHexPrefix } from 'ethereumjs-util';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import { Collector } from 'istanbul';
|
import { Collector } from 'istanbul';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
@@ -36,12 +37,11 @@ export class CoverageManager {
|
|||||||
constructor(
|
constructor(
|
||||||
artifactsPath: string,
|
artifactsPath: string,
|
||||||
sourcesPath: string,
|
sourcesPath: string,
|
||||||
networkId: number,
|
|
||||||
getContractCodeAsync: (address: string) => Promise<string>,
|
getContractCodeAsync: (address: string) => Promise<string>,
|
||||||
) {
|
) {
|
||||||
this._getContractCodeAsync = getContractCodeAsync;
|
this._getContractCodeAsync = getContractCodeAsync;
|
||||||
this._sourcesPath = sourcesPath;
|
this._sourcesPath = sourcesPath;
|
||||||
this._contractsData = collectContractsData(artifactsPath, this._sourcesPath, networkId);
|
this._contractsData = collectContractsData(artifactsPath, this._sourcesPath);
|
||||||
}
|
}
|
||||||
public appendTraceInfo(traceInfo: TraceInfo): void {
|
public appendTraceInfo(traceInfo: TraceInfo): void {
|
||||||
this._traceInfos.push(traceInfo);
|
this._traceInfos.push(traceInfo);
|
||||||
@@ -134,7 +134,7 @@ export class CoverageManager {
|
|||||||
if (traceInfo.address !== constants.NEW_CONTRACT) {
|
if (traceInfo.address !== constants.NEW_CONTRACT) {
|
||||||
// Runtime transaction
|
// Runtime transaction
|
||||||
let runtimeBytecode = (traceInfo as TraceInfoExistingContract).runtimeBytecode;
|
let runtimeBytecode = (traceInfo as TraceInfoExistingContract).runtimeBytecode;
|
||||||
runtimeBytecode = utils.removeHexPrefix(runtimeBytecode);
|
runtimeBytecode = addHexPrefix(runtimeBytecode);
|
||||||
const contractData = _.find(this._contractsData, { runtimeBytecode }) as ContractData;
|
const contractData = _.find(this._contractsData, { runtimeBytecode }) as ContractData;
|
||||||
if (_.isUndefined(contractData)) {
|
if (_.isUndefined(contractData)) {
|
||||||
throw new Error(`Transaction to an unknown address: ${traceInfo.address}`);
|
throw new Error(`Transaction to an unknown address: ${traceInfo.address}`);
|
||||||
@@ -159,7 +159,7 @@ export class CoverageManager {
|
|||||||
} else {
|
} else {
|
||||||
// Contract creation transaction
|
// Contract creation transaction
|
||||||
let bytecode = (traceInfo as TraceInfoNewContract).bytecode;
|
let bytecode = (traceInfo as TraceInfoNewContract).bytecode;
|
||||||
bytecode = utils.removeHexPrefix(bytecode);
|
bytecode = addHexPrefix(bytecode);
|
||||||
const contractData = _.find(this._contractsData, contractDataCandidate =>
|
const contractData = _.find(this._contractsData, contractDataCandidate =>
|
||||||
bytecode.startsWith(contractDataCandidate.bytecode),
|
bytecode.startsWith(contractDataCandidate.bytecode),
|
||||||
) as ContractData;
|
) as ContractData;
|
||||||
@@ -185,7 +185,6 @@ export class CoverageManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO: Remove any cast as soon as https://github.com/DefinitelyTyped/DefinitelyTyped/pull/24233 gets merged
|
return collector.getFinalCoverage();
|
||||||
return (collector as any).getFinalCoverage();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,19 +28,13 @@ export class CoverageSubprovider extends Subprovider {
|
|||||||
* Instantiates a CoverageSubprovider instance
|
* Instantiates a CoverageSubprovider instance
|
||||||
* @param artifactsPath Path to the smart contract artifacts
|
* @param artifactsPath Path to the smart contract artifacts
|
||||||
* @param sourcesPath Path to the smart contract source files
|
* @param sourcesPath Path to the smart contract source files
|
||||||
* @param networkId network id
|
|
||||||
* @param defaultFromAddress default from address to use when sending transactions
|
* @param defaultFromAddress default from address to use when sending transactions
|
||||||
*/
|
*/
|
||||||
constructor(artifactsPath: string, sourcesPath: string, networkId: number, defaultFromAddress: string) {
|
constructor(artifactsPath: string, sourcesPath: string, defaultFromAddress: string) {
|
||||||
super();
|
super();
|
||||||
this._lock = new Lock();
|
this._lock = new Lock();
|
||||||
this._defaultFromAddress = defaultFromAddress;
|
this._defaultFromAddress = defaultFromAddress;
|
||||||
this._coverageManager = new CoverageManager(
|
this._coverageManager = new CoverageManager(artifactsPath, sourcesPath, this._getContractCodeAsync.bind(this));
|
||||||
artifactsPath,
|
|
||||||
sourcesPath,
|
|
||||||
networkId,
|
|
||||||
this._getContractCodeAsync.bind(this),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Write the test coverage results to a file in Istanbul format.
|
* Write the test coverage results to a file in Istanbul format.
|
||||||
|
|||||||
@@ -12,8 +12,7 @@ describe('Collect contracts data', () => {
|
|||||||
it('correctly collects contracts data', () => {
|
it('correctly collects contracts data', () => {
|
||||||
const artifactsPath = path.resolve(__dirname, 'fixtures/artifacts');
|
const artifactsPath = path.resolve(__dirname, 'fixtures/artifacts');
|
||||||
const sourcesPath = path.resolve(__dirname, 'fixtures/contracts');
|
const sourcesPath = path.resolve(__dirname, 'fixtures/contracts');
|
||||||
const networkId = 50;
|
const contractsData = collectContractsData(artifactsPath, sourcesPath);
|
||||||
const contractsData = collectContractsData(artifactsPath, sourcesPath, networkId);
|
|
||||||
_.forEach(contractsData, contractData => {
|
_.forEach(contractsData, contractData => {
|
||||||
expect(contractData).to.have.keys([
|
expect(contractData).to.have.keys([
|
||||||
'sourceCodes',
|
'sourceCodes',
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
"build:watch": "tsc -w",
|
"build:watch": "tsc -w",
|
||||||
"clean": "shx rm -rf lib scripts",
|
"clean": "shx rm -rf lib scripts",
|
||||||
"build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
|
"build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
|
||||||
"lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'",
|
"lint": "tslint --project .",
|
||||||
"run_mocha_unit": "mocha lib/test/unit/**/*_test.js --timeout 10000 --bail --exit",
|
"run_mocha_unit": "mocha lib/test/unit/**/*_test.js --timeout 10000 --bail --exit",
|
||||||
"run_mocha_integration": "mocha lib/test/integration/**/*_test.js --timeout 10000 --bail --exit",
|
"run_mocha_integration": "mocha lib/test/integration/**/*_test.js --timeout 10000 --bail --exit",
|
||||||
"test": "npm run test:unit",
|
"test": "npm run test:unit",
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
"build": "node ../../node_modules/gulp/bin/gulp.js build",
|
"build": "node ../../node_modules/gulp/bin/gulp.js build",
|
||||||
"dev": "node ../../node_modules/gulp/bin/gulp.js run",
|
"dev": "node ../../node_modules/gulp/bin/gulp.js run",
|
||||||
"start": "node ./bin/server.js",
|
"start": "node ./bin/server.js",
|
||||||
"lint": "tslint --project . 'src/**/*.ts'",
|
"lint": "tslint --project .",
|
||||||
"clean": "shx rm -rf bin"
|
"clean": "shx rm -rf bin"
|
||||||
},
|
},
|
||||||
"author": "Fabio Berger",
|
"author": "Fabio Berger",
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
"build:watch": "tsc -w",
|
"build:watch": "tsc -w",
|
||||||
"build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts",
|
"build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts",
|
||||||
"clean": "shx rm -rf lib scripts",
|
"clean": "shx rm -rf lib scripts",
|
||||||
"lint": "tslint --project . 'rules/**/*.ts'",
|
"lint": "tslint --project .",
|
||||||
"manual:postpublish": "yarn build; node ./scripts/postpublish.js"
|
"manual:postpublish": "yarn build; node ./scripts/postpublish.js"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
"build:watch": "tsc -w",
|
"build:watch": "tsc -w",
|
||||||
"build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts",
|
"build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts",
|
||||||
"clean": "shx rm -rf lib scripts",
|
"clean": "shx rm -rf lib scripts",
|
||||||
"lint": "tslint --project . 'src/**/*.ts'",
|
"lint": "tslint --project .",
|
||||||
"manual:postpublish": "yarn build; node ./scripts/postpublish.js"
|
"manual:postpublish": "yarn build; node ./scripts/postpublish.js"
|
||||||
},
|
},
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
declare module 'ethers' {
|
declare module 'ethers' {
|
||||||
|
import { TxData } from '@0xproject/types';
|
||||||
|
|
||||||
export interface TransactionDescription {
|
export interface TransactionDescription {
|
||||||
name: string;
|
name: string;
|
||||||
signature: string;
|
signature: string;
|
||||||
@@ -26,7 +28,7 @@ declare module 'ethers' {
|
|||||||
constructor(abi: any);
|
constructor(abi: any);
|
||||||
}
|
}
|
||||||
export class Contract {
|
export class Contract {
|
||||||
public static getDeployTransaction(bytecode: string, abi: any, ...args: any[]): any;
|
public static getDeployTransaction(bytecode: string, abi: any, ...args: any[]): Partial<TxData>;
|
||||||
constructor(address: string, abi: any, provider: any);
|
constructor(address: string, abi: any, provider: any);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
"build:watch": "tsc -w",
|
"build:watch": "tsc -w",
|
||||||
"build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts",
|
"build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts",
|
||||||
"clean": "shx rm -rf lib scripts",
|
"clean": "shx rm -rf lib scripts",
|
||||||
"lint": "tslint --project . 'src/**/*.ts'",
|
"lint": "tslint --project .",
|
||||||
"manual:postpublish": "yarn build; node ./scripts/postpublish.js"
|
"manual:postpublish": "yarn build; node ./scripts/postpublish.js"
|
||||||
},
|
},
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
"build:watch": "tsc -w",
|
"build:watch": "tsc -w",
|
||||||
"build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
|
"build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
|
||||||
"clean": "shx rm -rf lib scripts",
|
"clean": "shx rm -rf lib scripts",
|
||||||
"lint": "tslint --project . 'src/**/*.ts'",
|
"lint": "tslint --project .",
|
||||||
"test": "run-s clean build run_mocha",
|
"test": "run-s clean build run_mocha",
|
||||||
"test:circleci": "yarn test:coverage",
|
"test:circleci": "yarn test:coverage",
|
||||||
"run_mocha": "mocha lib/test/**/*_test.js --bail --exit",
|
"run_mocha": "mocha lib/test/**/*_test.js --bail --exit",
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ const contractsPath = 'src/contracts';
|
|||||||
const networkId = 50;
|
const networkId = 50;
|
||||||
// Some calls might not have `from` address specified. Nevertheless - transactions need to be submitted from an address with at least some funds. defaultFromAddress is the address that will be used to submit those calls as transactions from.
|
// Some calls might not have `from` address specified. Nevertheless - transactions need to be submitted from an address with at least some funds. defaultFromAddress is the address that will be used to submit those calls as transactions from.
|
||||||
const defaultFromAddress = '0x5409ed021d9299bf6814279a6a1411a7e866a631';
|
const defaultFromAddress = '0x5409ed021d9299bf6814279a6a1411a7e866a631';
|
||||||
const coverageSubprovider = new CoverageSubprovider(artifactsPath, contractsPath, networkId, defaultFromAddress);
|
const coverageSubprovider = new CoverageSubprovider(artifactsPath, contractsPath, defaultFromAddress);
|
||||||
|
|
||||||
provider.addProvider(coverageSubprovider);
|
provider.addProvider(coverageSubprovider);
|
||||||
```
|
```
|
||||||
|
|||||||
69
yarn.lock
69
yarn.lock
@@ -6,25 +6,6 @@
|
|||||||
version "0.3.9"
|
version "0.3.9"
|
||||||
resolved "https://registry.yarnpkg.com/8fold-marked/-/8fold-marked-0.3.9.tgz#bb89c645612f8ccfaffac1ca6e3c11f168c9cf59"
|
resolved "https://registry.yarnpkg.com/8fold-marked/-/8fold-marked-0.3.9.tgz#bb89c645612f8ccfaffac1ca6e3c11f168c9cf59"
|
||||||
|
|
||||||
"@0xproject/sol-compiler@^0.3.5":
|
|
||||||
version "0.3.5"
|
|
||||||
resolved "https://registry.yarnpkg.com/@0xproject/sol-compiler/-/deployer-0.3.5.tgz#3b4144ac62cfbbe4fc7174cbf92f29594f411973"
|
|
||||||
dependencies:
|
|
||||||
"@0xproject/json-schemas" "^0.7.19"
|
|
||||||
"@0xproject/types" "^0.5.0"
|
|
||||||
"@0xproject/typescript-typings" "^0.0.3"
|
|
||||||
"@0xproject/utils" "^0.5.0"
|
|
||||||
"@0xproject/web3-wrapper" "^0.5.0"
|
|
||||||
ethereumjs-util "^5.1.1"
|
|
||||||
isomorphic-fetch "^2.2.1"
|
|
||||||
lodash "^4.17.4"
|
|
||||||
require-from-string "^2.0.1"
|
|
||||||
semver "^5.5.0"
|
|
||||||
solc "^0.4.18"
|
|
||||||
web3 "^0.20.0"
|
|
||||||
web3-eth-abi "^1.0.0-beta.24"
|
|
||||||
yargs "^10.0.3"
|
|
||||||
|
|
||||||
"@0xproject/tslint-config@0.4.13":
|
"@0xproject/tslint-config@0.4.13":
|
||||||
version "0.4.13"
|
version "0.4.13"
|
||||||
resolved "https://registry.yarnpkg.com/@0xproject/tslint-config/-/tslint-config-0.4.13.tgz#98c71c5ae5e80315a23eda0134cc9f6f4438cac2"
|
resolved "https://registry.yarnpkg.com/@0xproject/tslint-config/-/tslint-config-0.4.13.tgz#98c71c5ae5e80315a23eda0134cc9f6f4438cac2"
|
||||||
@@ -47,37 +28,6 @@
|
|||||||
"@0xproject/types" "^0.5.0"
|
"@0xproject/types" "^0.5.0"
|
||||||
bignumber.js "~4.1.0"
|
bignumber.js "~4.1.0"
|
||||||
|
|
||||||
"@0xproject/typescript-typings@^0.2.0":
|
|
||||||
version "0.2.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/@0xproject/typescript-typings/-/typescript-typings-0.2.0.tgz#53590e6866fde0f0bd3584b83e1211dabe9cd530"
|
|
||||||
dependencies:
|
|
||||||
"@0xproject/types" "^0.6.1"
|
|
||||||
bignumber.js "~4.1.0"
|
|
||||||
|
|
||||||
"@0xproject/utils@^0.5.0":
|
|
||||||
version "0.5.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/@0xproject/utils/-/utils-0.5.2.tgz#02ce0a920437db0a15d059e8c6c70fa33e9c3860"
|
|
||||||
dependencies:
|
|
||||||
"@0xproject/types" "^0.6.1"
|
|
||||||
"@0xproject/typescript-typings" "^0.2.0"
|
|
||||||
"@types/node" "^8.0.53"
|
|
||||||
bignumber.js "~4.1.0"
|
|
||||||
ethers-contracts "^2.2.1"
|
|
||||||
js-sha3 "^0.7.0"
|
|
||||||
lodash "^4.17.4"
|
|
||||||
web3 "^0.20.0"
|
|
||||||
|
|
||||||
"@0xproject/web3-wrapper@^0.5.0":
|
|
||||||
version "0.5.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/@0xproject/web3-wrapper/-/web3-wrapper-0.5.0.tgz#99a1acea60a5c3163ac0be28f4c0577c3d43dec4"
|
|
||||||
dependencies:
|
|
||||||
"@0xproject/types" "^0.5.0"
|
|
||||||
"@0xproject/typescript-typings" "^0.0.3"
|
|
||||||
"@0xproject/utils" "^0.5.0"
|
|
||||||
ethers-contracts "^2.2.1"
|
|
||||||
lodash "^4.17.4"
|
|
||||||
web3 "^0.20.0"
|
|
||||||
|
|
||||||
"@ledgerhq/hw-app-eth@^4.3.0":
|
"@ledgerhq/hw-app-eth@^4.3.0":
|
||||||
version "4.7.3"
|
version "4.7.3"
|
||||||
resolved "https://registry.yarnpkg.com/@ledgerhq/hw-app-eth/-/hw-app-eth-4.7.3.tgz#d352e19658ae296532e522c53c8ec2a1a77b64e5"
|
resolved "https://registry.yarnpkg.com/@ledgerhq/hw-app-eth/-/hw-app-eth-4.7.3.tgz#d352e19658ae296532e522c53c8ec2a1a77b64e5"
|
||||||
@@ -204,7 +154,7 @@
|
|||||||
version "4.6.2"
|
version "4.6.2"
|
||||||
resolved "https://registry.yarnpkg.com/@types/history/-/history-4.6.2.tgz#12cfaba693ba20f114ed5765467ff25fdf67ddb0"
|
resolved "https://registry.yarnpkg.com/@types/history/-/history-4.6.2.tgz#12cfaba693ba20f114ed5765467ff25fdf67ddb0"
|
||||||
|
|
||||||
"@types/istanbul@^0.4.29":
|
"@types/istanbul@^0.4.30":
|
||||||
version "0.4.30"
|
version "0.4.30"
|
||||||
resolved "https://registry.yarnpkg.com/@types/istanbul/-/istanbul-0.4.30.tgz#073159320ab3296b2cfeb481f756a1f8f4c9c8e4"
|
resolved "https://registry.yarnpkg.com/@types/istanbul/-/istanbul-0.4.30.tgz#073159320ab3296b2cfeb481f756a1f8f4c9c8e4"
|
||||||
|
|
||||||
@@ -3787,21 +3737,6 @@ ethereumjs-wallet@~0.6.0:
|
|||||||
utf8 "^2.1.1"
|
utf8 "^2.1.1"
|
||||||
uuid "^2.0.1"
|
uuid "^2.0.1"
|
||||||
|
|
||||||
ethers-contracts@^2.2.1:
|
|
||||||
version "2.2.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/ethers-contracts/-/ethers-contracts-2.2.1.tgz#e2bf5dd5e157313ba454b50c646c8472fcd0a8b3"
|
|
||||||
dependencies:
|
|
||||||
ethers-utils "^2.1.0"
|
|
||||||
|
|
||||||
ethers-utils@^2.1.0:
|
|
||||||
version "2.1.11"
|
|
||||||
resolved "https://registry.yarnpkg.com/ethers-utils/-/ethers-utils-2.1.11.tgz#b27535ca3226118be300211c39c896b1e5e21641"
|
|
||||||
dependencies:
|
|
||||||
bn.js "^4.4.0"
|
|
||||||
hash.js "^1.0.0"
|
|
||||||
js-sha3 "0.5.7"
|
|
||||||
xmlhttprequest "1.8.0"
|
|
||||||
|
|
||||||
ethers@^3.0.15:
|
ethers@^3.0.15:
|
||||||
version "3.0.15"
|
version "3.0.15"
|
||||||
resolved "https://registry.yarnpkg.com/ethers/-/ethers-3.0.15.tgz#7cdea4e23025681f69f575bf481b227315e0e7ab"
|
resolved "https://registry.yarnpkg.com/ethers/-/ethers-3.0.15.tgz#7cdea4e23025681f69f575bf481b227315e0e7ab"
|
||||||
@@ -9763,7 +9698,7 @@ solc@0.4.18:
|
|||||||
semver "^5.3.0"
|
semver "^5.3.0"
|
||||||
yargs "^4.7.1"
|
yargs "^4.7.1"
|
||||||
|
|
||||||
solc@^0.4.18, solc@^0.4.2:
|
solc@^0.4.2:
|
||||||
version "0.4.21"
|
version "0.4.21"
|
||||||
resolved "https://registry.yarnpkg.com/solc/-/solc-0.4.21.tgz#6a7ecd505bfa0fc268330d5de6b9ae65c8c68264"
|
resolved "https://registry.yarnpkg.com/solc/-/solc-0.4.21.tgz#6a7ecd505bfa0fc268330d5de6b9ae65c8c68264"
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|||||||
Reference in New Issue
Block a user