-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
558 additions
and
369 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { ethers } from "hardhat"; | ||
// import currency from "currency.js" | ||
|
||
// const gasPrice = ethers.parseUnits("60", "gwei") | ||
// const etherPrice = currency(2600) | ||
|
||
// Assuming you have an async function where you deploy the contract | ||
async function main() { | ||
const [deployer] = await ethers.getSigners(); | ||
|
||
console.log("Deploying contracts with the account:", deployer.address); | ||
|
||
// Assuming `YourContract` is the contract you want to deploy | ||
const YourContract = await ethers.getContractFactory("AIMeFactory"); | ||
const yourContract = await YourContract.deploy(); // Add constructor arguments if any | ||
|
||
await yourContract.deployed(); | ||
|
||
console.log("YourContract deployed to:", yourContract.address); | ||
|
||
// Get the transaction receipt | ||
const transactionReceipt = await ethers.provider.getTransactionReceipt(yourContract.deployTransaction.hash); | ||
|
||
console.log("Gas used for deployment:", transactionReceipt.gasUsed.toString()); | ||
const gasPrice = 130; // gwei | ||
const gasCost = gasPrice * Number(transactionReceipt.gasUsed); | ||
const gasCostInEth = ethers.utils.formatUnits(gasCost.toString(), 'gwei'); | ||
console.log("Gas cost for deployment:", gasCostInEth, "ETH"); | ||
} | ||
|
||
main() | ||
.then(() => process.exit(0)) | ||
.catch((error) => { | ||
console.error(error); | ||
process.exit(1); | ||
}); |
Oops, something went wrong.