@gearbox-protocol/sdk 16.6.1 → 16.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/onchain/OnchainSDK.js +3 -3
- package/dist/cjs/onchain/index.js +49 -38
- package/dist/cjs/onchain/market/index.js +49 -38
- package/dist/cjs/onchain/market/oracle/PriceOracleBaseContract.js +3 -3
- package/dist/cjs/onchain/market/pricefeeds/AbstractPriceFeed.js +0 -5
- package/dist/cjs/onchain/market/pricefeeds/PriceFeedRegistry.js +127 -0
- package/dist/cjs/onchain/market/pricefeeds/{BalancerStablePriceFeed.js → feeds/BalancerStablePriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{BalancerWeightedPriceFeed.js → feeds/BalancerWeightedPriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{BoundedPriceFeed.js → feeds/BoundedPriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{CompositePriceFeed.js → feeds/CompositePriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{ConstantPriceFeed.js → feeds/ConstantPriceFeed.js} +3 -3
- package/dist/cjs/onchain/market/pricefeeds/{CurveCryptoPriceFeed.js → feeds/CurveCryptoPriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{CurveStablePriceFeed.js → feeds/CurveStablePriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{CurveUSDPriceFeed.js → feeds/CurveUSDPriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{Erc4626PriceFeed.js → feeds/Erc4626PriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{ExternalPriceFeed.js → feeds/ExternalPriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{MellowLRTPriceFeed.js → feeds/MellowLRTPriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{PendleTWAPPTPriceFeed.js → feeds/PendleTWAPPTPriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{PythPriceFeed.js → feeds/PythPriceFeed.js} +3 -3
- package/dist/cjs/onchain/market/pricefeeds/{RedstonePriceFeed.js → feeds/RedstonePriceFeed.js} +6 -6
- package/dist/cjs/onchain/market/pricefeeds/{WstETHPriceFeed.js → feeds/WstETHPriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{YearnPriceFeed.js → feeds/YearnPriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/{ZeroPriceFeed.js → feeds/ZeroPriceFeed.js} +4 -4
- package/dist/cjs/onchain/market/pricefeeds/feeds/index.js +35 -0
- package/dist/cjs/onchain/market/pricefeeds/index.js +51 -39
- package/dist/cjs/onchain/market/pricefeeds/updates/UpdatablePriceFeedRegistry.js +189 -0
- package/dist/cjs/onchain/market/pricefeeds/{getRawPriceUpdates.js → updates/getRawPriceUpdates.js} +2 -2
- package/dist/cjs/onchain/market/pricefeeds/updates/index.js +8 -0
- package/dist/cjs/onchain/market/pricefeeds/{isUpdatablePriceFeed.js → updates/isUpdatablePriceFeed.js} +1 -1
- package/dist/cjs/onchain/market/pricefeeds/updates/updatableDependencies.js +14 -0
- package/dist/cjs/permissionless/utils/price-update/get-price-update-tx.js +2 -2
- package/dist/cjs/permissionless/utils/price-update/get-updatable-feeds.js +2 -2
- package/dist/esm/onchain/OnchainSDK.js +3 -3
- package/dist/esm/onchain/index.js +25 -20
- package/dist/esm/onchain/market/index.js +25 -20
- package/dist/esm/onchain/market/oracle/PriceOracleBaseContract.js +1 -1
- package/dist/esm/onchain/market/pricefeeds/AbstractPriceFeed.js +0 -5
- package/dist/esm/onchain/market/pricefeeds/PriceFeedRegistry.js +126 -0
- package/dist/esm/onchain/market/pricefeeds/{BalancerStablePriceFeed.js → feeds/BalancerStablePriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{BalancerWeightedPriceFeed.js → feeds/BalancerWeightedPriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{BoundedPriceFeed.js → feeds/BoundedPriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{CompositePriceFeed.js → feeds/CompositePriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{ConstantPriceFeed.js → feeds/ConstantPriceFeed.js} +3 -3
- package/dist/esm/onchain/market/pricefeeds/{CurveCryptoPriceFeed.js → feeds/CurveCryptoPriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{CurveStablePriceFeed.js → feeds/CurveStablePriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{CurveUSDPriceFeed.js → feeds/CurveUSDPriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{Erc4626PriceFeed.js → feeds/Erc4626PriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{ExternalPriceFeed.js → feeds/ExternalPriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{MellowLRTPriceFeed.js → feeds/MellowLRTPriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{PendleTWAPPTPriceFeed.js → feeds/PendleTWAPPTPriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{PythPriceFeed.js → feeds/PythPriceFeed.js} +3 -3
- package/dist/esm/onchain/market/pricefeeds/{RedstonePriceFeed.js → feeds/RedstonePriceFeed.js} +6 -6
- package/dist/esm/onchain/market/pricefeeds/{WstETHPriceFeed.js → feeds/WstETHPriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{YearnPriceFeed.js → feeds/YearnPriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/{ZeroPriceFeed.js → feeds/ZeroPriceFeed.js} +4 -4
- package/dist/esm/onchain/market/pricefeeds/feeds/index.js +18 -0
- package/dist/esm/onchain/market/pricefeeds/index.js +27 -21
- package/dist/esm/onchain/market/pricefeeds/updates/UpdatablePriceFeedRegistry.js +188 -0
- package/dist/esm/onchain/market/pricefeeds/{getRawPriceUpdates.js → updates/getRawPriceUpdates.js} +2 -2
- package/dist/esm/onchain/market/pricefeeds/updates/index.js +5 -1
- package/dist/esm/onchain/market/pricefeeds/{isUpdatablePriceFeed.js → updates/isUpdatablePriceFeed.js} +1 -1
- package/dist/esm/onchain/market/pricefeeds/updates/updatableDependencies.js +13 -0
- package/dist/esm/permissionless/utils/price-update/get-price-update-tx.js +1 -1
- package/dist/esm/permissionless/utils/price-update/get-updatable-feeds.js +1 -1
- package/dist/types/onchain/OnchainSDK.d.ts +2 -2
- package/dist/types/onchain/index.d.ts +27 -22
- package/dist/types/onchain/market/index.d.ts +27 -22
- package/dist/types/onchain/market/oracle/PriceOracleBaseContract.d.ts +2 -1
- package/dist/types/onchain/market/oracle/types.d.ts +2 -1
- package/dist/types/onchain/market/pricefeeds/AbstractPriceFeed.d.ts +1 -2
- package/dist/types/onchain/market/pricefeeds/PriceFeedRegistry.d.ts +60 -0
- package/dist/types/onchain/market/pricefeeds/feeds/BalancerStablePriceFeed.d.ts +12 -0
- package/dist/types/onchain/market/pricefeeds/{BalancerWeightedPriceFeed.d.ts → feeds/BalancerWeightedPriceFeed.d.ts} +7 -7
- package/dist/types/onchain/market/pricefeeds/feeds/BoundedPriceFeed.d.ts +15 -0
- package/dist/types/onchain/market/pricefeeds/{CompositePriceFeed.d.ts → feeds/CompositePriceFeed.d.ts} +6 -6
- package/dist/types/onchain/market/pricefeeds/{ConstantPriceFeed.d.ts → feeds/ConstantPriceFeed.d.ts} +6 -6
- package/dist/types/onchain/market/pricefeeds/feeds/CurveCryptoPriceFeed.d.ts +12 -0
- package/dist/types/onchain/market/pricefeeds/feeds/CurveStablePriceFeed.d.ts +12 -0
- package/dist/types/onchain/market/pricefeeds/feeds/CurveUSDPriceFeed.d.ts +12 -0
- package/dist/types/onchain/market/pricefeeds/feeds/Erc4626PriceFeed.d.ts +12 -0
- package/dist/types/onchain/market/pricefeeds/feeds/ExternalPriceFeed.d.ts +11 -0
- package/dist/types/onchain/market/pricefeeds/feeds/MellowLRTPriceFeed.d.ts +12 -0
- package/dist/types/onchain/market/pricefeeds/{PendleTWAPPTPriceFeed.d.ts → feeds/PendleTWAPPTPriceFeed.d.ts} +3 -3
- package/dist/types/onchain/market/pricefeeds/{PythPriceFeed.d.ts → feeds/PythPriceFeed.d.ts} +3 -3
- package/dist/types/onchain/market/pricefeeds/{RedstonePriceFeed.d.ts → feeds/RedstonePriceFeed.d.ts} +9 -9
- package/dist/types/onchain/market/pricefeeds/feeds/WstETHPriceFeed.d.ts +12 -0
- package/dist/types/onchain/market/pricefeeds/feeds/YearnPriceFeed.d.ts +12 -0
- package/dist/types/onchain/market/pricefeeds/feeds/ZeroPriceFeed.d.ts +11 -0
- package/dist/types/onchain/market/pricefeeds/feeds/index.d.ts +18 -0
- package/dist/types/onchain/market/pricefeeds/index.d.ts +28 -22
- package/dist/types/onchain/market/pricefeeds/types.d.ts +1 -31
- package/dist/types/onchain/market/pricefeeds/updates/RedstoneUpdater.d.ts +1 -1
- package/dist/types/onchain/market/pricefeeds/updates/UpdatablePriceFeedRegistry.d.ts +106 -0
- package/dist/types/onchain/market/pricefeeds/updates/getRawPriceUpdates.d.ts +6 -0
- package/dist/types/onchain/market/pricefeeds/updates/index.d.ts +7 -3
- package/dist/types/onchain/market/pricefeeds/updates/isUpdatablePriceFeed.d.ts +6 -0
- package/dist/types/onchain/market/pricefeeds/updates/types.d.ts +56 -2
- package/dist/types/onchain/market/pricefeeds/updates/updatableDependencies.d.ts +10 -0
- package/package.json +1 -1
- package/dist/cjs/onchain/market/pricefeeds/PriceFeedsRegister.js +0 -301
- package/dist/esm/onchain/market/pricefeeds/PriceFeedsRegister.js +0 -300
- package/dist/types/onchain/market/pricefeeds/BalancerStablePriceFeed.d.ts +0 -12
- package/dist/types/onchain/market/pricefeeds/BoundedPriceFeed.d.ts +0 -15
- package/dist/types/onchain/market/pricefeeds/CurveCryptoPriceFeed.d.ts +0 -12
- package/dist/types/onchain/market/pricefeeds/CurveStablePriceFeed.d.ts +0 -12
- package/dist/types/onchain/market/pricefeeds/CurveUSDPriceFeed.d.ts +0 -12
- package/dist/types/onchain/market/pricefeeds/Erc4626PriceFeed.d.ts +0 -12
- package/dist/types/onchain/market/pricefeeds/ExternalPriceFeed.d.ts +0 -11
- package/dist/types/onchain/market/pricefeeds/MellowLRTPriceFeed.d.ts +0 -12
- package/dist/types/onchain/market/pricefeeds/PriceFeedsRegister.d.ts +0 -180
- package/dist/types/onchain/market/pricefeeds/WstETHPriceFeed.d.ts +0 -12
- package/dist/types/onchain/market/pricefeeds/YearnPriceFeed.d.ts +0 -12
- package/dist/types/onchain/market/pricefeeds/ZeroPriceFeed.d.ts +0 -11
- package/dist/types/onchain/market/pricefeeds/getRawPriceUpdates.d.ts +0 -5
- package/dist/types/onchain/market/pricefeeds/isUpdatablePriceFeed.d.ts +0 -5
|
@@ -1,300 +0,0 @@
|
|
|
1
|
-
import { AddressMap } from "../../utils/AddressMap.js";
|
|
2
|
-
import { bytes32ToString } from "../../utils/bytes32ToString.js";
|
|
3
|
-
import { createRawTx } from "../../utils/createRawTx.js";
|
|
4
|
-
import { AP_PRICE_FEED_COMPRESSOR, AP_PRICE_FEED_STORE } from "../../constants/address-provider.js";
|
|
5
|
-
import { ADDRESS_0X0 } from "../../constants/addresses.js";
|
|
6
|
-
import { VERSION_RANGE_310 } from "../../constants/versions.js";
|
|
7
|
-
import "../../constants/index.js";
|
|
8
|
-
import "../../utils/index.js";
|
|
9
|
-
import { SDKConstruct } from "../../base/SDKConstruct.js";
|
|
10
|
-
import "../../base/index.js";
|
|
11
|
-
import { priceFeedCompressorAbi } from "../../../abi/compressors/priceFeedCompressor.js";
|
|
12
|
-
import { PartialPriceFeedInitError } from "./AbstractPriceFeed.js";
|
|
13
|
-
import { BalancerStablePriceFeedContract } from "./BalancerStablePriceFeed.js";
|
|
14
|
-
import { BalancerWeightedPriceFeedContract } from "./BalancerWeightedPriceFeed.js";
|
|
15
|
-
import { BoundedPriceFeedContract } from "./BoundedPriceFeed.js";
|
|
16
|
-
import { CompositePriceFeedContract } from "./CompositePriceFeed.js";
|
|
17
|
-
import { CurveCryptoPriceFeedContract } from "./CurveCryptoPriceFeed.js";
|
|
18
|
-
import { CurveStablePriceFeedContract } from "./CurveStablePriceFeed.js";
|
|
19
|
-
import { CurveUSDPriceFeedContract } from "./CurveUSDPriceFeed.js";
|
|
20
|
-
import { Erc4626PriceFeedContract } from "./Erc4626PriceFeed.js";
|
|
21
|
-
import { ExternalPriceFeedContract } from "./ExternalPriceFeed.js";
|
|
22
|
-
import { getRawPriceUpdates } from "./getRawPriceUpdates.js";
|
|
23
|
-
import { MellowLRTPriceFeedContract } from "./MellowLRTPriceFeed.js";
|
|
24
|
-
import { PendleTWAPPTPriceFeed } from "./PendleTWAPPTPriceFeed.js";
|
|
25
|
-
import { Hooks } from "../../utils/internal/Hooks.js";
|
|
26
|
-
import "../../utils/internal/index.js";
|
|
27
|
-
import { ConstantPriceFeedContract } from "./ConstantPriceFeed.js";
|
|
28
|
-
import { PythPriceFeed } from "./PythPriceFeed.js";
|
|
29
|
-
import { RedstonePriceFeedContract } from "./RedstonePriceFeed.js";
|
|
30
|
-
import { RedstoneUpdater } from "./updates/RedstoneUpdater.js";
|
|
31
|
-
import "./updates/index.js";
|
|
32
|
-
import { WstETHPriceFeedContract } from "./WstETHPriceFeed.js";
|
|
33
|
-
import { YearnPriceFeedContract } from "./YearnPriceFeed.js";
|
|
34
|
-
import { ZeroPriceFeedContract } from "./ZeroPriceFeed.js";
|
|
35
|
-
import { parseAbi } from "viem";
|
|
36
|
-
//#region src/onchain/market/pricefeeds/PriceFeedsRegister.ts
|
|
37
|
-
/**
|
|
38
|
-
* Chain-level cache of price feed contract instances.
|
|
39
|
-
*
|
|
40
|
-
* All {@link IPriceOracleContract}s across different markets share a single
|
|
41
|
-
* `PriceFeedRegister`, avoiding duplicate contract wrappers for the same
|
|
42
|
-
* on-chain feed. The register also orchestrates off-chain price updates
|
|
43
|
-
* (Redstone, etc.).
|
|
44
|
-
**/
|
|
45
|
-
var PriceFeedRegister = class extends SDKConstruct {
|
|
46
|
-
#hooks = new Hooks();
|
|
47
|
-
#updaters;
|
|
48
|
-
#feeds = new AddressMap(void 0, "priceFeeds");
|
|
49
|
-
#latestUpdate;
|
|
50
|
-
constructor(sdk, opts = {}) {
|
|
51
|
-
super(sdk);
|
|
52
|
-
this.#updaters = [new RedstoneUpdater(sdk, opts?.redstone)];
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* @internal
|
|
56
|
-
* Registers a callback for price-feed register lifecycle events.
|
|
57
|
-
* @param event - Event name.
|
|
58
|
-
* @param handler - Callback to invoke.
|
|
59
|
-
**/
|
|
60
|
-
addHook = this.#hooks.addHook.bind(this.#hooks);
|
|
61
|
-
/**
|
|
62
|
-
* @internal
|
|
63
|
-
* Removes a previously registered hook.
|
|
64
|
-
* @param event - Event name.
|
|
65
|
-
* @param handler - Callback to remove.
|
|
66
|
-
**/
|
|
67
|
-
removeHook = this.#hooks.removeHook.bind(this.#hooks);
|
|
68
|
-
/**
|
|
69
|
-
* Returns all price feeds known to sdk
|
|
70
|
-
*/
|
|
71
|
-
get feeds() {
|
|
72
|
-
return this.#feeds.values();
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Generates transactions to push fresh off-chain prices to updatable feeds.
|
|
76
|
-
*
|
|
77
|
-
* @param priceFeeds - Top-level price feeds whose updatable dependencies
|
|
78
|
-
* will be resolved, or a filter (`{ main: true }` / `{ reserve: true }`)
|
|
79
|
-
* to gather feeds from all oracles. When omitted, all registered feeds
|
|
80
|
-
* are used.
|
|
81
|
-
**/
|
|
82
|
-
async generatePriceFeedsUpdateTxs(priceFeeds) {
|
|
83
|
-
let updateables = this.#feeds.values();
|
|
84
|
-
let filterRemark = "";
|
|
85
|
-
if (priceFeeds) {
|
|
86
|
-
if (Array.isArray(priceFeeds)) updateables = priceFeeds.flatMap((pf) => pf.updatableDependencies());
|
|
87
|
-
else if ("main" in priceFeeds && priceFeeds.main) {
|
|
88
|
-
filterRemark = " main";
|
|
89
|
-
updateables = this.sdk.marketRegister.priceOracles.flatMap((o) => o.mainPriceFeeds.values()).flatMap((pf) => pf.priceFeed.updatableDependencies());
|
|
90
|
-
} else if ("reserve" in priceFeeds && priceFeeds.reserve) {
|
|
91
|
-
filterRemark = " reserve";
|
|
92
|
-
updateables = this.sdk.marketRegister.priceOracles.flatMap((o) => o.reservePriceFeeds.values()).flatMap((pf) => pf.priceFeed.updatableDependencies());
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
if (updateables.length === 0) return {
|
|
96
|
-
txs: [],
|
|
97
|
-
timestamp: 0
|
|
98
|
-
};
|
|
99
|
-
const txs = [];
|
|
100
|
-
const latestUpdate = {
|
|
101
|
-
updates: [],
|
|
102
|
-
timestamp: Math.floor(Date.now() / 1e3)
|
|
103
|
-
};
|
|
104
|
-
const updates = (await Promise.all(this.#updaters.map((u) => u.getUpdateTxs(updateables).catch(() => [])))).flat();
|
|
105
|
-
let maxTimestamp = 0;
|
|
106
|
-
for (const tx of updates) {
|
|
107
|
-
const { data } = tx;
|
|
108
|
-
const { timestamp } = data;
|
|
109
|
-
if (timestamp > maxTimestamp) maxTimestamp = timestamp;
|
|
110
|
-
txs.push(tx);
|
|
111
|
-
latestUpdate.updates.push(data);
|
|
112
|
-
}
|
|
113
|
-
txs.sort((a, b) => a.raw.to.toLowerCase().localeCompare(b.raw.to.toLowerCase()));
|
|
114
|
-
const result = {
|
|
115
|
-
txs,
|
|
116
|
-
timestamp: maxTimestamp
|
|
117
|
-
};
|
|
118
|
-
const tsDelta = BigInt(maxTimestamp) - this.sdk.timestamp;
|
|
119
|
-
this.logger?.debug(`generated ${txs.length}${filterRemark} price feed update transactions, timestamp: ${maxTimestamp} (delta ${tsDelta})`);
|
|
120
|
-
if (txs.length) await this.#hooks.triggerHooks("updatesGenerated", result);
|
|
121
|
-
this.#latestUpdate = latestUpdate;
|
|
122
|
-
return result;
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Similar to {@link generatePriceFeedsUpdateTxs}, but returns raw structures instead of transactions
|
|
126
|
-
* @param priceFeeds
|
|
127
|
-
* @returns
|
|
128
|
-
*/
|
|
129
|
-
async generatePriceFeedsUpdates(priceFeeds) {
|
|
130
|
-
const updates = await this.generatePriceFeedsUpdateTxs(priceFeeds);
|
|
131
|
-
return getRawPriceUpdates(updates);
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Similar to {@link generatePriceFeedsUpdates}, but returns raw transaction to PriceFeedStore.updatePrices
|
|
135
|
-
* @param priceFeeds
|
|
136
|
-
* @returns
|
|
137
|
-
*/
|
|
138
|
-
async getPriceFeedStoreUpdateTx(priceFeeds) {
|
|
139
|
-
const pfs = this.sdk.addressProvider.getAddress(AP_PRICE_FEED_STORE);
|
|
140
|
-
const updates = await this.generatePriceFeedsUpdates(priceFeeds);
|
|
141
|
-
return createRawTx(pfs, {
|
|
142
|
-
abi: parseAbi(["function updatePrices((address,bytes)[])"]),
|
|
143
|
-
functionName: "updatePrices",
|
|
144
|
-
args: [updates.map((u) => [u.priceFeed, u.data])]
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Similar to {@link generatePriceFeedsUpdateTxs}, but will generate necessary price update transactions for external price feeds (not known to sdk)
|
|
149
|
-
* This does not add feeds to this register, so they won't be implicitly included in future generatePriceFeedsUpdateTxs calls
|
|
150
|
-
* @param feeds
|
|
151
|
-
* @param block
|
|
152
|
-
* @returns
|
|
153
|
-
*/
|
|
154
|
-
async generateExternalPriceFeedsUpdateTxs(feeds, block) {
|
|
155
|
-
const [priceFeedCompressorAddress] = this.sdk.addressProvider.mustGetLatest(AP_PRICE_FEED_COMPRESSOR, VERSION_RANGE_310);
|
|
156
|
-
const blockParam = block ?? { blockNumber: this.sdk.currentBlock };
|
|
157
|
-
const feedContracts = (await this.client.readContract({
|
|
158
|
-
address: priceFeedCompressorAddress,
|
|
159
|
-
abi: priceFeedCompressorAbi,
|
|
160
|
-
functionName: "loadPriceFeedTree",
|
|
161
|
-
args: [feeds],
|
|
162
|
-
...blockParam,
|
|
163
|
-
gas: this.sdk.gasLimit
|
|
164
|
-
})).map((data) => this.#createUpdatableProxy(data));
|
|
165
|
-
return this.generatePriceFeedsUpdateTxs(feedContracts);
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Similar to {@link generateExternalPriceFeedsUpdateTxs}, but returns raw structures instead of transactions
|
|
169
|
-
* @param feeds
|
|
170
|
-
* @param block
|
|
171
|
-
* @returns
|
|
172
|
-
*/
|
|
173
|
-
async generateExternalPriceFeedsUpdates(feeds, block) {
|
|
174
|
-
const updates = await this.generateExternalPriceFeedsUpdateTxs(feeds, block);
|
|
175
|
-
return getRawPriceUpdates(updates);
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Checks whether a price feed is already registered at the given address.
|
|
179
|
-
* @param address - On-chain address to look up.
|
|
180
|
-
**/
|
|
181
|
-
has(address) {
|
|
182
|
-
return this.#feeds.has(address);
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Returns the cached price feed contract at the given address.
|
|
186
|
-
* @param address - On-chain address to look up.
|
|
187
|
-
* @throws If no feed is registered at that address.
|
|
188
|
-
**/
|
|
189
|
-
mustGet(address) {
|
|
190
|
-
return this.#feeds.mustGet(address);
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Inserts or updates a price feed from a full tree node.
|
|
194
|
-
*
|
|
195
|
-
* If a fully loaded feed already exists at the same address, only the
|
|
196
|
-
* answer is refreshed. Otherwise a new contract wrapper is created and
|
|
197
|
-
* cached.
|
|
198
|
-
*
|
|
199
|
-
* @param data - Full price feed tree node from the compressor.
|
|
200
|
-
* @returns The cached (or newly created) feed instance.
|
|
201
|
-
* @throws If the created feed is only partially initialized.
|
|
202
|
-
**/
|
|
203
|
-
upsert(data) {
|
|
204
|
-
const existing = this.#feeds.get(data.baseParams.addr);
|
|
205
|
-
if (existing?.loaded) {
|
|
206
|
-
existing.updateAnswer(data.answer);
|
|
207
|
-
return existing;
|
|
208
|
-
}
|
|
209
|
-
const feed = this.create(data);
|
|
210
|
-
if (!feed.loaded) throw new PartialPriceFeedInitError({
|
|
211
|
-
...data,
|
|
212
|
-
abi: [],
|
|
213
|
-
name: ""
|
|
214
|
-
});
|
|
215
|
-
this.#feeds.upsert(data.baseParams.addr, feed);
|
|
216
|
-
return feed;
|
|
217
|
-
}
|
|
218
|
-
/**
|
|
219
|
-
* Loads PARTIAL information about all updatable price feeds from MarketCompressor
|
|
220
|
-
* Discovered price feeds are not saved anywhere in PriceFeedRegister, and can later be used to load price feed updates
|
|
221
|
-
*/
|
|
222
|
-
async getPartialUpdatablePriceFeeds(configurators) {
|
|
223
|
-
const [priceFeedCompressorAddress] = this.sdk.addressProvider.mustGetLatest(AP_PRICE_FEED_COMPRESSOR, VERSION_RANGE_310);
|
|
224
|
-
this.logger?.debug({ configurators }, `calling getUpdatablePriceFeeds in block ${this.sdk.currentBlock}`);
|
|
225
|
-
const result = await this.client.readContract({
|
|
226
|
-
address: priceFeedCompressorAddress,
|
|
227
|
-
abi: priceFeedCompressorAbi,
|
|
228
|
-
functionName: "getUpdatablePriceFeeds",
|
|
229
|
-
args: [{
|
|
230
|
-
configurators,
|
|
231
|
-
pools: [],
|
|
232
|
-
underlying: ADDRESS_0X0
|
|
233
|
-
}],
|
|
234
|
-
blockNumber: this.sdk.currentBlock,
|
|
235
|
-
gas: this.sdk.gasLimit
|
|
236
|
-
});
|
|
237
|
-
this.logger?.debug(`loaded ${result.length} partial updatable price feeds in block ${this.sdk.currentBlock}`);
|
|
238
|
-
return result.map((baseParams) => this.#createUpdatableProxy({ baseParams }));
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Instantiates the appropriate price feed contract wrapper based on
|
|
242
|
-
* the `contractType` discriminator in the node's base params.
|
|
243
|
-
*
|
|
244
|
-
* @param data - Partial or full price feed tree node.
|
|
245
|
-
* @returns A new (uncached) feed contract instance.
|
|
246
|
-
* @throws If the contract type is unsupported and strict mode is enabled.
|
|
247
|
-
**/
|
|
248
|
-
create(data) {
|
|
249
|
-
const contractType = bytes32ToString(data.baseParams.contractType);
|
|
250
|
-
switch (contractType) {
|
|
251
|
-
case "PRICE_FEED::BALANCER_STABLE": return new BalancerStablePriceFeedContract(this.sdk, data);
|
|
252
|
-
case "PRICE_FEED::BALANCER_WEIGHTED": return new BalancerWeightedPriceFeedContract(this.sdk, data);
|
|
253
|
-
case "PRICE_FEED::BOUNDED": return new BoundedPriceFeedContract(this.sdk, data);
|
|
254
|
-
case "PRICE_FEED::COMPOSITE": return new CompositePriceFeedContract(this.sdk, data);
|
|
255
|
-
case "PRICE_FEED::CONSTANT": return new ConstantPriceFeedContract(this.sdk, data);
|
|
256
|
-
case "PRICE_FEED::CURVE_CRYPTO": return new CurveCryptoPriceFeedContract(this.sdk, data);
|
|
257
|
-
case "PRICE_FEED::CURVE_STABLE": return new CurveStablePriceFeedContract(this.sdk, data);
|
|
258
|
-
case "PRICE_FEED::CURVE_USD": return new CurveUSDPriceFeedContract(this.sdk, data);
|
|
259
|
-
case "PRICE_FEED::ERC4626": return new Erc4626PriceFeedContract(this.sdk, data);
|
|
260
|
-
case "PRICE_FEED::EXTERNAL": return new ExternalPriceFeedContract(this.sdk, data);
|
|
261
|
-
case "PRICE_FEED::MELLOW_LRT": return new MellowLRTPriceFeedContract(this.sdk, data);
|
|
262
|
-
case "PRICE_FEED::PENDLE_PT_TWAP": return new PendleTWAPPTPriceFeed(this.sdk, data);
|
|
263
|
-
case "PRICE_FEED::PYTH": return new PythPriceFeed(this.sdk, data);
|
|
264
|
-
case "PRICE_FEED::REDSTONE": return new RedstonePriceFeedContract(this.sdk, data);
|
|
265
|
-
case "PRICE_FEED::WSTETH": return new WstETHPriceFeedContract(this.sdk, data);
|
|
266
|
-
case "PRICE_FEED::YEARN": return new YearnPriceFeedContract(this.sdk, data);
|
|
267
|
-
case "PRICE_FEED::ZERO": return new ZeroPriceFeedContract(this.sdk, data);
|
|
268
|
-
default: {
|
|
269
|
-
const err = /* @__PURE__ */ new Error(`Price feed type ${contractType} not supported for price feed at ${data.baseParams.addr}`);
|
|
270
|
-
if (this.sdk.strictContractTypes) throw err;
|
|
271
|
-
this.logger?.error(err);
|
|
272
|
-
return new ExternalPriceFeedContract(this.sdk, data);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
#createUpdatableProxy(data) {
|
|
277
|
-
const contract = this.#feeds.get(data.baseParams.addr) ?? this.create(data);
|
|
278
|
-
return new Proxy(contract, { get(target, prop) {
|
|
279
|
-
if (prop === "updatableDependencies") return () => [target];
|
|
280
|
-
return target[prop];
|
|
281
|
-
} });
|
|
282
|
-
}
|
|
283
|
-
/**
|
|
284
|
-
* @internal
|
|
285
|
-
* Diagnostic snapshot of the most recent price-update round, or
|
|
286
|
-
* `undefined` if no updates have been generated yet.
|
|
287
|
-
**/
|
|
288
|
-
get latestUpdate() {
|
|
289
|
-
return this.#latestUpdate;
|
|
290
|
-
}
|
|
291
|
-
/**
|
|
292
|
-
* @internal
|
|
293
|
-
* Returns true if any of the updaters are in historical mode
|
|
294
|
-
*/
|
|
295
|
-
get historical() {
|
|
296
|
-
return this.#updaters.some((u) => u.historical);
|
|
297
|
-
}
|
|
298
|
-
};
|
|
299
|
-
//#endregion
|
|
300
|
-
export { PriceFeedRegister };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { PartialPriceFeedTreeNode } from "./AbstractPriceFeed.js";
|
|
2
|
-
import { AbstractLPPriceFeedContract } from "./AbstractLPPriceFeed.js";
|
|
3
|
-
import { bptStablePriceFeedAbi } from "../../abi/oracles.js";
|
|
4
|
-
import "../../abi/index.js";
|
|
5
|
-
import { ConstructOptions } from "../../base/Construct.js";
|
|
6
|
-
//#region src/onchain/market/pricefeeds/BalancerStablePriceFeed.d.ts
|
|
7
|
-
type abi = typeof bptStablePriceFeedAbi;
|
|
8
|
-
declare class BalancerStablePriceFeedContract extends AbstractLPPriceFeedContract<abi> {
|
|
9
|
-
constructor(options: ConstructOptions, args: PartialPriceFeedTreeNode);
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
|
-
export { BalancerStablePriceFeedContract };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { BoundedOracleStateHuman } from "../../types/state-human.js";
|
|
2
|
-
import { AbstractPriceFeedContract, PartialPriceFeedTreeNode } from "./AbstractPriceFeed.js";
|
|
3
|
-
import { boundedPriceFeedAbi } from "../../abi/oracles.js";
|
|
4
|
-
import "../../abi/index.js";
|
|
5
|
-
import { ConstructOptions } from "../../base/Construct.js";
|
|
6
|
-
import "../../types/index.js";
|
|
7
|
-
//#region src/onchain/market/pricefeeds/BoundedPriceFeed.d.ts
|
|
8
|
-
type abi = typeof boundedPriceFeedAbi;
|
|
9
|
-
declare class BoundedPriceFeedContract extends AbstractPriceFeedContract<abi> {
|
|
10
|
-
readonly upperBound: bigint;
|
|
11
|
-
constructor(options: ConstructOptions, args: PartialPriceFeedTreeNode);
|
|
12
|
-
stateHuman(raw?: boolean): Omit<BoundedOracleStateHuman, "stalenessPeriod">;
|
|
13
|
-
}
|
|
14
|
-
//#endregion
|
|
15
|
-
export { BoundedPriceFeedContract };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { PartialPriceFeedTreeNode } from "./AbstractPriceFeed.js";
|
|
2
|
-
import { AbstractLPPriceFeedContract } from "./AbstractLPPriceFeed.js";
|
|
3
|
-
import { curveCryptoLpPriceFeedAbi } from "../../abi/oracles.js";
|
|
4
|
-
import "../../abi/index.js";
|
|
5
|
-
import { ConstructOptions } from "../../base/Construct.js";
|
|
6
|
-
//#region src/onchain/market/pricefeeds/CurveCryptoPriceFeed.d.ts
|
|
7
|
-
type abi = typeof curveCryptoLpPriceFeedAbi;
|
|
8
|
-
declare class CurveCryptoPriceFeedContract extends AbstractLPPriceFeedContract<abi> {
|
|
9
|
-
constructor(options: ConstructOptions, args: PartialPriceFeedTreeNode);
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
|
-
export { CurveCryptoPriceFeedContract };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { PartialPriceFeedTreeNode } from "./AbstractPriceFeed.js";
|
|
2
|
-
import { AbstractLPPriceFeedContract } from "./AbstractLPPriceFeed.js";
|
|
3
|
-
import { curveStableLpPriceFeedAbi } from "../../abi/oracles.js";
|
|
4
|
-
import "../../abi/index.js";
|
|
5
|
-
import { ConstructOptions } from "../../base/Construct.js";
|
|
6
|
-
//#region src/onchain/market/pricefeeds/CurveStablePriceFeed.d.ts
|
|
7
|
-
type abi = typeof curveStableLpPriceFeedAbi;
|
|
8
|
-
declare class CurveStablePriceFeedContract extends AbstractLPPriceFeedContract<abi> {
|
|
9
|
-
constructor(options: ConstructOptions, args: PartialPriceFeedTreeNode);
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
|
-
export { CurveStablePriceFeedContract };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { PartialPriceFeedTreeNode } from "./AbstractPriceFeed.js";
|
|
2
|
-
import { AbstractLPPriceFeedContract } from "./AbstractLPPriceFeed.js";
|
|
3
|
-
import { curveUsdPriceFeedAbi } from "../../abi/oracles.js";
|
|
4
|
-
import "../../abi/index.js";
|
|
5
|
-
import { ConstructOptions } from "../../base/Construct.js";
|
|
6
|
-
//#region src/onchain/market/pricefeeds/CurveUSDPriceFeed.d.ts
|
|
7
|
-
type abi = typeof curveUsdPriceFeedAbi;
|
|
8
|
-
declare class CurveUSDPriceFeedContract extends AbstractLPPriceFeedContract<abi> {
|
|
9
|
-
constructor(options: ConstructOptions, args: PartialPriceFeedTreeNode);
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
|
-
export { CurveUSDPriceFeedContract };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { PartialPriceFeedTreeNode } from "./AbstractPriceFeed.js";
|
|
2
|
-
import { AbstractLPPriceFeedContract } from "./AbstractLPPriceFeed.js";
|
|
3
|
-
import { erc4626PriceFeedAbi } from "../../abi/oracles.js";
|
|
4
|
-
import "../../abi/index.js";
|
|
5
|
-
import { ConstructOptions } from "../../base/Construct.js";
|
|
6
|
-
//#region src/onchain/market/pricefeeds/Erc4626PriceFeed.d.ts
|
|
7
|
-
type abi = typeof erc4626PriceFeedAbi;
|
|
8
|
-
declare class Erc4626PriceFeedContract extends AbstractLPPriceFeedContract<abi> {
|
|
9
|
-
constructor(options: ConstructOptions, args: PartialPriceFeedTreeNode);
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
|
-
export { Erc4626PriceFeedContract };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { AbstractPriceFeedContract, PartialPriceFeedTreeNode } from "./AbstractPriceFeed.js";
|
|
2
|
-
import { chainlinkReadableAggregatorAbi } from "../../abi/oracles.js";
|
|
3
|
-
import "../../abi/index.js";
|
|
4
|
-
import { ConstructOptions } from "../../base/Construct.js";
|
|
5
|
-
//#region src/onchain/market/pricefeeds/ExternalPriceFeed.d.ts
|
|
6
|
-
type abi = typeof chainlinkReadableAggregatorAbi;
|
|
7
|
-
declare class ExternalPriceFeedContract extends AbstractPriceFeedContract<abi> {
|
|
8
|
-
constructor(options: ConstructOptions, args: PartialPriceFeedTreeNode);
|
|
9
|
-
}
|
|
10
|
-
//#endregion
|
|
11
|
-
export { ExternalPriceFeedContract };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { PartialPriceFeedTreeNode } from "./AbstractPriceFeed.js";
|
|
2
|
-
import { AbstractLPPriceFeedContract } from "./AbstractLPPriceFeed.js";
|
|
3
|
-
import { mellowLrtPriceFeedAbi } from "../../abi/oracles.js";
|
|
4
|
-
import "../../abi/index.js";
|
|
5
|
-
import { ConstructOptions } from "../../base/Construct.js";
|
|
6
|
-
//#region src/onchain/market/pricefeeds/MellowLRTPriceFeed.d.ts
|
|
7
|
-
type abi = typeof mellowLrtPriceFeedAbi;
|
|
8
|
-
declare class MellowLRTPriceFeedContract extends AbstractLPPriceFeedContract<abi> {
|
|
9
|
-
constructor(options: ConstructOptions, args: PartialPriceFeedTreeNode);
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
|
-
export { MellowLRTPriceFeedContract };
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { PriceFeedTreeNode } from "../../base/types.js";
|
|
2
|
-
import { IPriceFeedContract, PriceUpdate, UpdatePriceFeedsResult } from "./types.js";
|
|
3
|
-
import { PartialPriceFeedTreeNode } from "./AbstractPriceFeed.js";
|
|
4
|
-
import { IHooks } from "../../utils/internal/Hooks.js";
|
|
5
|
-
import "../../utils/internal/index.js";
|
|
6
|
-
import { IPriceUpdateTask } from "./updates/types.js";
|
|
7
|
-
import { RedstoneOptions } from "./updates/RedstoneUpdater.js";
|
|
8
|
-
import "./updates/index.js";
|
|
9
|
-
import { RawTx } from "../../types/transactions.js";
|
|
10
|
-
import { OnchainSDK } from "../../OnchainSDK.js";
|
|
11
|
-
import "../../types/index.js";
|
|
12
|
-
import { SDKConstruct } from "../../base/SDKConstruct.js";
|
|
13
|
-
import "../../base/index.js";
|
|
14
|
-
import { Address, BlockTag } from "viem";
|
|
15
|
-
//#region src/onchain/market/pricefeeds/PriceFeedsRegister.d.ts
|
|
16
|
-
type PriceFeedRegisterHooks = {
|
|
17
|
-
/**
|
|
18
|
-
* Emitted when transactions to update price feeds have been generated, but before they're used anywhere
|
|
19
|
-
*/
|
|
20
|
-
updatesGenerated: [UpdatePriceFeedsResult];
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Configuration for external price-update providers supported by the register.
|
|
24
|
-
**/
|
|
25
|
-
interface PriceFeedRegisterOptions {
|
|
26
|
-
/**
|
|
27
|
-
* Redstone price-update provider options.
|
|
28
|
-
**/
|
|
29
|
-
redstone?: RedstoneOptions;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* @internal
|
|
33
|
-
* Diagnostic snapshot of the most recent price-update round.
|
|
34
|
-
**/
|
|
35
|
-
interface LatestUpdate {
|
|
36
|
-
/**
|
|
37
|
-
* Unix timestamp (seconds) of the most recent update.
|
|
38
|
-
**/
|
|
39
|
-
timestamp: number;
|
|
40
|
-
/**
|
|
41
|
-
* Individual update tasks that were executed.
|
|
42
|
-
**/
|
|
43
|
-
updates: IPriceUpdateTask[];
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Chain-level cache of price feed contract instances.
|
|
47
|
-
*
|
|
48
|
-
* All {@link IPriceOracleContract}s across different markets share a single
|
|
49
|
-
* `PriceFeedRegister`, avoiding duplicate contract wrappers for the same
|
|
50
|
-
* on-chain feed. The register also orchestrates off-chain price updates
|
|
51
|
-
* (Redstone, etc.).
|
|
52
|
-
**/
|
|
53
|
-
declare class PriceFeedRegister extends SDKConstruct implements IHooks<PriceFeedRegisterHooks> {
|
|
54
|
-
#private;
|
|
55
|
-
constructor(sdk: OnchainSDK, opts?: PriceFeedRegisterOptions);
|
|
56
|
-
/**
|
|
57
|
-
* @internal
|
|
58
|
-
* Registers a callback for price-feed register lifecycle events.
|
|
59
|
-
* @param event - Event name.
|
|
60
|
-
* @param handler - Callback to invoke.
|
|
61
|
-
**/
|
|
62
|
-
addHook: <K extends "updatesGenerated">(hookName: K, fn: (...args: PriceFeedRegisterHooks[K]) => void | Promise<void>) => void;
|
|
63
|
-
/**
|
|
64
|
-
* @internal
|
|
65
|
-
* Removes a previously registered hook.
|
|
66
|
-
* @param event - Event name.
|
|
67
|
-
* @param handler - Callback to remove.
|
|
68
|
-
**/
|
|
69
|
-
removeHook: <K extends "updatesGenerated">(hookName: K, fn: (...args: PriceFeedRegisterHooks[K]) => void | Promise<void>) => void;
|
|
70
|
-
/**
|
|
71
|
-
* Returns all price feeds known to sdk
|
|
72
|
-
*/
|
|
73
|
-
get feeds(): readonly IPriceFeedContract[];
|
|
74
|
-
/**
|
|
75
|
-
* Generates transactions to push fresh off-chain prices to updatable feeds.
|
|
76
|
-
*
|
|
77
|
-
* @param priceFeeds - Top-level price feeds whose updatable dependencies
|
|
78
|
-
* will be resolved, or a filter (`{ main: true }` / `{ reserve: true }`)
|
|
79
|
-
* to gather feeds from all oracles. When omitted, all registered feeds
|
|
80
|
-
* are used.
|
|
81
|
-
**/
|
|
82
|
-
generatePriceFeedsUpdateTxs(priceFeeds?: IPriceFeedContract[] | {
|
|
83
|
-
main: true;
|
|
84
|
-
} | {
|
|
85
|
-
reserve: true;
|
|
86
|
-
}): Promise<UpdatePriceFeedsResult>;
|
|
87
|
-
/**
|
|
88
|
-
* Similar to {@link generatePriceFeedsUpdateTxs}, but returns raw structures instead of transactions
|
|
89
|
-
* @param priceFeeds
|
|
90
|
-
* @returns
|
|
91
|
-
*/
|
|
92
|
-
generatePriceFeedsUpdates(priceFeeds?: IPriceFeedContract[] | {
|
|
93
|
-
main: true;
|
|
94
|
-
} | {
|
|
95
|
-
reserve: true;
|
|
96
|
-
}): Promise<PriceUpdate[]>;
|
|
97
|
-
/**
|
|
98
|
-
* Similar to {@link generatePriceFeedsUpdates}, but returns raw transaction to PriceFeedStore.updatePrices
|
|
99
|
-
* @param priceFeeds
|
|
100
|
-
* @returns
|
|
101
|
-
*/
|
|
102
|
-
getPriceFeedStoreUpdateTx(priceFeeds?: IPriceFeedContract[] | {
|
|
103
|
-
main: true;
|
|
104
|
-
} | {
|
|
105
|
-
reserve: true;
|
|
106
|
-
}): Promise<RawTx>;
|
|
107
|
-
/**
|
|
108
|
-
* Similar to {@link generatePriceFeedsUpdateTxs}, but will generate necessary price update transactions for external price feeds (not known to sdk)
|
|
109
|
-
* This does not add feeds to this register, so they won't be implicitly included in future generatePriceFeedsUpdateTxs calls
|
|
110
|
-
* @param feeds
|
|
111
|
-
* @param block
|
|
112
|
-
* @returns
|
|
113
|
-
*/
|
|
114
|
-
generateExternalPriceFeedsUpdateTxs(feeds: Address[], block?: {
|
|
115
|
-
blockNumber: bigint;
|
|
116
|
-
} | {
|
|
117
|
-
blockTag: BlockTag;
|
|
118
|
-
}): Promise<UpdatePriceFeedsResult>;
|
|
119
|
-
/**
|
|
120
|
-
* Similar to {@link generateExternalPriceFeedsUpdateTxs}, but returns raw structures instead of transactions
|
|
121
|
-
* @param feeds
|
|
122
|
-
* @param block
|
|
123
|
-
* @returns
|
|
124
|
-
*/
|
|
125
|
-
generateExternalPriceFeedsUpdates(feeds: Address[], block?: {
|
|
126
|
-
blockNumber: bigint;
|
|
127
|
-
} | {
|
|
128
|
-
blockTag: BlockTag;
|
|
129
|
-
}): Promise<PriceUpdate[]>;
|
|
130
|
-
/**
|
|
131
|
-
* Checks whether a price feed is already registered at the given address.
|
|
132
|
-
* @param address - On-chain address to look up.
|
|
133
|
-
**/
|
|
134
|
-
has(address: Address): boolean;
|
|
135
|
-
/**
|
|
136
|
-
* Returns the cached price feed contract at the given address.
|
|
137
|
-
* @param address - On-chain address to look up.
|
|
138
|
-
* @throws If no feed is registered at that address.
|
|
139
|
-
**/
|
|
140
|
-
mustGet(address: Address): IPriceFeedContract;
|
|
141
|
-
/**
|
|
142
|
-
* Inserts or updates a price feed from a full tree node.
|
|
143
|
-
*
|
|
144
|
-
* If a fully loaded feed already exists at the same address, only the
|
|
145
|
-
* answer is refreshed. Otherwise a new contract wrapper is created and
|
|
146
|
-
* cached.
|
|
147
|
-
*
|
|
148
|
-
* @param data - Full price feed tree node from the compressor.
|
|
149
|
-
* @returns The cached (or newly created) feed instance.
|
|
150
|
-
* @throws If the created feed is only partially initialized.
|
|
151
|
-
**/
|
|
152
|
-
upsert(data: PriceFeedTreeNode): IPriceFeedContract;
|
|
153
|
-
/**
|
|
154
|
-
* Loads PARTIAL information about all updatable price feeds from MarketCompressor
|
|
155
|
-
* Discovered price feeds are not saved anywhere in PriceFeedRegister, and can later be used to load price feed updates
|
|
156
|
-
*/
|
|
157
|
-
getPartialUpdatablePriceFeeds(configurators: Address[]): Promise<IPriceFeedContract[]>;
|
|
158
|
-
/**
|
|
159
|
-
* Instantiates the appropriate price feed contract wrapper based on
|
|
160
|
-
* the `contractType` discriminator in the node's base params.
|
|
161
|
-
*
|
|
162
|
-
* @param data - Partial or full price feed tree node.
|
|
163
|
-
* @returns A new (uncached) feed contract instance.
|
|
164
|
-
* @throws If the contract type is unsupported and strict mode is enabled.
|
|
165
|
-
**/
|
|
166
|
-
create(data: PartialPriceFeedTreeNode): IPriceFeedContract;
|
|
167
|
-
/**
|
|
168
|
-
* @internal
|
|
169
|
-
* Diagnostic snapshot of the most recent price-update round, or
|
|
170
|
-
* `undefined` if no updates have been generated yet.
|
|
171
|
-
**/
|
|
172
|
-
get latestUpdate(): LatestUpdate | undefined;
|
|
173
|
-
/**
|
|
174
|
-
* @internal
|
|
175
|
-
* Returns true if any of the updaters are in historical mode
|
|
176
|
-
*/
|
|
177
|
-
get historical(): boolean;
|
|
178
|
-
}
|
|
179
|
-
//#endregion
|
|
180
|
-
export { LatestUpdate, PriceFeedRegister, PriceFeedRegisterHooks, PriceFeedRegisterOptions };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { PartialPriceFeedTreeNode } from "./AbstractPriceFeed.js";
|
|
2
|
-
import { AbstractLPPriceFeedContract } from "./AbstractLPPriceFeed.js";
|
|
3
|
-
import { wstEthPriceFeedAbi } from "../../abi/oracles.js";
|
|
4
|
-
import "../../abi/index.js";
|
|
5
|
-
import { ConstructOptions } from "../../base/Construct.js";
|
|
6
|
-
//#region src/onchain/market/pricefeeds/WstETHPriceFeed.d.ts
|
|
7
|
-
type abi = typeof wstEthPriceFeedAbi;
|
|
8
|
-
declare class WstETHPriceFeedContract extends AbstractLPPriceFeedContract<abi> {
|
|
9
|
-
constructor(options: ConstructOptions, args: PartialPriceFeedTreeNode);
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
|
-
export { WstETHPriceFeedContract };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { PartialPriceFeedTreeNode } from "./AbstractPriceFeed.js";
|
|
2
|
-
import { AbstractLPPriceFeedContract } from "./AbstractLPPriceFeed.js";
|
|
3
|
-
import { yearnPriceFeedAbi } from "../../abi/oracles.js";
|
|
4
|
-
import "../../abi/index.js";
|
|
5
|
-
import { ConstructOptions } from "../../base/Construct.js";
|
|
6
|
-
//#region src/onchain/market/pricefeeds/YearnPriceFeed.d.ts
|
|
7
|
-
type abi = typeof yearnPriceFeedAbi;
|
|
8
|
-
declare class YearnPriceFeedContract extends AbstractLPPriceFeedContract<abi> {
|
|
9
|
-
constructor(options: ConstructOptions, args: PartialPriceFeedTreeNode);
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
|
-
export { YearnPriceFeedContract };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { AbstractPriceFeedContract, PartialPriceFeedTreeNode } from "./AbstractPriceFeed.js";
|
|
2
|
-
import { zeroPriceFeedAbi } from "../../abi/oracles.js";
|
|
3
|
-
import "../../abi/index.js";
|
|
4
|
-
import { ConstructOptions } from "../../base/Construct.js";
|
|
5
|
-
//#region src/onchain/market/pricefeeds/ZeroPriceFeed.d.ts
|
|
6
|
-
type abi = typeof zeroPriceFeedAbi;
|
|
7
|
-
declare class ZeroPriceFeedContract extends AbstractPriceFeedContract<abi> {
|
|
8
|
-
constructor(options: ConstructOptions, args: PartialPriceFeedTreeNode);
|
|
9
|
-
}
|
|
10
|
-
//#endregion
|
|
11
|
-
export { ZeroPriceFeedContract };
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { IPriceFeedContract, IUpdatablePriceFeedContract } from "./types.js";
|
|
2
|
-
//#region src/onchain/market/pricefeeds/isUpdatablePriceFeed.d.ts
|
|
3
|
-
declare function isUpdatablePriceFeed(pf: IPriceFeedContract): pf is IUpdatablePriceFeedContract;
|
|
4
|
-
//#endregion
|
|
5
|
-
export { isUpdatablePriceFeed };
|