@@ -6,7 +6,7 @@ import { changeCurrencyRate } from "./utils/klerosCoreHelper";
66import { HomeChains , isSkipped , isDevnet , PNK , ETH } from "./utils" ;
77import { getContractOrDeploy , getContractOrDeployUpgradable } from "./utils/getContractOrDeploy" ;
88import { deployERC20AndFaucet , deployERC721 } from "./utils/deployTokens" ;
9- import { DisputeKitClassic , KlerosCoreNeo } from "../typechain-types" ;
9+ import { ChainlinkRNG , DisputeKitClassic , KlerosCoreNeo , RandomizerRNG } from "../typechain-types" ;
1010
1111const deployArbitration : DeployFunction = async ( hre : HardhatRuntimeEnvironment ) => {
1212 const { ethers, deployments, getNamedAccounts, getChainId } = hre ;
@@ -29,19 +29,6 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment)
2929
3030 await deployUpgradable ( deployments , "EvidenceModule" , { from : deployer , args : [ deployer ] , log : true } ) ;
3131
32- const randomizerOracle = await getContractOrDeploy ( hre , "RandomizerOracle" , {
33- from : deployer ,
34- contract : "RandomizerMock" ,
35- args : [ ] ,
36- log : true ,
37- } ) ;
38-
39- const rng = await deployUpgradable ( deployments , "RandomizerRNG" , {
40- from : deployer ,
41- args : [ randomizerOracle . target , deployer ] ,
42- log : true ,
43- } ) ;
44-
4532 const disputeKit = await deployUpgradable ( deployments , "DisputeKitClassicNeo" , {
4633 from : deployer ,
4734 contract : "DisputeKitClassic" ,
@@ -58,6 +45,7 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment)
5845 const devnet = isDevnet ( hre . network ) ;
5946 const minStakingTime = devnet ? 180 : 1800 ;
6047 const maxFreezingTime = devnet ? 600 : 1800 ;
48+ const rng = ( await ethers . getContract ( "ChainlinkRNG" ) ) as ChainlinkRNG ;
6149 const maxStakePerJuror = PNK ( 2_000 ) ;
6250 const maxTotalStaked = PNK ( 2_000_000 ) ;
6351 const sortitionModule = await deployUpgradable ( deployments , "SortitionModuleNeo" , {
@@ -67,7 +55,7 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment)
6755 klerosCoreAddress ,
6856 minStakingTime ,
6957 maxFreezingTime ,
70- rng . address ,
58+ rng . target ,
7159 RNG_LOOKAHEAD ,
7260 maxStakePerJuror ,
7361 maxTotalStaked ,
@@ -85,7 +73,7 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment)
8573 deployer ,
8674 deployer ,
8775 pnk . target ,
88- ZeroAddress ,
76+ ZeroAddress , // KlerosCore is configured later
8977 disputeKit . address ,
9078 false ,
9179 [ minStake , alpha , feeForJuror , jurorsForCourtJump ] ,
@@ -97,14 +85,21 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment)
9785 log : true ,
9886 } ) ; // nonce+2 (implementation), nonce+3 (proxy)
9987
100- // execute DisputeKitClassic .changeCore() only if necessary
88+ // disputeKit .changeCore() only if necessary
10189 const disputeKitContract = ( await hre . ethers . getContract ( "DisputeKitClassicNeo" ) ) as DisputeKitClassic ;
10290 const currentCore = await disputeKitContract . core ( ) ;
10391 if ( currentCore !== klerosCore . address ) {
10492 console . log ( `disputeKit.changeCore(${ klerosCore . address } )` ) ;
10593 await disputeKitContract . changeCore ( klerosCore . address ) ;
10694 }
10795
96+ // rng.changeSortitionModule() only if necessary
97+ const rngSortitionModule = await rng . sortitionModule ( ) ;
98+ if ( rngSortitionModule !== sortitionModule . address ) {
99+ console . log ( `rng.changeSortitionModule(${ sortitionModule . address } )` ) ;
100+ await rng . changeSortitionModule ( sortitionModule . address ) ;
101+ }
102+
108103 const core = ( await hre . ethers . getContract ( "KlerosCoreNeo" ) ) as KlerosCoreNeo ;
109104 try {
110105 await changeCurrencyRate ( core , await weth . getAddress ( ) , true , 1 , 1 ) ;
@@ -130,6 +125,7 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment)
130125} ;
131126
132127deployArbitration . tags = [ "ArbitrationNeo" ] ;
128+ deployArbitration . dependencies = [ "ChainlinkRNG" ] ;
133129deployArbitration . skip = async ( { network } ) => {
134130 return isSkipped ( network , ! HomeChains [ network . config . chainId ?? 0 ] ) ;
135131} ;
0 commit comments