@@ -250,6 +250,7 @@ describe("DeltaNeutralBasisTradingStrategyExtension", () => {
250
250
const recenteringSpeed = ether ( 0.05 ) ;
251
251
const rebalanceInterval = ONE_DAY_IN_SECONDS ;
252
252
const reinvestInterval = ONE_DAY_IN_SECONDS . mul ( 7 ) ;
253
+ const minReinvestUnits = TWO ;
253
254
254
255
const exchangeName = "UniswapV3ExchangeAdapterV2" ;
255
256
const buyExactSpotTradeData = await uniswapV3ExchangeAdapter . generateDataParam (
@@ -295,7 +296,8 @@ describe("DeltaNeutralBasisTradingStrategyExtension", () => {
295
296
maxLeverageRatio : maxLeverageRatio ,
296
297
recenteringSpeed : recenteringSpeed ,
297
298
rebalanceInterval : rebalanceInterval ,
298
- reinvestInterval : reinvestInterval
299
+ reinvestInterval : reinvestInterval ,
300
+ minReinvestUnits : minReinvestUnits
299
301
} ;
300
302
execution = {
301
303
twapCooldownPeriod : twapCooldownPeriod ,
@@ -365,7 +367,8 @@ describe("DeltaNeutralBasisTradingStrategyExtension", () => {
365
367
maxLeverageRatio : ether ( - 1.3 ) ,
366
368
recenteringSpeed : ether ( 0.05 ) ,
367
369
rebalanceInterval : BigNumber . from ( 86400 ) ,
368
- reinvestInterval : ONE_DAY_IN_SECONDS . mul ( 7 )
370
+ reinvestInterval : ONE_DAY_IN_SECONDS . mul ( 7 ) ,
371
+ minReinvestUnits : TWO
369
372
} ;
370
373
subjectExecutionSettings = {
371
374
twapCooldownPeriod : BigNumber . from ( 120 ) ,
@@ -2617,7 +2620,8 @@ describe("DeltaNeutralBasisTradingStrategyExtension", () => {
2617
2620
maxLeverageRatio : ether ( - 1.1 ) ,
2618
2621
recenteringSpeed : ether ( 0.1 ) ,
2619
2622
rebalanceInterval : BigNumber . from ( 43200 ) ,
2620
- reinvestInterval : ONE_DAY_IN_SECONDS . mul ( 7 )
2623
+ reinvestInterval : ONE_DAY_IN_SECONDS . mul ( 7 ) ,
2624
+ minReinvestUnits : TWO
2621
2625
} ;
2622
2626
subjectCaller = owner ;
2623
2627
} ;
@@ -2650,10 +2654,24 @@ describe("DeltaNeutralBasisTradingStrategyExtension", () => {
2650
2654
subjectMethodologySettings . maxLeverageRatio ,
2651
2655
subjectMethodologySettings . recenteringSpeed ,
2652
2656
subjectMethodologySettings . rebalanceInterval ,
2653
- subjectMethodologySettings . reinvestInterval
2657
+ subjectMethodologySettings . reinvestInterval ,
2658
+ subjectMethodologySettings . minReinvestUnits
2654
2659
) ;
2655
2660
} ) ;
2656
2661
2662
+ describe ( "when min reinvest units is zero" , async ( ) => {
2663
+ beforeEach ( async ( ) => {
2664
+ subjectMethodologySettings = {
2665
+ ...subjectMethodologySettings ,
2666
+ minReinvestUnits : ZERO
2667
+ } ;
2668
+ } ) ;
2669
+
2670
+ it ( "should revert" , async ( ) => {
2671
+ await expect ( subject ( ) ) . to . be . revertedWith ( "Must be valid min reinvest units" ) ;
2672
+ } ) ;
2673
+ } ) ;
2674
+
2657
2675
describe ( "when the caller is not the operator" , async ( ) => {
2658
2676
beforeEach ( async ( ) => {
2659
2677
subjectCaller = await getRandomAccount ( ) ;
@@ -3513,7 +3531,7 @@ describe("DeltaNeutralBasisTradingStrategyExtension", () => {
3513
3531
} ) ;
3514
3532
} ) ;
3515
3533
3516
- describe ( "when reinvestment amount is zero " , async ( ) => {
3534
+ describe ( "when reinvestment amount is below threshold " , async ( ) => {
3517
3535
beforeEach ( async ( ) => {
3518
3536
// Set oracle price above mark price to accrue negative funding
3519
3537
await perpV2Setup . setBaseTokenOraclePrice ( perpV2Setup . vETH , usdc ( 1020 ) ) ;
@@ -3828,7 +3846,7 @@ describe("DeltaNeutralBasisTradingStrategyExtension", () => {
3828
3846
} ) ;
3829
3847
} ) ;
3830
3848
3831
- describe ( "when reinvestment amount is zero " , async ( ) => {
3849
+ describe ( "when reinvestment amount is below threshold " , async ( ) => {
3832
3850
beforeEach ( async ( ) => {
3833
3851
// Set oracle price above mark price to accrue negative funding
3834
3852
await perpV2Setup . setBaseTokenOraclePrice ( perpV2Setup . vETH , usdc ( 1020 ) ) ;
0 commit comments