@@ -20,6 +20,9 @@ const randomizerByChain = new Map<HomeChains, string>([
20
20
[ HomeChains . ARBITRUM_GOERLI , "0x923096Da90a3b60eb7E12723fA2E1547BA9236Bc" ] ,
21
21
] ) ;
22
22
23
+ const daiByChain = new Map < HomeChains , string > ( [ [ HomeChains . ARBITRUM_ONE , "??" ] ] ) ;
24
+ const wethByChain = new Map < HomeChains , string > ( [ [ HomeChains . ARBITRUM_ONE , "??" ] ] ) ;
25
+
23
26
const deployArbitration : DeployFunction = async ( hre : HardhatRuntimeEnvironment ) => {
24
27
const { ethers, deployments, getNamedAccounts, getChainId } = hre ;
25
28
const { deploy, execute } = deployments ;
@@ -31,26 +34,26 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment)
31
34
const chainId = Number ( await getChainId ( ) ) ;
32
35
console . log ( "Deploying to %s with deployer %s" , HomeChains [ chainId ] , deployer ) ;
33
36
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 ) ;
54
57
}
55
58
56
59
await deploy ( "PolicyRegistry" , {
@@ -83,6 +86,8 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment)
83
86
} ) ;
84
87
85
88
const pnk = pnkByChain . get ( chainId ) ?? AddressZero ;
89
+ const dai = daiByChain . get ( chainId ) ?? AddressZero ;
90
+ const weth = wethByChain . get ( chainId ) ?? AddressZero ;
86
91
const minStake = BigNumber . from ( 10 ) . pow ( 20 ) . mul ( 2 ) ;
87
92
const alpha = 10000 ;
88
93
const feeForJuror = BigNumber . from ( 10 ) . pow ( 17 ) ;
@@ -108,6 +113,23 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment)
108
113
await execute ( "DisputeKitClassic" , { from : deployer , log : true } , "changeCore" , klerosCore . address ) ;
109
114
}
110
115
116
+ await execute (
117
+ "KlerosCore" ,
118
+ { from : deployer , log : true } ,
119
+ "changeAcceptedFeeTokens" ,
120
+ [ pnk , dai , weth ] ,
121
+ [ true , true , true ]
122
+ ) ;
123
+
124
+ await execute (
125
+ "KlerosCore" ,
126
+ { from : deployer , log : true } ,
127
+ "changeCurrencyRates" ,
128
+ [ pnk , dai , weth ] ,
129
+ [ 12225583 , 60327783 , 1 ] ,
130
+ [ 12 , 11 , 1 ]
131
+ ) ;
132
+
111
133
await deploy ( "DisputeResolver" , {
112
134
from : deployer ,
113
135
args : [ klerosCore . address ] ,
@@ -121,4 +143,16 @@ deployArbitration.skip = async ({ getChainId }) => {
121
143
return ! HomeChains [ chainId ] ;
122
144
} ;
123
145
146
+ const deployERC20 = async ( hre : HardhatRuntimeEnvironment , deployer : string , ticker : string ) => {
147
+ const { deploy } = hre . deployments ;
148
+ const erc20 = await deploy ( ticker , {
149
+ from : deployer ,
150
+ contract : "TestERC20" ,
151
+ args : [ ticker , ticker ] ,
152
+ log : true ,
153
+ } ) ;
154
+ console . log ( "Deployed %s at %s" , ticker , erc20 . address ) ;
155
+ return erc20 . address ;
156
+ } ;
157
+
124
158
export default deployArbitration ;
0 commit comments