File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -31,13 +31,14 @@ contract OracleTwoFeeds is IOracle {
31
31
) {
32
32
BASE_FEED = baseFeed;
33
33
QUOTE_FEED = quoteFeed;
34
- // We note pB the base price, and pQ the quote price (price of 1e(decimals) asset).
35
- // We want to return 1e36 * (pB/1e(bDecimals) / (pQ/1e(qDecimals)).
36
- // Chainlink returns pB * bFeedPrecision and pQ * qFeedPrecision.
37
- // So we have 1e36 * (pB/1e(bDecimals) / (pQ/1e(qDecimals) = pB * 1e(bFeedPrecision) * SCALE_FACTOR / (pQ *
38
- // 1e(qFeedPrecision))
34
+ // Let pB be the base price, and pQ the quote price (price of 1e(decimals) asset).
35
+ // Chainlink feeds return pB * bFeedPrecision and pQ * qFeedPrecision.
36
+ // `price()` should return 1e36 * (pB/1e(bDecimals) / (pQ/1e(qDecimals)).
37
+ // Yet `price()` returns pB * 1e(bFeedPrecision) * SCALE_FACTOR / (pQ * 1e(qFeedPrecision))
38
+ // So 1e36 * (pB/1e(bDecimals) / (pQ/1e(qDecimals) = pB*1e(bFeedPrecision) * SCALE_FACTOR /
39
+ // (pQ*1e(qFeedPrecision))
39
40
// So SCALE_FACTOR = 1e36 / 1e(bDecimals) * 1e(qDecimals) * 1e(qFeedPrecision) / 1e(bFeedPrecision)
40
- // So SCALE_FACTOR = 1e(36 + qDecimals + qFeedPrecision - bDecimals - bFeedPrecision)
41
+ // = 1e(36 + qDecimals + qFeedPrecision - bDecimals - bFeedPrecision)
41
42
SCALE_FACTOR =
42
43
10 ** (36 + quoteTokenDecimals + quoteFeed.getDecimals () - baseFeed.getDecimals () - baseTokenDecimals);
43
44
}
You can’t perform that action at this time.
0 commit comments