From 3eb8bf5d63f2b680951fad38a1b498ff3a8020ea Mon Sep 17 00:00:00 2001 From: Dimitar Manov <99065541+dimitarmanov@users.noreply.github.com> Date: Wed, 11 Jun 2025 09:28:52 +0300 Subject: [PATCH] test hardhat --- .gitignore | 4 +++- hardhat/.gitignore | 35 ++++++++++++++++++----------------- hardhat/contracts/Greeter.sol | 19 +++++++++++++++++++ hardhat/eth.chainId | 0 hardhat/scripts/deploy.ts | 19 +++++++++++++++++++ 5 files changed, 59 insertions(+), 18 deletions(-) create mode 100644 hardhat/contracts/Greeter.sol create mode 100644 hardhat/eth.chainId create mode 100644 hardhat/scripts/deploy.ts diff --git a/.gitignore b/.gitignore index 269455db7a..ff4ee206ce 100644 --- a/.gitignore +++ b/.gitignore @@ -55,4 +55,6 @@ cmd/ethkey/ethkey cmd/evm/evm cmd/geth/geth cmd/rlpdump/rlpdump -cmd/workload/workload \ No newline at end of file +cmd/workload/workload + +devnet/ \ No newline at end of file diff --git a/hardhat/.gitignore b/hardhat/.gitignore index 29dd748fce..3349e092df 100644 --- a/hardhat/.gitignore +++ b/hardhat/.gitignore @@ -13,23 +13,24 @@ node_modules /coverage /coverage.json +# Hardhat Ignition default folder for deployments against a local node +ignition/deployments/chain-1337/ + +node_modules +.env + +# Hardhat files +/cache +/artifacts + +# TypeChain files +/typechain +/typechain-types + +# solidity-coverage files +/coverage +/coverage.json + # Hardhat Ignition default folder for deployments against a local node ignition/deployments/chain-31337 -node_modules -.env - -# Hardhat files -/cache -/artifacts - -# TypeChain files -/typechain -/typechain-types - -# solidity-coverage files -/coverage -/coverage.json - -# Hardhat Ignition default folder for deployments against a local node -ignition/deployments/chain-31337 diff --git a/hardhat/contracts/Greeter.sol b/hardhat/contracts/Greeter.sol new file mode 100644 index 0000000000..d5135ff58b --- /dev/null +++ b/hardhat/contracts/Greeter.sol @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; + +contract Greeter { + string public greeting; + + constructor(string memory _greeting) { + greeting = _greeting; + } + + function greet() public view returns (string memory) { + return greeting; + } + + function setGreeting(string memory _greeting) public { + greeting = _greeting; + } +} + diff --git a/hardhat/eth.chainId b/hardhat/eth.chainId new file mode 100644 index 0000000000..e69de29bb2 diff --git a/hardhat/scripts/deploy.ts b/hardhat/scripts/deploy.ts new file mode 100644 index 0000000000..37beda2d12 --- /dev/null +++ b/hardhat/scripts/deploy.ts @@ -0,0 +1,19 @@ +import { ethers } from "hardhat"; + +async function main() { + const [deployer] = await ethers.getSigners(); + console.log("Deploying contract with account:", deployer.address); + + const Greeter = await ethers.getContractFactory("Greeter"); + const greeter = await Greeter.deploy("Hello from Geth Devnet!"); + + await greeter.waitForDeployment(); // <-- Ethers v6 method + + console.log("Contract deployed to:", await greeter.getAddress()); +} + +main().catch((error) => { + console.error(error); + process.exitCode = 1; +}); +