@@ -3,10 +3,10 @@ import { DeployFunction } from "hardhat-deploy/types";
3
3
import { getContractAddress } from "./utils/getContractAddress" ;
4
4
import { deployUpgradable } from "./utils/deployUpgradable" ;
5
5
import { changeCurrencyRate } from "./utils/klerosCoreHelper" ;
6
- import { HomeChains , isSkipped , isDevnet , isMainnet , PNK , ETH } from "./utils" ;
6
+ import { HomeChains , isSkipped , isDevnet , PNK , ETH } from "./utils" ;
7
7
import { getContractOrDeploy , getContractOrDeployUpgradable } from "./utils/getContractOrDeploy" ;
8
8
import { deployERC20AndFaucet } from "./utils/deployTokens" ;
9
- import { DisputeKitClassic , KlerosCore , RandomizerRNG } from "../typechain-types" ;
9
+ import { ChainlinkRNG , DisputeKitClassic , KlerosCore } from "../typechain-types" ;
10
10
11
11
const deployArbitration : DeployFunction = async ( hre : HardhatRuntimeEnvironment ) => {
12
12
const { ethers, deployments, getNamedAccounts, getChainId } = hre ;
@@ -28,30 +28,6 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment)
28
28
29
29
await getContractOrDeployUpgradable ( hre , "EvidenceModule" , { from : deployer , args : [ deployer ] , log : true } ) ;
30
30
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
-
55
31
const disputeKit = await deployUpgradable ( deployments , "DisputeKitClassic" , {
56
32
from : deployer ,
57
33
args : [ deployer , ZeroAddress ] ,
@@ -67,6 +43,7 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment)
67
43
const devnet = isDevnet ( hre . network ) ;
68
44
const minStakingTime = devnet ? 180 : 1800 ;
69
45
const maxFreezingTime = devnet ? 600 : 1800 ;
46
+ const rng = ( await ethers . getContract ( "ChainlinkRNG" ) ) as ChainlinkRNG ;
70
47
const sortitionModule = await deployUpgradable ( deployments , "SortitionModule" , {
71
48
from : deployer ,
72
49
args : [ deployer , klerosCoreAddress , minStakingTime , maxFreezingTime , rng . target , RNG_LOOKAHEAD ] ,
@@ -103,11 +80,10 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment)
103
80
}
104
81
105
82
// 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 ) {
109
85
console . log ( `rng.changeSortitionModule(${ sortitionModule . address } )` ) ;
110
- await rngContract . changeSortitionModule ( sortitionModule . address ) ;
86
+ await rng . changeSortitionModule ( sortitionModule . address ) ;
111
87
}
112
88
113
89
const core = ( await hre . ethers . getContract ( "KlerosCore" ) ) as KlerosCore ;
@@ -121,6 +97,7 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment)
121
97
} ;
122
98
123
99
deployArbitration . tags = [ "Arbitration" ] ;
100
+ deployArbitration . dependencies = [ "ChainlinkRNG" ] ;
124
101
deployArbitration . skip = async ( { network } ) => {
125
102
return isSkipped ( network , ! HomeChains [ network . config . chainId ?? 0 ] ) ;
126
103
} ;
0 commit comments