-
Notifications
You must be signed in to change notification settings - Fork 51
Adopt ERC-5313 by renaming governor
to owner
#2112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 was deleted.
Oops, something went wrong.
This file contains hidden or 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,77 @@ | ||
import { task } from "hardhat/config"; | ||
import { prompt, print } from "gluegun"; | ||
import { Cores, getContracts } from "./utils/contracts"; | ||
import { isAddress } from "viem"; | ||
|
||
const { bold } = print.colors; | ||
|
||
task("change-owner", "Changes the owner for all the contracts") | ||
.addPositionalParam("newOwner", "The address of the new owner") | ||
.addOptionalParam("coreType", "The type of core to use between base, neo, university (default: base)", Cores.BASE) | ||
.setAction(async (taskArgs, hre) => { | ||
const newOwner = taskArgs.newOwner; | ||
if (!isAddress(newOwner)) { | ||
throw new Error("Invalid owner address provided"); | ||
} | ||
print.highlight(`💣 Changing owner to ${bold(newOwner)}`); | ||
|
||
const { confirm } = await prompt.ask({ | ||
type: "confirm", | ||
name: "confirm", | ||
message: "Are you sure you want to proceed?", | ||
}); | ||
if (!confirm) { | ||
console.log("Operation cancelled by user."); | ||
return; | ||
} | ||
|
||
const coreType = Cores[taskArgs.coreType.toUpperCase() as keyof typeof Cores]; | ||
if (coreType === undefined) { | ||
console.error("Invalid core type, must be one of base, neo, university"); | ||
return; | ||
} | ||
console.log("Using core type %s", coreType); | ||
|
||
const { | ||
core, | ||
disputeKitClassic, | ||
disputeResolver, | ||
disputeTemplateRegistry, | ||
policyRegistry, | ||
chainlinkRng, | ||
randomizerRng, | ||
snapshotProxy, | ||
sortition, | ||
evidence, | ||
} = await getContracts(hre, coreType); | ||
|
||
const updateOwner = async (contractName: string, contractInstance: any) => { | ||
print.info(`Changing owner for ${contractName}`); | ||
|
||
const spinner = print.spin(`Executing transaction for ${contractName}...`); | ||
try { | ||
const tx = await contractInstance.changeOwner(newOwner); | ||
await tx.wait(); | ||
spinner.succeed(`Owner changed for ${contractName}, tx hash: ${tx.hash}`); | ||
} catch (error) { | ||
if (error instanceof Error) { | ||
spinner.fail(`Failed to change owner for ${contractName}: ${error.message}`); | ||
} else { | ||
spinner.fail(`Failed to change owner for ${contractName}: ${String(error)}`); | ||
} | ||
} | ||
}; | ||
|
||
await updateOwner("KlerosCore", core); | ||
await updateOwner("DisputeKitClassic", disputeKitClassic); | ||
await updateOwner("DisputeResolver", disputeResolver); | ||
await updateOwner("DisputeTemplateRegistry", disputeTemplateRegistry); | ||
await updateOwner("PolicyRegistry", policyRegistry); | ||
await updateOwner("KlerosCoreSnapshotProxy", snapshotProxy); | ||
await updateOwner("SortitionModule", sortition); | ||
await updateOwner("EvidenceModule", evidence); | ||
if (chainlinkRng) await updateOwner("ChainlinkRNG", chainlinkRng); | ||
if (randomizerRng) await updateOwner("RandomizerRNG", randomizerRng); | ||
|
||
print.success("Owner changed successfully"); | ||
}); | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Repo-wide verification: detect leftover governor APIs.
Run the following to find any stragglers like
changeGovernor
,onlyByGovernor
, orGovernorOnly
still referenced by scripts or contracts.🏁 Script executed:
Length of output: 161
I’ve updated the search to use file globs instead of unsupported
--type=sol
. Please run this to catch any leftover governor-era identifiers:🏁 Script executed:
Length of output: 13931
Regenerate or Exclude Stale ABI Definitions
We’ve confirmed dozens of
changeGovernor
andGovernorOnly
occurrences—but all are coming from the auto-generated viem ABI files undercontracts/deployments/testnet.viem.ts
contracts/deployments/mainnet.viem.ts
These aren’t hand‐written references in your scripts or contracts themselves, but stale ABI definitions. You should either:
contracts/deployments/**
from your grep checks (e.g. add-g '!contracts/deployments/**'
) and optionally remove them from version control if they’re fully generated at build time.Please update accordingly to ensure no leftover governor APIs remain in your committed source.