-
Notifications
You must be signed in to change notification settings - Fork 0
Resolves AP-638, AP-784: Update setStratParams
to run both on Polygon (main Registrar) and strategy's network (LocalRegistrar)"
#375
Conversation
…trategy's network (LocalRegistrar)
AP-638 Implement shell script for updating cross-chain strat params
When a strat param is updated we need to:
|
} | ||
); | ||
|
||
hre.changeNetwork = lazyFunction( |
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.
Changing Hardhat network during runtime is currently not possible, but is in the works. In the meantime, added this extension to our hardhat runtime that enables us to achieve this.
@@ -0,0 +1,56 @@ | |||
/** | |||
* @author misicnenad | |||
* @description created based on unmaintained repo https://www.npmjs.com/package/hardhat-change-network |
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.
The linked repo is unmaintained and had some issues with our version of hardhat.
Just copy/pasted the code and fixed the issues
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's awesome man.
This "context switching" assumes that the hardhat accounts are the same for each network, yes? Might be good to make that explicit though I suppose our env config mostly enforces that anyway. This is irrelevant in cases where we're executing calls with a pkey
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.
When we make this repo public, consider linking it in the issue! Some people might be interested in using this in the meantime :) Get those gh stars!
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's awesome man.
This "context switching" assumes that the hardhat accounts are the same for each network, yes? Might be good to make that explicit though I suppose our env config mostly enforces that anyway. This is irrelevant in cases where we're executing calls with a pkey
The function is reading Hardhat's config for the target network (the one being switched to), so any accounts configured on said network should be there.
What's really being changed here are just the provider (create one connecting to the target network) and the network metadata.
@@ -1,3 +1,12 @@ | |||
export enum ChainID { |
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.
Makes it easier to associate network name with chain ID + improves type-safety a bit
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.
Love this
@@ -56,9 +59,72 @@ const stringArray: CLIArgumentType<Array<string>> = { | |||
}, | |||
}; | |||
|
|||
function enums<T extends {[key in string]: string | number}>( |
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.
We can use this to validate types of other task params that should be cast to enums (see https://linear.app/angel-protocol/issue/AP-779/create-custom-task-argument-types-where-applicable)
setStratParams
to run both on Polygon (main Registrar) and strategy's network (LocalRegistrar)"setStratParams
to run both on Polygon (main Registrar) and strategy's network (LocalRegistrar)"
setStratParams
to run both on Polygon (main Registrar) and strategy's network (LocalRegistrar)"setStratParams
to run both on Polygon (main Registrar) and strategy's network (LocalRegistrar)"
setStratParams
to run both on Polygon (main Registrar) and strategy's network (LocalRegistrar)"setStratParams
to run both on Polygon (main Registrar) and strategy's network (LocalRegistrar)"
setStratParams
to run both on Polygon (main Registrar) and strategy's network (LocalRegistrar)"setStratParams
to run both on Polygon (main Registrar) and strategy's network (LocalRegistrar)"
AP-784 Investigate how to estimate Tx gas data while respecting DRY principle
Context: #371 (comment) An example where this is needed: Possible resources:
|
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.
Left a couple comments but this looks so cool man. Great work extending hardhat!
@@ -0,0 +1,56 @@ | |||
/** | |||
* @author misicnenad | |||
* @description created based on unmaintained repo https://www.npmjs.com/package/hardhat-change-network |
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's awesome man.
This "context switching" assumes that the hardhat accounts are the same for each network, yes? Might be good to make that explicit though I suppose our env config mostly enforces that anyway. This is irrelevant in cases where we're executing calls with a pkey
@@ -1,3 +1,12 @@ | |||
export enum ChainID { |
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.
Love this
Explanation of the solution
Instructions on making this work
yarn
oryarn install
to install npm dependencies