@@ -10,14 +10,9 @@ describe("SpotCDRPricer", function () {
1010 const accounts = await ethers . getSigners ( ) ;
1111 const deployer = accounts [ 0 ] ;
1212
13- const amplTargetOracle = new DMock ( "MedianOracle" ) ;
14- await amplTargetOracle . deploy ( ) ;
15- await amplTargetOracle . mockMethod ( "getData()" , [ priceFP ( "1.15" ) , true ] ) ;
16- await amplTargetOracle . mockMethod ( "DECIMALS()" , [ 18 ] ) ;
17-
18- const policy = new DMock ( "UFragmentsPolicy" ) ;
13+ const policy = new DMock ( "IAmpleforth" ) ;
1914 await policy . deploy ( ) ;
20- await policy . mockMethod ( "cpiOracle ()" , [ amplTargetOracle . target ] ) ;
15+ await policy . mockMethod ( "getTargetRate ()" , [ priceFP ( "1.15" ) , true ] ) ;
2116
2217 const ampl = new DMock ( "UFragments" ) ;
2318 await ampl . deploy ( ) ;
@@ -42,30 +37,26 @@ describe("SpotCDRPricer", function () {
4237 ] ) ;
4338
4439 const SpotCDRPricer = await ethers . getContractFactory ( "SpotCDRPricer" ) ;
45- const strategy = await SpotCDRPricer . deploy (
46- spot . target ,
47- usdPriceOrcle . target ,
48- amplTargetOracle . target ,
49- ) ;
40+ const strategy = await SpotCDRPricer . deploy ( spot . target , usdPriceOrcle . target ) ;
5041 return {
5142 deployer,
5243 ampl,
5344 spot,
5445 usdPriceOrcle,
55- amplTargetOracle ,
46+ policy ,
5647 strategy,
5748 } ;
5849 }
5950
6051 describe ( "init" , function ( ) {
6152 it ( "should initial params" , async function ( ) {
62- const { strategy, ampl, spot, usdPriceOrcle, amplTargetOracle } = await loadFixture (
53+ const { strategy, ampl, spot, usdPriceOrcle, policy } = await loadFixture (
6354 setupContracts ,
6455 ) ;
6556 expect ( await strategy . AMPL ( ) ) . to . eq ( ampl . target ) ;
6657 expect ( await strategy . SPOT ( ) ) . to . eq ( spot . target ) ;
6758 expect ( await strategy . USD_ORACLE ( ) ) . to . eq ( usdPriceOrcle . target ) ;
68- expect ( await strategy . AMPL_CPI_ORACLE ( ) ) . to . eq ( amplTargetOracle . target ) ;
59+ expect ( await strategy . AMPLEFORTH_POLICY ( ) ) . to . eq ( policy . target ) ;
6960 expect ( await strategy . decimals ( ) ) . to . eq ( 18 ) ;
7061 } ) ;
7162 } ) ;
@@ -130,8 +121,8 @@ describe("SpotCDRPricer", function () {
130121 describe ( "#perpPrice" , function ( ) {
131122 describe ( "when AMPL target data is invalid" , function ( ) {
132123 it ( "should return invalid" , async function ( ) {
133- const { strategy, amplTargetOracle } = await loadFixture ( setupContracts ) ;
134- await amplTargetOracle . mockMethod ( "getData ()" , [ priceFP ( "1.2" ) , false ] ) ;
124+ const { strategy, policy } = await loadFixture ( setupContracts ) ;
125+ await policy . mockMethod ( "getTargetRate ()" , [ priceFP ( "1.2" ) , false ] ) ;
135126 const p = await strategy . perpPrice . staticCall ( ) ;
136127 expect ( p [ 0 ] ) . to . eq ( priceFP ( "1.2" ) ) ;
137128 expect ( p [ 1 ] ) . to . eq ( false ) ;
0 commit comments