Skip to content

Commit f53f67c

Browse files
authored
Merge pull request #35 from Gearbox-protocol/composite-price-feed-deploy
Composite price feed deploy
2 parents 3b4b617 + d4fbca7 commit f53f67c

File tree

3 files changed

+53
-10
lines changed

3 files changed

+53
-10
lines changed

contracts/test/suites/PriceFeedDeployer.sol

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ contract PriceFeedDeployer is Test, PriceFeedDataLive {
130130
string memory description = string(abi.encodePacked("PRICEFEED_", tokenTestSuite.symbols(t)));
131131
vm.label(pf, description);
132132
}
133-
updateRedstoneOraclePriceFeeds();
134133
}
135134

136135
// BOUNDED PRICE FEEDS
@@ -172,18 +171,61 @@ contract PriceFeedDeployer is Test, PriceFeedDataLive {
172171
address token = tokenTestSuite.addressOf(t);
173172

174173
if (
175-
token != address(0) && compositePriceFeeds[i].targetToBaseFeed != address(0)
176-
&& compositePriceFeeds[i].baseToUSDFeed != address(0)
174+
token != address(0)
175+
&& (
176+
compositePriceFeeds[i].targetToBaseFeed != address(0)
177+
|| compositePriceFeeds[i].isTargetRedstone
178+
)
179+
&& (
180+
compositePriceFeeds[i].baseToUSDFeed != address(0) || compositePriceFeeds[i].isBaseComposite
181+
)
177182
) {
183+
address targetToBaseFeed;
184+
if (compositePriceFeeds[i].isTargetRedstone) {
185+
targetToBaseFeed = address(
186+
new RedstonePriceFeed(
187+
token,
188+
compositePriceFeeds[i].redstoneTargetToBaseData.dataFeedId,
189+
compositePriceFeeds[i].redstoneTargetToBaseData.signers,
190+
compositePriceFeeds[i].redstoneTargetToBaseData.signersThreshold
191+
)
192+
);
193+
redstoneServiceIdByPriceFeed[targetToBaseFeed] =
194+
compositePriceFeeds[i].redstoneTargetToBaseData.dataServiceId;
195+
redStoneOracles.push(targetToBaseFeed);
196+
} else {
197+
targetToBaseFeed = compositePriceFeeds[i].targetToBaseFeed;
198+
}
199+
200+
address baseToUSDFeed;
201+
if (compositePriceFeeds[i].isBaseComposite) {
202+
baseToUSDFeed = address(
203+
new CompositePriceFeed(
204+
[
205+
PriceFeedParams({
206+
priceFeed: compositePriceFeeds[i].compositeBaseToUSDData.targetToBaseFeed,
207+
stalenessPeriod: compositePriceFeeds[i].compositeBaseToUSDData.targetStalenessPeriod
208+
}),
209+
PriceFeedParams({
210+
priceFeed: compositePriceFeeds[i].compositeBaseToUSDData.baseToUSDFeed,
211+
stalenessPeriod: compositePriceFeeds[i].compositeBaseToUSDData.baseStalenessPeriod
212+
})
213+
]
214+
)
215+
);
216+
} else {
217+
baseToUSDFeed = compositePriceFeeds[i].baseToUSDFeed;
218+
}
219+
178220
address pf = address(
179221
new CompositePriceFeed(
180222
[
181223
PriceFeedParams({
182-
priceFeed: compositePriceFeeds[i].targetToBaseFeed,
224+
priceFeed: targetToBaseFeed,
183225
stalenessPeriod: compositePriceFeeds[i].targetStalenessPeriod
184226
}),
185227
PriceFeedParams({
186-
priceFeed: compositePriceFeeds[i].baseToUSDFeed,
228+
priceFeed: baseToUSDFeed,
187229
stalenessPeriod: compositePriceFeeds[i].baseStalenessPeriod
188230
})
189231
]
@@ -197,6 +239,7 @@ contract PriceFeedDeployer is Test, PriceFeedDataLive {
197239
}
198240
}
199241
}
242+
updateRedstoneOraclePriceFeeds();
200243
}
201244

202245
// ZERO PRICE FEEDS

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"@gearbox-protocol/core-v3": "^1.47.1",
3535
"@gearbox-protocol/eslint-config": "^1.6.1",
3636
"@gearbox-protocol/prettier-config": "^1.5.0",
37-
"@gearbox-protocol/sdk-gov": "^1.31.0",
37+
"@gearbox-protocol/sdk-gov": "^1.38.0",
3838
"@openzeppelin/contracts": "4.9.3",
3939
"@redstone-finance/evm-connector": "0.2.5",
4040
"@typechain/ethers-v5": "^10.1.0",

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,10 +1329,10 @@
13291329
resolved "https://registry.yarnpkg.com/@gearbox-protocol/prettier-config/-/prettier-config-1.5.0.tgz#4df8e9fd2305fee6ab8c1417a02e31343836932a"
13301330
integrity sha512-FUoprSsBdZyBjgxXCKL6mTkbeUJytaLzPJqIOoQpDmBRTX0seCc2o5I9PI9tySoRIlNnd/XXnKCXq1xHDEGbxw==
13311331

1332-
"@gearbox-protocol/sdk-gov@^1.31.0":
1333-
version "1.31.0"
1334-
resolved "https://registry.yarnpkg.com/@gearbox-protocol/sdk-gov/-/sdk-gov-1.31.0.tgz#1cc83ee35f9ed2da832ca1c95aa8307ed44aa7c8"
1335-
integrity sha512-tDEwSx+bW8Bi1tj93Ujw0ZUuTi6Cw/dHF1dFlbLTtFwsdG2hDuCPGOYdLLJUsirHbY69p3ztUXmjm22492W2VA==
1332+
"@gearbox-protocol/sdk-gov@^1.38.0":
1333+
version "1.38.0"
1334+
resolved "https://registry.yarnpkg.com/@gearbox-protocol/sdk-gov/-/sdk-gov-1.38.0.tgz#3532bc37be2e42825c4d9aaace487695df21e38f"
1335+
integrity sha512-5WuUpRELGddQr+dchvMxQxTKojH9xaOufO39qKMd3c/bsvSTIm4QkMijdyAkCM7v2XiZNxSWTwIDGXeGHaYOqA==
13361336
dependencies:
13371337
"@types/yaml" "^1.9.7"
13381338
add "^2.0.6"

0 commit comments

Comments
 (0)