bug: Use Testnet Exchange over mainnet
This commit is contained in:
parent
a5359df002
commit
f0f6b26c3b
@ -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",
|
"version": "1.1.0",
|
||||||
"changes": [
|
"changes": [
|
||||||
|
@ -3028,29 +3028,35 @@ export class ExchangeContract extends BaseContract {
|
|||||||
artifact: ContractArtifact | SimpleContractArtifact,
|
artifact: ContractArtifact | SimpleContractArtifact,
|
||||||
provider: Provider,
|
provider: Provider,
|
||||||
txDefaults: Partial<TxData>,
|
txDefaults: Partial<TxData>,
|
||||||
|
_zrxAssetData: string,
|
||||||
): Promise<ExchangeContract> {
|
): Promise<ExchangeContract> {
|
||||||
if (_.isUndefined(artifact.compilerOutput)) {
|
if (_.isUndefined(artifact.compilerOutput)) {
|
||||||
throw new Error('Compiler output not found in the artifact file');
|
throw new Error('Compiler output not found in the artifact file');
|
||||||
}
|
}
|
||||||
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 ExchangeContract.deployAsync(bytecode, abi, provider, txDefaults, );
|
return ExchangeContract.deployAsync(bytecode, abi, provider, txDefaults, _zrxAssetData
|
||||||
|
);
|
||||||
}
|
}
|
||||||
public static async deployAsync(
|
public static async deployAsync(
|
||||||
bytecode: string,
|
bytecode: string,
|
||||||
abi: ContractAbi,
|
abi: ContractAbi,
|
||||||
provider: Provider,
|
provider: Provider,
|
||||||
txDefaults: Partial<TxData>,
|
txDefaults: Partial<TxData>,
|
||||||
|
_zrxAssetData: string,
|
||||||
): Promise<ExchangeContract> {
|
): Promise<ExchangeContract> {
|
||||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||||
[] = BaseContract._formatABIDataItemList(
|
[_zrxAssetData
|
||||||
|
] = BaseContract._formatABIDataItemList(
|
||||||
constructorAbi.inputs,
|
constructorAbi.inputs,
|
||||||
[],
|
[_zrxAssetData
|
||||||
|
],
|
||||||
BaseContract._bigNumberToString,
|
BaseContract._bigNumberToString,
|
||||||
);
|
);
|
||||||
const iface = new ethers.utils.Interface(abi);
|
const iface = new ethers.utils.Interface(abi);
|
||||||
const deployInfo = iface.deployFunction;
|
const deployInfo = iface.deployFunction;
|
||||||
const txData = deployInfo.encode(bytecode, []);
|
const txData = deployInfo.encode(bytecode, [_zrxAssetData
|
||||||
|
]);
|
||||||
const web3Wrapper = new Web3Wrapper(provider);
|
const web3Wrapper = new Web3Wrapper(provider);
|
||||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||||
{data: txData},
|
{data: txData},
|
||||||
@ -3062,7 +3068,8 @@ export class ExchangeContract extends BaseContract {
|
|||||||
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||||
logUtils.log(`Exchange successfully deployed at ${txReceipt.contractAddress}`);
|
logUtils.log(`Exchange successfully deployed at ${txReceipt.contractAddress}`);
|
||||||
const contractInstance = new ExchangeContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
|
const contractInstance = new ExchangeContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
|
||||||
contractInstance.constructorArgs = [];
|
contractInstance.constructorArgs = [_zrxAssetData
|
||||||
|
];
|
||||||
return contractInstance;
|
return contractInstance;
|
||||||
}
|
}
|
||||||
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
|
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
|
||||||
|
@ -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",
|
"version": "1.1.0",
|
||||||
"changes": [
|
"changes": [
|
||||||
|
File diff suppressed because one or more lines are too long
@ -47,6 +47,7 @@ export async function runMigrationsAsync(provider: Provider, txDefaults: Partial
|
|||||||
artifacts.Exchange,
|
artifacts.Exchange,
|
||||||
provider,
|
provider,
|
||||||
txDefaults,
|
txDefaults,
|
||||||
|
zrxAssetData,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Multisigs
|
// Multisigs
|
||||||
|
Loading…
x
Reference in New Issue
Block a user