Remove unused deployer docs configs
This commit is contained in:
@@ -144,10 +144,10 @@ export class ZeroEx {
|
||||
]);
|
||||
const artifactJSONs = _.values(artifacts);
|
||||
const abiArrays = _.map(artifactJSONs, artifact => artifact.abi);
|
||||
const defaults = {
|
||||
const txDefaults = {
|
||||
gasPrice: config.gasPrice,
|
||||
};
|
||||
this._web3Wrapper = new Web3Wrapper(provider, defaults);
|
||||
this._web3Wrapper = new Web3Wrapper(provider, txDefaults);
|
||||
_.forEach(abiArrays, abi => {
|
||||
this._web3Wrapper.abiDecoder.addABI(abi);
|
||||
});
|
||||
|
||||
@@ -9,10 +9,10 @@ before('migrate contracts', async function() {
|
||||
// HACK: Since the migrations take longer then our global mocha timeout limit
|
||||
// we manually increase it for this before hook.
|
||||
this.timeout(20000);
|
||||
const defaults = {
|
||||
const txDefaults = {
|
||||
gas: devConstants.GAS_ESTIMATE,
|
||||
from: devConstants.TESTRPC_FIRST_ADDRESS,
|
||||
};
|
||||
const artifactsDir = `../migrations/artifacts/1.0.0`;
|
||||
await runMigrationsAsync(provider, artifactsDir, defaults);
|
||||
await runMigrationsAsync(provider, artifactsDir, txDefaults);
|
||||
});
|
||||
|
||||
@@ -35,7 +35,6 @@ export class FillScenarios {
|
||||
const web3Wrapper = (this._zeroEx as any)._web3Wrapper as Web3Wrapper;
|
||||
for (const token of this._tokens) {
|
||||
if (token.symbol !== 'ZRX' && token.symbol !== 'WETH') {
|
||||
const defaults = {};
|
||||
const dummyToken = new DummyTokenContract(
|
||||
artifacts.DummyTokenArtifact.abi,
|
||||
token.address,
|
||||
|
||||
@@ -64,7 +64,7 @@ export class BaseContract {
|
||||
}
|
||||
protected static async _applyDefaultsToTxDataAsync<T extends Partial<TxData | TxDataPayable>>(
|
||||
txData: T,
|
||||
defaults: Partial<TxData>,
|
||||
txDefaults: Partial<TxData>,
|
||||
estimateGasAsync?: (txData: T) => Promise<number>,
|
||||
): Promise<TxData> {
|
||||
// Gas amount sourced with the following priorities:
|
||||
@@ -73,7 +73,7 @@ export class BaseContract {
|
||||
// 3. Gas estimate calculation + safety margin
|
||||
const removeUndefinedProperties = _.pickBy;
|
||||
const txDataWithDefaults: TxData = {
|
||||
...removeUndefinedProperties(defaults),
|
||||
...removeUndefinedProperties(txDefaults),
|
||||
...removeUndefinedProperties(txData as any),
|
||||
// HACK: TS can't prove that T is spreadable.
|
||||
// Awaiting https://github.com/Microsoft/TypeScript/pull/13288 to be merged
|
||||
@@ -109,10 +109,10 @@ export class BaseContract {
|
||||
abi: ContractAbi,
|
||||
address: string,
|
||||
provider: Provider,
|
||||
defaults?: Partial<TxData>,
|
||||
txDefaults?: Partial<TxData>,
|
||||
) {
|
||||
this.contractName = contractName;
|
||||
this._web3Wrapper = new Web3Wrapper(provider, defaults);
|
||||
this._web3Wrapper = new Web3Wrapper(provider, txDefaults);
|
||||
this.abi = abi;
|
||||
this.address = address;
|
||||
const methodAbis = this.abi.filter(
|
||||
|
||||
@@ -43,7 +43,7 @@ export class {{contractName}}Contract extends BaseContract {
|
||||
public static async deployFrom0xArtifactAsync(
|
||||
artifact: ContractArtifact,
|
||||
provider: Provider,
|
||||
defaults: Partial<TxData>,
|
||||
txDefaults: Partial<TxData>,
|
||||
{{> typed_params inputs=ctor.inputs}}
|
||||
): Promise<{{contractName}}Contract> {
|
||||
if (_.isUndefined(artifact.compilerOutput)) {
|
||||
@@ -51,13 +51,13 @@ export class {{contractName}}Contract extends BaseContract {
|
||||
}
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
return {{contractName}}Contract.deployAsync(bytecode, abi, provider, defaults, {{> params inputs=ctor.inputs}});
|
||||
return {{contractName}}Contract.deployAsync(bytecode, abi, provider, txDefaults, {{> params inputs=ctor.inputs}});
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
provider: Provider,
|
||||
defaults: Partial<TxData>,
|
||||
txDefaults: Partial<TxData>,
|
||||
{{> typed_params inputs=ctor.inputs}}
|
||||
): Promise<{{contractName}}Contract> {
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
@@ -70,19 +70,19 @@ export class {{contractName}}Contract extends BaseContract {
|
||||
const web3Wrapper = new Web3Wrapper(provider);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
txData,
|
||||
defaults,
|
||||
txDefaults,
|
||||
web3Wrapper.estimateGasAsync.bind(web3Wrapper),
|
||||
);
|
||||
const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
logUtils.log(`transactionHash: ${txHash}`);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionMinedAsync(txHash);
|
||||
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, txDefaults);
|
||||
contractInstance.constructorArgs = [{{> params inputs=ctor.inputs}}];
|
||||
return contractInstance;
|
||||
}
|
||||
constructor(abi: ContractAbi, address: string, provider: Provider, defaults?: Partial<TxData>) {
|
||||
super("{{contractName}}", abi, address, provider, defaults);
|
||||
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
|
||||
super("{{contractName}}", abi, address, provider, txDefaults);
|
||||
classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
|
||||
}
|
||||
} // tslint:disable:max-file-line-count
|
||||
|
||||
@@ -11,7 +11,7 @@ import { ContractName } from '../util/types';
|
||||
|
||||
import { chaiSetup } from './utils/chai_setup';
|
||||
|
||||
import { defaults, provider, web3Wrapper } from './utils/web3_wrapper';
|
||||
import { txDefaults, provider, web3Wrapper } from './utils/web3_wrapper';
|
||||
|
||||
chaiSetup.configure();
|
||||
const expect = chai.expect;
|
||||
@@ -26,7 +26,7 @@ describe('EtherToken', () => {
|
||||
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
||||
account = accounts[0];
|
||||
|
||||
const etherToken = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.EtherToken, provider, defaults);
|
||||
const etherToken = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.EtherToken, provider, txDefaults);
|
||||
etherTokenAddress = etherToken.address;
|
||||
zeroEx = new ZeroEx(provider, {
|
||||
gasPrice,
|
||||
|
||||
@@ -24,7 +24,7 @@ import { OrderFactory } from '../../util/order_factory';
|
||||
import { BalancesByOwner, ContractName, ExchangeContractErrs } from '../../util/types';
|
||||
import { chaiSetup } from '../utils/chai_setup';
|
||||
|
||||
import { defaults, provider, web3Wrapper } from '../utils/web3_wrapper';
|
||||
import { txDefaults, provider, web3Wrapper } from '../utils/web3_wrapper';
|
||||
|
||||
chaiSetup.configure();
|
||||
const expect = chai.expect;
|
||||
@@ -60,7 +60,7 @@ describe('Exchange', () => {
|
||||
DummyTokenContract.deployFrom0xArtifactAsync(
|
||||
artifacts.DummyToken,
|
||||
provider,
|
||||
defaults,
|
||||
txDefaults,
|
||||
constants.DUMMY_TOKEN_NAME,
|
||||
constants.DUMMY_TOKEN_SYMBOL,
|
||||
constants.DUMMY_TOKEN_DECIMALS,
|
||||
@@ -69,7 +69,7 @@ describe('Exchange', () => {
|
||||
DummyTokenContract.deployFrom0xArtifactAsync(
|
||||
artifacts.DummyToken,
|
||||
provider,
|
||||
defaults,
|
||||
txDefaults,
|
||||
constants.DUMMY_TOKEN_NAME,
|
||||
constants.DUMMY_TOKEN_SYMBOL,
|
||||
constants.DUMMY_TOKEN_DECIMALS,
|
||||
@@ -78,7 +78,7 @@ describe('Exchange', () => {
|
||||
DummyTokenContract.deployFrom0xArtifactAsync(
|
||||
artifacts.DummyToken,
|
||||
provider,
|
||||
defaults,
|
||||
txDefaults,
|
||||
constants.DUMMY_TOKEN_NAME,
|
||||
constants.DUMMY_TOKEN_SYMBOL,
|
||||
constants.DUMMY_TOKEN_DECIMALS,
|
||||
@@ -88,12 +88,12 @@ describe('Exchange', () => {
|
||||
tokenTransferProxy = await TokenTransferProxyContract.deployFrom0xArtifactAsync(
|
||||
artifacts.TokenTransferProxy,
|
||||
provider,
|
||||
defaults,
|
||||
txDefaults,
|
||||
);
|
||||
exchange = await ExchangeContract.deployFrom0xArtifactAsync(
|
||||
artifacts.Exchange,
|
||||
provider,
|
||||
defaults,
|
||||
txDefaults,
|
||||
zrx.address,
|
||||
tokenTransferProxy.address,
|
||||
);
|
||||
@@ -716,7 +716,7 @@ describe('Exchange', () => {
|
||||
const maliciousToken = await MaliciousTokenContract.deployFrom0xArtifactAsync(
|
||||
artifacts.MaliciousToken,
|
||||
provider,
|
||||
defaults,
|
||||
txDefaults,
|
||||
);
|
||||
await maliciousToken.approve.sendTransactionAsync(tokenTransferProxy.address, INITIAL_ALLOWANCE, {
|
||||
from: taker,
|
||||
|
||||
@@ -22,7 +22,7 @@ import { OrderFactory } from '../../util/order_factory';
|
||||
import { ContractName } from '../../util/types';
|
||||
import { chaiSetup } from '../utils/chai_setup';
|
||||
|
||||
import { defaults, provider, web3Wrapper } from '../utils/web3_wrapper';
|
||||
import { txDefaults, provider, web3Wrapper } from '../utils/web3_wrapper';
|
||||
|
||||
chaiSetup.configure();
|
||||
const expect = chai.expect;
|
||||
@@ -43,18 +43,18 @@ describe('Exchange', () => {
|
||||
const tokenRegistry = await TokenRegistryContract.deployFrom0xArtifactAsync(
|
||||
artifacts.TokenRegistry,
|
||||
provider,
|
||||
defaults,
|
||||
txDefaults,
|
||||
);
|
||||
const tokenTransferProxy = await TokenTransferProxyContract.deployFrom0xArtifactAsync(
|
||||
artifacts.TokenTransferProxy,
|
||||
provider,
|
||||
defaults,
|
||||
txDefaults,
|
||||
);
|
||||
const [rep, dgd, zrx] = await Promise.all([
|
||||
DummyTokenContract.deployFrom0xArtifactAsync(
|
||||
artifacts.DummyToken,
|
||||
provider,
|
||||
defaults,
|
||||
txDefaults,
|
||||
constants.DUMMY_TOKEN_NAME,
|
||||
constants.DUMMY_TOKEN_SYMBOL,
|
||||
constants.DUMMY_TOKEN_DECIMALS,
|
||||
@@ -63,7 +63,7 @@ describe('Exchange', () => {
|
||||
DummyTokenContract.deployFrom0xArtifactAsync(
|
||||
artifacts.DummyToken,
|
||||
provider,
|
||||
defaults,
|
||||
txDefaults,
|
||||
constants.DUMMY_TOKEN_NAME,
|
||||
constants.DUMMY_TOKEN_SYMBOL,
|
||||
constants.DUMMY_TOKEN_DECIMALS,
|
||||
@@ -72,7 +72,7 @@ describe('Exchange', () => {
|
||||
DummyTokenContract.deployFrom0xArtifactAsync(
|
||||
artifacts.DummyToken,
|
||||
provider,
|
||||
defaults,
|
||||
txDefaults,
|
||||
constants.DUMMY_TOKEN_NAME,
|
||||
constants.DUMMY_TOKEN_SYMBOL,
|
||||
constants.DUMMY_TOKEN_DECIMALS,
|
||||
@@ -82,7 +82,7 @@ describe('Exchange', () => {
|
||||
const exchange = await ExchangeContract.deployFrom0xArtifactAsync(
|
||||
artifacts.Exchange,
|
||||
provider,
|
||||
defaults,
|
||||
txDefaults,
|
||||
zrx.address,
|
||||
tokenTransferProxy.address,
|
||||
);
|
||||
|
||||
@@ -23,7 +23,7 @@ import { OrderFactory } from '../../util/order_factory';
|
||||
import { BalancesByOwner, ContractName } from '../../util/types';
|
||||
import { chaiSetup } from '../utils/chai_setup';
|
||||
|
||||
import { defaults, provider, web3Wrapper } from '../utils/web3_wrapper';
|
||||
import { txDefaults, provider, web3Wrapper } from '../utils/web3_wrapper';
|
||||
|
||||
chaiSetup.configure();
|
||||
const expect = chai.expect;
|
||||
@@ -59,7 +59,7 @@ describe('Exchange', () => {
|
||||
DummyTokenContract.deployFrom0xArtifactAsync(
|
||||
artifacts.DummyToken,
|
||||
provider,
|
||||
defaults,
|
||||
txDefaults,
|
||||
constants.DUMMY_TOKEN_NAME,
|
||||
constants.DUMMY_TOKEN_SYMBOL,
|
||||
constants.DUMMY_TOKEN_DECIMALS,
|
||||
@@ -68,7 +68,7 @@ describe('Exchange', () => {
|
||||
DummyTokenContract.deployFrom0xArtifactAsync(
|
||||
artifacts.DummyToken,
|
||||
provider,
|
||||
defaults,
|
||||
txDefaults,
|
||||
constants.DUMMY_TOKEN_NAME,
|
||||
constants.DUMMY_TOKEN_SYMBOL,
|
||||
constants.DUMMY_TOKEN_DECIMALS,
|
||||
@@ -77,7 +77,7 @@ describe('Exchange', () => {
|
||||
DummyTokenContract.deployFrom0xArtifactAsync(
|
||||
artifacts.DummyToken,
|
||||
provider,
|
||||
defaults,
|
||||
txDefaults,
|
||||
constants.DUMMY_TOKEN_NAME,
|
||||
constants.DUMMY_TOKEN_SYMBOL,
|
||||
constants.DUMMY_TOKEN_DECIMALS,
|
||||
@@ -87,17 +87,17 @@ describe('Exchange', () => {
|
||||
tokenRegistry = await TokenRegistryContract.deployFrom0xArtifactAsync(
|
||||
artifacts.TokenRegistry,
|
||||
provider,
|
||||
defaults,
|
||||
txDefaults,
|
||||
);
|
||||
tokenTransferProxy = await TokenTransferProxyContract.deployFrom0xArtifactAsync(
|
||||
artifacts.TokenTransferProxy,
|
||||
provider,
|
||||
defaults,
|
||||
txDefaults,
|
||||
);
|
||||
exchange = await ExchangeContract.deployFrom0xArtifactAsync(
|
||||
artifacts.Exchange,
|
||||
provider,
|
||||
defaults,
|
||||
txDefaults,
|
||||
zrx.address,
|
||||
tokenTransferProxy.address,
|
||||
);
|
||||
|
||||
@@ -15,7 +15,7 @@ import { ContractName, SubmissionContractEventArgs } from '../util/types';
|
||||
|
||||
import { chaiSetup } from './utils/chai_setup';
|
||||
|
||||
import { defaults, provider, web3Wrapper } from './utils/web3_wrapper';
|
||||
import { txDefaults, provider, web3Wrapper } from './utils/web3_wrapper';
|
||||
|
||||
const MULTI_SIG_ABI = artifacts.MultiSigWalletWithTimeLock.compilerOutput.abi;
|
||||
chaiSetup.configure();
|
||||
@@ -50,7 +50,7 @@ describe('MultiSigWalletWithTimeLock', () => {
|
||||
multiSig = await MultiSigWalletWithTimeLockContract.deployFrom0xArtifactAsync(
|
||||
artifacts.MultiSigWalletWithTimeLock,
|
||||
provider,
|
||||
defaults,
|
||||
txDefaults,
|
||||
owners,
|
||||
SIGNATURES_REQUIRED,
|
||||
new BigNumber(0),
|
||||
@@ -145,7 +145,7 @@ describe('MultiSigWalletWithTimeLock', () => {
|
||||
multiSig = await MultiSigWalletWithTimeLockContract.deployFrom0xArtifactAsync(
|
||||
artifacts.MultiSigWalletWithTimeLock,
|
||||
provider,
|
||||
defaults,
|
||||
txDefaults,
|
||||
owners,
|
||||
SIGNATURES_REQUIRED,
|
||||
SECONDS_TIME_LOCKED,
|
||||
|
||||
@@ -16,7 +16,7 @@ import { ContractName, SubmissionContractEventArgs, TransactionDataParams } from
|
||||
|
||||
import { chaiSetup } from './utils/chai_setup';
|
||||
|
||||
import { defaults, provider, web3Wrapper } from './utils/web3_wrapper';
|
||||
import { txDefaults, provider, web3Wrapper } from './utils/web3_wrapper';
|
||||
const PROXY_ABI = artifacts.TokenTransferProxy.compilerOutput.abi;
|
||||
const MUTISIG_WALLET_WITH_TIME_LOCK_EXCEPT_REMOVE_AUTHORIZED_ADDRESS_ABI =
|
||||
artifacts.MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress.compilerOutput.abi;
|
||||
@@ -49,7 +49,7 @@ describe('MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress', () => {
|
||||
tokenTransferProxy = await TokenTransferProxyContract.deployFrom0xArtifactAsync(
|
||||
artifacts.TokenTransferProxy,
|
||||
provider,
|
||||
defaults,
|
||||
txDefaults,
|
||||
);
|
||||
await tokenTransferProxy.addAuthorizedAddress.sendTransactionAsync(authorizedAddress, {
|
||||
from: initialOwner,
|
||||
@@ -57,7 +57,7 @@ describe('MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress', () => {
|
||||
multiSig = await MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddressContract.deployFrom0xArtifactAsync(
|
||||
artifacts.MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress,
|
||||
provider,
|
||||
defaults,
|
||||
txDefaults,
|
||||
owners,
|
||||
requiredApprovals,
|
||||
SECONDS_TIME_LOCKED,
|
||||
@@ -112,7 +112,7 @@ describe('MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress', () => {
|
||||
const invalidTokenTransferProxy = await TokenTransferProxyContract.deployFrom0xArtifactAsync(
|
||||
artifacts.TokenTransferProxy,
|
||||
provider,
|
||||
defaults,
|
||||
txDefaults,
|
||||
);
|
||||
const invalidDestination = invalidTokenTransferProxy.address;
|
||||
const dataParams: TransactionDataParams = {
|
||||
|
||||
@@ -14,7 +14,7 @@ import { TokenRegWrapper } from '../util/token_registry_wrapper';
|
||||
import { ContractName } from '../util/types';
|
||||
|
||||
import { chaiSetup } from './utils/chai_setup';
|
||||
import { defaults, provider, web3Wrapper } from './utils/web3_wrapper';
|
||||
import { txDefaults, provider, web3Wrapper } from './utils/web3_wrapper';
|
||||
|
||||
chaiSetup.configure();
|
||||
const expect = chai.expect;
|
||||
@@ -29,7 +29,7 @@ describe('TokenRegistry', () => {
|
||||
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
||||
owner = accounts[0];
|
||||
notOwner = accounts[1];
|
||||
tokenReg = await TokenRegistryContract.deployFrom0xArtifactAsync(artifacts.TokenRegistry, provider, defaults);
|
||||
tokenReg = await TokenRegistryContract.deployFrom0xArtifactAsync(artifacts.TokenRegistry, provider, txDefaults);
|
||||
tokenRegWrapper = new TokenRegWrapper(tokenReg);
|
||||
});
|
||||
beforeEach(async () => {
|
||||
|
||||
@@ -9,7 +9,7 @@ import { constants } from '../../util/constants';
|
||||
import { ContractName } from '../../util/types';
|
||||
import { chaiSetup } from '../utils/chai_setup';
|
||||
|
||||
import { defaults, provider, web3Wrapper } from '../utils/web3_wrapper';
|
||||
import { txDefaults, provider, web3Wrapper } from '../utils/web3_wrapper';
|
||||
|
||||
chaiSetup.configure();
|
||||
const expect = chai.expect;
|
||||
@@ -27,7 +27,7 @@ describe('TokenTransferProxy', () => {
|
||||
tokenTransferProxy = await TokenTransferProxyContract.deployFrom0xArtifactAsync(
|
||||
artifacts.TokenTransferProxy,
|
||||
provider,
|
||||
defaults,
|
||||
txDefaults,
|
||||
);
|
||||
});
|
||||
beforeEach(async () => {
|
||||
|
||||
@@ -12,7 +12,7 @@ import { constants } from '../../util/constants';
|
||||
import { ContractName } from '../../util/types';
|
||||
import { chaiSetup } from '../utils/chai_setup';
|
||||
|
||||
import { defaults, provider, web3Wrapper } from '../utils/web3_wrapper';
|
||||
import { txDefaults, provider, web3Wrapper } from '../utils/web3_wrapper';
|
||||
|
||||
chaiSetup.configure();
|
||||
const expect = chai.expect;
|
||||
@@ -35,12 +35,12 @@ describe('TokenTransferProxy', () => {
|
||||
tokenTransferProxy = await TokenTransferProxyContract.deployFrom0xArtifactAsync(
|
||||
artifacts.TokenTransferProxy,
|
||||
provider,
|
||||
defaults,
|
||||
txDefaults,
|
||||
);
|
||||
rep = await DummyTokenContract.deployFrom0xArtifactAsync(
|
||||
artifacts.DummyToken,
|
||||
provider,
|
||||
defaults,
|
||||
txDefaults,
|
||||
constants.DUMMY_TOKEN_NAME,
|
||||
constants.DUMMY_TOKEN_SYMBOL,
|
||||
constants.DUMMY_TOKEN_DECIMALS,
|
||||
|
||||
@@ -21,7 +21,7 @@ import { OrderFactory } from '../../util/order_factory';
|
||||
import { BalancesByOwner, ContractName, ExchangeContractErrs } from '../../util/types';
|
||||
import { chaiSetup } from '../utils/chai_setup';
|
||||
|
||||
import { defaults, provider, web3Wrapper } from '../utils/web3_wrapper';
|
||||
import { txDefaults, provider, web3Wrapper } from '../utils/web3_wrapper';
|
||||
|
||||
chaiSetup.configure();
|
||||
const expect = chai.expect;
|
||||
@@ -61,7 +61,7 @@ describe('Arbitrage', () => {
|
||||
weth = await DummyTokenContract.deployFrom0xArtifactAsync(
|
||||
artifacts.DummyToken,
|
||||
provider,
|
||||
defaults,
|
||||
txDefaults,
|
||||
constants.DUMMY_TOKEN_NAME,
|
||||
constants.DUMMY_TOKEN_SYMBOL,
|
||||
constants.DUMMY_TOKEN_DECIMALS,
|
||||
@@ -70,7 +70,7 @@ describe('Arbitrage', () => {
|
||||
zrx = await DummyTokenContract.deployFrom0xArtifactAsync(
|
||||
artifacts.DummyToken,
|
||||
provider,
|
||||
defaults,
|
||||
txDefaults,
|
||||
constants.DUMMY_TOKEN_NAME,
|
||||
constants.DUMMY_TOKEN_SYMBOL,
|
||||
constants.DUMMY_TOKEN_DECIMALS,
|
||||
@@ -79,7 +79,7 @@ describe('Arbitrage', () => {
|
||||
const accountLevels = await AccountLevelsContract.deployFrom0xArtifactAsync(
|
||||
artifacts.AccountLevels,
|
||||
provider,
|
||||
defaults,
|
||||
txDefaults,
|
||||
);
|
||||
const edAdminAddress = accounts[0];
|
||||
const edMakerFee = new BigNumber(0);
|
||||
@@ -88,7 +88,7 @@ describe('Arbitrage', () => {
|
||||
etherDelta = await EtherDeltaContract.deployFrom0xArtifactAsync(
|
||||
artifacts.EtherDelta,
|
||||
provider,
|
||||
defaults,
|
||||
txDefaults,
|
||||
edAdminAddress,
|
||||
feeRecipient,
|
||||
accountLevels.address,
|
||||
@@ -99,12 +99,12 @@ describe('Arbitrage', () => {
|
||||
const tokenTransferProxy = await TokenTransferProxyContract.deployFrom0xArtifactAsync(
|
||||
artifacts.TokenTransferProxy,
|
||||
provider,
|
||||
defaults,
|
||||
txDefaults,
|
||||
);
|
||||
const exchange = await ExchangeContract.deployFrom0xArtifactAsync(
|
||||
artifacts.Exchange,
|
||||
provider,
|
||||
defaults,
|
||||
txDefaults,
|
||||
zrx.address,
|
||||
tokenTransferProxy.address,
|
||||
);
|
||||
@@ -132,7 +132,7 @@ describe('Arbitrage', () => {
|
||||
arbitrage = await ArbitrageContract.deployFrom0xArtifactAsync(
|
||||
artifacts.Arbitrage,
|
||||
provider,
|
||||
defaults,
|
||||
txDefaults,
|
||||
exchange.address,
|
||||
etherDelta.address,
|
||||
tokenTransferProxy.address,
|
||||
|
||||
@@ -11,7 +11,7 @@ import { constants } from '../util/constants';
|
||||
import { ContractName } from '../util/types';
|
||||
|
||||
import { chaiSetup } from './utils/chai_setup';
|
||||
import { defaults, provider, web3Wrapper } from './utils/web3_wrapper';
|
||||
import { txDefaults, provider, web3Wrapper } from './utils/web3_wrapper';
|
||||
|
||||
chaiSetup.configure();
|
||||
const expect = chai.expect;
|
||||
@@ -36,7 +36,7 @@ describe('UnlimitedAllowanceToken', () => {
|
||||
token = await DummyTokenContract.deployFrom0xArtifactAsync(
|
||||
artifacts.DummyToken,
|
||||
provider,
|
||||
defaults,
|
||||
txDefaults,
|
||||
constants.DUMMY_TOKEN_NAME,
|
||||
constants.DUMMY_TOKEN_SYMBOL,
|
||||
constants.DUMMY_TOKEN_DECIMALS,
|
||||
|
||||
@@ -2,7 +2,7 @@ import { devConstants, web3Factory } from '@0xproject/dev-utils';
|
||||
import { Provider } from '@0xproject/types';
|
||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||
|
||||
export const defaults = {
|
||||
export const txDefaults = {
|
||||
from: devConstants.TESTRPC_FIRST_ADDRESS,
|
||||
gas: devConstants.GAS_ESTIMATE,
|
||||
};
|
||||
|
||||
@@ -11,7 +11,7 @@ import { constants } from '../util/constants';
|
||||
import { ContractName } from '../util/types';
|
||||
|
||||
import { chaiSetup } from './utils/chai_setup';
|
||||
import { defaults, provider, web3Wrapper } from './utils/web3_wrapper';
|
||||
import { txDefaults, provider, web3Wrapper } from './utils/web3_wrapper';
|
||||
|
||||
chaiSetup.configure();
|
||||
const expect = chai.expect;
|
||||
@@ -34,7 +34,7 @@ describe('ZRXToken', () => {
|
||||
zeroEx = new ZeroEx(provider, {
|
||||
networkId: constants.TESTRPC_NETWORK_ID,
|
||||
});
|
||||
zrx = await ZRXTokenContract.deployFrom0xArtifactAsync(artifacts.ZRX, provider, defaults);
|
||||
zrx = await ZRXTokenContract.deployFrom0xArtifactAsync(artifacts.ZRX, provider, txDefaults);
|
||||
zrxAddress = zrx.address;
|
||||
MAX_UINT = zeroEx.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS;
|
||||
});
|
||||
|
||||
@@ -23,7 +23,7 @@ describe('Metacoin', () => {
|
||||
const ownerAddress = devConstants.TESTRPC_FIRST_ADDRESS;
|
||||
const INITIAL_BALANCE = new BigNumber(10000);
|
||||
before(async () => {
|
||||
metacoin = await MetacoinContract.deployFrom0xArtifactAsync(artifact, provider, config.defaults);
|
||||
metacoin = await MetacoinContract.deployFrom0xArtifactAsync(artifact, provider, config.txDefaults);
|
||||
web3Wrapper.abiDecoder.addABI(metacoin.abi);
|
||||
});
|
||||
beforeEach(async () => {
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
"dependencies": {
|
||||
"@0xproject/sol-compiler": "^0.4.3",
|
||||
"@0xproject/base-contract": "^0.3.1",
|
||||
"@0xproject/typescript-typings": "^0.3.1",
|
||||
"@0xproject/utils": "^0.6.1",
|
||||
"@0xproject/web3-wrapper": "^0.6.3",
|
||||
"ethers": "^3.0.15",
|
||||
|
||||
26
packages/migrations/src/artifact_writer.ts
Normal file
26
packages/migrations/src/artifact_writer.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { BaseContract } from '@0xproject/base-contract';
|
||||
import { ContractArtifact } from '@0xproject/sol-compiler';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
|
||||
export class ArtifactWriter {
|
||||
private _artifactsDir: string;
|
||||
private _networkId: number;
|
||||
constructor(artifactsDir: string, networkId: number) {
|
||||
this._artifactsDir = artifactsDir;
|
||||
this._networkId = networkId;
|
||||
}
|
||||
// This updates the artifact file but does not update the `artifacts` module above. It will not
|
||||
// contain the saved artifact changes.
|
||||
public saveArtifact(contract: BaseContract): void {
|
||||
const contractName = contract.contractName;
|
||||
const artifactFile = path.join(this._artifactsDir, `${contractName}.json`);
|
||||
const artifact: ContractArtifact = JSON.parse(fs.readFileSync(artifactFile).toString());
|
||||
artifact.networks[this._networkId] = {
|
||||
address: contract.address,
|
||||
links: {},
|
||||
constructorArgs: JSON.stringify(contract.constructorArgs),
|
||||
};
|
||||
fs.writeFileSync(artifactFile, JSON.stringify(artifact, null, '\t'));
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,4 @@
|
||||
import { BaseContract } from '@0xproject/base-contract';
|
||||
import { ContractArtifact } from '@0xproject/sol-compiler';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
|
||||
import * as AccountLevels from '../artifacts/1.0.0/AccountLevels.json';
|
||||
import * as Arbitrage from '../artifacts/1.0.0/Arbitrage.json';
|
||||
@@ -32,23 +29,3 @@ export const artifacts = {
|
||||
MultiSigWalletWithTimeLock: (MultiSigWalletWithTimeLock as any) as ContractArtifact,
|
||||
MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress: (MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress as any) as ContractArtifact,
|
||||
};
|
||||
|
||||
export class ArtifactWriter {
|
||||
private _artifactsDir: string;
|
||||
private _networkId: number;
|
||||
constructor(artifactsDir: string, networkId: number) {
|
||||
this._artifactsDir = artifactsDir;
|
||||
this._networkId = networkId;
|
||||
}
|
||||
public saveArtifact(contract: BaseContract): void {
|
||||
const contractName = contract.contractName;
|
||||
const artifactFile = path.join(this._artifactsDir, `${contractName}.json`);
|
||||
const artifact: ContractArtifact = JSON.parse(fs.readFileSync(artifactFile).toString());
|
||||
artifact.networks[this._networkId] = {
|
||||
address: contract.address,
|
||||
links: {},
|
||||
constructorArgs: JSON.stringify(contract.constructorArgs),
|
||||
};
|
||||
fs.writeFileSync(artifactFile, JSON.stringify(artifact, null, 2));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import { runMigrationsAsync } from './migration';
|
||||
const web3 = web3Factory.create(providerConfigs);
|
||||
const provider = web3.currentProvider;
|
||||
const artifactsDir = 'artifacts/1.0.0';
|
||||
await runMigrationsAsync(provider, artifactsDir, defaults);
|
||||
await runMigrationsAsync(provider, artifactsDir, txDefaults);
|
||||
process.exit(0);
|
||||
})().catch(err => {
|
||||
logUtils.log(err);
|
||||
|
||||
@@ -20,24 +20,28 @@ import { tokenInfo } from './utils/token_info';
|
||||
* the migration should be written to run synchronously.
|
||||
* @param provider Web3 provider instance.
|
||||
* @param artifactsDir The directory with compiler artifact files.
|
||||
* @param defaults Default transaction values to use when deploying contracts.
|
||||
* @param txDefaults 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, txDefaults: Partial<TxData>) => {
|
||||
const web3Wrapper = new Web3Wrapper(provider);
|
||||
const networkId = await web3Wrapper.getNetworkIdAsync();
|
||||
const artifactsWriter = new ArtifactWriter(artifactsDir, networkId);
|
||||
const tokenTransferProxy = await TokenTransferProxyContract.deployFrom0xArtifactAsync(
|
||||
artifacts.TokenTransferProxy,
|
||||
provider,
|
||||
defaults,
|
||||
txDefaults,
|
||||
);
|
||||
artifactsWriter.saveArtifact(tokenTransferProxy);
|
||||
const zrxToken = await ZRXTokenContract.deployFrom0xArtifactAsync(artifacts.ZRX, provider, defaults);
|
||||
const zrxToken = await ZRXTokenContract.deployFrom0xArtifactAsync(artifacts.ZRX, provider, txDefaults);
|
||||
artifactsWriter.saveArtifact(zrxToken);
|
||||
|
||||
const etherToken = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.EtherToken, provider, defaults);
|
||||
const etherToken = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.EtherToken, provider, txDefaults);
|
||||
artifactsWriter.saveArtifact(etherToken);
|
||||
const tokenReg = await TokenRegistryContract.deployFrom0xArtifactAsync(artifacts.TokenRegistry, provider, defaults);
|
||||
const tokenReg = await TokenRegistryContract.deployFrom0xArtifactAsync(
|
||||
artifacts.TokenRegistry,
|
||||
provider,
|
||||
txDefaults,
|
||||
);
|
||||
artifactsWriter.saveArtifact(tokenReg);
|
||||
|
||||
const accounts: string[] = await web3Wrapper.getAvailableAddressesAsync();
|
||||
@@ -47,7 +51,7 @@ export const runMigrationsAsync = async (provider: Provider, artifactsDir: strin
|
||||
const exchange = await ExchangeContract.deployFrom0xArtifactAsync(
|
||||
artifacts.Exchange,
|
||||
provider,
|
||||
defaults,
|
||||
txDefaults,
|
||||
zrxToken.address,
|
||||
tokenTransferProxy.address,
|
||||
);
|
||||
@@ -55,7 +59,7 @@ export const runMigrationsAsync = async (provider: Provider, artifactsDir: strin
|
||||
const multiSig = await MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddressContract.deployFrom0xArtifactAsync(
|
||||
artifacts.MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress,
|
||||
provider,
|
||||
defaults,
|
||||
txDefaults,
|
||||
owners,
|
||||
confirmationsRequired,
|
||||
secondsRequired,
|
||||
@@ -104,7 +108,7 @@ export const runMigrationsAsync = async (provider: Provider, artifactsDir: strin
|
||||
const dummyToken = await DummyTokenContract.deployFrom0xArtifactAsync(
|
||||
artifacts.DummyToken,
|
||||
provider,
|
||||
defaults,
|
||||
txDefaults,
|
||||
token.name,
|
||||
token.symbol,
|
||||
token.decimals,
|
||||
|
||||
@@ -214,7 +214,7 @@ async function updateChangeLogsAsync(updatedPublicLernaPackages: LernaPackage[])
|
||||
}
|
||||
|
||||
// Save updated CHANGELOG.json
|
||||
fs.writeFileSync(changelogJSONPath, JSON.stringify(changelogs, null, 4));
|
||||
fs.writeFileSync(changelogJSONPath, JSON.stringify(changelogs, null, '\t'));
|
||||
await utils.prettifyAsync(changelogJSONPath, constants.monorepoRootPath);
|
||||
utils.log(`${packageName}: Updated CHANGELOG.json`);
|
||||
// Generate updated CHANGELOG.md
|
||||
|
||||
@@ -46,7 +46,7 @@ import { utils } from './utils';
|
||||
include: ['index.ts'],
|
||||
};
|
||||
const tsconfigFilePath = path.join(testDirectory, 'tsconfig.json');
|
||||
fs.writeFileSync(tsconfigFilePath, JSON.stringify(tsConfig, null, 4));
|
||||
fs.writeFileSync(tsconfigFilePath, JSON.stringify(tsConfig, null, '\t'));
|
||||
utils.log(`Compiling ${packageName}`);
|
||||
const tscBinaryPath = path.join(monorepoRootPath, './node_modules/typescript/bin/tsc');
|
||||
await execAsync(tscBinaryPath, { cwd: testDirectory });
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
export const utils = {
|
||||
stringifyWithFormatting(obj: any): string {
|
||||
const jsonReplacer: null = null;
|
||||
const numberOfJsonSpaces = 4;
|
||||
const stringifiedObj = JSON.stringify(obj, jsonReplacer, numberOfJsonSpaces);
|
||||
const stringifiedObj = JSON.stringify(obj, null, '\t');
|
||||
return stringifiedObj;
|
||||
},
|
||||
};
|
||||
|
||||
@@ -48,9 +48,7 @@ export class CoverageManager {
|
||||
}
|
||||
public async writeCoverageAsync(): Promise<void> {
|
||||
const finalCoverage = await this._computeCoverageAsync();
|
||||
const jsonReplacer: null = null;
|
||||
const numberOfJsonSpaces = 4;
|
||||
const stringifiedCoverage = JSON.stringify(finalCoverage, jsonReplacer, numberOfJsonSpaces);
|
||||
const stringifiedCoverage = JSON.stringify(finalCoverage, null, '\t');
|
||||
fs.writeFileSync('coverage/coverage.json', stringifiedCoverage);
|
||||
}
|
||||
private _getSingleFileCoverageForTrace(
|
||||
|
||||
@@ -29,7 +29,7 @@ export class Web3Wrapper {
|
||||
public isZeroExWeb3Wrapper = true;
|
||||
public abiDecoder: AbiDecoder;
|
||||
private _web3: Web3;
|
||||
private _defaults: Partial<TxData>;
|
||||
private _txDefaults: Partial<TxData>;
|
||||
private _jsonRpcRequestId: number;
|
||||
/**
|
||||
* Check if an address is a valid Ethereum address
|
||||
@@ -83,10 +83,10 @@ export class Web3Wrapper {
|
||||
* Instantiates a new Web3Wrapper.
|
||||
* @param provider The Web3 provider instance you would like the Web3Wrapper to use for interacting with
|
||||
* the backing Ethereum node.
|
||||
* @param defaults Override TxData defaults sent with RPC requests to the backing Ethereum node.
|
||||
* @param txDefaults Override TxData defaults sent with RPC requests to the backing Ethereum node.
|
||||
* @return An instance of the Web3Wrapper class.
|
||||
*/
|
||||
constructor(provider: Provider, defaults?: Partial<TxData>) {
|
||||
constructor(provider: Provider, txDefaults?: Partial<TxData>) {
|
||||
if (_.isUndefined((provider as any).sendAsync)) {
|
||||
// Web3@1.0 provider doesn't support synchronous http requests,
|
||||
// so it only has an async `send` method, instead of a `send` and `sendAsync` in web3@0.x.x`
|
||||
@@ -96,7 +96,7 @@ export class Web3Wrapper {
|
||||
this.abiDecoder = new AbiDecoder([]);
|
||||
this._web3 = new Web3();
|
||||
this._web3.setProvider(provider);
|
||||
this._defaults = defaults || {};
|
||||
this._txDefaults = txDefaults || {};
|
||||
this._jsonRpcRequestId = 0;
|
||||
}
|
||||
/**
|
||||
@@ -104,7 +104,7 @@ export class Web3Wrapper {
|
||||
* @return TxData defaults (e.g gas, gasPrice, nonce, etc...)
|
||||
*/
|
||||
public getContractDefaults(): Partial<TxData> {
|
||||
return this._defaults;
|
||||
return this._txDefaults;
|
||||
}
|
||||
/**
|
||||
* Retrieve the Web3 provider
|
||||
|
||||
@@ -28,7 +28,7 @@ const docSections = {
|
||||
const docsInfoConfig: DocsInfoConfig = {
|
||||
id: DocPackages.SolCompiler,
|
||||
type: SupportedDocJson.TypeDoc,
|
||||
displayName: 'Sol Compiler',
|
||||
displayName: 'Solidity Compiler',
|
||||
packageUrl: 'https://github.com/0xProject/0x-monorepo',
|
||||
menu: {
|
||||
introduction: [docSections.introduction],
|
||||
@@ -52,22 +52,9 @@ const docsInfoConfig: DocsInfoConfig = {
|
||||
typeConfigs: {
|
||||
// Note: This needs to be kept in sync with the types exported in index.ts. Unfortunately there is
|
||||
// currently no way to extract the re-exported types from index.ts via TypeDoc :(
|
||||
publicTypes: [
|
||||
'CompilerOptions',
|
||||
'DeployerOptions',
|
||||
'BaseDeployerOptions',
|
||||
'UrlDeployerOptions',
|
||||
'ProviderDeployerOptions',
|
||||
'TxData',
|
||||
],
|
||||
typeNameToExternalLink: {
|
||||
Web3: constants.URL_WEB3_DOCS,
|
||||
BigNumber: constants.URL_BIGNUMBERJS_GITHUB,
|
||||
ContractInstance: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L98',
|
||||
},
|
||||
typeNameToPrefix: {
|
||||
ContractInstance: 'Web3',
|
||||
},
|
||||
publicTypes: ['CompilerOptions'],
|
||||
typeNameToExternalLink: {},
|
||||
typeNameToPrefix: {},
|
||||
},
|
||||
};
|
||||
const docsInfo = new DocsInfo(docsInfoConfig);
|
||||
|
||||
Reference in New Issue
Block a user