Fix contract not deployed on network bug in ContractWrapper class
This commit is contained in:
@@ -4,6 +4,10 @@
|
||||
"changes": [
|
||||
{
|
||||
"note": "Add `OrderValidatorWrapper`"
|
||||
},
|
||||
{
|
||||
"note":
|
||||
"Fix bug where contracts not deployed on a network showed an `EXCHANGE_CONTRACT_DOES_NOT_EXIST` error instead of `CONTRACT_NOT_DEPLOYED_ON_NETWORK`"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@@ -145,9 +145,12 @@ export abstract class ContractWrapper {
|
||||
}
|
||||
protected _getContractAddress(artifact: ContractArtifact, addressIfExists?: string): string {
|
||||
if (_.isUndefined(addressIfExists)) {
|
||||
if (_.isUndefined(artifact.networks[this._networkId])) {
|
||||
throw new Error(ContractWrappersError.ContractNotDeployedOnNetwork);
|
||||
}
|
||||
const contractAddress = artifact.networks[this._networkId].address;
|
||||
if (_.isUndefined(contractAddress)) {
|
||||
throw new Error(ContractWrappersError.ExchangeContractDoesNotExist);
|
||||
throw new Error(CONTRACT_NAME_TO_NOT_FOUND_ERROR[artifact.contractName]);
|
||||
}
|
||||
return contractAddress;
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user