You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/sdk/market/oracle/createPriceOracle.ts
+12-6Lines changed: 12 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,8 @@ import type { IPriceOracleContract } from "./types.js";
13
13
*
14
14
* So this method bridges multiple compressor data pieces and single oracle contract isntance
15
15
*
16
+
* @deprecated This will be removed when v300 is deprecated
17
+
*
16
18
* @param sdk
17
19
* @param data
18
20
* @param underlying
@@ -23,20 +25,24 @@ export function getOrCreatePriceOracle(
23
25
data: PriceOracleData,
24
26
): IPriceOracleContract{
25
27
const{ version, addr }=data.baseParams;
26
-
constexisting=sdk.getContract(addr);
27
28
28
29
letresult: IPriceOracleContract;
29
-
if(existing){
30
-
result=tryExtendExistingOracle(existing,data);
31
-
}elseif(isV300(version)){
32
-
result=newPriceOracleV300Contract(sdk,data);
30
+
letaction="created";
31
+
if(isV300(version)){
32
+
constexisting=sdk.getContract(addr);
33
+
if(existing){
34
+
result=tryExtendExistingOracle(existing,data);
35
+
action="extended";
36
+
}else{
37
+
result=newPriceOracleV300Contract(sdk,data);
38
+
}
33
39
}elseif(isV310(version)){
34
40
result=newPriceOracleV310Contract(sdk,data);
35
41
}else{
36
42
thrownewError(`Unsupported oracle version ${version}`);
37
43
}
38
44
sdk.logger?.debug(
39
-
`oracle ${addr} v${version} was ${existing ? "extended" : "created"} with ${result.mainPriceFeeds.size} main and ${result.reservePriceFeeds.size} reserve price feeds`,
45
+
`oracle ${addr} v${version} was ${action} with ${result.mainPriceFeeds.size} main and ${result.reservePriceFeeds.size} reserve price feeds`,
0 commit comments