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: README.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,11 +14,11 @@ Being documented, easily usable, and officially recommended by Api3, they offer
14
14
Data Feed Proxy Combinators provide modular and composable smart contracts for on-chain data feed adaptation. They typically take the address(es) of underlying feed(s) and operational parameters (like scaling factors) in their constructors. Key contract implementations include:
15
15
16
16
-**`InverseApi3ReaderProxyV1`**: Takes an underlying `IApi3ReaderProxy` (e.g., ETH/USD). Its `read()` method returns the inverse of the underlying feed's value (e.g., `1 / (ETH/USD value)` to represent USD/ETH), exposing an `IApi3ReaderProxy` interface.
17
-
-**`ScaledApi3FeedProxyV1`**: Reads from an underlying `IApi3ReaderProxy`, scales its value to a specified number of decimal places, and exposes the Chainlink `AggregatorV3Interface` (and `AggregatorV2V3Interface`). This makes an Api3 data feed, with adjusted precision, consumable by systems expecting a Chainlink-compatible interface with arbitrary decimals.
17
+
-**`ScaledApi3FeedProxyV1`**: Reads from an underlying `IApi3ReaderProxy`, scales its value to a specified number of decimal places, and exposes the Chainlink `AggregatorV2V3Interface`. This makes an Api3 data feed, with adjusted precision, consumable by systems expecting a Chainlink-compatible interface with arbitrary decimals.
18
18
-**`ProductApi3ReaderProxyV1`**: Takes two underlying `IApi3ReaderProxy` instances. Its `read()` method returns the product of their values, implementing the `IApi3ReaderProxy` interface.
19
19
-**`NormalizedApi3ReaderProxyV1`**: Reads from an external data feed implementing the Chainlink-compatible `AggregatorV2V3Interface` and exposes the standard Api3 `IApi3ReaderProxy` interface. This allows dApps expecting an Api3 feed to consume data from other sources, useful for migration.
20
20
21
-
These combinators either consume and expose the Api3 `IApi3ReaderProxy` interface or act as adapters to/from other interfaces like Chainlink's `AggregatorV3Interface`. This facilitates integration within the Api3 ecosystem or when bridging with other oracle systems. The output of one combinator can often serve as input for another, enabling complex data transformation pipelines.
21
+
These combinators either consume and expose the Api3 `IApi3ReaderProxy` interface or act as adapters to/from other interfaces like Chainlink's `AggregatorV2V3Interface`. This facilitates integration within the Api3 ecosystem or when bridging with other oracle systems. The output of one combinator can often serve as input for another, enabling complex data transformation pipelines.
22
22
23
23
## Deployment Guide
24
24
@@ -105,7 +105,7 @@ The `NETWORK` variable should be set to a chain name as defined by `@api3/contra
105
105
- **`NormalizedApi3ReaderProxyV1`**:
106
106
107
107
- `NETWORK`: Target network name.
108
-
- `FEED`: Address of the external data feed (e.g., a Chainlink `AggregatorV3Interface` compatible feed).
108
+
- `FEED`: Address of the external data feed (e.g., a Chainlink `AggregatorV2V3Interface` compatible feed).
@@ -142,7 +142,7 @@ If verification fails during the deployment (e.g., due to network latency or an
142
142
143
143
### 4. Combining Contracts (Advanced Usage)
144
144
145
-
The true power of these combinators is realized when they are chained together. The deployed address of one combinator contract can serve as an input (a constructor argument, typically an `IApi3ReaderProxy` or `AggregatorV3Interface` address) for another. This allows you to build sophisticated data transformation pipelines tailored to your dApp's specific needs.
145
+
The true power of these combinators is realized when they are chained together. The deployed address of one combinator contract can serve as an input (a constructor argument, typically an `IApi3ReaderProxy` or `AggregatorV2V3Interface` address) for another. This allows you to build sophisticated data transformation pipelines tailored to your dApp's specific needs.
146
146
147
147
Below are some common scenarios illustrating how you can combine these proxies:
148
148
@@ -159,7 +159,7 @@ Imagine your dApp requires a USD/ETH price feed with 8 decimal places, but the a
159
159
2. **Deploy `ScaledApi3FeedProxyV1`**:
160
160
- Input `PROXY`: Address of `InverseProxy_ETHUSD` (from step 1).
161
161
- Input `DECIMALS`: `8`.
162
-
- Output: An `AggregatorV3Interface` contract that reads USD/ETH scaled to 8 decimals.
162
+
- Output: An `AggregatorV2V3Interface` contract that reads USD/ETH scaled to 8 decimals.
163
163
- Example command: `NETWORK=your_network PROXY=0xAddressOfInverseProxyEthUsd DECIMALS=8 pnpm deploy:ScaledApi3FeedProxyV1`
164
164
165
165
**Scenario 2: Creating a Cross-Currency Pair (e.g., BTC/ETH) and Adapting its Interface**
@@ -180,15 +180,15 @@ Suppose your dApp needs a BTC/ETH price feed, and you have access to BTC/USD and
180
180
3. **Deploy `ScaledApi3FeedProxyV1` (Optional, for interface adaptation and scaling)**:
181
181
- Input `PROXY`: Address of `ProductProxy_BTCETH` (from step 2).
182
182
- Input `DECIMALS`: Desired decimals (e.g., `8` or `18`).
183
-
- Output: An `AggregatorV3Interface` contract providing the BTC/ETH price, compatible with systems expecting a Chainlink feed.
183
+
- Output: An `AggregatorV2V3Interface` contract providing the BTC/ETH price, compatible with systems expecting a Chainlink feed.
184
184
185
185
**Scenario 3: Normalizing an External Feed and Then Inverting It**
186
186
187
187
Your dApp wants to use an external (e.g., Chainlink) EUR/USD feed but requires it as USD/EUR and prefers to interact with it via the API3 `IApi3ReaderProxy` interface.
188
188
189
189
1. **Deploy `NormalizedApi3ReaderProxyV1`**:
190
190
191
-
- Input `FEED`: Address of the external EUR/USD `AggregatorV3Interface` feed.
191
+
- Input `FEED`: Address of the external EUR/USD `AggregatorV2V3Interface` feed.
192
192
- Output: An `IApi3ReaderProxy` contract (`NormalizedProxy_EURUSD`) that reads EUR/USD.
0 commit comments