Write Smart Contract
Configure Hardhat to connect with SupraEVM, write a Solidity smart contract, and create a deployment script to automate deployment using Hardhat scripts.
Configure Hardhat to connect with SupraEVM, write a Solidity smart contract, and create a deployment script to automate deployment using Hardhat scripts.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract SimpleStorage {
uint256 public storedData;
function set(uint256 x) public {
storedData = x;
}
function get() public view returns (uint256) {
return storedData;
}
}
const { ethers } = require("hardhat");
async function main() {
const [deployer] = await ethers.getSigners();
console.log("Deploying contracts with the account:", deployer.address);
const SimpleStorage = await ethers.getContractFactory("SimpleStorage");
console.log("Deploying SimpleStorage...");
const simpleStorage = await SimpleStorage.deploy();
// Directly access the target property
console.log("Contract Address from target property:", simpleStorage.target);
}
main().catch((error) => {
console.error("Error:", error);
process.exitCode = 1;
});