generated from gnosisguild/zodiac-mod-starter-kit
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: introduce zodiac-core and update dependencies
- Loading branch information
1 parent
b29f5d8
commit 974728f
Showing
18 changed files
with
3,286 additions
and
7,874 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
ETHERSCAN_API_KEY=ABC123ABC123ABC123ABC123ABC123ABC1 | ||
RINKEBY_URL=https://eth-ropsten.alchemyapi.io/v2/<YOUR ALCHEMY KEY> | ||
PRIVATE_KEY=0xabc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc1 | ||
INFURA_KEY= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// SPDX-License-Identifier: LGPL-3.0-only | ||
pragma solidity >=0.8.0; | ||
|
||
import "@gnosis.pm/zodiac/contracts/factory/ModuleProxyFactory.sol"; | ||
import "zodiac-core/contracts/factory/ModuleProxyFactory.sol"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Signer } from "ethers" | ||
import { EIP1193Provider } from "zodiac-core" | ||
import { EthereumProvider } from "hardhat/types" | ||
|
||
export default function createAdapter({ | ||
provider, | ||
signer, | ||
}: { | ||
provider: EthereumProvider | ||
signer: Signer | ||
}): EIP1193Provider { | ||
return { | ||
request: async ({ method, params }) => { | ||
if (method == "eth_sendTransaction") { | ||
const { hash } = await signer.sendTransaction((params as any[])[0]) | ||
return hash | ||
} | ||
|
||
return provider.request({ method, params }) | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { deployMastercopy } from "zodiac-core" | ||
import { DeployFunction } from "hardhat-deploy/types" | ||
import { HardhatRuntimeEnvironment } from "hardhat/types" | ||
import createAdapter from "./createEIP1193" | ||
import "@nomicfoundation/hardhat-ethers" | ||
|
||
const FirstAddress = "0x0000000000000000000000000000000000000001" | ||
const SaltZero = "0x0000000000000000000000000000000000000000000000000000000000000000" | ||
|
||
const deploy: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
const { getNamedAccounts } = hre | ||
const { deployer: deployerAddress } = await getNamedAccounts() | ||
const [signer] = await hre.ethers.getSigners() | ||
const eip1193Provider = createAdapter({ | ||
provider: hre.network.provider, | ||
signer: signer, | ||
}) | ||
const provider = new hre.ethers.BrowserProvider(eip1193Provider) | ||
const deployer = await provider.getSigner(deployerAddress) | ||
const ConnextModule = await hre.ethers.getContractFactory("ConnextModule") | ||
const args = [FirstAddress, FirstAddress, FirstAddress, FirstAddress, 0, FirstAddress] | ||
|
||
const { noop, address } = await deployMastercopy({ | ||
bytecode: ConnextModule.bytecode, | ||
constructorArgs: { | ||
types: ["address", "address", "address", "address", "uint32", "address"], | ||
values: args, | ||
}, | ||
salt: SaltZero, | ||
provider: eip1193Provider, | ||
}) | ||
|
||
if (noop) { | ||
console.log("ConnextModule already deployed to:", address) | ||
} else { | ||
console.log("ConnextModule was deployed to:", address) | ||
} | ||
} | ||
|
||
deploy.tags = ["connect-module"] | ||
export default deploy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { HardhatRuntimeEnvironment } from "hardhat/types"; | ||
import { DeployFunction } from "hardhat-deploy/types"; | ||
import { TASK_ETHERSCAN_VERIFY } from "hardhat-deploy"; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
const { run } = hre; | ||
if (!["sepolia", "mainnet"].includes(hre.network.name)) { | ||
return; | ||
} | ||
|
||
if (!process.env.INFURA_KEY) { | ||
console.log( | ||
`Could not find Infura key in env, unable to connect to network ${hre.network.name}` | ||
); | ||
return; | ||
} | ||
|
||
console.log("Verification of Connext Module in etherscan..."); | ||
console.log("Waiting for 1 minute before verifying contracts..."); | ||
// Etherscan needs some time to process before trying to verify. | ||
await new Promise((resolve) => setTimeout(resolve, 60000)); | ||
|
||
console.log("Starting to verify now"); | ||
|
||
await run(TASK_ETHERSCAN_VERIFY, { | ||
apiKey: process.env.ETHERSCAN_KEY_API, | ||
license: "GPL-3.0", | ||
solcInput: true, | ||
forceLicense: true, // we need this because contracts license is LGPL-3.0-only | ||
}); | ||
}; | ||
export default func; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Signer } from "ethers" | ||
import { task } from "hardhat/config" | ||
import { EthereumProvider } from "hardhat/types" | ||
import "@nomicfoundation/hardhat-ethers" | ||
import { EIP1193Provider, deployMastercopiesFromArtifact } from "zodiac-core" | ||
import createAdapter from "../deploy/createEIP1193" | ||
|
||
task( | ||
"mastercopy:deploy", | ||
"For every version entry on the artifacts file, deploys a mastercopy into the current network", | ||
).setAction(async (_, hre) => { | ||
const [deployer] = await hre.ethers.getSigners() | ||
const eip1193Provider = createAdapter({ | ||
provider: hre.network.provider, | ||
signer: deployer, | ||
}) | ||
const provider = new hre.ethers.BrowserProvider(eip1193Provider) | ||
const signer = await provider.getSigner() | ||
await deployMastercopiesFromArtifact({ | ||
provider: createEIP1193(hre.network.provider, signer), | ||
}) | ||
}) | ||
|
||
function createEIP1193(provider: EthereumProvider, signer: Signer): EIP1193Provider { | ||
return { | ||
request: async ({ method, params }) => { | ||
if (method === "eth_sendTransaction") { | ||
const { hash } = await signer.sendTransaction((params as any[])[0]) | ||
return hash | ||
} | ||
|
||
return provider.request({ method, params }) | ||
}, | ||
} | ||
} |
Oops, something went wrong.