11// SPDX-License-Identifier: MIT
22pragma solidity 0.8.27 ;
33
4- import "../ interfaces/IApi3ReaderProxyWithDappId .sol " ;
4+ import "@api3/contracts/ interfaces/IApi3ReaderProxy .sol " ;
55import "./interfaces/IScaledApi3FeedProxyV1.sol " ;
66
77/// @title An immutable Chainlink AggregatorV2V3Interface feed contract that
8- /// scales the value of an IApi3ReaderProxyWithDappId data feed to a target
9- /// number of decimals
8+ /// scales the value of an IApi3ReaderProxy data feed to a target number of
9+ /// decimals
1010/// @dev This contract reads an `int224` value (assumed to be 18 decimals)
11- /// from the underlying `IApi3ReaderProxyWithDappId` and scales it to
12- ///`targetDecimals`.
11+ /// from the underlying `IApi3ReaderProxy` and scales it to `targetDecimals`.
1312/// The scaling arithmetic uses `int256` for intermediate results, allowing the
1413/// scaled value to exceed `int224` limits if upscaling significantly; it will
1514/// revert on `int256` overflow.
1615/// When downscaling, integer division (`proxyValue / scalingFactor`) is used,
1716/// which truncates and may lead to precision loss. Integrators must carefully
1817/// consider this potential precision loss for their specific use case.
1918contract ScaledApi3FeedProxyV1 is IScaledApi3FeedProxyV1 {
20- /// @notice IApi3ReaderProxyWithDappId contract address
19+ /// @notice IApi3ReaderProxy contract address
2120 address public immutable override proxy;
2221
23- /// @notice dApp ID of the proxy
24- uint256 public immutable override dappId;
25-
2622 /// @notice Pre-calculated factor for scaling the proxy's 18-decimal value
2723 /// to `targetDecimals`.
2824 int256 public immutable override scalingFactor;
@@ -34,9 +30,8 @@ contract ScaledApi3FeedProxyV1 is IScaledApi3FeedProxyV1 {
3430 /// @dev Target decimals for the scaled value.
3531 uint8 private immutable targetDecimals;
3632
37- /// @param proxy_ IApi3ReaderProxyWithDappId contract address
38- /// @param targetDecimals_ Decimals to scale the IApi3ReaderProxyWithDappId
39- /// value
33+ /// @param proxy_ IApi3ReaderProxy contract address
34+ /// @param targetDecimals_ Decimals to scale the IApi3ReaderProxy value
4035 constructor (address proxy_ , uint8 targetDecimals_ ) {
4136 if (proxy_ == address (0 )) {
4237 revert ZeroProxyAddress ();
@@ -48,7 +43,6 @@ contract ScaledApi3FeedProxyV1 is IScaledApi3FeedProxyV1 {
4843 revert NoScalingNeeded ();
4944 }
5045 proxy = proxy_;
51- dappId = IApi3ReaderProxyWithDappId (proxy_).dappId ();
5246 targetDecimals = targetDecimals_;
5347 uint8 delta = targetDecimals_ > 18
5448 ? targetDecimals_ - 18
@@ -94,7 +88,7 @@ contract ScaledApi3FeedProxyV1 is IScaledApi3FeedProxyV1 {
9488 revert FunctionIsNotSupported ();
9589 }
9690
97- /// @dev Decimals used to scale the IApi3ReaderProxyWithDappId value
91+ /// @dev Decimals used to scale the IApi3ReaderProxy value
9892 function decimals () external view override returns (uint8 ) {
9993 return targetDecimals;
10094 }
@@ -143,7 +137,7 @@ contract ScaledApi3FeedProxyV1 is IScaledApi3FeedProxyV1 {
143137 updatedAt = startedAt;
144138 }
145139
146- /// @notice Reads a value from the underlying `IApi3ReaderProxyWithDappId `
140+ /// @notice Reads a value from the underlying `IApi3ReaderProxy `
147141 /// and scales it to `targetDecimals`.
148142 /// @dev Reads from the underlying proxy and applies scaling to
149143 /// `targetDecimals`. Upscaling uses multiplication; downscaling uses integer
@@ -152,9 +146,8 @@ contract ScaledApi3FeedProxyV1 is IScaledApi3FeedProxyV1 {
152146 /// @return value The scaled signed fixed-point value with `targetDecimals`.
153147 /// @return timestamp The timestamp from the underlying proxy.
154148 function _read () internal view returns (int256 value , uint32 timestamp ) {
155- (int224 proxyValue , uint32 proxyTimestamp ) = IApi3ReaderProxyWithDappId (
156- proxy
157- ).read ();
149+ (int224 proxyValue , uint32 proxyTimestamp ) = IApi3ReaderProxy (proxy)
150+ .read ();
158151
159152 value = isUpscaling
160153 ? proxyValue * scalingFactor
0 commit comments