11import { deployments , getNamedAccounts , getChainId , ethers } from "hardhat" ;
22import { KlerosCore } from "../typechain-types" ;
33import { 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" ;
56
67enum HomeChains {
78 ARBITRUM_ONE = 42161 ,
@@ -10,8 +11,11 @@ enum HomeChains {
1011 HARDHAT = 31337 ,
1112}
1213
14+ const TESTING_PARAMETERS = true ;
15+ const FROM_GNOSIS = true ;
16+ const ETH_USD = BigNumber . from ( 1500 ) ;
1317const DISPUTE_KIT_CLASSIC = BigNumber . from ( 1 ) ;
14- const TESTING_PARAMETERS = false ;
18+ const TEN_THOUSAND_GWEI = BigNumber . from ( 10 ) . pow ( 13 ) ;
1519
1620async function main ( ) {
1721 // fallback to hardhat node signers on local network
@@ -25,15 +29,31 @@ async function main() {
2529 console . log ( "deploying to %s with deployer %s" , HomeChains [ chainId ] , deployer ) ;
2630 }
2731
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+
2847 // 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 ) => ( {
3049 ...court ,
3150 id : BigNumber . from ( court . id ) . add ( 1 ) ,
3251 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 ) ;
3757
3858 console . log ( "courtsV2 = %O" , courtsV2 ) ;
3959
0 commit comments