@@ -408,47 +408,52 @@ async function migrateDAO ({ arcVersion, web3, spinner, confirm, opts, migration
408
408
deploymentState . permissions = [ ]
409
409
deploymentState . votingMachinesParams = [ ]
410
410
}
411
+ if ( migrationParams . VotingMachinesParams !== undefined && migrationParams . VotingMachinesParams . length > 0 ) {
412
+ if ( deploymentState . registeredGenesisProtocolParamsCount === undefined ) {
413
+ deploymentState . registeredGenesisProtocolParamsCount = 0
414
+ }
415
+ for ( deploymentState . registeredGenesisProtocolParamsCount ;
416
+ deploymentState . registeredGenesisProtocolParamsCount < migrationParams . VotingMachinesParams . length ;
417
+ deploymentState . registeredGenesisProtocolParamsCount ++ ) {
418
+ spinner . start ( 'Setting GenesisProtocol parameters...' )
419
+ setState ( deploymentState , network )
420
+ if ( migrationParams . VotingMachinesParams [ deploymentState . registeredGenesisProtocolParamsCount ] . votingParamsHash !== undefined ) {
421
+ deploymentState . votingMachinesParams . push ( migrationParams . VotingMachinesParams [ deploymentState . registeredGenesisProtocolParamsCount ] . votingParamsHash )
422
+ setState ( deploymentState , network )
423
+ continue
424
+ }
425
+ let parameters = [
426
+ [
427
+ migrationParams . VotingMachinesParams [ deploymentState . registeredGenesisProtocolParamsCount ] . queuedVoteRequiredPercentage . toString ( ) ,
428
+ migrationParams . VotingMachinesParams [ deploymentState . registeredGenesisProtocolParamsCount ] . queuedVotePeriodLimit . toString ( ) ,
429
+ migrationParams . VotingMachinesParams [ deploymentState . registeredGenesisProtocolParamsCount ] . boostedVotePeriodLimit . toString ( ) ,
430
+ migrationParams . VotingMachinesParams [ deploymentState . registeredGenesisProtocolParamsCount ] . preBoostedVotePeriodLimit . toString ( ) ,
431
+ migrationParams . VotingMachinesParams [ deploymentState . registeredGenesisProtocolParamsCount ] . thresholdConst . toString ( ) ,
432
+ migrationParams . VotingMachinesParams [ deploymentState . registeredGenesisProtocolParamsCount ] . quietEndingPeriod . toString ( ) ,
433
+ web3 . utils . toWei ( migrationParams . VotingMachinesParams [ deploymentState . registeredGenesisProtocolParamsCount ] . proposingRepReward . toString ( ) ) ,
434
+ migrationParams . VotingMachinesParams [ deploymentState . registeredGenesisProtocolParamsCount ] . votersReputationLossRatio . toString ( ) ,
435
+ web3 . utils . toWei ( migrationParams . VotingMachinesParams [ deploymentState . registeredGenesisProtocolParamsCount ] . minimumDaoBounty . toString ( ) ) ,
436
+ migrationParams . VotingMachinesParams [ deploymentState . registeredGenesisProtocolParamsCount ] . daoBountyConst . toString ( ) ,
437
+ migrationParams . VotingMachinesParams [ deploymentState . registeredGenesisProtocolParamsCount ] . activationTime . toString ( )
438
+ ] ,
439
+ migrationParams . VotingMachinesParams [ deploymentState . registeredGenesisProtocolParamsCount ] . voteOnBehalf
440
+ ]
441
+ const genesisProtocolSetParams = genesisProtocol . methods . setParameters ( ...parameters )
411
442
412
- if ( deploymentState . registeredGenesisProtocolParamsCount === undefined ) {
413
- deploymentState . registeredGenesisProtocolParamsCount = 0
414
- }
415
- for ( deploymentState . registeredGenesisProtocolParamsCount ;
416
- deploymentState . registeredGenesisProtocolParamsCount < migrationParams . VotingMachinesParams . length ;
417
- deploymentState . registeredGenesisProtocolParamsCount ++ ) {
418
- spinner . start ( 'Setting GenesisProtocol parameters...' )
419
- setState ( deploymentState , network )
420
- if ( migrationParams . VotingMachinesParams [ deploymentState . registeredGenesisProtocolParamsCount ] . votingParamsHash !== undefined ) {
421
- deploymentState . votingMachinesParams . push ( migrationParams . VotingMachinesParams [ deploymentState . registeredGenesisProtocolParamsCount ] . votingParamsHash )
422
- setState ( deploymentState , network )
423
- continue
424
- }
425
- let parameters = [
426
- [
427
- migrationParams . VotingMachinesParams [ deploymentState . registeredGenesisProtocolParamsCount ] . queuedVoteRequiredPercentage . toString ( ) ,
428
- migrationParams . VotingMachinesParams [ deploymentState . registeredGenesisProtocolParamsCount ] . queuedVotePeriodLimit . toString ( ) ,
429
- migrationParams . VotingMachinesParams [ deploymentState . registeredGenesisProtocolParamsCount ] . boostedVotePeriodLimit . toString ( ) ,
430
- migrationParams . VotingMachinesParams [ deploymentState . registeredGenesisProtocolParamsCount ] . preBoostedVotePeriodLimit . toString ( ) ,
431
- migrationParams . VotingMachinesParams [ deploymentState . registeredGenesisProtocolParamsCount ] . thresholdConst . toString ( ) ,
432
- migrationParams . VotingMachinesParams [ deploymentState . registeredGenesisProtocolParamsCount ] . quietEndingPeriod . toString ( ) ,
433
- web3 . utils . toWei ( migrationParams . VotingMachinesParams [ deploymentState . registeredGenesisProtocolParamsCount ] . proposingRepReward . toString ( ) ) ,
434
- migrationParams . VotingMachinesParams [ deploymentState . registeredGenesisProtocolParamsCount ] . votersReputationLossRatio . toString ( ) ,
435
- web3 . utils . toWei ( migrationParams . VotingMachinesParams [ deploymentState . registeredGenesisProtocolParamsCount ] . minimumDaoBounty . toString ( ) ) ,
436
- migrationParams . VotingMachinesParams [ deploymentState . registeredGenesisProtocolParamsCount ] . daoBountyConst . toString ( ) ,
437
- migrationParams . VotingMachinesParams [ deploymentState . registeredGenesisProtocolParamsCount ] . activationTime . toString ( )
438
- ] ,
439
- migrationParams . VotingMachinesParams [ deploymentState . registeredGenesisProtocolParamsCount ] . voteOnBehalf
440
- ]
441
- const genesisProtocolSetParams = genesisProtocol . methods . setParameters ( ...parameters )
442
-
443
- tx = await genesisProtocolSetParams . send ( { nonce : ++ nonce } )
444
- let votingMachinesParams = await genesisProtocolSetParams . call ( )
445
- deploymentState . votingMachinesParams . push ( votingMachinesParams )
446
- await logTx ( tx ,
447
- 'GenesisProtocol parameters set. | Params Hash: ' +
448
- votingMachinesParams + '\nParameters:\n' +
449
- parameters . toString ( ) . replace ( / , / g, ',\n' )
450
- )
451
- setState ( deploymentState , network )
443
+ let votingMachinesParams = await genesisProtocolSetParams . call ( )
444
+ const votingMachineCheckParams = await genesisProtocol . methods . parameters ( votingMachinesParams ) . call ( )
445
+ if ( votingMachineCheckParams . minimumDaoBounty === 0 ) {
446
+ tx = await genesisProtocolSetParams . send ( { nonce : ++ nonce } )
447
+ await logTx ( tx ,
448
+ 'GenesisProtocol parameters set. | Params Hash: ' +
449
+ votingMachinesParams + '\nParameters:\n' +
450
+ parameters . toString ( ) . replace ( / , / g, ',\n' )
451
+ )
452
+ }
453
+
454
+ deploymentState . votingMachinesParams . push ( votingMachinesParams )
455
+ setState ( deploymentState , network )
456
+ }
452
457
}
453
458
deploymentState . registeredGenesisProtocolParamsCount ++
454
459
setState ( deploymentState , network )
@@ -476,12 +481,16 @@ async function migrateDAO ({ arcVersion, web3, spinner, confirm, opts, migration
476
481
]
477
482
const schemeRegistrarSetParams = schemeRegistrar . methods . setParameters ( ...parameters )
478
483
schemeRegistrarParams = await schemeRegistrarSetParams . call ( )
479
- tx = await schemeRegistrarSetParams . send ( { nonce : ++ nonce } )
480
- await logTx ( tx ,
481
- 'Scheme Registrar parameters set. | Params Hash: ' +
482
- schemeRegistrarParams + '\nParameters:\n' +
483
- parameters . toString ( ) . replace ( / , / g, ',\n' )
484
- )
484
+
485
+ const schemeRegistrarCheckParams = await schemeRegistrar . methods . parameters ( schemeRegistrarParams ) . call ( )
486
+ if ( schemeRegistrarCheckParams . intVote === '0x0000000000000000000000000000000000000000' ) {
487
+ tx = await schemeRegistrarSetParams . send ( { nonce : ++ nonce } )
488
+ await logTx ( tx ,
489
+ 'Scheme Registrar parameters set. | Params Hash: ' +
490
+ schemeRegistrarParams + '\nParameters:\n' +
491
+ parameters . toString ( ) . replace ( / , / g, ',\n' )
492
+ )
493
+ }
485
494
486
495
deploymentState . schemeNames . push ( 'Scheme Registrar' )
487
496
deploymentState . schemes . push ( SchemeRegistrar )
@@ -510,12 +519,16 @@ async function migrateDAO ({ arcVersion, web3, spinner, confirm, opts, migration
510
519
: migrationParams . ContributionReward [ deploymentState . ContributionRewardParamsCount ] . votingMachine ]
511
520
const contributionRewardSetParams = contributionReward . methods . setParameters ( ...parameters )
512
521
contributionRewardParams = await contributionRewardSetParams . call ( )
513
- tx = await contributionRewardSetParams . send ( { nonce : ++ nonce } )
514
- await logTx ( tx ,
515
- 'Contribution Reward parameters set. | Params Hash: ' +
516
- contributionRewardParams + '\nParameters:' +
517
- parameters . toString ( ) . replace ( / , / g, ',\n' )
518
- )
522
+
523
+ const contributionRewardCheckParams = await contributionReward . methods . parameters ( contributionRewardParams ) . call ( )
524
+ if ( contributionRewardCheckParams . intVote === '0x0000000000000000000000000000000000000000' ) {
525
+ tx = await contributionRewardSetParams . send ( { nonce : ++ nonce } )
526
+ await logTx ( tx ,
527
+ 'Contribution Reward parameters set. | Params Hash: ' +
528
+ contributionRewardParams + '\nParameters:' +
529
+ parameters . toString ( ) . replace ( / , / g, ',\n' )
530
+ )
531
+ }
519
532
520
533
deploymentState . schemeNames . push ( 'Contribution Reward' )
521
534
deploymentState . schemes . push ( ContributionReward )
@@ -543,12 +556,16 @@ async function migrateDAO ({ arcVersion, web3, spinner, confirm, opts, migration
543
556
]
544
557
const genericSchemeSetParams = genericScheme . methods . setParameters ( ...parameters )
545
558
genericSchemeParams = await genericSchemeSetParams . call ( )
546
- tx = await genericSchemeSetParams . send ( { nonce : ++ nonce } )
547
- await logTx ( tx ,
548
- 'Generic Scheme parameters set. | Params Hash: ' +
549
- genericSchemeParams + '\nParameters:\n' +
550
- parameters . toString ( ) . replace ( / , / g, ',\n' )
551
- )
559
+
560
+ const genericSchemeCheckParams = await genericScheme . methods . parameters ( genericSchemeParams ) . call ( )
561
+ if ( genericSchemeCheckParams . intVote === '0x0000000000000000000000000000000000000000' ) {
562
+ tx = await genericSchemeSetParams . send ( { nonce : ++ nonce } )
563
+ await logTx ( tx ,
564
+ 'Generic Scheme parameters set. | Params Hash: ' +
565
+ genericSchemeParams + '\nParameters:\n' +
566
+ parameters . toString ( ) . replace ( / , / g, ',\n' )
567
+ )
568
+ }
552
569
553
570
deploymentState . schemeNames . push ( 'Generic Scheme' )
554
571
deploymentState . schemes . push ( Number ( arcVersion . slice ( - 2 ) ) >= 24 ? UGenericScheme : GenericScheme )
@@ -579,12 +596,16 @@ async function migrateDAO ({ arcVersion, web3, spinner, confirm, opts, migration
579
596
]
580
597
const globalConstraintRegistrarSetParams = globalConstraintRegistrar . methods . setParameters ( ...parameters )
581
598
globalConstraintRegistrarParams = await globalConstraintRegistrarSetParams . call ( )
582
- tx = await globalConstraintRegistrarSetParams . send ( { nonce : ++ nonce } )
583
- await logTx ( tx ,
584
- 'Global Constraints Registrar parameters set. | Params Hash: ' +
585
- globalConstraintRegistrarParams + '\nParameters:\n' +
586
- parameters . toString ( ) . replace ( / , / g, ',\n' )
587
- )
599
+
600
+ const globalConstraintRegistrarCheckParams = await globalConstraintRegistrar . methods . parameters ( globalConstraintRegistrarParams ) . call ( )
601
+ if ( globalConstraintRegistrarCheckParams . intVote === '0x0000000000000000000000000000000000000000' ) {
602
+ tx = await globalConstraintRegistrarSetParams . send ( { nonce : ++ nonce } )
603
+ await logTx ( tx ,
604
+ 'Global Constraints Registrar parameters set. | Params Hash: ' +
605
+ globalConstraintRegistrarParams + '\nParameters:\n' +
606
+ parameters . toString ( ) . replace ( / , / g, ',\n' )
607
+ )
608
+ }
588
609
589
610
deploymentState . schemeNames . push ( 'Global Constraints Registrar' )
590
611
deploymentState . schemes . push ( GlobalConstraintRegistrar )
@@ -615,12 +636,16 @@ async function migrateDAO ({ arcVersion, web3, spinner, confirm, opts, migration
615
636
]
616
637
const upgradeSchemeSetParams = upgradeScheme . methods . setParameters ( ...parameters )
617
638
upgradeSchemeParams = await upgradeSchemeSetParams . call ( )
618
- tx = await upgradeSchemeSetParams . send ( { nonce : ++ nonce } )
619
- await logTx ( tx ,
620
- 'Upgrade Scheme parameters set. | Params Hash: ' +
621
- upgradeSchemeParams + '\nParameters:\n' +
622
- parameters . toString ( ) . replace ( / , / g, ',\n' )
623
- )
639
+
640
+ const upgradeSchemeCheckParams = await upgradeScheme . methods . parameters ( upgradeSchemeParams ) . call ( )
641
+ if ( upgradeSchemeCheckParams . intVote === '0x0000000000000000000000000000000000000000' ) {
642
+ tx = await upgradeSchemeSetParams . send ( { nonce : ++ nonce } )
643
+ await logTx ( tx ,
644
+ 'Upgrade Scheme parameters set. | Params Hash: ' +
645
+ upgradeSchemeParams + '\nParameters:\n' +
646
+ parameters . toString ( ) . replace ( / , / g, ',\n' )
647
+ )
648
+ }
624
649
625
650
deploymentState . schemeNames . push ( 'Upgrade Scheme' )
626
651
deploymentState . schemes . push ( UpgradeScheme )
0 commit comments