mirror of
https://github.com/luxfi/eoa-contracts.git
synced 2026-10-30 16:58:32 +00:00
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
import { ethers } from "hardhat";
|
|
import {
|
|
deployContract,
|
|
DEPLOYMENT_SALTS_DEV,
|
|
getDeployerInstance,
|
|
isContract,
|
|
} from "./utils";
|
|
|
|
async function main() {
|
|
const provider = ethers.provider;
|
|
|
|
const deployerInstance = await getDeployerInstance();
|
|
const salt = ethers.utils.keccak256(
|
|
ethers.utils.toUtf8Bytes(DEPLOYMENT_SALTS.DECODER)
|
|
);
|
|
|
|
const decoder = await ethers.getContractFactory("Decoder");
|
|
const decoderBytecode = `${decoder.bytecode}`;
|
|
const decoderComputedAddr = await deployerInstance.addressOf(salt);
|
|
|
|
console.log("decoder Computed Address: ", decoderComputedAddr);
|
|
|
|
const isdecoderDeployed = await isContract(decoderComputedAddr, provider); // true (deployed on-chain)
|
|
if (!isdecoderDeployed) {
|
|
await deployContract(
|
|
DEPLOYMENT_SALTS.DECODER,
|
|
decoderComputedAddr,
|
|
salt,
|
|
decoderBytecode,
|
|
deployerInstance
|
|
);
|
|
} else {
|
|
console.log(
|
|
"decoder is Already deployed with address ",
|
|
decoderComputedAddr
|
|
);
|
|
}
|
|
}
|
|
|
|
main().catch((error) => {
|
|
console.error(error);
|
|
process.exitCode = 1;
|
|
});
|