-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: compare and upgrade all contracts in batch transaction
- Loading branch information
1 parent
abea2e0
commit 30c5d0e
Showing
3 changed files
with
51 additions
and
24 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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const { ethers, upgrades } = require("hardhat"); | ||
import { artifacts } from "hardhat"; | ||
|
||
export async function getDeployedBytecode(address: string, provider: any) { | ||
const contractImpl = await upgrades.erc1967.getImplementationAddress(address); | ||
const response = await provider.getCode(contractImpl); | ||
return response; | ||
} | ||
|
||
export async function getArtifact(name: string) { | ||
const artifact = await artifacts.readArtifact(name); | ||
return artifact.deployedBytecode; | ||
} | ||
|
||
export async function forceImportDeployedProxies(contractAddress: string, contractName: string) { | ||
const contractArtifact = await ethers.getContractFactory(contractName); | ||
await upgrades.forceImport(contractAddress, contractArtifact, { kind: "transparent" }); | ||
} |
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