Fix linter issues
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
"prebuild": "run-s clean generate_contract_wrappers",
|
||||
"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'",
|
||||
"lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'",
|
||||
"lint": "tslint --project .",
|
||||
"test:circleci": "run-s test:coverage",
|
||||
"test": "run-s clean test:commonjs",
|
||||
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"types": "lib/index.d.ts",
|
||||
"scripts": {
|
||||
"build:watch": "tsc -w",
|
||||
"lint": "tslint --project . 'src/**/*.ts'",
|
||||
"lint": "tslint --project .",
|
||||
"clean": "shx rm -rf lib scripts",
|
||||
"build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts",
|
||||
"manual:postpublish": "yarn build; node ./scripts/postpublish.js"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"build:watch": "tsc -w",
|
||||
"build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./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",
|
||||
"prepublishOnly": "run-p build",
|
||||
"test": "run-s clean build run_mocha",
|
||||
|
||||
@@ -48,12 +48,13 @@ export class BaseContract {
|
||||
if (!_.isUndefined(constructorAbiIfExists)) {
|
||||
return constructorAbiIfExists;
|
||||
} else {
|
||||
return {
|
||||
const defaultConstructorAbi: ConstructorAbi = {
|
||||
type: AbiType.Constructor,
|
||||
stateMutability: 'nonpayable',
|
||||
payable: false,
|
||||
inputs: [],
|
||||
};
|
||||
return defaultConstructorAbi;
|
||||
}
|
||||
}
|
||||
protected static _bnToBigNumber(type: string, value: any): any {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
|
||||
"clean": "shx rm -rf lib test_temp scripts",
|
||||
"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",
|
||||
"test": "run-s clean build copy_test_fixtures run_mocha",
|
||||
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
// tslint:disable:no-consecutive-blank-lines
|
||||
// tslint:disable-next-line:no-unused-variable
|
||||
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 { 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 * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
@@ -40,7 +40,7 @@ export class {{contractName}}Contract extends BaseContract {
|
||||
{{> tx contractName=../contractName}}
|
||||
{{/this.constant}}
|
||||
{{/each}}
|
||||
public static async deploy0xArtifactAsync(
|
||||
public static async deployFrom0xArtifactAsync(
|
||||
artifact: ContractArtifact,
|
||||
provider: Provider,
|
||||
defaults: Partial<TxData>,
|
||||
@@ -71,9 +71,9 @@ export class {{contractName}}Contract extends BaseContract {
|
||||
web3Wrapper.estimateGasAsync.bind(web3Wrapper),
|
||||
);
|
||||
const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
console.log(`transactionHash: ${txHash}`);
|
||||
logUtils.log(`transactionHash: ${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);
|
||||
contractInstance.constructorArgs = [{{> params inputs=ctor.inputs}}];
|
||||
return contractInstance;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
"compile": "node ../sol-compiler/lib/src/cli.js",
|
||||
"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'",
|
||||
"lint": "tslint --project . 'migrations/**/*.ts' 'test/**/*.ts' 'util/**/*.ts' 'deploy/**/*.ts'",
|
||||
"lint": "tslint --project .",
|
||||
"coverage:report:text": "istanbul report text",
|
||||
"coverage:report:html": "istanbul report html && open coverage/index.html",
|
||||
"coverage:report:lcov": "istanbul report lcov",
|
||||
@@ -60,6 +60,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"0x.js": "^0.37.2",
|
||||
"@0xproject/base-contract": "^0.3.1",
|
||||
"@0xproject/sol-compiler": "^0.4.3",
|
||||
"@0xproject/types": "^0.6.3",
|
||||
"@0xproject/typescript-typings": "^0.3.1",
|
||||
@@ -68,7 +69,7 @@
|
||||
"bn.js": "^4.11.8",
|
||||
"ethereumjs-abi": "^0.6.4",
|
||||
"ethereumjs-util": "^5.1.1",
|
||||
"ethers-contracts": "^2.2.1",
|
||||
"ethers": "^3.0.15",
|
||||
"lodash": "^4.17.4",
|
||||
"web3": "^0.20.0"
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ describe('EtherToken', () => {
|
||||
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
||||
account = accounts[0];
|
||||
|
||||
const etherToken = await WETH9Contract.deploy0xArtifactAsync(artifacts.EtherToken, provider, defaults);
|
||||
const etherToken = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.EtherToken, provider, defaults);
|
||||
etherTokenAddress = etherToken.address;
|
||||
zeroEx = new ZeroEx(provider, {
|
||||
gasPrice,
|
||||
|
||||
@@ -57,7 +57,7 @@ describe('Exchange', () => {
|
||||
maker = accounts[0];
|
||||
[tokenOwner, taker, feeRecipient] = accounts;
|
||||
[rep, dgd, zrx] = await Promise.all([
|
||||
DummyTokenContract.deploy0xArtifactAsync(
|
||||
DummyTokenContract.deployFrom0xArtifactAsync(
|
||||
artifacts.DummyToken,
|
||||
provider,
|
||||
defaults,
|
||||
@@ -66,7 +66,7 @@ describe('Exchange', () => {
|
||||
constants.DUMMY_TOKEN_DECIMALS,
|
||||
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
|
||||
),
|
||||
DummyTokenContract.deploy0xArtifactAsync(
|
||||
DummyTokenContract.deployFrom0xArtifactAsync(
|
||||
artifacts.DummyToken,
|
||||
provider,
|
||||
defaults,
|
||||
@@ -75,7 +75,7 @@ describe('Exchange', () => {
|
||||
constants.DUMMY_TOKEN_DECIMALS,
|
||||
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
|
||||
),
|
||||
DummyTokenContract.deploy0xArtifactAsync(
|
||||
DummyTokenContract.deployFrom0xArtifactAsync(
|
||||
artifacts.DummyToken,
|
||||
provider,
|
||||
defaults,
|
||||
@@ -85,12 +85,12 @@ describe('Exchange', () => {
|
||||
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
|
||||
),
|
||||
]);
|
||||
tokenTransferProxy = await TokenTransferProxyContract.deploy0xArtifactAsync(
|
||||
tokenTransferProxy = await TokenTransferProxyContract.deployFrom0xArtifactAsync(
|
||||
artifacts.TokenTransferProxy,
|
||||
provider,
|
||||
defaults,
|
||||
);
|
||||
exchange = await ExchangeContract.deploy0xArtifactAsync(
|
||||
exchange = await ExchangeContract.deployFrom0xArtifactAsync(
|
||||
artifacts.Exchange,
|
||||
provider,
|
||||
defaults,
|
||||
@@ -713,7 +713,7 @@ describe('Exchange', () => {
|
||||
|
||||
it('should throw if getBalance or getAllowance attempts to change state and \
|
||||
shouldThrowOnInsufficientBalanceOrAllowance = false', async () => {
|
||||
const maliciousToken = await MaliciousTokenContract.deploy0xArtifactAsync(
|
||||
const maliciousToken = await MaliciousTokenContract.deployFrom0xArtifactAsync(
|
||||
artifacts.MaliciousToken,
|
||||
provider,
|
||||
defaults,
|
||||
|
||||
@@ -40,18 +40,18 @@ describe('Exchange', () => {
|
||||
before(async () => {
|
||||
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
||||
[maker, feeRecipient] = accounts;
|
||||
const tokenRegistry = await TokenRegistryContract.deploy0xArtifactAsync(
|
||||
const tokenRegistry = await TokenRegistryContract.deployFrom0xArtifactAsync(
|
||||
artifacts.TokenRegistry,
|
||||
provider,
|
||||
defaults,
|
||||
);
|
||||
const tokenTransferProxy = await TokenTransferProxyContract.deploy0xArtifactAsync(
|
||||
const tokenTransferProxy = await TokenTransferProxyContract.deployFrom0xArtifactAsync(
|
||||
artifacts.TokenTransferProxy,
|
||||
provider,
|
||||
defaults,
|
||||
);
|
||||
const [rep, dgd, zrx] = await Promise.all([
|
||||
DummyTokenContract.deploy0xArtifactAsync(
|
||||
DummyTokenContract.deployFrom0xArtifactAsync(
|
||||
artifacts.DummyToken,
|
||||
provider,
|
||||
defaults,
|
||||
@@ -60,7 +60,7 @@ describe('Exchange', () => {
|
||||
constants.DUMMY_TOKEN_DECIMALS,
|
||||
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
|
||||
),
|
||||
DummyTokenContract.deploy0xArtifactAsync(
|
||||
DummyTokenContract.deployFrom0xArtifactAsync(
|
||||
artifacts.DummyToken,
|
||||
provider,
|
||||
defaults,
|
||||
@@ -69,7 +69,7 @@ describe('Exchange', () => {
|
||||
constants.DUMMY_TOKEN_DECIMALS,
|
||||
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
|
||||
),
|
||||
DummyTokenContract.deploy0xArtifactAsync(
|
||||
DummyTokenContract.deployFrom0xArtifactAsync(
|
||||
artifacts.DummyToken,
|
||||
provider,
|
||||
defaults,
|
||||
@@ -79,7 +79,7 @@ describe('Exchange', () => {
|
||||
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
|
||||
),
|
||||
]);
|
||||
const exchange = await ExchangeContract.deploy0xArtifactAsync(
|
||||
const exchange = await ExchangeContract.deployFrom0xArtifactAsync(
|
||||
artifacts.Exchange,
|
||||
provider,
|
||||
defaults,
|
||||
|
||||
@@ -56,7 +56,7 @@ describe('Exchange', () => {
|
||||
tokenOwner = accounts[0];
|
||||
[maker, taker, feeRecipient] = accounts;
|
||||
[rep, dgd, zrx] = await Promise.all([
|
||||
DummyTokenContract.deploy0xArtifactAsync(
|
||||
DummyTokenContract.deployFrom0xArtifactAsync(
|
||||
artifacts.DummyToken,
|
||||
provider,
|
||||
defaults,
|
||||
@@ -65,7 +65,7 @@ describe('Exchange', () => {
|
||||
constants.DUMMY_TOKEN_DECIMALS,
|
||||
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
|
||||
),
|
||||
DummyTokenContract.deploy0xArtifactAsync(
|
||||
DummyTokenContract.deployFrom0xArtifactAsync(
|
||||
artifacts.DummyToken,
|
||||
provider,
|
||||
defaults,
|
||||
@@ -74,7 +74,7 @@ describe('Exchange', () => {
|
||||
constants.DUMMY_TOKEN_DECIMALS,
|
||||
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
|
||||
),
|
||||
DummyTokenContract.deploy0xArtifactAsync(
|
||||
DummyTokenContract.deployFrom0xArtifactAsync(
|
||||
artifacts.DummyToken,
|
||||
provider,
|
||||
defaults,
|
||||
@@ -84,13 +84,17 @@ describe('Exchange', () => {
|
||||
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
|
||||
),
|
||||
]);
|
||||
tokenRegistry = await TokenRegistryContract.deploy0xArtifactAsync(artifacts.TokenRegistry, provider, defaults);
|
||||
tokenTransferProxy = await TokenTransferProxyContract.deploy0xArtifactAsync(
|
||||
tokenRegistry = await TokenRegistryContract.deployFrom0xArtifactAsync(
|
||||
artifacts.TokenRegistry,
|
||||
provider,
|
||||
defaults,
|
||||
);
|
||||
tokenTransferProxy = await TokenTransferProxyContract.deployFrom0xArtifactAsync(
|
||||
artifacts.TokenTransferProxy,
|
||||
provider,
|
||||
defaults,
|
||||
);
|
||||
exchange = await ExchangeContract.deploy0xArtifactAsync(
|
||||
exchange = await ExchangeContract.deployFrom0xArtifactAsync(
|
||||
artifacts.Exchange,
|
||||
provider,
|
||||
defaults,
|
||||
|
||||
@@ -47,7 +47,7 @@ describe('MultiSigWalletWithTimeLock', () => {
|
||||
describe('changeTimeLock', () => {
|
||||
describe('initially non-time-locked', async () => {
|
||||
before('deploy a wallet', async () => {
|
||||
multiSig = await MultiSigWalletWithTimeLockContract.deploy0xArtifactAsync(
|
||||
multiSig = await MultiSigWalletWithTimeLockContract.deployFrom0xArtifactAsync(
|
||||
artifacts.MultiSigWalletWithTimeLock,
|
||||
provider,
|
||||
defaults,
|
||||
@@ -142,7 +142,7 @@ describe('MultiSigWalletWithTimeLock', () => {
|
||||
});
|
||||
describe('initially time-locked', async () => {
|
||||
before('deploy a wallet', async () => {
|
||||
multiSig = await MultiSigWalletWithTimeLockContract.deploy0xArtifactAsync(
|
||||
multiSig = await MultiSigWalletWithTimeLockContract.deployFrom0xArtifactAsync(
|
||||
artifacts.MultiSigWalletWithTimeLock,
|
||||
provider,
|
||||
defaults,
|
||||
|
||||
@@ -46,7 +46,7 @@ describe('MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress', () => {
|
||||
owners = [accounts[0], accounts[1]];
|
||||
[authorizedAddress, unauthorizedAddress] = accounts;
|
||||
const initialOwner = accounts[0];
|
||||
tokenTransferProxy = await TokenTransferProxyContract.deploy0xArtifactAsync(
|
||||
tokenTransferProxy = await TokenTransferProxyContract.deployFrom0xArtifactAsync(
|
||||
artifacts.TokenTransferProxy,
|
||||
provider,
|
||||
defaults,
|
||||
@@ -54,7 +54,7 @@ describe('MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress', () => {
|
||||
await tokenTransferProxy.addAuthorizedAddress.sendTransactionAsync(authorizedAddress, {
|
||||
from: initialOwner,
|
||||
});
|
||||
multiSig = await MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddressContract.deploy0xArtifactAsync(
|
||||
multiSig = await MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddressContract.deployFrom0xArtifactAsync(
|
||||
artifacts.MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress,
|
||||
provider,
|
||||
defaults,
|
||||
@@ -109,7 +109,7 @@ describe('MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress', () => {
|
||||
});
|
||||
|
||||
it('should throw if tx destination is not the tokenTransferProxy', async () => {
|
||||
const invalidTokenTransferProxy = await TokenTransferProxyContract.deploy0xArtifactAsync(
|
||||
const invalidTokenTransferProxy = await TokenTransferProxyContract.deployFrom0xArtifactAsync(
|
||||
artifacts.TokenTransferProxy,
|
||||
provider,
|
||||
defaults,
|
||||
|
||||
@@ -29,7 +29,7 @@ describe('TokenRegistry', () => {
|
||||
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
||||
owner = accounts[0];
|
||||
notOwner = accounts[1];
|
||||
tokenReg = await TokenRegistryContract.deploy0xArtifactAsync(artifacts.TokenRegistry, provider, defaults);
|
||||
tokenReg = await TokenRegistryContract.deployFrom0xArtifactAsync(artifacts.TokenRegistry, provider, defaults);
|
||||
tokenRegWrapper = new TokenRegWrapper(tokenReg);
|
||||
});
|
||||
beforeEach(async () => {
|
||||
|
||||
@@ -24,7 +24,7 @@ describe('TokenTransferProxy', () => {
|
||||
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
||||
owner = address = accounts[0];
|
||||
notOwner = accounts[1];
|
||||
tokenTransferProxy = await TokenTransferProxyContract.deploy0xArtifactAsync(
|
||||
tokenTransferProxy = await TokenTransferProxyContract.deployFrom0xArtifactAsync(
|
||||
artifacts.TokenTransferProxy,
|
||||
provider,
|
||||
defaults,
|
||||
|
||||
@@ -32,12 +32,12 @@ describe('TokenTransferProxy', () => {
|
||||
before(async () => {
|
||||
accounts = await web3Wrapper.getAvailableAddressesAsync();
|
||||
owner = notAuthorized = accounts[0];
|
||||
tokenTransferProxy = await TokenTransferProxyContract.deploy0xArtifactAsync(
|
||||
tokenTransferProxy = await TokenTransferProxyContract.deployFrom0xArtifactAsync(
|
||||
artifacts.TokenTransferProxy,
|
||||
provider,
|
||||
defaults,
|
||||
);
|
||||
rep = await DummyTokenContract.deploy0xArtifactAsync(
|
||||
rep = await DummyTokenContract.deployFrom0xArtifactAsync(
|
||||
artifacts.DummyToken,
|
||||
provider,
|
||||
defaults,
|
||||
|
||||
@@ -40,8 +40,8 @@ describe('Arbitrage', () => {
|
||||
const INITIAL_BALANCE = ZeroEx.toBaseUnitAmount(new BigNumber(10000), 18);
|
||||
const INITIAL_ALLOWANCE = ZeroEx.toBaseUnitAmount(new BigNumber(10000), 18);
|
||||
|
||||
let weth: Web3.ContractInstance;
|
||||
let zrx: Web3.ContractInstance;
|
||||
let weth: DummyTokenContract;
|
||||
let zrx: DummyTokenContract;
|
||||
let arbitrage: ArbitrageContract;
|
||||
let etherDelta: EtherDeltaContract;
|
||||
|
||||
@@ -58,7 +58,7 @@ describe('Arbitrage', () => {
|
||||
before(async () => {
|
||||
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
||||
[coinbase, maker, edMaker, edFrontRunner] = accounts;
|
||||
weth = await DummyTokenContract.deploy0xArtifactAsync(
|
||||
weth = await DummyTokenContract.deployFrom0xArtifactAsync(
|
||||
artifacts.DummyToken,
|
||||
provider,
|
||||
defaults,
|
||||
@@ -67,7 +67,7 @@ describe('Arbitrage', () => {
|
||||
constants.DUMMY_TOKEN_DECIMALS,
|
||||
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
|
||||
);
|
||||
zrx = await DummyTokenContract.deploy0xArtifactAsync(
|
||||
zrx = await DummyTokenContract.deployFrom0xArtifactAsync(
|
||||
artifacts.DummyToken,
|
||||
provider,
|
||||
defaults,
|
||||
@@ -76,7 +76,7 @@ describe('Arbitrage', () => {
|
||||
constants.DUMMY_TOKEN_DECIMALS,
|
||||
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
|
||||
);
|
||||
const accountLevels = await AccountLevelsContract.deploy0xArtifactAsync(
|
||||
const accountLevels = await AccountLevelsContract.deployFrom0xArtifactAsync(
|
||||
artifacts.AccountLevels,
|
||||
provider,
|
||||
defaults,
|
||||
@@ -85,7 +85,7 @@ describe('Arbitrage', () => {
|
||||
const edMakerFee = new BigNumber(0);
|
||||
const edTakerFee = new BigNumber(0);
|
||||
const edFeeRebate = new BigNumber(0);
|
||||
etherDelta = await EtherDeltaContract.deploy0xArtifactAsync(
|
||||
etherDelta = await EtherDeltaContract.deployFrom0xArtifactAsync(
|
||||
artifacts.EtherDelta,
|
||||
provider,
|
||||
defaults,
|
||||
@@ -96,12 +96,12 @@ describe('Arbitrage', () => {
|
||||
edTakerFee,
|
||||
edFeeRebate,
|
||||
);
|
||||
const tokenTransferProxy = await TokenTransferProxyContract.deploy0xArtifactAsync(
|
||||
const tokenTransferProxy = await TokenTransferProxyContract.deployFrom0xArtifactAsync(
|
||||
artifacts.TokenTransferProxy,
|
||||
provider,
|
||||
defaults,
|
||||
);
|
||||
const exchange = await ExchangeContract.deploy0xArtifactAsync(
|
||||
const exchange = await ExchangeContract.deployFrom0xArtifactAsync(
|
||||
artifacts.Exchange,
|
||||
provider,
|
||||
defaults,
|
||||
@@ -129,7 +129,7 @@ describe('Arbitrage', () => {
|
||||
takerFee: new BigNumber(0),
|
||||
};
|
||||
orderFactory = new OrderFactory(zeroEx, defaultOrderParams);
|
||||
arbitrage = await ArbitrageContract.deploy0xArtifactAsync(
|
||||
arbitrage = await ArbitrageContract.deployFrom0xArtifactAsync(
|
||||
artifacts.Arbitrage,
|
||||
provider,
|
||||
defaults,
|
||||
@@ -142,26 +142,26 @@ describe('Arbitrage', () => {
|
||||
await arbitrage.setAllowances.sendTransactionAsync(zrx.address, { from: coinbase });
|
||||
|
||||
// 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
|
||||
await zrx.setBalance(maker, makerTokenAmount, { from: coinbase });
|
||||
await zrx.setBalance.sendTransactionAsync(maker, makerTokenAmount, { from: coinbase });
|
||||
// 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);
|
||||
// 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
|
||||
await weth.approve(etherDelta.address, INITIAL_ALLOWANCE, { from: edMaker });
|
||||
await weth.approve.sendTransactionAsync(etherDelta.address, INITIAL_ALLOWANCE, { from: edMaker });
|
||||
// Deposit maker funds into EtherDelta
|
||||
await etherDelta.depositToken.sendTransactionAsync(weth.address, amountGive, { from: edMaker });
|
||||
|
||||
amountGet = makerTokenAmount;
|
||||
// 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
|
||||
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
|
||||
await etherDelta.depositToken.sendTransactionAsync(zrx.address, amountGet, { from: edFrontRunner });
|
||||
});
|
||||
@@ -228,11 +228,11 @@ describe('Arbitrage', () => {
|
||||
from: coinbase,
|
||||
});
|
||||
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);
|
||||
});
|
||||
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
|
||||
await etherDelta.trade.sendTransactionAsync(
|
||||
tokenGet,
|
||||
@@ -252,7 +252,7 @@ describe('Arbitrage', () => {
|
||||
await expect(
|
||||
arbitrage.makeAtomicTrade.sendTransactionAsync(addresses, values, v, r, s, { from: coinbase }),
|
||||
).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);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -33,7 +33,7 @@ describe('UnlimitedAllowanceToken', () => {
|
||||
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
||||
owner = accounts[0];
|
||||
spender = accounts[1];
|
||||
token = await DummyTokenContract.deploy0xArtifactAsync(
|
||||
token = await DummyTokenContract.deployFrom0xArtifactAsync(
|
||||
artifacts.DummyToken,
|
||||
provider,
|
||||
defaults,
|
||||
|
||||
@@ -34,7 +34,7 @@ describe('ZRXToken', () => {
|
||||
zeroEx = new ZeroEx(provider, {
|
||||
networkId: constants.TESTRPC_NETWORK_ID,
|
||||
});
|
||||
zrx = await ZRXTokenContract.deploy0xArtifactAsync(artifacts.ZRX, provider, defaults);
|
||||
zrx = await ZRXTokenContract.deployFrom0xArtifactAsync(artifacts.ZRX, provider, defaults);
|
||||
zrxAddress = zrx.address;
|
||||
MAX_UINT = zeroEx.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS;
|
||||
});
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
|
||||
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
|
||||
"clean": "shx rm -rf lib scripts",
|
||||
"lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'",
|
||||
"lint": "tslint --project .",
|
||||
"manual:postpublish": "yarn build; node ./scripts/postpublish.js"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -15,8 +15,7 @@ export const coverage = {
|
||||
_getCoverageSubprovider(): CoverageSubprovider {
|
||||
const artifactsPath = '../migrations/artifacts/1.0.0';
|
||||
const contractsPath = 'src/contracts';
|
||||
const networkId = 50;
|
||||
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",
|
||||
"scripts": {
|
||||
"build:watch": "tsc -w",
|
||||
"lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'",
|
||||
"lint": "tslint --project .",
|
||||
"test": "run-s clean build run_mocha",
|
||||
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
|
||||
"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 { ContractArtifact } from '@0xproject/sol-compiler';
|
||||
import { LogWithDecodedArgs } from '@0xproject/types';
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||
@@ -23,7 +23,7 @@ describe('Metacoin', () => {
|
||||
const ownerAddress = devConstants.TESTRPC_FIRST_ADDRESS;
|
||||
const INITIAL_BALANCE = new BigNumber(10000);
|
||||
before(async () => {
|
||||
metacoin = await MetacoinContract.deploy0xArtifactAsync(artifact, provider, config.defaults);
|
||||
metacoin = await MetacoinContract.deployFrom0xArtifactAsync(artifact, provider, config.defaults);
|
||||
web3Wrapper.abiDecoder.addABI(metacoin.abi);
|
||||
});
|
||||
beforeEach(async () => {
|
||||
|
||||
@@ -15,6 +15,6 @@ export const coverage = {
|
||||
},
|
||||
_getCoverageSubprovider(): CoverageSubprovider {
|
||||
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",
|
||||
"build": "tsc",
|
||||
"clean": "shx rm -rf lib",
|
||||
"lint": "tslint --project . 'src/**/*.ts'",
|
||||
"lint": "tslint --project .",
|
||||
"migrate": "run-s build compile script:migrate",
|
||||
"script:migrate": "node ./lib/migrate.js",
|
||||
"copy_artifacts": "copyfiles 'artifacts/1.0.0/**/*' ./lib",
|
||||
@@ -35,6 +35,7 @@
|
||||
"@0xproject/base-contract": "^0.3.1",
|
||||
"@0xproject/utils": "^0.6.1",
|
||||
"@0xproject/web3-wrapper": "^0.6.3",
|
||||
"ethers": "^3.0.15",
|
||||
"lodash": "^4.17.4"
|
||||
},
|
||||
"publishConfig": {
|
||||
|
||||
@@ -33,7 +33,6 @@ export const artifacts = {
|
||||
MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress: (MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress as any) as ContractArtifact,
|
||||
};
|
||||
|
||||
const ARTIFACTS_DIR = '../artifacts/1.0.0';
|
||||
export class ArtifactWriter {
|
||||
private _artifactsDir: string;
|
||||
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.
|
||||
* 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.
|
||||
* @param provider Provider instance.
|
||||
* @param artifactsDir The directory with artifact files.
|
||||
* @param defaults Default transaction values to use.
|
||||
* @param provider Web3 provider instance.
|
||||
* @param artifactsDir The directory with compiler artifact files.
|
||||
* @param defaults Default transaction values to use when deploying contracts.
|
||||
*/
|
||||
export const runMigrationsAsync = async (provider: Provider, artifactsDir: string, defaults: Partial<TxData>) => {
|
||||
const web3Wrapper = new Web3Wrapper(provider);
|
||||
const networkId = await web3Wrapper.getNetworkIdAsync();
|
||||
const artifactsWriter = new ArtifactWriter(artifactsDir, networkId);
|
||||
const tokenTransferProxy = await TokenTransferProxyContract.deploy0xArtifactAsync(
|
||||
const tokenTransferProxy = await TokenTransferProxyContract.deployFrom0xArtifactAsync(
|
||||
artifacts.TokenTransferProxy,
|
||||
provider,
|
||||
defaults,
|
||||
);
|
||||
artifactsWriter.saveArtifact(tokenTransferProxy);
|
||||
const zrxToken = await ZRXTokenContract.deploy0xArtifactAsync(artifacts.ZRX, provider, defaults);
|
||||
const zrxToken = await ZRXTokenContract.deployFrom0xArtifactAsync(artifacts.ZRX, provider, defaults);
|
||||
artifactsWriter.saveArtifact(zrxToken);
|
||||
|
||||
const etherToken = await WETH9Contract.deploy0xArtifactAsync(artifacts.EtherToken, provider, defaults);
|
||||
const etherToken = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.EtherToken, provider, defaults);
|
||||
artifactsWriter.saveArtifact(etherToken);
|
||||
const tokenReg = await TokenRegistryContract.deploy0xArtifactAsync(artifacts.TokenRegistry, provider, defaults);
|
||||
const tokenReg = await TokenRegistryContract.deployFrom0xArtifactAsync(artifacts.TokenRegistry, provider, defaults);
|
||||
artifactsWriter.saveArtifact(tokenReg);
|
||||
|
||||
const accounts: string[] = await web3Wrapper.getAvailableAddressesAsync();
|
||||
const owners = [accounts[0], accounts[1]];
|
||||
const confirmationsRequired = new BigNumber(2);
|
||||
const secondsRequired = new BigNumber(0);
|
||||
const exchange = await ExchangeContract.deploy0xArtifactAsync(
|
||||
const exchange = await ExchangeContract.deployFrom0xArtifactAsync(
|
||||
artifacts.Exchange,
|
||||
provider,
|
||||
defaults,
|
||||
@@ -52,7 +52,7 @@ export const runMigrationsAsync = async (provider: Provider, artifactsDir: strin
|
||||
tokenTransferProxy.address,
|
||||
);
|
||||
artifactsWriter.saveArtifact(exchange);
|
||||
const multiSig = await MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddressContract.deploy0xArtifactAsync(
|
||||
const multiSig = await MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddressContract.deployFrom0xArtifactAsync(
|
||||
artifacts.MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress,
|
||||
provider,
|
||||
defaults,
|
||||
@@ -101,7 +101,7 @@ export const runMigrationsAsync = async (provider: Provider, artifactsDir: strin
|
||||
);
|
||||
for (const token of tokenInfo) {
|
||||
const totalSupply = new BigNumber(100000000000000000000);
|
||||
const dummyToken = await DummyTokenContract.deploy0xArtifactAsync(
|
||||
const dummyToken = await DummyTokenContract.deployFrom0xArtifactAsync(
|
||||
artifacts.DummyToken,
|
||||
provider,
|
||||
defaults,
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"types": "lib/index.d.ts",
|
||||
"scripts": {
|
||||
"build:watch": "tsc -w",
|
||||
"lint": "tslint --project . 'src/**/*.ts'",
|
||||
"lint": "tslint --project .",
|
||||
"clean": "shx rm -rf lib",
|
||||
"build": "tsc",
|
||||
"test:publish": "run-s build script:publish",
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"version": "0.0.11",
|
||||
"description": "An example app using react-docs",
|
||||
"scripts": {
|
||||
"lint": "tslint --project . 'ts/**/*.ts' 'ts/**/*.tsx'",
|
||||
"lint": "tslint --project .",
|
||||
"build": "tsc",
|
||||
"build:example": "NODE_ENV=production webpack",
|
||||
"build:watch": "tsc -w",
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"scripts": {
|
||||
"lint": "tslint --project . 'src/**/*.ts' 'src/**/*.tsx'",
|
||||
"lint": "tslint --project .",
|
||||
"build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts",
|
||||
"build:watch": "tsc -w",
|
||||
"clean": "shx rm -rf lib scripts",
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"scripts": {
|
||||
"lint": "tslint --project . 'src/**/*.ts' 'src/**/*.tsx'",
|
||||
"lint": "tslint --project .",
|
||||
"build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts",
|
||||
"build:watch": "tsc -w",
|
||||
"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",
|
||||
"clean": "shx rm -rf lib scripts",
|
||||
"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",
|
||||
"docs:stage": "yarn build && node ./scripts/stage_docs.js",
|
||||
"manual:postpublish": "yarn build; node ./scripts/postpublish.js",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env node
|
||||
// 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 * as _ from 'lodash';
|
||||
import * as path from 'path';
|
||||
@@ -38,4 +38,7 @@ const SEPARATOR = ',';
|
||||
};
|
||||
const compiler = new Compiler(opts);
|
||||
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 exchangeArtifact: ContractArtifact = JSON.parse(exchangeArtifactString);
|
||||
// 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);
|
||||
expect(unlinkedBinaryWithoutMetadata).to.equal(exchangeBinaryWithoutMetadata);
|
||||
});
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"types": "lib/src/index.d.ts",
|
||||
"scripts": {
|
||||
"build:watch": "tsc -w",
|
||||
"lint": "tslint --project . 'src/**/*.ts'",
|
||||
"lint": "tslint --project .",
|
||||
"test": "run-s clean build compile_test run_mocha",
|
||||
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
|
||||
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
|
||||
@@ -54,10 +54,9 @@
|
||||
"solidity-parser-antlr": "^0.2.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@0xproject/sol-compiler": "^0.3.5",
|
||||
"@0xproject/monorepo-scripts": "^0.1.19",
|
||||
"@0xproject/tslint-config": "^0.4.17",
|
||||
"@types/istanbul": "^0.4.29",
|
||||
"@types/istanbul": "^0.4.30",
|
||||
"@types/mocha": "^2.2.42",
|
||||
"@types/node": "^8.0.53",
|
||||
"chai": "^4.0.1",
|
||||
|
||||
@@ -5,7 +5,7 @@ import * as path from 'path';
|
||||
|
||||
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 artifactFileNames = glob.sync(artifactsGlob, { absolute: true });
|
||||
const contractsData: ContractData[] = [];
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { addHexPrefix } from 'ethereumjs-util';
|
||||
import * as fs from 'fs';
|
||||
import { Collector } from 'istanbul';
|
||||
import * as _ from 'lodash';
|
||||
@@ -36,12 +37,11 @@ export class CoverageManager {
|
||||
constructor(
|
||||
artifactsPath: string,
|
||||
sourcesPath: string,
|
||||
networkId: number,
|
||||
getContractCodeAsync: (address: string) => Promise<string>,
|
||||
) {
|
||||
this._getContractCodeAsync = getContractCodeAsync;
|
||||
this._sourcesPath = sourcesPath;
|
||||
this._contractsData = collectContractsData(artifactsPath, this._sourcesPath, networkId);
|
||||
this._contractsData = collectContractsData(artifactsPath, this._sourcesPath);
|
||||
}
|
||||
public appendTraceInfo(traceInfo: TraceInfo): void {
|
||||
this._traceInfos.push(traceInfo);
|
||||
@@ -134,7 +134,7 @@ export class CoverageManager {
|
||||
if (traceInfo.address !== constants.NEW_CONTRACT) {
|
||||
// Runtime transaction
|
||||
let runtimeBytecode = (traceInfo as TraceInfoExistingContract).runtimeBytecode;
|
||||
runtimeBytecode = utils.removeHexPrefix(runtimeBytecode);
|
||||
runtimeBytecode = addHexPrefix(runtimeBytecode);
|
||||
const contractData = _.find(this._contractsData, { runtimeBytecode }) as ContractData;
|
||||
if (_.isUndefined(contractData)) {
|
||||
throw new Error(`Transaction to an unknown address: ${traceInfo.address}`);
|
||||
@@ -159,7 +159,7 @@ export class CoverageManager {
|
||||
} else {
|
||||
// Contract creation transaction
|
||||
let bytecode = (traceInfo as TraceInfoNewContract).bytecode;
|
||||
bytecode = utils.removeHexPrefix(bytecode);
|
||||
bytecode = addHexPrefix(bytecode);
|
||||
const contractData = _.find(this._contractsData, contractDataCandidate =>
|
||||
bytecode.startsWith(contractDataCandidate.bytecode),
|
||||
) 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 as any).getFinalCoverage();
|
||||
return collector.getFinalCoverage();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,19 +28,13 @@ export class CoverageSubprovider extends Subprovider {
|
||||
* Instantiates a CoverageSubprovider instance
|
||||
* @param artifactsPath Path to the smart contract artifacts
|
||||
* @param sourcesPath Path to the smart contract source files
|
||||
* @param networkId network id
|
||||
* @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();
|
||||
this._lock = new Lock();
|
||||
this._defaultFromAddress = defaultFromAddress;
|
||||
this._coverageManager = new CoverageManager(
|
||||
artifactsPath,
|
||||
sourcesPath,
|
||||
networkId,
|
||||
this._getContractCodeAsync.bind(this),
|
||||
);
|
||||
this._coverageManager = new CoverageManager(artifactsPath, sourcesPath, this._getContractCodeAsync.bind(this));
|
||||
}
|
||||
/**
|
||||
* Write the test coverage results to a file in Istanbul format.
|
||||
|
||||
@@ -12,8 +12,7 @@ describe('Collect contracts data', () => {
|
||||
it('correctly collects contracts data', () => {
|
||||
const artifactsPath = path.resolve(__dirname, 'fixtures/artifacts');
|
||||
const sourcesPath = path.resolve(__dirname, 'fixtures/contracts');
|
||||
const networkId = 50;
|
||||
const contractsData = collectContractsData(artifactsPath, sourcesPath, networkId);
|
||||
const contractsData = collectContractsData(artifactsPath, sourcesPath);
|
||||
_.forEach(contractsData, contractData => {
|
||||
expect(contractData).to.have.keys([
|
||||
'sourceCodes',
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"build:watch": "tsc -w",
|
||||
"clean": "shx rm -rf lib 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_integration": "mocha lib/test/integration/**/*_test.js --timeout 10000 --bail --exit",
|
||||
"test": "npm run test:unit",
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"build": "node ../../node_modules/gulp/bin/gulp.js build",
|
||||
"dev": "node ../../node_modules/gulp/bin/gulp.js run",
|
||||
"start": "node ./bin/server.js",
|
||||
"lint": "tslint --project . 'src/**/*.ts'",
|
||||
"lint": "tslint --project .",
|
||||
"clean": "shx rm -rf bin"
|
||||
},
|
||||
"author": "Fabio Berger",
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"build:watch": "tsc -w",
|
||||
"build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts",
|
||||
"clean": "shx rm -rf lib scripts",
|
||||
"lint": "tslint --project . 'rules/**/*.ts'",
|
||||
"lint": "tslint --project .",
|
||||
"manual:postpublish": "yarn build; node ./scripts/postpublish.js"
|
||||
},
|
||||
"repository": {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"build:watch": "tsc -w",
|
||||
"build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts",
|
||||
"clean": "shx rm -rf lib scripts",
|
||||
"lint": "tslint --project . 'src/**/*.ts'",
|
||||
"lint": "tslint --project .",
|
||||
"manual:postpublish": "yarn build; node ./scripts/postpublish.js"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
declare module 'ethers' {
|
||||
import { TxData } from '@0xproject/types';
|
||||
|
||||
export interface TransactionDescription {
|
||||
name: string;
|
||||
signature: string;
|
||||
@@ -26,7 +28,7 @@ declare module 'ethers' {
|
||||
constructor(abi: any);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"build:watch": "tsc -w",
|
||||
"build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts",
|
||||
"clean": "shx rm -rf lib scripts",
|
||||
"lint": "tslint --project . 'src/**/*.ts'",
|
||||
"lint": "tslint --project .",
|
||||
"manual:postpublish": "yarn build; node ./scripts/postpublish.js"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"build:watch": "tsc -w",
|
||||
"build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
|
||||
"clean": "shx rm -rf lib scripts",
|
||||
"lint": "tslint --project . 'src/**/*.ts'",
|
||||
"lint": "tslint --project .",
|
||||
"test": "run-s clean build run_mocha",
|
||||
"test:circleci": "yarn test:coverage",
|
||||
"run_mocha": "mocha lib/test/**/*_test.js --bail --exit",
|
||||
|
||||
@@ -12,7 +12,7 @@ const contractsPath = 'src/contracts';
|
||||
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.
|
||||
const defaultFromAddress = '0x5409ed021d9299bf6814279a6a1411a7e866a631';
|
||||
const coverageSubprovider = new CoverageSubprovider(artifactsPath, contractsPath, networkId, defaultFromAddress);
|
||||
const coverageSubprovider = new CoverageSubprovider(artifactsPath, contractsPath, defaultFromAddress);
|
||||
|
||||
provider.addProvider(coverageSubprovider);
|
||||
```
|
||||
|
||||
69
yarn.lock
69
yarn.lock
@@ -6,25 +6,6 @@
|
||||
version "0.3.9"
|
||||
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":
|
||||
version "0.4.13"
|
||||
resolved "https://registry.yarnpkg.com/@0xproject/tslint-config/-/tslint-config-0.4.13.tgz#98c71c5ae5e80315a23eda0134cc9f6f4438cac2"
|
||||
@@ -47,37 +28,6 @@
|
||||
"@0xproject/types" "^0.5.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":
|
||||
version "4.7.3"
|
||||
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"
|
||||
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"
|
||||
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"
|
||||
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:
|
||||
version "3.0.15"
|
||||
resolved "https://registry.yarnpkg.com/ethers/-/ethers-3.0.15.tgz#7cdea4e23025681f69f575bf481b227315e0e7ab"
|
||||
@@ -9763,7 +9698,7 @@ solc@0.4.18:
|
||||
semver "^5.3.0"
|
||||
yargs "^4.7.1"
|
||||
|
||||
solc@^0.4.18, solc@^0.4.2:
|
||||
solc@^0.4.2:
|
||||
version "0.4.21"
|
||||
resolved "https://registry.yarnpkg.com/solc/-/solc-0.4.21.tgz#6a7ecd505bfa0fc268330d5de6b9ae65c8c68264"
|
||||
dependencies:
|
||||
|
||||
Reference in New Issue
Block a user