diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-05-10 21:20:00 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-05-10 23:47:38 +0800 |
commit | f854f3ee2bd74bbb61ed465099168b4d391f92c8 (patch) | |
tree | d0d126e9041198dfb8d27a48a251167bf4fd4e44 /packages | |
parent | 1055ca6d4435c0a9b325586e4c7af3458eff273a (diff) | |
download | dexon-sol-tools-f854f3ee2bd74bbb61ed465099168b4d391f92c8.tar dexon-sol-tools-f854f3ee2bd74bbb61ed465099168b4d391f92c8.tar.gz dexon-sol-tools-f854f3ee2bd74bbb61ed465099168b4d391f92c8.tar.bz2 dexon-sol-tools-f854f3ee2bd74bbb61ed465099168b4d391f92c8.tar.lz dexon-sol-tools-f854f3ee2bd74bbb61ed465099168b4d391f92c8.tar.xz dexon-sol-tools-f854f3ee2bd74bbb61ed465099168b4d391f92c8.tar.zst dexon-sol-tools-f854f3ee2bd74bbb61ed465099168b4d391f92c8.zip |
Remove unused deployer docs configs
Diffstat (limited to 'packages')
30 files changed, 120 insertions, 130 deletions
diff --git a/packages/0x.js/src/0x.ts b/packages/0x.js/src/0x.ts index 78f9f6beb..f603ad644 100644 --- a/packages/0x.js/src/0x.ts +++ b/packages/0x.js/src/0x.ts @@ -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); }); diff --git a/packages/0x.js/test/global_hooks.ts b/packages/0x.js/test/global_hooks.ts index 3e6731add..88f202761 100644 --- a/packages/0x.js/test/global_hooks.ts +++ b/packages/0x.js/test/global_hooks.ts @@ -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); }); diff --git a/packages/0x.js/test/utils/fill_scenarios.ts b/packages/0x.js/test/utils/fill_scenarios.ts index 5a82a56d2..7f28c8af3 100644 --- a/packages/0x.js/test/utils/fill_scenarios.ts +++ b/packages/0x.js/test/utils/fill_scenarios.ts @@ -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, diff --git a/packages/base-contract/src/index.ts b/packages/base-contract/src/index.ts index 8da3c2e71..f9298f413 100644 --- a/packages/base-contract/src/index.ts +++ b/packages/base-contract/src/index.ts @@ -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( diff --git a/packages/contract_templates/contract.handlebars b/packages/contract_templates/contract.handlebars index 1fa9508f5..ed11ac8d2 100644 --- a/packages/contract_templates/contract.handlebars +++ b/packages/contract_templates/contract.handlebars @@ -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 diff --git a/packages/contracts/test/ether_token.ts b/packages/contracts/test/ether_token.ts index a25e4ebba..da84b8b97 100644 --- a/packages/contracts/test/ether_token.ts +++ b/packages/contracts/test/ether_token.ts @@ -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, diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts index 1a404c410..3d7a7a174 100644 --- a/packages/contracts/test/exchange/core.ts +++ b/packages/contracts/test/exchange/core.ts @@ -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, diff --git a/packages/contracts/test/exchange/helpers.ts b/packages/contracts/test/exchange/helpers.ts index 8835412de..112f9782c 100644 --- a/packages/contracts/test/exchange/helpers.ts +++ b/packages/contracts/test/exchange/helpers.ts @@ -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, ); diff --git a/packages/contracts/test/exchange/wrapper.ts b/packages/contracts/test/exchange/wrapper.ts index 1c80189ab..a8d97f552 100644 --- a/packages/contracts/test/exchange/wrapper.ts +++ b/packages/contracts/test/exchange/wrapper.ts @@ -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, ); diff --git a/packages/contracts/test/multi_sig_with_time_lock.ts b/packages/contracts/test/multi_sig_with_time_lock.ts index 361d87ff7..1a22a4011 100644 --- a/packages/contracts/test/multi_sig_with_time_lock.ts +++ b/packages/contracts/test/multi_sig_with_time_lock.ts @@ -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, diff --git a/packages/contracts/test/multi_sig_with_time_lock_except_remove_auth_addr.ts b/packages/contracts/test/multi_sig_with_time_lock_except_remove_auth_addr.ts index ba23889b3..0ea212f7b 100644 --- a/packages/contracts/test/multi_sig_with_time_lock_except_remove_auth_addr.ts +++ b/packages/contracts/test/multi_sig_with_time_lock_except_remove_auth_addr.ts @@ -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 = { diff --git a/packages/contracts/test/token_registry.ts b/packages/contracts/test/token_registry.ts index 363631385..7f45284af 100644 --- a/packages/contracts/test/token_registry.ts +++ b/packages/contracts/test/token_registry.ts @@ -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 () => { diff --git a/packages/contracts/test/token_transfer_proxy/auth.ts b/packages/contracts/test/token_transfer_proxy/auth.ts index 6baadab61..47f07e2a8 100644 --- a/packages/contracts/test/token_transfer_proxy/auth.ts +++ b/packages/contracts/test/token_transfer_proxy/auth.ts @@ -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 () => { diff --git a/packages/contracts/test/token_transfer_proxy/transfer_from.ts b/packages/contracts/test/token_transfer_proxy/transfer_from.ts index 92573caf7..5a3071a33 100644 --- a/packages/contracts/test/token_transfer_proxy/transfer_from.ts +++ b/packages/contracts/test/token_transfer_proxy/transfer_from.ts @@ -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, diff --git a/packages/contracts/test/tutorials/arbitrage.ts b/packages/contracts/test/tutorials/arbitrage.ts index 43dbd2989..89062d4dc 100644 --- a/packages/contracts/test/tutorials/arbitrage.ts +++ b/packages/contracts/test/tutorials/arbitrage.ts @@ -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, diff --git a/packages/contracts/test/unlimited_allowance_token.ts b/packages/contracts/test/unlimited_allowance_token.ts index 546958cfd..860efa73c 100644 --- a/packages/contracts/test/unlimited_allowance_token.ts +++ b/packages/contracts/test/unlimited_allowance_token.ts @@ -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, diff --git a/packages/contracts/test/utils/web3_wrapper.ts b/packages/contracts/test/utils/web3_wrapper.ts index 4b2a8ed60..ed1c488a2 100644 --- a/packages/contracts/test/utils/web3_wrapper.ts +++ b/packages/contracts/test/utils/web3_wrapper.ts @@ -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, }; diff --git a/packages/contracts/test/zrx_token.ts b/packages/contracts/test/zrx_token.ts index dcba5ab1a..dda15783f 100644 --- a/packages/contracts/test/zrx_token.ts +++ b/packages/contracts/test/zrx_token.ts @@ -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; }); diff --git a/packages/metacoin/test/metacoin_test.ts b/packages/metacoin/test/metacoin_test.ts index a31ce1779..8369632c2 100644 --- a/packages/metacoin/test/metacoin_test.ts +++ b/packages/metacoin/test/metacoin_test.ts @@ -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 () => { diff --git a/packages/migrations/package.json b/packages/migrations/package.json index be17614b4..0723c5d88 100644 --- a/packages/migrations/package.json +++ b/packages/migrations/package.json @@ -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", diff --git a/packages/migrations/src/artifact_writer.ts b/packages/migrations/src/artifact_writer.ts new file mode 100644 index 000000000..2da5a09dd --- /dev/null +++ b/packages/migrations/src/artifact_writer.ts @@ -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')); + } +} diff --git a/packages/migrations/src/artifacts.ts b/packages/migrations/src/artifacts.ts index f8913fe52..42eb1c33e 100644 --- a/packages/migrations/src/artifacts.ts +++ b/packages/migrations/src/artifacts.ts @@ -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)); - } -} diff --git a/packages/migrations/src/migrate.ts b/packages/migrations/src/migrate.ts index 58d39734e..fe3daed98 100644 --- a/packages/migrations/src/migrate.ts +++ b/packages/migrations/src/migrate.ts @@ -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); diff --git a/packages/migrations/src/migration.ts b/packages/migrations/src/migration.ts index 5b49b9282..2e38b59ae 100644 --- a/packages/migrations/src/migration.ts +++ b/packages/migrations/src/migration.ts @@ -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, diff --git a/packages/monorepo-scripts/src/publish.ts b/packages/monorepo-scripts/src/publish.ts index 2011dc393..a5be40014 100644 --- a/packages/monorepo-scripts/src/publish.ts +++ b/packages/monorepo-scripts/src/publish.ts @@ -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 diff --git a/packages/monorepo-scripts/src/test_installation.ts b/packages/monorepo-scripts/src/test_installation.ts index 78e0f0929..e84221f9d 100644 --- a/packages/monorepo-scripts/src/test_installation.ts +++ b/packages/monorepo-scripts/src/test_installation.ts @@ -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 }); diff --git a/packages/sol-compiler/src/utils/utils.ts b/packages/sol-compiler/src/utils/utils.ts index 9b1e59f9d..4f2de2caa 100644 --- a/packages/sol-compiler/src/utils/utils.ts +++ b/packages/sol-compiler/src/utils/utils.ts @@ -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; }, }; diff --git a/packages/sol-cov/src/coverage_manager.ts b/packages/sol-cov/src/coverage_manager.ts index bf580025b..f50f010b9 100644 --- a/packages/sol-cov/src/coverage_manager.ts +++ b/packages/sol-cov/src/coverage_manager.ts @@ -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( diff --git a/packages/web3-wrapper/src/web3_wrapper.ts b/packages/web3-wrapper/src/web3_wrapper.ts index 5e6ff3239..82e6ef4f9 100644 --- a/packages/web3-wrapper/src/web3_wrapper.ts +++ b/packages/web3-wrapper/src/web3_wrapper.ts @@ -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 diff --git a/packages/website/ts/containers/sol_compiler_documentation.ts b/packages/website/ts/containers/sol_compiler_documentation.ts index 0cf595645..2f6486146 100644 --- a/packages/website/ts/containers/sol_compiler_documentation.ts +++ b/packages/website/ts/containers/sol_compiler_documentation.ts @@ -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); |