@@ -20,6 +20,9 @@ const randomizerByChain = new Map<HomeChains, string>([
2020 [ HomeChains . ARBITRUM_GOERLI , "0x923096Da90a3b60eb7E12723fA2E1547BA9236Bc" ] ,
2121] ) ;
2222
23+ const daiByChain = new Map < HomeChains , string > ( [ [ HomeChains . ARBITRUM_ONE , "??" ] ] ) ;
24+ const wethByChain = new Map < HomeChains , string > ( [ [ HomeChains . ARBITRUM_ONE , "??" ] ] ) ;
25+
2326const deployArbitration : DeployFunction = async ( hre : HardhatRuntimeEnvironment ) => {
2427 const { ethers, deployments, getNamedAccounts, getChainId } = hre ;
2528 const { deploy, execute } = deployments ;
@@ -31,26 +34,26 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment)
3134 const chainId = Number ( await getChainId ( ) ) ;
3235 console . log ( "Deploying to %s with deployer %s" , HomeChains [ chainId ] , deployer ) ;
3336
34- if ( chainId === HomeChains . HARDHAT ) {
35- pnkByChain . set (
36- HomeChains . HARDHAT ,
37- (
38- await deploy ( "PNK" , {
39- from : deployer ,
40- log : true ,
41- } )
42- ) . address
43- ) ;
44- randomizerByChain . set (
45- HomeChains . HARDHAT ,
46- (
47- await deploy ( "RandomizerMock" , {
48- from : deployer ,
49- args : [ ] ,
50- log : true ,
51- } )
52- ) . address
53- ) ;
37+ if ( ! pnkByChain . get ( chainId ) ) {
38+ const erc20Address = await deployERC20 ( hre , deployer , "PNK" ) ;
39+ pnkByChain . set ( HomeChains [ HomeChains [ chainId ] ] , erc20Address ) ;
40+ }
41+ if ( ! daiByChain . get ( chainId ) ) {
42+ const erc20Address = await deployERC20 ( hre , deployer , "DAI" ) ;
43+ daiByChain . set ( HomeChains [ HomeChains [ chainId ] ] , erc20Address ) ;
44+ }
45+ if ( ! wethByChain . get ( chainId ) ) {
46+ const erc20Address = await deployERC20 ( hre , deployer , "WETH" ) ;
47+ wethByChain . set ( HomeChains [ HomeChains [ chainId ] ] , erc20Address ) ;
48+ }
49+
50+ if ( ! randomizerByChain . get ( chainId ) ) {
51+ const randomizerMock = await deploy ( "RandomizerMock" , {
52+ from : deployer ,
53+ args : [ ] ,
54+ log : true ,
55+ } ) ;
56+ randomizerByChain . set ( HomeChains [ HomeChains [ chainId ] ] , randomizerMock . address ) ;
5457 }
5558
5659 await deploy ( "PolicyRegistry" , {
@@ -83,6 +86,8 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment)
8386 } ) ;
8487
8588 const pnk = pnkByChain . get ( chainId ) ?? AddressZero ;
89+ const dai = daiByChain . get ( chainId ) ?? AddressZero ;
90+ const weth = wethByChain . get ( chainId ) ?? AddressZero ;
8691 const minStake = BigNumber . from ( 10 ) . pow ( 20 ) . mul ( 2 ) ;
8792 const alpha = 10000 ;
8893 const feeForJuror = BigNumber . from ( 10 ) . pow ( 17 ) ;
@@ -108,6 +113,14 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment)
108113 await execute ( "DisputeKitClassic" , { from : deployer , log : true } , "changeCore" , klerosCore . address ) ;
109114 }
110115
116+ await execute ( "KlerosCore" , { from : deployer , log : true } , "changeAcceptedFeeTokens" , pnk , true ) ;
117+ await execute ( "KlerosCore" , { from : deployer , log : true } , "changeAcceptedFeeTokens" , dai , true ) ;
118+ await execute ( "KlerosCore" , { from : deployer , log : true } , "changeAcceptedFeeTokens" , weth , true ) ;
119+
120+ await execute ( "KlerosCore" , { from : deployer , log : true } , "changeCurrencyRates" , pnk , 12225583 , 12 ) ;
121+ await execute ( "KlerosCore" , { from : deployer , log : true } , "changeCurrencyRates" , dai , 60327783 , 11 ) ;
122+ await execute ( "KlerosCore" , { from : deployer , log : true } , "changeCurrencyRates" , weth , 1 , 1 ) ;
123+
111124 await deploy ( "DisputeResolver" , {
112125 from : deployer ,
113126 args : [ klerosCore . address ] ,
@@ -121,4 +134,16 @@ deployArbitration.skip = async ({ getChainId }) => {
121134 return ! HomeChains [ chainId ] ;
122135} ;
123136
137+ const deployERC20 = async ( hre : HardhatRuntimeEnvironment , deployer : string , ticker : string ) => {
138+ const { deploy } = hre . deployments ;
139+ const erc20 = await deploy ( ticker , {
140+ from : deployer ,
141+ contract : "TestERC20" ,
142+ args : [ ticker , ticker ] ,
143+ log : true ,
144+ } ) ;
145+ console . log ( "Deployed %s at %s" , ticker , erc20 . address ) ;
146+ return erc20 . address ;
147+ } ;
148+
124149export default deployArbitration ;
0 commit comments