Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
bytecodeHex = bytecode.object;
}
else {
// Crash in the next verification step
bytecodeHex = "!";
}
// Make sure it is 0x prefixed
if (bytecodeHex.substring(0, 2) !== "0x") {
bytecodeHex = "0x" + bytecodeHex;
}
// Make sure the final result is valid bytecode
if (!isHexString(bytecodeHex) || (bytecodeHex.length % 2)) {
logger.throwArgumentError("invalid bytecode", "bytecode", bytecode);
}
// If we have a signer, make sure it is valid
if (signer && !Signer.isSigner(signer)) {
logger.throwArgumentError("invalid signer", "signer", signer);
}
defineReadOnly(this, "bytecode", bytecodeHex);
defineReadOnly(this, "interface", getStatic((new.target), "getInterface")(contractInterface));
defineReadOnly(this, "signer", signer || null);
}
getDeployTransaction(...args) {
constructor(addressOrName, contractInterface, signerOrProvider) {
logger.checkNew(new.target, Contract);
// @TODO: Maybe still check the addressOrName looks like a valid address or name?
//address = getAddress(address);
defineReadOnly(this, "interface", getStatic((new.target), "getInterface")(contractInterface));
if (Signer.isSigner(signerOrProvider)) {
defineReadOnly(this, "provider", signerOrProvider.provider || null);
defineReadOnly(this, "signer", signerOrProvider);
}
else if (Provider.isProvider(signerOrProvider)) {
defineReadOnly(this, "provider", signerOrProvider);
defineReadOnly(this, "signer", null);
}
else {
logger.throwArgumentError("invalid signer or provider", "signerOrProvider", signerOrProvider);
}
defineReadOnly(this, "callStatic", {});
defineReadOnly(this, "estimate", {});
defineReadOnly(this, "functions", {});
defineReadOnly(this, "populateTransaction", {});
defineReadOnly(this, "filters", {});
{