@@ -556,7 +556,6 @@ describe('e2e', function () {
556556 describe ( 'Optimistic Approval' , async ( ) => {
557557 beforeEach ( async function ( ) {
558558 const { tribalChiefOptimisticMultisigAddress, timelockAddress } = contractAddresses ;
559- const { tribalChiefOptimisticTimelock } = contracts ;
560559
561560 await hre . network . provider . request ( {
562561 method : 'hardhat_impersonateAccount' ,
@@ -570,35 +569,55 @@ describe('e2e', function () {
570569
571570 await web3 . eth . sendTransaction ( { from : deployAddress , to : tribalChiefOptimisticMultisigAddress , value : '40000000000000000' } ) ;
572571
573- } ) ;
574- it ( 'governor can cancel a proposal' , async ( ) => {
575- const { tribalChiefOptimisticMultisigAddress, timelockAddress } = contractAddresses ;
576- const { tribalChiefOptimisticTimelock } = contracts ;
572+ await web3 . eth . sendTransaction ( { from : timelockAddress , to : tribalChiefOptimisticMultisigAddress , value : '40000000000000000' } ) ;
577573
578- await tribalChiefOptimisticTimelock . queueTransaction ( deployAddress , 0 , 'sig()' , '0x' , '10000000000000000' , { from : tribalChiefOptimisticMultisigAddress } ) ;
579- const hash = await tribalChiefOptimisticTimelock . getTxHash ( deployAddress , 0 , 'sig()' , '0x' , '10000000000000000' ) ;
580- expect ( await tribalChiefOptimisticTimelock . queuedTransactions ( hash ) ) . to . be . true ;
574+ } ) ;
575+ it ( 'governor can assume timelock admin' , async ( ) => {
576+ const { timelockAddress } = contractAddresses ;
577+ const { optimisticTimelock } = contracts ;
581578
582- await tribalChiefOptimisticTimelock . vetoTransactions ( [ deployAddress ] , [ 0 ] , [ 'sig()' ] , [ '0x' ] , [ '10000000000000000' ] , { from : timelockAddress } ) ;
579+ await optimisticTimelock . becomeAdmin ( { from : timelockAddress } ) ;
583580
584- expect ( await tribalChiefOptimisticTimelock . queuedTransactions ( hash ) ) . to . be . false ;
581+ const admin = await optimisticTimelock . TIMELOCK_ADMIN_ROLE ( ) ;
582+ expect ( await optimisticTimelock . hasRole ( admin , timelockAddress ) ) . to . be . true ;
585583 } ) ;
586584
587585 it ( 'proposal can execute on tribalChief' , async ( ) => {
588586 const { tribalChiefOptimisticMultisigAddress } = contractAddresses ;
589- const { tribalChiefOptimisticTimelock , tribalChief } = contracts ;
587+ const { optimisticTimelock , tribalChief } = contracts ;
590588
591589 const oldBlockReward = await tribalChief . tribePerBlock ( ) ;
590+ await optimisticTimelock . schedule (
591+ tribalChief . address ,
592+ 0 ,
593+ '0xf580ffcb0000000000000000000000000000000000000000000000000000000000000001' ,
594+ '0x0000000000000000000000000000000000000000000000000000000000000000' ,
595+ '0x0000000000000000000000000000000000000000000000000000000000000001' ,
596+ '500000' ,
597+ { from : tribalChiefOptimisticMultisigAddress }
598+ ) ;
592599
593- await tribalChiefOptimisticTimelock . queueTransaction ( tribalChief . address , 0 , 'updateBlockReward(uint256)' , '0x0000000000000000000000000000000000000000000000000000000000000001' , '100000000000' , { from : tribalChiefOptimisticMultisigAddress } ) ;
594- const hash = await tribalChiefOptimisticTimelock . getTxHash ( tribalChief . address , 0 , 'updateBlockReward(uint256)' , '0x0000000000000000000000000000000000000000000000000000000000000001' , '100000000000' ) ;
595- expect ( await tribalChiefOptimisticTimelock . queuedTransactions ( hash ) ) . to . be . true ;
600+ const hash = await optimisticTimelock . hashOperation (
601+ tribalChief . address ,
602+ 0 ,
603+ '0xf580ffcb0000000000000000000000000000000000000000000000000000000000000001' ,
604+ '0x0000000000000000000000000000000000000000000000000000000000000000' ,
605+ '0x0000000000000000000000000000000000000000000000000000000000000001' ,
606+ ) ;
607+ expect ( await optimisticTimelock . isOperationPending ( hash ) ) . to . be . true ;
596608
597- await time . increaseTo ( '100000000000' ) ;
598- await tribalChiefOptimisticTimelock . executeTransaction ( tribalChief . address , 0 , 'updateBlockReward(uint256)' , '0x0000000000000000000000000000000000000000000000000000000000000001' , '100000000000' , { from : tribalChiefOptimisticMultisigAddress } ) ;
609+ await time . increase ( '500000' ) ;
610+ await optimisticTimelock . execute (
611+ tribalChief . address ,
612+ 0 ,
613+ '0xf580ffcb0000000000000000000000000000000000000000000000000000000000000001' ,
614+ '0x0000000000000000000000000000000000000000000000000000000000000000' ,
615+ '0x0000000000000000000000000000000000000000000000000000000000000001' ,
616+ { from : tribalChiefOptimisticMultisigAddress }
617+ ) ;
599618
600619 expect ( await tribalChief . tribePerBlock ( ) ) . to . be . bignumber . equal ( '1' ) ;
601- expect ( await tribalChiefOptimisticTimelock . queuedTransactions ( hash ) ) . to . be . false ;
620+ expect ( await optimisticTimelock . isOperationDone ( hash ) ) . to . be . true ;
602621
603622 await tribalChief . updateBlockReward ( oldBlockReward ) ;
604623 } ) ;
0 commit comments