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