From d01fce1ca262b8fbce97cd560382105d655d2bfc Mon Sep 17 00:00:00 2001 From: juliopavila Date: Tue, 27 Aug 2024 16:12:38 -0300 Subject: [PATCH] feat: implement zodiac core package --- .env.example | 2 +- .github/workflows/ci.yml | 2 +- contracts/MyModule.sol | 2 +- deploy/01_mastercopy_module.ts | 4 +-- deploy/03_proxy_module.ts | 12 ++------- deploy/eip1193.ts | 2 +- hardhat.config.ts | 4 +-- package.json | 9 ++++--- yarn.lock | 47 ++++++++++++---------------------- 9 files changed, 32 insertions(+), 52 deletions(-) diff --git a/.env.example b/.env.example index fef0a45..83dc51a 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,3 @@ ETHERSCAN_API_KEY=ABC123ABC123ABC123ABC123ABC123ABC1 -GOERLI_URL=https://eth-goerli.alchemyapi.io/v2/ +SEPOLIA_URL=https://eth-sepolia.alchemyapi.io/v2/ PRIVATE_KEY=0xabc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc1 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c81ddc2..a44d468 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-node@v2 with: - node-version: 18 + node-version: 20 - uses: actions/cache@v2 with: path: "**/node_modules" diff --git a/contracts/MyModule.sol b/contracts/MyModule.sol index c07ceed..2b20708 100644 --- a/contracts/MyModule.sol +++ b/contracts/MyModule.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.7.0 <0.9.0; -import "zodiac-core/contracts/core/Module.sol"; +import "@gnosis-guild/zodiac-core/contracts/core/Module.sol"; contract MyModule is Module { address public button; diff --git a/deploy/01_mastercopy_module.ts b/deploy/01_mastercopy_module.ts index 9c21772..2a93948 100644 --- a/deploy/01_mastercopy_module.ts +++ b/deploy/01_mastercopy_module.ts @@ -1,10 +1,10 @@ import { ZeroHash } from "ethers" import { DeployFunction } from "hardhat-deploy/types" import { HardhatRuntimeEnvironment } from "hardhat/types" -import { deployFactories, deployMastercopy } from "zodiac-core" +import { deployFactories, deployMastercopy } from "@gnosis-guild/zodiac-core" import createAdapter from "./eip1193" -import MODULE_CONTRACT_ARTIFACT from "../artifacts/contracts/MyModule.sol/MyModule.json" +import MODULE_CONTRACT_ARTIFACT from "../build/artifacts/contracts/MyModule.sol/MyModule.json" const FirstAddress = "0x0000000000000000000000000000000000000001" diff --git a/deploy/03_proxy_module.ts b/deploy/03_proxy_module.ts index 1d00d47..13b8d4c 100644 --- a/deploy/03_proxy_module.ts +++ b/deploy/03_proxy_module.ts @@ -1,7 +1,7 @@ import { DeployFunction } from "hardhat-deploy/types" import { HardhatRuntimeEnvironment } from "hardhat/types" -import MODULE_CONTRACT_ARTIFACT from "../artifacts/contracts/MyModule.sol/MyModule.json" +import MODULE_CONTRACT_ARTIFACT from "../build/artifacts/contracts/MyModule.sol/MyModule.json" import createAdapter from "./eip1193" import { deployFactories, deployProxy } from "zodiac-core" @@ -23,15 +23,7 @@ const deploy: DeployFunction = async function ({ provider: network.provider, signer: await ethers.getSigner(deployerAddress), }) - - /// const chainId = await getChainId() - // const network: SupportedNetworks = Number(chainId) - // if ((await ethers.provider.getCode(ContractAddresses[network][KnownContracts.FACTORY])) === "0x") { - // // the Module Factory should already be deployed to all supported chains - // // if you are deploying to a chain where its not deployed yet (most likely locale test chains), run deployModuleFactory from the zodiac package - // throw Error("The Module Factory is not deployed on this network. Please deploy it first.") - // } - + console.log("buttonDeployment.address:", buttonDeployment.address) // Deploys the ModuleFactory (and the Singleton factory) if it is not already deployed diff --git a/deploy/eip1193.ts b/deploy/eip1193.ts index 64daa08..839ffac 100644 --- a/deploy/eip1193.ts +++ b/deploy/eip1193.ts @@ -1,5 +1,5 @@ import { Signer } from "ethers" -import { EIP1193Provider } from "zodiac-core" +import { EIP1193Provider } from "@gnosis-guild/zodiac-core" export default function createAdapter({ provider, diff --git a/hardhat.config.ts b/hardhat.config.ts index 3018a6e..dfc1a53 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -11,8 +11,8 @@ dotenv.config() const config: HardhatUserConfig = { solidity: "0.8.22", networks: { - goerli: { - url: process.env.GOERLI_URL || "", + sepolia: { + url: process.env.SEPOLIA_URL || "", accounts: process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [], }, }, diff --git a/package.json b/package.json index 046396b..a608e0f 100644 --- a/package.json +++ b/package.json @@ -24,11 +24,12 @@ }, "homepage": "https://github.com/gnosis/zodiac-mod-starter-kit", "devDependencies": { + "@gnosis-guild/zodiac-core": "^2.0.1", "@gnosis.pm/safe-contracts": "1.3.0", "@nomicfoundation/hardhat-chai-matchers": "^2.0.7", "@nomicfoundation/hardhat-ethers": "^3.0.6", - "@nomicfoundation/hardhat-ignition-ethers": "^0.15.5", "@nomicfoundation/hardhat-ignition": "^0.15.5", + "@nomicfoundation/hardhat-ignition-ethers": "^0.15.5", "@nomicfoundation/hardhat-network-helpers": "^1.0.11", "@nomicfoundation/hardhat-toolbox": "^5.0.0", "@nomicfoundation/hardhat-verify": "^2.0.9", @@ -40,19 +41,19 @@ "@typescript-eslint/parser": "^7.17.0", "chai": "^4.3.7", "dotenv": "^16.4.5", + "eslint": "^9.8.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-eslint-comments": "^3.2.0", "eslint-plugin-import": "^2.29.1", "eslint-plugin-prettier": "^5.2.1", - "eslint": "^9.8.0", "ethers": "^6.13.2", + "hardhat": "^2.14.0", "hardhat-deploy": "^0.12.0", "hardhat-gas-reporter": "^2.2.0", - "hardhat": "^2.14.0", "prettier": "^3.3.3", "prettier-plugin-solidity": "^1.1.3", - "solhint-plugin-prettier": "0.1.0", "solhint": "5.0.2", + "solhint-plugin-prettier": "0.1.0", "solidity-coverage": "^0.8.12", "ts-node": "^10.9.2", "typechain": "^8.1.1", diff --git a/yarn.lock b/yarn.lock index dbeb305..3bcfdfc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -465,6 +465,17 @@ resolved "https://registry.yarnpkg.com/@fastify/busboy/-/busboy-2.1.1.tgz#b9da6a878a371829a0502c9b6c1c143ef6663f4d" integrity sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA== +"@gnosis-guild/zodiac-core@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@gnosis-guild/zodiac-core/-/zodiac-core-2.0.1.tgz#07226e77e09e2ac8faf2ed21fe1dcb8d18a796bb" + integrity sha512-R3K4DLjkbGdUXy3USLaciQwSJzcFaKcxiua4it8fT84wydN+auRs3DIcHLZdiL5yEWXv5yFPcXoCex8Ecc/SHw== + dependencies: + "@gnosis.pm/safe-contracts" "1.3.0" + "@openzeppelin/contracts" "5.0.2" + "@openzeppelin/contracts-upgradeable" "5.0.2" + ethers "^6.13.2" + semver "^7.6.3" + "@gnosis.pm/safe-contracts@1.3.0": version "1.3.0" resolved "https://registry.yarnpkg.com/@gnosis.pm/safe-contracts/-/safe-contracts-1.3.0.tgz#316741a7690d8751a1f701538cfc9ec80866eedc" @@ -4534,7 +4545,7 @@ semver@^6.3.0, semver@^6.3.1: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== -semver@^7.3.4, semver@^7.3.7, semver@^7.5.2, semver@^7.5.4, semver@^7.6.0: +semver@^7.3.4, semver@^7.3.7, semver@^7.5.2, semver@^7.5.4, semver@^7.6.0, semver@^7.6.3: version "7.6.3" resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143" integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A== @@ -4775,16 +4786,7 @@ string-format@^2.0.0: resolved "https://registry.yarnpkg.com/string-format/-/string-format-2.0.0.tgz#f2df2e7097440d3b65de31b6d40d54c96eaffb9b" integrity sha512-bbEs3scLeYNXLecRRuk6uJxdXUSj6le/8rNPHChIJTn2V79aXVTR1EH2OH5zLKKoz0V02fOUKZZcw01pLUShZA== -"string-width-cjs@npm:string-width@^4.2.0": - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -4837,14 +4839,7 @@ string_decoder@^1.1.1: dependencies: safe-buffer "~5.2.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - -strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -5329,16 +5324,7 @@ workerpool@^6.5.1: resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.5.1.tgz#060f73b39d0caf97c6db64da004cd01b4c099544" integrity sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - -wrap-ansi@^7.0.0: +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -5432,9 +5418,10 @@ zksync-ethers@^5.0.0: ethers "~5.7.0" "zodiac-core@file:../zodiac-core": - version "4.0.3" + version "2.0.0" dependencies: "@gnosis.pm/safe-contracts" "1.3.0" "@openzeppelin/contracts" "5.0.2" "@openzeppelin/contracts-upgradeable" "5.0.2" ethers "^6.13.2" + semver "^7.6.3"