Contract & Deployment Script
Prepare your contract & deployment script
Deploying Your Smart Contract with Ignition
Paste Your Solidity Contract
Go to contracts and use the one you built in the Solidity lessons, or drop in an example like this:
pragma solidity ^0.8.20; contract MyContract { uint public value; constructor(uint _value) { value = _value; } }
pragma solidity ^0.8.20; contract MyContract { uint public value; constructor(uint _value) { value = _value; } }
Create the Deploy Script
File path: contracts/ignition/modules/myScript.ts
import { ethers } from "hardhat"; async function main() { const [deployer] = await ethers.getSigners(); console.log("Deploying with:", deployer.address); const ContractFactory = await ethers.getContractFactory("MyContract"); const contract = await ContractFactory.deploy(42); console.log("Contract deployed at:", contract.target); } main().catch((error) => { console.error(error); process.exitCode = 1; });
import { ethers } from "hardhat"; async function main() { const [deployer] = await ethers.getSigners(); console.log("Deploying with:", deployer.address); const ContractFactory = await ethers.getContractFactory("MyContract"); const contract = await ContractFactory.deploy(42); console.log("Contract deployed at:", contract.target); } main().catch((error) => { console.error(error); process.exitCode = 1; });
Install Required Packages
npm install @nomicfoundation/hardhat-ignition-ethers npm install @vechain/sdk-hardhat-plugin
npm install @nomicfoundation/hardhat-ignition-ethers npm install @vechain/sdk-hardhat-plugin
Deploying Your Smart Contract with Ignition
Paste Your Solidity Contract
Go to contracts and use the one you built in the Solidity lessons, or drop in an example like this:
pragma solidity ^0.8.20; contract MyContract { uint public value; constructor(uint _value) { value = _value; } }
Create the Deploy Script
File path: contracts/ignition/modules/myScript.ts
import { ethers } from "hardhat"; async function main() { const [deployer] = await ethers.getSigners(); console.log("Deploying with:", deployer.address); const ContractFactory = await ethers.getContractFactory("MyContract"); const contract = await ContractFactory.deploy(42); console.log("Contract deployed at:", contract.target); } main().catch((error) => { console.error(error); process.exitCode = 1; });
Install Required Packages
npm install @nomicfoundation/hardhat-ignition-ethers npm install @vechain/sdk-hardhat-plugin
Join our Telegram