mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 14:16:44 +00:00
test hardhat
This commit is contained in:
parent
c1ecf8fbd6
commit
3eb8bf5d63
5 changed files with 59 additions and 18 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
|
@ -55,4 +55,6 @@ cmd/ethkey/ethkey
|
||||||
cmd/evm/evm
|
cmd/evm/evm
|
||||||
cmd/geth/geth
|
cmd/geth/geth
|
||||||
cmd/rlpdump/rlpdump
|
cmd/rlpdump/rlpdump
|
||||||
cmd/workload/workload
|
cmd/workload/workload
|
||||||
|
|
||||||
|
devnet/
|
||||||
35
hardhat/.gitignore
vendored
35
hardhat/.gitignore
vendored
|
|
@ -13,23 +13,24 @@ node_modules
|
||||||
/coverage
|
/coverage
|
||||||
/coverage.json
|
/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
|
# Hardhat Ignition default folder for deployments against a local node
|
||||||
ignition/deployments/chain-31337
|
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
|
|
||||||
|
|
|
||||||
19
hardhat/contracts/Greeter.sol
Normal file
19
hardhat/contracts/Greeter.sol
Normal file
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
0
hardhat/eth.chainId
Normal file
0
hardhat/eth.chainId
Normal file
19
hardhat/scripts/deploy.ts
Normal file
19
hardhat/scripts/deploy.ts
Normal file
|
|
@ -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;
|
||||||
|
});
|
||||||
|
|
||||||
Loading…
Reference in a new issue