Skip to content

Commit 58208e2

Browse files
committed
fix: handling tickers
1 parent 0834a2c commit 58208e2

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

src/sdk/market/PriceOracleContract.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { Address, Hex } from "viem";
22
import { decodeFunctionData } from "viem";
33

4+
import type { NetworkType } from "../../../../sdk-gov/src/core/chains";
45
import {
56
iPriceFeedCompressorAbi,
67
iUpdatablePriceFeedAbi,
@@ -288,6 +289,11 @@ export class PriceOracleContract extends BaseContract<abi> {
288289
return [token as Address, true];
289290
}
290291
}
292+
// TODO: this is v3.0 legacy code, should be gone after full v.3.1 rollout
293+
const ticker = priceFeedToTicker[this.sdk.provider.networkType][priceFeed];
294+
if (ticker) {
295+
return [ticker, false];
296+
}
291297
throw new Error(`cannot find token for price feed ${priceFeed}`);
292298
}
293299

@@ -309,3 +315,35 @@ export class PriceOracleContract extends BaseContract<abi> {
309315
};
310316
}
311317
}
318+
319+
/**
320+
* Mapping for ticker price feeds PriceFeed -> TickerToken
321+
* This is v3.0 stuff, in v3.1 tickers are not added into price oracles
322+
*/
323+
const priceFeedToTicker: Record<NetworkType, Record<Address, Address>> = {
324+
Mainnet: {
325+
"0x6F13996411743d22566176482B6b677Ec4eb6cE6":
326+
"0x8C23b9E4CB9884e807294c4b4C33820333cC613c",
327+
"0xa7cB34Cd731486F61cfDb7ff5F6fC7B40537eD76":
328+
"0xFb56Fb16B4F33A875b01881Da7458E09D286208e",
329+
"0xcf1FDc8DC6e83B38729d58C117BE704bb2AC362a":
330+
"0xf08D818be34C82cB5e3f33AC78F8268828764F17",
331+
"0xE683362b8ebcbfd9332CBB79BfAF9fC42073C49b":
332+
"0xBdb778F566b6cEd70D3d329DD1D14E221fFe1ba5",
333+
"0xB72A69e2182bE87bda706B7Ff9A539AC78338C61":
334+
"0x7fF63E75F48aad6F4bE97E75C6421f348f19fE7F",
335+
"0xd7396fA3aFB9833293Ce2149EEb3Dbf5380B1e0D":
336+
"0xB0EA0EC3Fd4947348816f76768b3a56249d47EEc",
337+
},
338+
Arbitrum: {
339+
"0xcB44ADd611f75F03191f8f1A2e2AF7a0113eadd1":
340+
"0x07299E4E806e4253727084c0493fFDf6fB2dBa3D",
341+
"0x354A63F07A5c1605920794aFFF09963b6DF897a9":
342+
"0x15094B05e679c9B7fDde6FB8e6BDa930ff1D6a62",
343+
},
344+
Optimism: {
345+
"0xF23C91b1E3B7FD9174c82F7Fb2BD270C3CfcC3CE":
346+
"0x658f8e60c57ad62a9299ef6c7b1da9a0d1d1e681",
347+
},
348+
Base: {},
349+
};

0 commit comments

Comments
 (0)