11import { HardhatRuntimeEnvironment } from "hardhat/types" ;
22import { DeployFunction } from "hardhat-deploy/types" ;
3- import { BigNumber , BigNumberish } from "ethers" ;
43import { deployUpgradable } from "./utils/deployUpgradable" ;
54import { HomeChains , isSkipped } from "./utils" ;
65import { deployERC20AndFaucet } from "./utils/deployTokens" ;
7- import { KlerosCore } from "../typechain-types" ;
6+ import { KlerosCore , KlerosCoreRuler } from "../typechain-types" ;
87import { getContractOrDeployUpgradable } from "./utils/getContractOrDeploy" ;
8+ import { changeCurrencyRate } from "./utils/klerosCoreHelper" ;
99
1010const deployArbitration : DeployFunction = async ( hre : HardhatRuntimeEnvironment ) => {
11- const { ethers , deployments, getNamedAccounts, getChainId } = hre ;
11+ const { deployments, getNamedAccounts, getChainId } = hre ;
1212 const { deploy } = deployments ;
1313
1414 // fallback to hardhat node signers on local network
@@ -22,40 +22,23 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment)
2222
2323 const minStake = 0 ;
2424 const alpha = 10000 ;
25- const feeForJuror = BigNumber . from ( 10 ) . pow ( 17 ) ;
25+ const feeForJuror = 10n ** 17n ;
2626 const jurorsForCourtJump = 16 ;
27- const klerosCore = await deployUpgradable ( deployments , "KlerosCoreRuler" , {
27+ await deployUpgradable ( deployments , "KlerosCoreRuler" , {
2828 from : deployer ,
2929 args : [
3030 deployer , // governor
31- pnk . address ,
31+ pnk . target ,
3232 [ minStake , alpha , feeForJuror , jurorsForCourtJump ] ,
3333 ] ,
3434 log : true ,
3535 } ) ;
36-
37- const changeCurrencyRate = async (
38- erc20 : string ,
39- accepted : boolean ,
40- rateInEth : BigNumberish ,
41- rateDecimals : BigNumberish
42- ) => {
43- const core = ( await ethers . getContract ( "KlerosCoreRuler" ) ) as KlerosCore ;
44- const pnkRate = await core . currencyRates ( erc20 ) ;
45- if ( pnkRate . feePaymentAccepted !== accepted ) {
46- console . log ( `core.changeAcceptedFeeTokens(${ erc20 } , ${ accepted } )` ) ;
47- await core . changeAcceptedFeeTokens ( erc20 , accepted ) ;
48- }
49- if ( ! pnkRate . rateInEth . eq ( rateInEth ) || pnkRate . rateDecimals !== rateDecimals ) {
50- console . log ( `core.changeCurrencyRates(${ erc20 } , ${ rateInEth } , ${ rateDecimals } )` ) ;
51- await core . changeCurrencyRates ( erc20 , rateInEth , rateDecimals ) ;
52- }
53- } ;
36+ const core = ( await hre . ethers . getContract ( "KlerosCoreRuler" ) ) as KlerosCoreRuler ;
5437
5538 try {
56- await changeCurrencyRate ( pnk . address , true , 12225583 , 12 ) ;
57- await changeCurrencyRate ( dai . address , true , 60327783 , 11 ) ;
58- await changeCurrencyRate ( weth . address , true , 1 , 1 ) ;
39+ await changeCurrencyRate ( core , await pnk . getAddress ( ) , true , 12225583 , 12 ) ;
40+ await changeCurrencyRate ( core , await dai . getAddress ( ) , true , 60327783 , 11 ) ;
41+ await changeCurrencyRate ( core , await weth . getAddress ( ) , true , 1 , 1 ) ;
5942 } catch ( e ) {
6043 console . error ( "failed to change currency rates:" , e ) ;
6144 }
@@ -68,7 +51,7 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment)
6851
6952 await deploy ( "DisputeResolverRuler" , {
7053 from : deployer ,
71- args : [ klerosCore . address , disputeTemplateRegistry . address ] ,
54+ args : [ core . target , disputeTemplateRegistry . target ] ,
7255 log : true ,
7356 } ) ;
7457} ;
0 commit comments