@@ -30,12 +30,14 @@ import {MkrAuthority} from "mkr-authority/MkrAuthority.sol";
3030import {IlkRegistry} from "ilk-registry/IlkRegistry.sol " ;
3131import {ClipperMom} from "clipper-mom/ClipperMom.sol " ;
3232import {Median} from "median/median.sol " ;
33- import {OSM} from "osm/osm.sol " ;
33+ import {OSM} from 'osm/osm.sol ' ;
34+ import {OsmAbstract,
35+ LerpAbstract} from "dss-interfaces/Interfaces.sol " ;
3436import {UNIV2LPOracle} from "univ2-lp-oracle/UNIV2LPOracle.sol " ;
35- import {OsmAbstract} from "dss-interfaces/Interfaces.sol " ;
3637import {DSProxyFactory,
3738 DSProxy} from "ds-proxy/proxy.sol " ;
3839import {DssAutoLine} from "dss-auto-line/DssAutoLine.sol " ;
40+ import {LerpFactory} from "dss-lerp/LerpFactory.sol " ;
3941
4042import {Vat} from "dss/vat.sol " ;
4143import {Dog} from "dss/dog.sol " ;
@@ -95,6 +97,7 @@ contract ActionTest is DSTest {
9597 ClipperMom clipperMom;
9698 MkrAuthority govGuard;
9799 DssAutoLine autoLine;
100+ LerpFactory lerpFab;
98101
99102 ChainLog clog;
100103
@@ -272,6 +275,8 @@ contract ActionTest is DSTest {
272275 autoLine = new DssAutoLine (address (vat));
273276 vat.rely (address (autoLine));
274277
278+ lerpFab = new LerpFactory ();
279+
275280 median = new Median ();
276281
277282 hevm.store (
@@ -297,6 +302,7 @@ contract ActionTest is DSTest {
297302 clog.setAddress ("GOV_GUARD " , address (govGuard));
298303 clog.setAddress ("CLIPPER_MOM " , address (clipperMom));
299304 clog.setAddress ("MCD_IAM_AUTO_LINE " , address (autoLine));
305+ clog.setAddress ("LERP_FAB " , address (lerpFab));
300306
301307 action = new DssTestAction ();
302308
@@ -315,6 +321,7 @@ contract ActionTest is DSTest {
315321 median.rely (address (action));
316322 clog.rely (address (action));
317323 autoLine.rely (address (action));
324+ lerpFab.rely (address (action));
318325
319326 clipperMom.setOwner (address (action));
320327 osmMom.setOwner (address (action));
@@ -1038,14 +1045,12 @@ contract ActionTest is DSTest {
10381045 function test_addNewCollateral_case6 () public {
10391046 collateralOnboardingTest (false , false , false ); // Liquidations: OFF, PIP != OSM, osmSrc != median
10401047 }
1041-
10421048 function test_officeHoursCanOverrideInAction () public {
10431049 DssTestNoOfficeHoursAction actionNoOfficeHours = new DssTestNoOfficeHoursAction ();
10441050 actionNoOfficeHours.execute ();
10451051 assertTrue (! actionNoOfficeHours.officeHours ());
10461052 }
10471053
1048-
10491054 /***************/
10501055 /*** Payment ***/
10511056 /***************/
@@ -1067,4 +1072,35 @@ contract ActionTest is DSTest {
10671072 assertEq (vat.dai (address (vow)), 0 );
10681073 assertEq (vat.sin (address (vow)), 100 * RAD);
10691074 }
1075+
1076+ /************/
1077+ /*** Misc ***/
1078+ /************/
1079+
1080+ function test_lerp_Line () public {
1081+ LerpAbstract lerp = LerpAbstract (action.linearInterpolation_test ("myLerp001 " , address (vat), "Line " , block .timestamp , rad (2400 ether), rad (0 ether), 1 days));
1082+ assertEq (lerp.what (), "Line " );
1083+ assertEq (lerp.start (), rad (2400 ether));
1084+ assertEq (lerp.end (), rad (0 ether));
1085+ assertEq (lerp.duration (), 1 days);
1086+ assertTrue (! lerp.done ());
1087+ assertEq (lerp.startTime (), block .timestamp );
1088+ assertEq (vat.Line (), rad (2400 ether));
1089+ hevm.warp (now + 1 hours);
1090+ assertEq (vat.Line (), rad (2400 ether));
1091+ lerp.tick ();
1092+ assertEq (vat.Line (), rad (2300 ether + 1600 )); // Small amount at the end is rounding errors
1093+ hevm.warp (now + 1 hours);
1094+ lerp.tick ();
1095+ assertEq (vat.Line (), rad (2200 ether + 800 ));
1096+ hevm.warp (now + 6 hours);
1097+ lerp.tick ();
1098+ assertEq (vat.Line (), rad (1600 ether + 800 ));
1099+ hevm.warp (now + 1 days);
1100+ assertEq (vat.Line (), rad (1600 ether + 800 ));
1101+ lerp.tick ();
1102+ assertEq (vat.Line (), rad (0 ether));
1103+ assertTrue (lerp.done ());
1104+ assertEq (vat.wards (address (lerp)), 0 );
1105+ }
10701106}
0 commit comments