@@ -385,6 +385,7 @@ if (process.env.INTEGRATIONTEST) {
385
385
const rebalanceInterval = BigNumber . from ( 86400 ) ;
386
386
387
387
const unutilizedLeveragePercentage = ether ( 0.01 ) ;
388
+ const unutilizedLeveragePercentageDelever = ZERO ;
388
389
const twapMaxTradeSize = ether ( 0.5 ) ;
389
390
const twapCooldownPeriod = BigNumber . from ( 3000 ) ;
390
391
const slippageTolerance = ether ( 0.01 ) ;
@@ -412,6 +413,7 @@ if (process.env.INTEGRATIONTEST) {
412
413
} ;
413
414
execution = {
414
415
unutilizedLeveragePercentage : unutilizedLeveragePercentage ,
416
+ unutilizedLeveragePercentageDelever : unutilizedLeveragePercentageDelever ,
415
417
twapCooldownPeriod : twapCooldownPeriod ,
416
418
slippageTolerance : slippageTolerance ,
417
419
} ;
@@ -473,6 +475,7 @@ if (process.env.INTEGRATIONTEST) {
473
475
} ;
474
476
subjectExecutionSettings = {
475
477
unutilizedLeveragePercentage : ether ( 0.01 ) ,
478
+ unutilizedLeveragePercentageDelever : ZERO ,
476
479
twapCooldownPeriod : BigNumber . from ( 120 ) ,
477
480
slippageTolerance : ether ( 0.01 ) ,
478
481
} ;
@@ -553,6 +556,9 @@ if (process.env.INTEGRATIONTEST) {
553
556
expect ( execution . unutilizedLeveragePercentage ) . to . eq (
554
557
subjectExecutionSettings . unutilizedLeveragePercentage ,
555
558
) ;
559
+ expect ( execution . unutilizedLeveragePercentageDelever ) . to . eq (
560
+ subjectExecutionSettings . unutilizedLeveragePercentageDelever
561
+ ) ;
556
562
expect ( execution . twapCooldownPeriod ) . to . eq ( subjectExecutionSettings . twapCooldownPeriod ) ;
557
563
expect ( execution . slippageTolerance ) . to . eq ( subjectExecutionSettings . slippageTolerance ) ;
558
564
} ) ;
@@ -650,6 +656,16 @@ if (process.env.INTEGRATIONTEST) {
650
656
} ) ;
651
657
} ) ;
652
658
659
+ describe ( "when unutilizedLeveragePercentageDelever is >100%" , async ( ) => {
660
+ beforeEach ( async ( ) => {
661
+ subjectExecutionSettings . unutilizedLeveragePercentageDelever = ether ( 1.1 ) ;
662
+ } ) ;
663
+
664
+ it ( "should revert" , async ( ) => {
665
+ await expect ( subject ( ) ) . to . be . revertedWith ( "Unutilized leverage on delever must be <100%" ) ;
666
+ } ) ;
667
+ } ) ;
668
+
653
669
describe ( "when slippage tolerance is >100%" , async ( ) => {
654
670
beforeEach ( async ( ) => {
655
671
subjectExecutionSettings . slippageTolerance = ether ( 1.1 ) ;
@@ -2967,7 +2983,6 @@ if (process.env.INTEGRATIONTEST) {
2967
2983
) ;
2968
2984
2969
2985
const expectedFirstPositionUnit = initialPositions [ 0 ] . unit . sub ( maxRedeemCollateral ) ;
2970
- console . log ( "expectedFirstPositionUnit" , expectedFirstPositionUnit . toString ( ) ) ;
2971
2986
2972
2987
expect ( initialPositions . length ) . to . eq ( 2 ) ;
2973
2988
expect ( currentPositions . length ) . to . eq ( 2 ) ;
@@ -3430,6 +3445,7 @@ if (process.env.INTEGRATIONTEST) {
3430
3445
const oldExecution = await leverageStrategyExtension . getExecution ( ) ;
3431
3446
const newExecution : ExecutionSettings = {
3432
3447
unutilizedLeveragePercentage : oldExecution . unutilizedLeveragePercentage ,
3448
+ unutilizedLeveragePercentageDelever : ZERO ,
3433
3449
twapCooldownPeriod : oldExecution . twapCooldownPeriod ,
3434
3450
slippageTolerance : ether ( 0.05 ) ,
3435
3451
} ;
@@ -3851,6 +3867,7 @@ if (process.env.INTEGRATIONTEST) {
3851
3867
const initializeSubjectVariables = ( ) => {
3852
3868
subjectExecutionSettings = {
3853
3869
unutilizedLeveragePercentage : ether ( 0.05 ) ,
3870
+ unutilizedLeveragePercentageDelever : ZERO ,
3854
3871
twapCooldownPeriod : BigNumber . from ( 360 ) ,
3855
3872
slippageTolerance : ether ( 0.02 ) ,
3856
3873
} ;
@@ -3872,6 +3889,9 @@ if (process.env.INTEGRATIONTEST) {
3872
3889
expect ( execution . unutilizedLeveragePercentage ) . to . eq (
3873
3890
subjectExecutionSettings . unutilizedLeveragePercentage ,
3874
3891
) ;
3892
+ expect ( execution . unutilizedLeveragePercentageDelever ) . to . eq (
3893
+ subjectExecutionSettings . unutilizedLeveragePercentageDelever ,
3894
+ ) ;
3875
3895
expect ( execution . twapCooldownPeriod ) . to . eq ( subjectExecutionSettings . twapCooldownPeriod ) ;
3876
3896
expect ( execution . slippageTolerance ) . to . eq ( subjectExecutionSettings . slippageTolerance ) ;
3877
3897
} ) ;
@@ -3881,6 +3901,7 @@ if (process.env.INTEGRATIONTEST) {
3881
3901
. to . emit ( leverageStrategyExtension , "ExecutionSettingsUpdated" )
3882
3902
. withArgs (
3883
3903
subjectExecutionSettings . unutilizedLeveragePercentage ,
3904
+ subjectExecutionSettings . unutilizedLeveragePercentageDelever ,
3884
3905
subjectExecutionSettings . twapCooldownPeriod ,
3885
3906
subjectExecutionSettings . slippageTolerance ,
3886
3907
) ;
0 commit comments