This repository contains a SSVRegistry and SSVNetwork smart contacts project.
The first things you need to do are cloning this repository and installing its dependencies:
git clone [email protected]:bloxapp/ssv-network.git
cd ssv-network
npm install
Once installed, to run Hardhat's testing network:
npx hardhat node
For more details about it and how to use MainNet forking you can find here.
Take a look at contracts/
folder, you should be able to find SSVNetwork.sol
, SSVNetworkV2.sol
as simple contract example.
To compile it, simply run:
npx hardhat compile
Take a look at test/
folder, you should be able to find tests related to specific actions.
It comes with tests that use Waffle and Ethers.js.
To run tests, run:
npx hardhat test
We use Proxy Upgrade pattern for smart contracts to have an ability to upgrade them later.
To deploy the contract we will use a Hardhat script. Inside scripts/
you will find ssv-registry-deploy.ts
and ssv-network-deploy.ts
files.
As general rule, you can target any network configured in the hardhat.config.ts
npx hardhat run --network <your-network> scripts/ssv-registry-deploy.ts
Output of this action will be smart SSV Registry contract proxy address.
Before run the cli command, in .env
need to add the following seetings:
SSVREGISTRY_ADDRESS=#SSV Registry contract address
SSVTOKEN_ADDRESS=#SSV Token contract address
After that:
npx hardhat run --network <your-network> scripts/ssv-network-deploy.ts
Output of this action will be smart SSV Network contract proxy address.
Open .openzeppelin/<network>.json
file and find [impls.<hash>.address]
value which is implementation smart contract address.
We use Proxy Upgrade pattern for smart contracts to have an ability to upgrade them later.
To deploy the contract we will use a Hardhat script. Inside scripts/
you will find deploy.ts
file.
Run this:
npx hardhat verify --network <network> <implementation-address>
Go to https://<network>.etherscan.io/address/<proxy-address>
and click on Contract
tab.
On a right side click More Options
dropbox and select Is this a proxy?
. On a verification page enter proxy address inside field and click Verify
button. As result you will see the message:
The proxy contract verification completed with the message:
The proxy\'s (<proxy-address) implementation contract is found at: <implementation-address>
To be sure that values are correct and click Save
button. As result on etherscan proxy address page in Contract
tab you will find two new buttons:
Write as Proxy
and Read as Proxy
which will represent implementation smart contract functions interface and the actual state.
Once we have tested our new implementation, for example contracts/SSVNetwork.sol
we can prepare the upgrade.
This will validate and deploy our new implementation contract.
PROXY_ADDRESS=0x... npx hardhat run --network <network> scripts/ssv-registry-upgrade.ts
PROXY_ADDRESS=0x... npx hardhat run --network <network> scripts/ssv-network-upgrade.ts
https://eth95.dev/?network=1&address=0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0
UI dApp direct link
You can find detailed instructions on using this repository and many tips in its documentation. For a complete introduction to Hardhat, refer to this guide.
Your environment will have everything you need to build a Dapp powered by Hardhat and React.
- Hardhat: An Ethereum development task runner and testing network.
- Mocha: A JavaScript test runner.
- Chai: A JavaScript assertion library.
- ethers.js: A JavaScript library for interacting with Ethereum.
- Waffle: To have Ethereum-specific Chai assertions/mathers.
Full audit report CoinFabrik Report
Invalid nonce
errors: if you are seeing this error on thenpx hardhat node
console, try resetting your Metamask account. This will reset the account's transaction history and also the nonce. Open Metamask, click on your account followed bySettings > Advanced > Reset Account
.