@kleros/kleros-v2-contracts
v0.7.0
Published
Smart contracts for Kleros version 2
Downloads
1,554
Keywords
Readme
@kleros/kleros-v2-contracts
Smart contracts for Kleros v2
Deployments
Refresh the list of deployed contracts by running ./scripts/generateDeploymentsMarkdown.sh
or ./scripts/populateReadme.sh
.
V2 Neo (prelaunch)
Arbitrum One
- DisputeKitClassicNeo: proxy, implementation
- DisputeResolverNeo
- DisputeTemplateRegistry: proxy, implementation
- EvidenceModule: proxy, implementation
- KlerosCoreNeo: proxy, implementation
- KlerosV2NeoEarlyUser
- Pinakion
- PolicyRegistry: proxy, implementation
- RandomizerRNG: proxy, implementation
- SortitionModuleNeo: proxy, implementation
- TransactionBatcher
Official Testnet
Arbitrum Sepolia
- BlockHashRNG
- DAI
- DAIFaucet
- DisputeKitClassic: proxy, implementation
- DisputeResolver
- DisputeTemplateRegistry: proxy, implementation
- EvidenceModule: proxy, implementation
- KlerosCore: proxy, implementation
- PNKFaucet
- PinakionV2
- PolicyRegistry: proxy, implementation
- RandomizerRNG: proxy, implementation
- SortitionModule: proxy, implementation
- TransactionBatcher
- WETH
- WETHFaucet
Sepolia
Chiado
- ArbitrableExample
- DisputeResolver
- DisputeTemplateRegistry
- ForeignGatewayOnGnosis
- SortitionSumTreeFactory
- TokenBridge
- WETH
- WETHFaucet
- WPNKFaucet
- WrappedPinakionV2
- xKlerosLiquidV2
Devnet
Arbitrum Sepolia
- ArbitrableExample
- BlockHashRNG
- DAI
- DAIFaucet
- DisputeKitClassic: proxy, implementation
- DisputeKitClassicNeo: proxy, implementation
- DisputeKitClassicUniversity: proxy, implementation
- DisputeResolver
- DisputeResolverNeo
- DisputeResolverRuler
- DisputeResolverUniversity
- DisputeTemplateRegistry: proxy, implementation
- EvidenceModule: proxy, implementation
- KlerosCore: proxy, implementation
- KlerosCoreNeo: proxy, implementation
- KlerosCoreRuler: proxy, implementation
- KlerosCoreUniversity: proxy, implementation
- KlerosV2NeoEarlyUser
- PNKFaucet
- PinakionV2
- PolicyRegistry: proxy, implementation
- RandomizerRNG: proxy, implementation
- SortitionModule: proxy, implementation
- SortitionModuleNeo: proxy, implementation
- SortitionModuleUniversity: proxy, implementation
- TransactionBatcher
- WETH
- WETHFaucet
Sepolia
Chiado
- ArbitrableExample
- DisputeResolver
- DisputeTemplateRegistry
- ForeignGatewayOnGnosis: proxy, implementation
- WETH
- WETHFaucet
- WPNKFaucet
- WrappedPinakionV2
Getting Started
Install the Dependencies
yarn install
Run Tests
yarn test
Compile the Contracts
yarn build
Run Linter on Files
yarn lint
Fix Linter Issues on Files
yarn fix
Deploy Instructions
NOTICE: the commands below work only if you are inside the contracts/
directory.
0. Set the Environment Variables
Copy .env.example
file as .env
and edit it accordingly.
cp .env.example .env
The following env vars are required:
PRIVATE_KEY
: the private key of the deployer account used for the testnets.MAINNET_PRIVATE_KEY
: the private key of the deployer account used for Mainnet.INFURA_API_KEY
: the API key for infura.
The ones below are optional:
ETHERSCAN_API_KEY
: to verify the source of the newly deployed contracts on Etherscan.ARBISCAN_API_KEY
: to verify the source of the newly deployed contracts on Arbitrum.GNOSISSCAN_API_KEY
: to verify the source of the newly deployed contracts on Gnosis chain.
1. Update the Constructor Parameters (optional)
If some of the constructor parameters (such as the Meta Evidence) needs to change, you need to update the files in the deploy/
directory.
2. Deploy to a Local Network
The complete deployment is multi-chain, so a deployment to the local network can only simulate either the Home chain or the Foreign chain.
Shell 1: the node
yarn hardhat node --tags nothing
Shell 2: the deploy script
yarn deploy --network localhost --tags <Arbitration|VeaMock|ForeignGatewayOnEthereum|HomeGateway>
3. Deploy to Public Testnets
# ArbitrumSepolia to Chiado
yarn deploy --network arbitrumSepolia --tags Arbitration
yarn deploy --network arbitrumSepolia --tags HomeArbitrable
yarn deploy --network chiado --tags ForeignGatewayOnGnosis
yarn deploy --network chiado --tags KlerosLiquidOnGnosis
yarn deploy --network chiado --tags ForeignArbitrable
yarn deploy --network arbitrumSepolia --tags HomeGatewayToGnosis
# Sepolia
yarn deploy --network sepolia --tags ForeignGatewayOnEthereum
yarn deploy --network sepolia --tags ForeignArbitrable
yarn deploy --network arbitrumSepolia --tags HomeGatewayToEthereum
The deployed addresses should be displayed to the screen after the deployment is complete. If you missed them, you can always go to the deployments/<network>
directory and look for the respective file.
4. Deploy a Devnet on Public Testnets
Same steps as above but append Devnet
to the --network
parameter.
Running Test Fixtures
Shell 1: the node
yarn hardhat node --tags Arbitration,VeaMock
Shell 2: the test scripts
yarn test --network localhost
4. Verify the Source Code
This must be done for each network separately.
# explorer
yarn etherscan-verify --network <arbitrumSepolia|arbitrum|chiado|gnosischain|sepolia|mainnet>
yarn etherscan-verify-proxies
# sourcify
yarn sourcify --network <arbitrumSepolia|arbitrum|chiado|gnosischain|sepolia|mainnet>
Ad-hoc procedures
Populating the policy registry and courts
The policy registry and courts configuration can be found in config/policies.*.json
and config/courts.*.json
.
1/ Export the registry data from V1
for network in mainnet gnosischain
do
yarn hardhat run scripts/getPoliciesV1.ts --network $network | tee config/policies.v1.$network.json
yarn hardhat run scripts/getCourtsV1.ts --network $network | tee config/courts.v1.$network.json
done
2/ Import the data to V2 - Local Network
Shell 1:
yarn hardhat node --tags Arbitration
Shell 2:
yarn hardhat run scripts/populateCourts.ts --network localhost
yarn hardhat run scripts/populatePolicyRegistry.ts --network localhost
3/ Import the data to V2 - Public Testnet
yarn hardhat run scripts/populateCourts.ts --network arbitrumSepolia
yarn hardhat run scripts/populatePolicyRegistry.ts --network arbitrumSepolia
Generate deployment artifacts for existing contracts
Usage
scripts/generateDeploymentArtifact.sh <network> <address>
Example: WETH on Gnosis chain
scripts/generateDeploymentArtifact.sh gnosischain 0xf8d1677c8a0c961938bf2f9adc3f3cfda759a9d9 > deployments/gnosischain/WETH.json
Push the contracts to a Tenderly project
Ensure that your $TENDERLY_PROJECT
and $TENDERLY_USERNAME
is set correctly in .env
.
yarn tenderly-verify --network sepolia
yarn tenderly-verify --network arbitrumSepolia