@@ -46,7 +46,7 @@ describe("FeePolicy", function () {
4646 expect ( f2 [ 2 ] ) . to . eq ( toPerc ( "1.5" ) ) ;
4747 expect ( f2 [ 3 ] ) . to . eq ( toPerc ( "0.25" ) ) ;
4848
49- const drEq = await feePolicy . drEqZone ( ) ;
49+ const drEq = await feePolicy . equilibriumDR ( ) ;
5050 expect ( drEq [ 0 ] ) . to . eq ( toPerc ( "0.95" ) ) ;
5151 expect ( drEq [ 1 ] ) . to . eq ( toPerc ( "1.05" ) ) ;
5252
@@ -91,6 +91,42 @@ describe("FeePolicy", function () {
9191 } ) ;
9292 } ) ;
9393
94+ describe ( "#updateEquilibriumDR" , function ( ) {
95+ describe ( "when triggered by non-owner" , function ( ) {
96+ it ( "should revert" , async function ( ) {
97+ await expect (
98+ feePolicy . connect ( otherUser ) . updateEquilibriumDR ( [ toPerc ( "0.9" ) , toPerc ( "1.1" ) ] ) ,
99+ ) . to . be . revertedWith ( "Ownable: caller is not the owner" ) ;
100+ } ) ;
101+ } ) ;
102+
103+ describe ( "when range is invalid" , function ( ) {
104+ it ( "should revert" , async function ( ) {
105+ await expect ( feePolicy . updateEquilibriumDR ( [ toPerc ( "1.2" ) , toPerc ( "1.1" ) ] ) ) . to . be . revertedWithCustomError (
106+ feePolicy ,
107+ "InvalidRange" ,
108+ ) ;
109+ await expect ( feePolicy . updateEquilibriumDR ( [ toPerc ( "1.01" ) , toPerc ( "1.1" ) ] ) ) . to . be . revertedWithCustomError (
110+ feePolicy ,
111+ "InvalidRange" ,
112+ ) ;
113+ await expect ( feePolicy . updateEquilibriumDR ( [ toPerc ( "0.9" ) , toPerc ( "0.99" ) ] ) ) . to . be . revertedWithCustomError (
114+ feePolicy ,
115+ "InvalidRange" ,
116+ ) ;
117+ } ) ;
118+ } ) ;
119+
120+ describe ( "when triggered by owner" , function ( ) {
121+ it ( "should update the target sr" , async function ( ) {
122+ await feePolicy . connect ( deployer ) . updateEquilibriumDR ( [ toPerc ( "0.9" ) , toPerc ( "1.1" ) ] ) ;
123+ const eq = await feePolicy . equilibriumDR ( ) ;
124+ expect ( eq [ 0 ] ) . to . eq ( toPerc ( "0.9" ) ) ;
125+ expect ( eq [ 1 ] ) . to . eq ( toPerc ( "1.1" ) ) ;
126+ } ) ;
127+ } ) ;
128+ } ) ;
129+
94130 describe ( "#updateFees" , function ( ) {
95131 const VALID_DOWN = toLine ( "0.0" , "1.0" , "0.99" , "0.0" ) ;
96132 const VALID_UP = toLine ( "1.01" , "0.0" , "2.0" , "1.0" ) ;
@@ -333,7 +369,7 @@ describe("FeePolicy", function () {
333369
334370 describe ( "when deviation is within eq range" , function ( ) {
335371 it ( "should compute rebalance data" , async function ( ) {
336- await feePolicy . updateFees ( toLine ( "0" , "0 .5", "0.5" , "0" ) , toLine ( "2" , "0" , "10" , "0.5" ) ) ;
372+ await feePolicy . updateEquilibriumDR ( [ toPerc ( "0.5" ) , toPerc ( "2" ) ] ) ;
337373 const r1 = await feePolicy . computeRebalanceAmount ( {
338374 perpTVL : toAmt ( "120" ) ,
339375 vaultTVL : toAmt ( "500" ) ,
0 commit comments