Skip to content

Commit

Permalink
chore: Add ZKSync and Hardhat contracts package to monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
bigint committed Mar 2, 2025
1 parent 3e7901e commit 98ff64b
Show file tree
Hide file tree
Showing 7 changed files with 5,114 additions and 94 deletions.
1 change: 1 addition & 0 deletions packages/contracts/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PRIVATE_KEY=""
4 changes: 4 additions & 0 deletions packages/contracts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cache-zk/
artifacts-zk/
typechain-types/
deployments-zk/
19 changes: 19 additions & 0 deletions packages/contracts/deploy/heypro.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Deployer } from "@matterlabs/hardhat-zksync";
import type { HardhatRuntimeEnvironment } from "hardhat/types";
import { Wallet } from "zksync-ethers";

export default async function (hre: HardhatRuntimeEnvironment) {
try {
// Initialize the wallet.
const wallet = new Wallet(process.env.PRIVATE_KEY as string);
const deployer = new Deployer(hre, wallet as any);
const artifact = await deployer.loadArtifact("HeyPro");
const heyProContract = await deployer.deploy(artifact);
console.log(
`${artifact.contractName} was deployed to ${await heyProContract.getAddress()}`
);
} catch (error) {
console.error("Error in deployment:", error);
process.exit(1);
}
}
24 changes: 24 additions & 0 deletions packages/contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
require("dotenv").config();
import "@matterlabs/hardhat-zksync";
import "@nomicfoundation/hardhat-toolbox";
import type { HardhatUserConfig } from "hardhat/config";

const config: HardhatUserConfig = {
solidity: "0.8.28",
zksolc: { version: "latest", settings: {} },
defaultNetwork: "lensSepoliaTestnet",
networks: {
lensSepoliaTestnet: {
accounts: [process.env.PRIVATE_KEY as string],
url: "https://rpc.testnet.lens.dev",
chainId: 37111,
zksync: true,
ethNetwork: "sepolia",
verifyURL:
"https://api-explorer-verify.staging.lens.zksync.dev/contract_verification"
},
hardhat: { zksync: true }
}
};

export default config;
22 changes: 22 additions & 0 deletions packages/contracts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "@hey/contracts",
"version": "0.0.0",
"private": true,
"license": "AGPL-3.0",
"scripts": {
"compile": "hardhat compile",
"typecheck": "tsc --pretty"
},
"devDependencies": {
"@hey/config": "workspace:*",
"@matterlabs/hardhat-zksync": "^1.4.0",
"@matterlabs/zksync-contracts": "1.0.0-beta.4",
"@nomicfoundation/hardhat-toolbox": "^5.0.0",
"@nomiclabs/hardhat-ethers": "^2.2.3",
"@openzeppelin/contracts": "^5.1.0",
"dotenv": "^16.4.7",
"hardhat": "^2.22.15",
"typescript": "^5.6.3",
"zksync-ethers": "^6.16.1"
}
}
7 changes: 7 additions & 0 deletions packages/contracts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "@hey/config/base.tsconfig.json",
"compilerOptions": {
"module": "CommonJS"
},
"exclude": ["typechain-types"]
}
Loading

0 comments on commit 98ff64b

Please sign in to comment.