-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include tasks for store, deploy and verify mastercopies
- Loading branch information
1 parent
24d9413
commit d9c4d39
Showing
5 changed files
with
99 additions
and
3 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
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,31 @@ | ||
import { Signer } from "ethers"; | ||
import { task } from "hardhat/config"; | ||
import { EthereumProvider } from "hardhat/types"; | ||
|
||
import { EIP1193Provider, deployMastercopiesFromArtifact } from "zodiac-core"; | ||
|
||
task( | ||
"mastercopies:deploy", | ||
"For every version entry on the artifacts file, deploys a mastercopy into the current network" | ||
).setAction(async (_, hre) => { | ||
const [signer] = await hre.ethers.getSigners(); | ||
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 }); | ||
}, | ||
}; | ||
} |
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,38 @@ | ||
import { task } from "hardhat/config"; | ||
|
||
import { storeMastercopyArtifact } from "zodiac-core"; | ||
|
||
import packageJson from "../package.json"; | ||
|
||
const AddressOne = "0x0000000000000000000000000000000000000001"; | ||
|
||
task( | ||
"extract-current", | ||
"Extracts and persists current mastercopy build artifacts" | ||
).setAction(async (_, hre) => { | ||
storeMastercopyArtifact({ | ||
contractVersion: packageJson.version, | ||
contractName: "ExitERC20", | ||
compilerInput: await hre.run("verify:etherscan-get-minimal-input", { | ||
sourceName: "contracts/ExitModule/ExitERC20Module.sol", | ||
}), | ||
constructorArgs: { | ||
types: ["address", "address", "address", "address", "address"], | ||
values: [AddressOne, AddressOne, AddressOne, AddressOne, AddressOne], | ||
}, | ||
salt: "0x0000000000000000000000000000000000000000000000000000000000000000", | ||
}); | ||
|
||
storeMastercopyArtifact({ | ||
contractVersion: packageJson.version, | ||
contractName: "ExitERC721", | ||
compilerInput: await hre.run("verify:etherscan-get-minimal-input", { | ||
sourceName: "contracts/ExitModule/ExitERC721Module.sol", | ||
}), | ||
constructorArgs: { | ||
types: ["address", "address", "address", "address", "address"], | ||
values: [AddressOne, AddressOne, AddressOne, AddressOne, AddressOne], | ||
}, | ||
salt: "0x0000000000000000000000000000000000000000000000000000000000000000", | ||
}); | ||
}); |
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,18 @@ | ||
import { task } from "hardhat/config"; | ||
import { verifyMastercopiesFromArtifact } from "zodiac-core"; | ||
|
||
const { ETHERSCAN_API_KEY } = process.env; | ||
|
||
task( | ||
"mastercopies:verify", | ||
"Verifies all mastercopies from the artifacts file, in the block explorer corresponding to the current network" | ||
).setAction(async (_, hre) => { | ||
if (!ETHERSCAN_API_KEY) { | ||
throw new Error("Missing ENV ETHERSCAN_API_KEY"); | ||
} | ||
|
||
await verifyMastercopiesFromArtifact({ | ||
apiUrl: String((await hre.ethers.provider.getNetwork()).chainId), | ||
apiKey: ETHERSCAN_API_KEY, | ||
}); | ||
}); |