Skip to content

Commit

Permalink
env settings, remove GOERLI config and references
Browse files Browse the repository at this point in the history
  • Loading branch information
mtabasco committed May 16, 2024
1 parent 6827f06 commit 97860c5
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 44 deletions.
4 changes: 1 addition & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
GOERLI_ETH_NODE_URL=
GOERLI_OWNER_PRIVATE_KEY=
HOLESKY_ETH_NODE_URL=
HOLESKY_OWNER_PRIVATE_KEY=
MAINNET_ETH_NODE_URL=
MAINNET_OWNER_PRIVATE_KEY=
GAS_PRICE=
GAS=
ETHERSCAN_KEY=
INFURA_KEY=
NODE_PROVIDER_KEY=
MINIMUM_BLOCKS_BEFORE_LIQUIDATION=100800
MINIMUM_LIQUIDATION_COLLATERAL=200000000
OPERATOR_MAX_FEE_INCREASE=3
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/tests-forked.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ jobs:
runs-on: ubuntu-latest
name: Hardhat unit test (forked network)
env: # Set environment variables for all steps in this job
GH_TOKEN: ${{ secrets.github_token }}
FORK_TESTING_ENABLED: true
GH_TOKEN: ${{ secrets.github_token }}
MAINNET_ETH_NODE_URL: ${{ secrets.mainnet_eth_node_url }}
NODE_PROVIDER_KEY: ${{ secrets.node_provider_key }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
Expand Down
11 changes: 6 additions & 5 deletions docs/local-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@ In [hardhat.config.ts](../hardhat.config.ts) you can find specific configs for d
For example, in `.env` file you can set:

```
GOERLI_ETH_NODE_URL="https://goerli.infura.io/v3/..."
GOERLI_OWNER_PRIVATE_KEY="d79d.."
HOLESKY_ETH_NODE_URL="https://holesky.infura.io/v3/..."
NODE_PROVIDER_KEY="abcd1234..."
HOLESKY_OWNER_PRIVATE_KEY="d79d.."
```

That means Hardhat will pick `config.networks.goerli` section in `hardhat.config.ts` to set the network parameters.
That means Hardhat will pick `config.networks.holesky` section in `hardhat.config.ts` to set the network parameters.

### Start the local node

Expand All @@ -53,7 +54,7 @@ For more details about it and how to use MainNet forking you can find [here](htt

The inital deployment process involves the deployment of all main modules (SSVClusters, SSVOperators, SSVDAO and SSVViews), SSVNetwork and SSVNetworkViews contracts.

Note: The SSV token address used when deploying to live networks (goerli, mainnet) is set in the hardhat config file. To deploy the contracts to a custom network defined in the hardhat config file, leave `SSVTOKEN_ADDRESS` empty in the `.env` file. You can set a specific SSV token address for custom networks too, if needed.
Note: The SSV token address used when deploying to live networks (holesky, mainnet) is set in the hardhat config file. To deploy the contracts to a custom network defined in the hardhat config file, leave `SSVTOKEN_ADDRESS` empty in the `.env` file. You can set a specific SSV token address for custom networks too, if needed.

To run the deployment, execute:

Expand Down Expand Up @@ -120,7 +121,7 @@ contracts/SSVNetwork.sol:SSVNetwork at 0x2279B7...
for verification on the block explorer. Waiting for verification result...

Successfully verified contract SSVNetwork on Etherscan.
https://goerli.etherscan.io/address/0x227...#code
https://holesky.etherscan.io/address/0x227...#code
```

After this action, you can go to the proxy contract in Etherscan and start interacting with it.
Expand Down
12 changes: 6 additions & 6 deletions docs/tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ npm run size-contracts

This project uses hardhat tasks to perform the deployment and upgrade of the main contracts and modules.

Following Hardhat's way of working, you must specify the network against which you want to run the task using the `--network` parameter. In all the following examples, the goerli network will be used, but you can specify any defined in your `hardhat.config` file.
Following Hardhat's way of working, you must specify the network against which you want to run the task using the `--network` parameter. In all the following examples, the holesky network will be used, but you can specify any defined in your `hardhat.config` file.

### Deploy all contracts

Runs the deployment of the main SSVNetwork and SSVNetworkViews contracts, along with their associated modules:

```
npx hardhat --network goerli_testnet deploy:all
npx hardhat --network holesky_testnet deploy:all
```

When deploying to live networks like Goerli or Mainnet, please double check the environment variables:
When deploying to live networks like Holesky or Mainnet, please double check the environment variables:

- MINIMUM_BLOCKS_BEFORE_LIQUIDATION
- MINIMUM_LIQUIDATION_COLLATERAL
Expand Down Expand Up @@ -94,7 +94,7 @@ POSITIONAL ARGUMENTS:
params Function parameters
Example:
npx hardhat --network goerli_testnet upgrade:proxy --proxy-address 0x1234... --contract SSVNetworkV2 --init-function initializev2 param1 param2
npx hardhat --network holesky_testnet upgrade:proxy --proxy-address 0x1234... --contract SSVNetworkV2 --init-function initializev2 param1 param2
```

It is crucial to verify the upgraded contract using its proxy address.
Expand All @@ -118,7 +118,7 @@ OPTIONS:
Example:
Update 'SSVOperators' module contract in the SSVNetwork
npx hardhat --network goerli_testnet update:module --module SSVOperators --attach-module true --proxy-address 0x1234...
npx hardhat --network holesky_testnet update:module --module SSVOperators --attach-module true --proxy-address 0x1234...
```

### Upgrade a library
Expand All @@ -144,7 +144,7 @@ OPTIONS:
--proxy-address Proxy address of SSVNetwork / SSVNetworkViews (default: null)
Example:
npx hardhat --network goerli_testnet upgrade:prepare --proxy-address 0x1234... --contract SSVNetworkViewsV2
npx hardhat --network holesky_testnet upgrade:prepare --proxy-address 0x1234... --contract SSVNetworkViewsV2
```

The task will return the new implementation address. After that, you can run `upgradeTo` or `upgradeToAndCall` in SSVNetwork / SSVNetworkViews proxy address, providing it as a parameter.
27 changes: 3 additions & 24 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,30 +82,9 @@ const config: HardhatUserConfig = {
},
};

if (process.env.GOERLI_ETH_NODE_URL) {
const sharedConfig = {
url: process.env.GOERLI_ETH_NODE_URL,
accounts: [`0x${process.env.GOERLI_OWNER_PRIVATE_KEY}`],
gasPrice: +(process.env.GAS_PRICE || ''),
gas: +(process.env.GAS || ''),
};
//@ts-ignore
config.networks = {
...config.networks,
goerli_development: {
...sharedConfig,
ssvToken: '0x6471F70b932390f527c6403773D082A0Db8e8A9F',
} as SSVNetworkConfig,
goerli_testnet: {
...sharedConfig,
ssvToken: '0x3a9f01091C446bdE031E39ea8354647AFef091E7',
} as SSVNetworkConfig,
};
}

if (process.env.HOLESKY_ETH_NODE_URL) {
const sharedConfig = {
url: process.env.HOLESKY_ETH_NODE_URL,
url: `${process.env.HOLESKY_ETH_NODE_URL}${process.env.NODE_PROVIDER_KEY}`,
accounts: [`0x${process.env.HOLESKY_OWNER_PRIVATE_KEY}`],
gasPrice: +(process.env.GAS_PRICE || ''),
gas: +(process.env.GAS || ''),
Expand All @@ -129,7 +108,7 @@ if (process.env.MAINNET_ETH_NODE_URL) {
config.networks = {
...config.networks,
mainnet: {
url: process.env.MAINNET_ETH_NODE_URL,
url: `${process.env.MAINNET_ETH_NODE_URL}${process.env.NODE_PROVIDER_KEY}`,
accounts: [`0x${process.env.MAINNET_OWNER_PRIVATE_KEY}`],
gasPrice: +(process.env.GAS_PRICE || ''),
gas: +(process.env.GAS || ''),
Expand All @@ -145,7 +124,7 @@ if (process.env.FORK_TESTING_ENABLED) {
...config.networks?.hardhat,
forking: {
enabled: process.env.FORK_TESTING_ENABLED === 'true',
url: process.env.MAINNET_ETH_NODE_URL ? process.env.MAINNET_ETH_NODE_URL : '',
url: `${process.env.MAINNET_ETH_NODE_URL}${process.env.NODE_PROVIDER_KEY}`,
blockNumber: 19621100,
},
},
Expand Down
4 changes: 2 additions & 2 deletions tasks/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ It uses the Hardhat Runtime Environment (HRE) to execute the deployment tasks an
it will be printed to the console, and the process will exit with a non-zero status code.
@example
// Deploy all contracts with the default deployer account
npx hardhat --network goerli_testnet deploy:all
npx hardhat --network holesky_testnet deploy:all
@remarks
The deployer account used will be the first one returned by ethers.getSigners().
Therefore, it should be appropriately configured in your Hardhat network configuration.
Expand Down Expand Up @@ -49,7 +49,7 @@ The contract parameter specifies the name of the contract implementation to be d
it will be printed to the console, and the process will exit with a non-zero status code.
@example
// Deploy SSVNetwork implementation contract with the default deployer account
npx hardhat --network goerli_testnet deploy:main-impl --contract SSVNetwork
npx hardhat --network holesky_testnet deploy:main-impl --contract SSVNetwork
@remarks
The deployer account used will be the first one returned by ethers.getSigners().
Therefore, it should be appropriately configured in your Hardhat network configuration.
Expand Down
2 changes: 1 addition & 1 deletion tasks/update-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The address of the SSVNetwork Proxy is expected to be set in the environment var
@param {string} proxyAddress - The proxy address of the SSVNetwork contract.
@example
// Update 'SSVOperators' module contract in the SSVNetwork
npx hardhat --network goerli_testnet update:module --module SSVOperators
npx hardhat --network holesky_testnet update:module --module SSVOperators
@remarks
The deployer account used will be the first one returned by ethers.getSigners().
Therefore, it should be appropriately configured in your Hardhat network configuration.
Expand Down
4 changes: 2 additions & 2 deletions tasks/upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ If 'initFunction' is not provided, this parameter has no effect.
@returns {void} This function doesn't return anything. After successfully upgrading, it prints the new implementation address to the console.
@example
// Upgrade the SSVNetwork contract to a new version 'SSVNetworkV2', and call a function 'initializev2' with parameters after upgrade:
npx hardhat --network goerli_testnet upgrade:proxy --proxyAddress 0x1234... --contract SSVNetworkV2 --initFunction initializev2 --params param1 param2
npx hardhat --network holesky_testnet upgrade:proxy --proxyAddress 0x1234... --contract SSVNetworkV2 --initFunction initializev2 --params param1 param2
*/
task('upgrade:proxy', 'Upgrade SSVNetwork / SSVNetworkViews proxy via hardhat upgrades plugin')
.addParam('proxyAddress', 'Proxy address of SSVNetwork / SSVNetworkViews', null, types.string)
Expand Down Expand Up @@ -60,7 +60,7 @@ The proxy address and contract name must be provided as parameters.
@param {string} contract - The name of the new implementation contract to deploy for the upgrade.
@example
// Prepare an upgrade for the SSVNetworkViews proxy contract with a new implementation contract named 'SSVNetworkViewsV2'
npx hardhat --network goerli_testnet upgrade:prepare --proxyAddress 0x1234... --contract SSVNetworkViewsV2
npx hardhat --network holesky_testnet upgrade:prepare --proxyAddress 0x1234... --contract SSVNetworkViewsV2
@remarks
The deployer account used will be the first one returned by ethers.getSigners().
Therefore, it should be appropriately configured in your Hardhat network configuration.
Expand Down

0 comments on commit 97860c5

Please sign in to comment.