@@ -10,8 +10,8 @@ chai.use(solidity);
10
10
// can simulate poylgon mainnet governance proposals here, enable fork object in hardhat.config.ts
11
11
describe . skip ( 'Governance - Polygon mainnet proposal simulations' , async ( ) => {
12
12
const [ user ] = waffle . provider . getWallets ( ) ;
13
- const deployment = getPolygonContracts ( user ) ;
14
- const { arenaToken, timeLock} = deployment ;
13
+ let deployment = getPolygonContracts ( user ) ;
14
+ const { governorV1 , governor , arenaToken, timeLock} = deployment ;
15
15
16
16
it ( 'should allow governance to move tokens in timeLock contract' , async ( ) => {
17
17
const treasuryAmount = await arenaToken . balanceOf ( timeLock . address ) ;
@@ -24,4 +24,34 @@ describe.skip('Governance - Polygon mainnet proposal simulations', async () => {
24
24
25
25
expect ( await arenaToken . balanceOf ( timeLock . address ) ) . to . eq ( ZERO ) ;
26
26
} ) ;
27
+
28
+ it ( 'should migrate to new governor' , async ( ) => {
29
+ // set to current existing governor for proposal creation
30
+ deployment . governor = governorV1 ;
31
+ const PROPOSER_ROLE = '0xb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc1' ;
32
+ let targets : string [ ] = [ timeLock . address , timeLock . address ] ;
33
+ let values : string [ ] = [ `0` , `0` ] ;
34
+ let calldatas : string [ ] = [
35
+ timeLock . interface . encodeFunctionData ( 'grantRole' , [ PROPOSER_ROLE , governor . address ] ) ,
36
+ timeLock . interface . encodeFunctionData ( 'revokeRole' , [ PROPOSER_ROLE , governorV1 . address ] ) ,
37
+ ] ;
38
+ await createAndExecuteProposal ( { targets, values, calldatas, user, ...deployment } ) ;
39
+
40
+ const treasuryAmount = await arenaToken . balanceOf ( timeLock . address ) ;
41
+ targets = [ arenaToken . address ] ;
42
+ values = [ `0` ] ;
43
+ calldatas = [ arenaToken . interface . encodeFunctionData ( 'transfer' , [ user . address , treasuryAmount ] ) ] ;
44
+
45
+ // attempt to move funds through old governor, will fail
46
+ try {
47
+ await createAndExecuteProposal ( { targets, values, calldatas, user, ...deployment } ) ;
48
+ } catch ( e ) {
49
+ console . log ( e ) ;
50
+ }
51
+
52
+ // attempt to move funds through new governor, should be successful
53
+ deployment . governor = governor ;
54
+ await createAndExecuteProposal ( { targets, values, calldatas, user, ...deployment } ) ;
55
+ expect ( await arenaToken . balanceOf ( timeLock . address ) ) . to . eq ( ZERO ) ;
56
+ } ) ;
27
57
} ) ;
0 commit comments