1
1
import { deployments , getNamedAccounts , getChainId , ethers } from "hardhat" ;
2
2
import { KlerosCore } from "../typechain-types" ;
3
3
import { BigNumber } from "ethers" ;
4
- import courtsV1 from "../courts.v1.mainnet.json" ;
4
+ import courtsV1Mainnet from "../config/courts.v1.mainnet.json" ;
5
+ import courtsV1GnosisChain from "../config/courts.v1.gnosischain.json" ;
5
6
6
7
enum HomeChains {
7
8
ARBITRUM_ONE = 42161 ,
@@ -10,8 +11,11 @@ enum HomeChains {
10
11
HARDHAT = 31337 ,
11
12
}
12
13
14
+ const TESTING_PARAMETERS = true ;
15
+ const FROM_GNOSIS = true ;
16
+ const ETH_USD = BigNumber . from ( 1500 ) ;
13
17
const DISPUTE_KIT_CLASSIC = BigNumber . from ( 1 ) ;
14
- const TESTING_PARAMETERS = false ;
18
+ const TEN_THOUSAND_GWEI = BigNumber . from ( 10 ) . pow ( 13 ) ;
15
19
16
20
async function main ( ) {
17
21
// fallback to hardhat node signers on local network
@@ -25,15 +29,31 @@ async function main() {
25
29
console . log ( "deploying to %s with deployer %s" , HomeChains [ chainId ] , deployer ) ;
26
30
}
27
31
32
+ const truncateWei = ( x : BigNumber ) => x . div ( TEN_THOUSAND_GWEI ) . mul ( TEN_THOUSAND_GWEI ) ;
33
+
34
+ const parametersUsdToEth = ( court ) => ( {
35
+ ...court ,
36
+ minStake : truncateWei ( BigNumber . from ( court . minStake ) . div ( ETH_USD ) ) ,
37
+ feeForJuror : truncateWei ( BigNumber . from ( court . feeForJuror ) . div ( ETH_USD ) ) ,
38
+ } ) ;
39
+
40
+ const parametersProductionToTesting = ( court ) => ( {
41
+ ...court ,
42
+ minStake : truncateWei ( BigNumber . from ( court . minStake ) . div ( 10000 ) ) ,
43
+ feeForJuror : truncateWei ( ethers . utils . parseEther ( "0.00001" ) ) ,
44
+ timesPerPeriod : [ 120 , 120 , 120 , 120 ] ,
45
+ } ) ;
46
+
28
47
// WARNING: skip the Forking court at id 0, so the v1 courts are shifted by 1
29
- const courtsV2 = courtsV1 . map ( ( court ) => ( {
48
+ const parametersV1ToV2 = ( court ) => ( {
30
49
...court ,
31
50
id : BigNumber . from ( court . id ) . add ( 1 ) ,
32
51
parent : BigNumber . from ( court . parent ) . add ( 1 ) ,
33
- minStake : TESTING_PARAMETERS ? BigNumber . from ( court . minStake ) . div ( 100 ) : court . minStake ,
34
- feeForJuror : TESTING_PARAMETERS ? ethers . utils . parseEther ( "0.001" ) : court . feeForJuror ,
35
- timesPerPeriod : TESTING_PARAMETERS ? [ 120 , 120 , 120 , 120 ] : court . timesPerPeriod ,
36
- } ) ) ;
52
+ } ) ;
53
+
54
+ let courtsV1 = FROM_GNOSIS ? courtsV1GnosisChain . map ( parametersUsdToEth ) : courtsV1Mainnet ;
55
+ courtsV1 = TESTING_PARAMETERS ? courtsV1 . map ( parametersProductionToTesting ) : courtsV1 ;
56
+ const courtsV2 = courtsV1 . map ( parametersV1ToV2 ) ;
37
57
38
58
console . log ( "courtsV2 = %O" , courtsV2 ) ;
39
59
0 commit comments