@@ -3,10 +3,10 @@ import { DeployFunction } from "hardhat-deploy/types";
33import { getContractAddress } from "./utils/getContractAddress" ;
44import { deployUpgradable } from "./utils/deployUpgradable" ;
55import { changeCurrencyRate } from "./utils/klerosCoreHelper" ;
6- import { HomeChains , isSkipped , isDevnet , isMainnet , PNK , ETH } from "./utils" ;
6+ import { HomeChains , isSkipped , isDevnet , PNK , ETH } from "./utils" ;
77import { getContractOrDeploy , getContractOrDeployUpgradable } from "./utils/getContractOrDeploy" ;
88import { deployERC20AndFaucet } from "./utils/deployTokens" ;
9- import { DisputeKitClassic , KlerosCore , RandomizerRNG } from "../typechain-types" ;
9+ import { ChainlinkRNG , DisputeKitClassic , KlerosCore } from "../typechain-types" ;
1010
1111const deployArbitration : DeployFunction = async ( hre : HardhatRuntimeEnvironment ) => {
1212 const { ethers, deployments, getNamedAccounts, getChainId } = hre ;
@@ -28,30 +28,6 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment)
2828
2929 await getContractOrDeployUpgradable ( hre , "EvidenceModule" , { from : deployer , args : [ deployer ] , log : true } ) ;
3030
31- // Randomizer.ai: https://randomizer.ai/docs#addresses
32- const randomizerOracle = await getContractOrDeploy ( hre , "RandomizerOracle" , {
33- from : deployer ,
34- contract : "RandomizerMock" , // The mock is deployed only on the Hardhat network
35- args : [ ] ,
36- log : true ,
37- } ) ;
38-
39- const randomizerRng = await getContractOrDeploy ( hre , "RandomizerRNG" , {
40- from : deployer ,
41- args : [ deployer , ZeroAddress , randomizerOracle . target ] , // The SortitionModule is configured later
42- log : true ,
43- } ) ;
44-
45- const blockhashRng = await getContractOrDeploy ( hre , "BlockHashRNG" , {
46- from : deployer ,
47- args : [ ] ,
48- log : true ,
49- } ) ;
50-
51- // RNG fallback on Arbitrum Sepolia because the Randomizer.ai oracle contract is unverified and not officially supported.
52- const rng = isMainnet ( hre . network ) ? randomizerRng : blockhashRng ;
53- console . log ( isMainnet ( hre . network ) ? "using RandomizerRNG on mainnet" : "using BlockHashRNG on testnet/devnet" ) ;
54-
5531 const disputeKit = await deployUpgradable ( deployments , "DisputeKitClassic" , {
5632 from : deployer ,
5733 args : [ deployer , ZeroAddress ] ,
@@ -67,6 +43,7 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment)
6743 const devnet = isDevnet ( hre . network ) ;
6844 const minStakingTime = devnet ? 180 : 1800 ;
6945 const maxFreezingTime = devnet ? 600 : 1800 ;
46+ const rng = ( await ethers . getContract ( "ChainlinkRNG" ) ) as ChainlinkRNG ;
7047 const sortitionModule = await deployUpgradable ( deployments , "SortitionModule" , {
7148 from : deployer ,
7249 args : [ deployer , klerosCoreAddress , minStakingTime , maxFreezingTime , rng . target , RNG_LOOKAHEAD ] ,
@@ -103,11 +80,10 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment)
10380 }
10481
10582 // rng.changeSortitionModule() only if necessary
106- const rngContract = ( await ethers . getContract ( "RandomizerRNG" ) ) as RandomizerRNG ;
107- const currentSortitionModule = await rngContract . sortitionModule ( ) ;
108- if ( currentSortitionModule !== sortitionModule . address ) {
83+ const rngSortitionModule = await rng . sortitionModule ( ) ;
84+ if ( rngSortitionModule !== sortitionModule . address ) {
10985 console . log ( `rng.changeSortitionModule(${ sortitionModule . address } )` ) ;
110- await rngContract . changeSortitionModule ( sortitionModule . address ) ;
86+ await rng . changeSortitionModule ( sortitionModule . address ) ;
11187 }
11288
11389 const core = ( await hre . ethers . getContract ( "KlerosCore" ) ) as KlerosCore ;
@@ -121,6 +97,7 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment)
12197} ;
12298
12399deployArbitration . tags = [ "Arbitration" ] ;
100+ deployArbitration . dependencies = [ "ChainlinkRNG" ] ;
124101deployArbitration . skip = async ( { network } ) => {
125102 return isSkipped ( network , ! HomeChains [ network . config . chainId ?? 0 ] ) ;
126103} ;
0 commit comments