Intro | Architecture | Setup | Tasks | Local development | Roles | Publish | Operator owners
You can deploy and run these contracts in a local node like Hardhat's, Ganache, or public testnets. This guide will cover the process.
Run Setup
Execute the steps to set up all tools needed.
Copy .env.example to .env and edit to suit.
[NETWORK]_ETH_NODE_URLRPC URL of the node[NETWORK]_OWNER_PRIVATE_KEYPrivate key of the deployer account, without 0x prefixGAS_PRICEExample 30000000000GASExample 8000000ETHERSCAN_KEYEtherescan API key to verify deployed contractsSSV_TOKEN_ADDRESSSSV Token contract address to be used in custom networks. Keep it empty to deploy a mocked SSV token.MINIMUM_BLOCKS_BEFORE_LIQUIDATIONA number of blocks before the cluster enters into a liquidatable state. Example: 214800 = 30 daysOPERATOR_MAX_FEE_INCREASEThe fee increase limit in percentage with this format: 100% = 10000, 10% = 1000 - using 10000 to represent 2 digit precisionDECLARE_OPERATOR_FEE_PERIODThe period in which an operator can declare a fee change (seconds)EXECUTE_OPERATOR_FEE_PERIODThe period in which an operator fee change can be executed (seconds)VALIDATORS_PER_OPERATOR_LIMITThe number of validators an operator can manageMINIMUM_LIQUIDATION_COLLATERALThe lowest number in wei a cluster can have before its liquidatable
In hardhat.config.ts you can find specific configs for different networks, that are taken into account only when the [NETWORK]_ETH_NODE_URL parameter in .env file is set.
For example, in .env file you can set:
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.holesky section in hardhat.config.ts to set the network parameters.
To run the local node, execute the command in a separate terminal.
npx hardhat nodeFor more details about it and how to use MainNet forking you can find here.
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 (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:
npx hardhat --network <network> deploy:allOutput of this action will be:
Deploying contracts with the account:0xf39...
SSVOperators module deployed to: 0x5Fb...
SSVClsuters module deployed to: 0xe7f1...
SSVDAO module deployed to: 0x9fE4...
SSVViews module deployed to: 0xCf7E...
Deploying SSVNetwork with ssvToken 0x3a9f...
SSVNetwork proxy deployed to: 0x5FC8...
SSVNetwork implementation deployed to: 0xDc64...
Deploying SSVNetworkViews with SSVNetwork 0x5FC8...
SSVNetworkViews proxy deployed to: 0xa513...
SSVNetworkViews implementation deployed to: 0x0165...As general rule, you can target any network configured in the hardhat.config.ts, specifying the right [network]_ETH_NODE_URL and [network]_OWNER_PRIVATE_KEY in .env file.
You can now go to Etherscan and see:
SSVNetworkproxy contract is deployed to the address shown previously inSSVNetwork proxy deployed toSSVNetworkimplementation contract is deployed to the address shown previously inSSVNetwork implementation deployed toSSVNetworkViewsproxy contract is deployed to the address shown previously inSSVNetworkViews proxy deployed toSSVNetworkViewsimplementation contract is deployed to the address shown previously inSSVNetworkViews implementation deployed to
Open .openzeppelin/<network>.json file and find [impls.<hash>.address] value which is the implementation smart contract address.
You will find 2 [impls.<hash>] entries, one for SSVNetwork and another for SSVNetworkViews.
Run this verification process for both.
You can take it from the output of the npx hardhat --network <network> deploy:all command.
To verify a proxy contract (SSVNetwork, SSVNetworkViews), run this:
npx hardhat verify --network <network> <proxy-address>By verifying a contract using its proxy address, the verification process for both the proxy and the implementation contracts is conducted seamlessly. The proxy contract is automatically linked to the implementation contract. As a result, users will be able to view interfaces of both the proxy and the implementation contracts on the Etherscan website's contract page, ensuring comprehensive visibility and transparency.
To verify a module contract (SSVClusters, SSVOperators, SSVDAO, SSVViews), run this:
npx hardhat verify --network <network> <implementation-address>Output of this action will be:
Nothing to compile
No need to generate any newer typings.
Successfully submitted source code for contract
contracts/SSVNetwork.sol:SSVNetwork at 0x2279B7...
for verification on the block explorer. Waiting for verification result...
Successfully verified contract SSVNetwork on Etherscan.
https://holesky.etherscan.io/address/0x227...#codeAfter this action, you can go to the proxy contract in Etherscan and start interacting with it.
- Error: no such file or directory, open ‘…/artifacts/build-info/XXXX...XXXX.json’
This issue can be resolved by executing the following commands.
npx hardhat clean
npx hardhat compile