bug: Use Testnet Exchange over mainnet

This commit is contained in:
Jacob Evans 2018-11-23 17:52:08 +11:00
parent a5359df002
commit f0f6b26c3b
No known key found for this signature in database
GPG Key ID: 2036DA2ADDFB0842
5 changed files with 38 additions and 7 deletions

View File

@ -1,4 +1,13 @@
[
{
"version": "2.0.0",
"changes": [
{
"pr": 1309,
"note": "Update Exchange artifact to receive ZRX asset data as a constructor argument"
}
]
},
{
"version": "1.1.0",
"changes": [

View File

@ -3028,29 +3028,35 @@ export class ExchangeContract extends BaseContract {
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
_zrxAssetData: string,
): Promise<ExchangeContract> {
if (_.isUndefined(artifact.compilerOutput)) {
throw new Error('Compiler output not found in the artifact file');
}
const bytecode = artifact.compilerOutput.evm.bytecode.object;
const abi = artifact.compilerOutput.abi;
return ExchangeContract.deployAsync(bytecode, abi, provider, txDefaults, );
return ExchangeContract.deployAsync(bytecode, abi, provider, txDefaults, _zrxAssetData
);
}
public static async deployAsync(
bytecode: string,
abi: ContractAbi,
provider: Provider,
txDefaults: Partial<TxData>,
_zrxAssetData: string,
): Promise<ExchangeContract> {
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
[] = BaseContract._formatABIDataItemList(
[_zrxAssetData
] = BaseContract._formatABIDataItemList(
constructorAbi.inputs,
[],
[_zrxAssetData
],
BaseContract._bigNumberToString,
);
const iface = new ethers.utils.Interface(abi);
const deployInfo = iface.deployFunction;
const txData = deployInfo.encode(bytecode, []);
const txData = deployInfo.encode(bytecode, [_zrxAssetData
]);
const web3Wrapper = new Web3Wrapper(provider);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{data: txData},
@ -3062,7 +3068,8 @@ export class ExchangeContract extends BaseContract {
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
logUtils.log(`Exchange successfully deployed at ${txReceipt.contractAddress}`);
const contractInstance = new ExchangeContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
contractInstance.constructorArgs = [];
contractInstance.constructorArgs = [_zrxAssetData
];
return contractInstance;
}
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {

View File

@ -1,4 +1,13 @@
[
{
"version": "1.1.2",
"changes": [
{
"pr": 1309,
"note": "Update Exchange artifact to receive ZRX asset data as a constructor argument"
}
]
},
{
"version": "1.1.0",
"changes": [

File diff suppressed because one or more lines are too long

View File

@ -47,6 +47,7 @@ export async function runMigrationsAsync(provider: Provider, txDefaults: Partial
artifacts.Exchange,
provider,
txDefaults,
zrxAssetData,
);
// Multisigs