This repository has been archived by the owner on Oct 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Fix issues with deploy:Registrar
and deploy:AngelProtocol
#215
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
584950a
Fix deployRegistrar > update index fund registrar instead of owner (e…
0xNeshi 375646d
Add updateRegistrar function to GasFwdFactory
0xNeshi 73ea8ef
Set proxyAdmin as the GasFwdFactory admin
0xNeshi ef19440
Make all fields public
0xNeshi 401eb64
Add manage:GasFwdFactory:updateRegistrar script
0xNeshi 08ea893
Update GasFwdFactory registrar address in deployRegistrar
0xNeshi 54dc485
Fix updateNetworkConnections script to use enum NetworkConnectionActi…
0xNeshi 4539e3e
Fix address used to connect to GasFwdFactory in manage:GasFwdFactory:…
0xNeshi 285fdfe
Remove deployer from deployGasFwd
0xNeshi 70bf155
Fix deploy:GasFwd non-existent param
0xNeshi 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 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
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
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 @@ | ||
import "./updateRegistrar"; |
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,48 @@ | ||
import {task} from "hardhat/config"; | ||
import {GasFwdFactory__factory} from "typechain-types"; | ||
import {confirmAction, getAddresses, getSigners, logger} from "utils"; | ||
|
||
type TaskArgs = {newRegistrar: string; yes: boolean}; | ||
|
||
task( | ||
"manage:GasFwdFactory:updateRegistrar", | ||
"Will update the registrar address of the GasFwdFactory" | ||
) | ||
.addOptionalParam( | ||
"newRegistrar", | ||
"Address of the new registrar. Will default to `contract-address.json > registrar.proxy` if none is provided." | ||
) | ||
.addFlag("yes", "Automatic yes to prompt.") | ||
.setAction(async (taskArgs: TaskArgs, hre) => { | ||
try { | ||
logger.divider(); | ||
const addresses = await getAddresses(hre); | ||
const {proxyAdmin} = await getSigners(hre); | ||
|
||
const newRegistrar = taskArgs.newRegistrar || addresses.registrar.proxy; | ||
|
||
logger.out("Querying current GasFwdFactory registrar..."); | ||
const gasFwdFactory = GasFwdFactory__factory.connect(addresses.gasFwd.factory, proxyAdmin); | ||
const curRegistrar = await gasFwdFactory.registrar(); | ||
if (curRegistrar === newRegistrar) { | ||
return logger.out(`"${newRegistrar}" is already set as the registrar address.`); | ||
} | ||
logger.out(`Current registrar: ${curRegistrar}`); | ||
|
||
const isConfirmed = | ||
taskArgs.yes || (await confirmAction(`Update Registrar address to: ${newRegistrar}`)); | ||
if (!isConfirmed) { | ||
return logger.out("Confirmation denied.", logger.Level.Warn); | ||
} | ||
|
||
logger.out(`Updating Registrar address to: ${newRegistrar}...`); | ||
const tx = await gasFwdFactory.updateRegistrar(newRegistrar); | ||
logger.out(`Tx hash: ${tx.hash}`); | ||
await tx.wait(); | ||
|
||
const updatedRegistrar = await gasFwdFactory.registrar(); | ||
logger.out(`New registrar: ${updatedRegistrar}`); | ||
} catch (error) { | ||
logger.out(error, logger.Level.Error); | ||
} | ||
}); |
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 +1,2 @@ | ||
import "./updateOwner"; | ||
import "./updateRegistrar"; |
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,54 @@ | ||
import {task} from "hardhat/config"; | ||
import {APTeamMultiSig__factory, IndexFund__factory} from "typechain-types"; | ||
import {confirmAction, getAddresses, getSigners, logger} from "utils"; | ||
|
||
type TaskArgs = {newRegistrar: string; yes: boolean}; | ||
|
||
task("manage:IndexFund:updateRegistrar", "Will update the registrar address of the IndexFund") | ||
.addOptionalParam( | ||
"newRegistrar", | ||
"Address of the new registrar. Will default to `contract-address.json > registrar.proxy` if none is provided." | ||
) | ||
.addFlag("yes", "Automatic yes to prompt.") | ||
.setAction(async (taskArgs: TaskArgs, hre) => { | ||
try { | ||
logger.divider(); | ||
const addresses = await getAddresses(hre); | ||
const {apTeamMultisigOwners} = await getSigners(hre); | ||
|
||
const newRegistrar = taskArgs.newRegistrar || addresses.registrar.proxy; | ||
|
||
logger.out("Querying current IndexFund registrar..."); | ||
const indexFund = IndexFund__factory.connect( | ||
addresses.indexFund.proxy, | ||
apTeamMultisigOwners[0] | ||
); | ||
const curRegistrar = (await indexFund.queryConfig()).registrarContract; | ||
if (curRegistrar === newRegistrar) { | ||
return logger.out(`"${newRegistrar}" is already set as the registrar address.`); | ||
} | ||
logger.out(`Current registrar: ${curRegistrar}`); | ||
|
||
const isConfirmed = | ||
taskArgs.yes || (await confirmAction(`Update Registrar address to: ${newRegistrar}`)); | ||
if (!isConfirmed) { | ||
return logger.out("Confirmation denied.", logger.Level.Warn); | ||
} | ||
|
||
logger.out(`Updating Registrar address to: ${newRegistrar}...`); | ||
const curOwner = (await indexFund.queryConfig()).owner; | ||
const apTeamMultiSig = APTeamMultiSig__factory.connect( | ||
curOwner, // ensure connection to current owning APTeamMultiSig contract | ||
apTeamMultisigOwners[0] | ||
); | ||
const data = indexFund.interface.encodeFunctionData("updateRegistrar", [newRegistrar]); | ||
const tx = await apTeamMultiSig.submitTransaction(indexFund.address, 0, data, "0x"); | ||
logger.out(`Tx hash: ${tx.hash}`); | ||
await tx.wait(); | ||
|
||
const updatedOwner = (await indexFund.queryConfig()).registrarContract; | ||
logger.out(`New registrar: ${updatedOwner}`); | ||
} catch (error) { | ||
logger.out(error, logger.Level.Error); | ||
} | ||
}); |
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
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.
Isn't this a
type
not aconstant
?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.
Enums in TS are actually objects (like many things in JS/TS it's confusing, I know).
https://www.typescriptlang.org/docs/handbook/enums.html#enums-at-runtime
Since we have many enums we need to create, we can store them in a separate
enums.ts
file?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.
That sounds like a good idea! Thanks for the info