@ubk-labs/ubk-oracle 0.1.7 → 0.1.8
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.
|
@@ -312,6 +312,36 @@ contract UBKOracle is IUBKOracle, Ownable {
|
|
|
312
312
|
return _fetchAndUpdatePrice(token);
|
|
313
313
|
}
|
|
314
314
|
|
|
315
|
+
/**
|
|
316
|
+
* @notice Batch price fetch & update for multiple tokens.
|
|
317
|
+
* @param tokens Array of asset token addresses.
|
|
318
|
+
* @return prices Array of fresh prices in 1e18 precision.
|
|
319
|
+
*
|
|
320
|
+
* @dev
|
|
321
|
+
* - Runs whenNotPaused modifier.
|
|
322
|
+
* - Reverts if any token is zero address.
|
|
323
|
+
* - Each iteration calls the same internal `_fetchAndUpdatePrice`.
|
|
324
|
+
* - Gas-efficient: msg.sender checked once, calldata parsed once.
|
|
325
|
+
*/
|
|
326
|
+
function fetchAndUpdatePrice(
|
|
327
|
+
address[] calldata tokens
|
|
328
|
+
) external whenNotPaused returns (uint256[] memory prices) {
|
|
329
|
+
uint256 len = tokens.length;
|
|
330
|
+
prices = new uint256[](len);
|
|
331
|
+
|
|
332
|
+
for (uint256 i = 0; i < len; ++i) {
|
|
333
|
+
address token = tokens[i];
|
|
334
|
+
if (token == address(0)) {
|
|
335
|
+
revert ZeroAddress(
|
|
336
|
+
"UBKOracle::fetchAndUpdatePriceBatch",
|
|
337
|
+
"token"
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
prices[i] = _fetchAndUpdatePrice(token);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
315
345
|
/**
|
|
316
346
|
* @notice Returns age of last cached price in seconds.
|
|
317
347
|
* @param token Token address.
|
|
@@ -415,7 +445,7 @@ contract UBKOracle is IUBKOracle, Ownable {
|
|
|
415
445
|
return (lv.timestamp != 0 &&
|
|
416
446
|
block.timestamp - lv.timestamp <= stalePeriod[token]);
|
|
417
447
|
}
|
|
418
|
-
|
|
448
|
+
|
|
419
449
|
/**
|
|
420
450
|
* @notice Resolves the fair price of an ERC4626 vault share.
|
|
421
451
|
* @param vault ERC4626 vault token address.
|
|
@@ -94,7 +94,9 @@ interface IUBKOracle {
|
|
|
94
94
|
* @dev Keeper entrypoint. May revert if price resolution fails.
|
|
95
95
|
*/
|
|
96
96
|
function fetchAndUpdatePrice(address token) external returns (uint256);
|
|
97
|
-
|
|
97
|
+
function fetchAndUpdatePrice(
|
|
98
|
+
address[] calldata tokens
|
|
99
|
+
) external returns (uint256[] memory);
|
|
98
100
|
// -----------------------------------------------------------------------
|
|
99
101
|
// ADMIN / GOVERNANCE CONFIGURATION
|
|
100
102
|
// -----------------------------------------------------------------------
|
package/package.json
CHANGED