6. Verification and Interaction

Verify Contract (if block explorer supports it)

npx hardhat verify --network luntraChain DEPLOYED_CONTRACT_ADDRESS "constructor_argument"

Interact with Deployed Contract

// scripts/interact.js
async function main() {
  const contractAddress = "YOUR_DEPLOYED_CONTRACT_ADDRESS";
  const Lock = await ethers.getContractFactory("Lock");
  const lock = Lock.attach(contractAddress);

  const unlockTime = await lock.unlockTime();
  console.log("Unlock time:", unlockTime.toString());

  const owner = await lock.owner();
  console.log("Owner:", owner);
}

main().catch((error) => {
  console.error(error);
  process.exit(1);
});

Last updated