Skip to content

Commit

Permalink
Merge branch 'main' into pendle-pt-price-feed
Browse files Browse the repository at this point in the history
  • Loading branch information
Van0k committed Nov 19, 2024
2 parents 1245616 + 989fedf commit efa28d3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 30 deletions.
42 changes: 17 additions & 25 deletions contracts/test/suites/PriceFeedDeployer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -532,31 +532,6 @@ contract PriceFeedDeployer is Test, PriceFeedDataLive {
}
}

// THE SAME PRICEFEEDS
TheSamePriceFeedData[] memory theSamePriceFeeds = theSamePriceFeedsByNetwork[chainId];
len = theSamePriceFeeds.length;
unchecked {
for (uint256 i; i < len; ++i) {
address token = tokenTestSuite.addressOf(theSamePriceFeeds[i].token);

if (token != address(0)) {
address tokenHasSamePriceFeed = tokenTestSuite.addressOf(theSamePriceFeeds[i].tokenHasSamePriceFeed);
address pf = priceFeeds[tokenHasSamePriceFeed];
if (pf != address(0)) {
setPriceFeed(
token,
pf,
stalenessPeriods[tokenHasSamePriceFeed],
theSamePriceFeeds[i].trusted,
theSamePriceFeeds[i].reserve
);
} else {
console.log("WARNING: Price feed for ", ERC20(token).symbol(), " not found");
}
}
}
}

// YEARN PRICE FEEDS
SingeTokenPriceFeedData[] memory yearnPriceFeeds = yearnPriceFeedsByNetwork[chainId];
len = yearnPriceFeeds.length;
Expand Down Expand Up @@ -761,6 +736,23 @@ contract PriceFeedDeployer is Test, PriceFeedDataLive {
PriceFeedConfig({token: token, priceFeed: priceFeed, stalenessPeriod: stalenessPeriod, trusted: trusted})
);
}
_setTheSameAsPFs(token, priceFeed, stalenessPeriod, reserve);
}

function _setTheSameAsPFs(address refToken, address priceFeed, uint32 stalenessPeriod, bool reserve) internal {
TheSamePriceFeedData[] memory theSamePriceFeeds = theSamePriceFeedsByNetwork[chainId];
uint256 len = theSamePriceFeeds.length;
unchecked {
for (uint256 i; i < len; ++i) {
address token = tokenTestSuite.addressOf(theSamePriceFeeds[i].token);
address tokenHasSamePriceFeed = tokenTestSuite.addressOf(theSamePriceFeeds[i].tokenHasSamePriceFeed);

if (refToken == tokenHasSamePriceFeed && reserve == theSamePriceFeeds[i].reserve && token != address(0))
{
setPriceFeed(token, priceFeed, stalenessPeriod, false, theSamePriceFeeds[i].reserve);
}
}
}
}

function getPriceFeeds() external view returns (PriceFeedConfig[] memory) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"@gearbox-protocol/core-v3": "^1.47.1",
"@gearbox-protocol/eslint-config": "^1.6.1",
"@gearbox-protocol/prettier-config": "^1.5.0",
"@gearbox-protocol/sdk-gov": "^2.15.0",
"@gearbox-protocol/sdk-gov": "^2.24.0",
"@openzeppelin/contracts": "4.9.3",
"@redstone-finance/evm-connector": "0.2.5",
"@typechain/ethers-v5": "^10.1.0",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -993,10 +993,10 @@
resolved "https://registry.yarnpkg.com/@gearbox-protocol/prettier-config/-/prettier-config-1.5.0.tgz#4df8e9fd2305fee6ab8c1417a02e31343836932a"
integrity sha512-FUoprSsBdZyBjgxXCKL6mTkbeUJytaLzPJqIOoQpDmBRTX0seCc2o5I9PI9tySoRIlNnd/XXnKCXq1xHDEGbxw==

"@gearbox-protocol/sdk-gov@^2.15.0":
version "2.15.0"
resolved "https://registry.yarnpkg.com/@gearbox-protocol/sdk-gov/-/sdk-gov-2.15.0.tgz#3ed7da0154b170fa5360f4dbb24fd8c98a67443b"
integrity sha512-AfSgKf+tSkpNT2a8f+yWX14pfXQXg82BU9aJcW2mTEEAT7b1CJg3jl8DQLneO2y3YtqnyGlQpv2m4pYtrUqAaQ==
"@gearbox-protocol/sdk-gov@^2.24.0":
version "2.24.0"
resolved "https://registry.yarnpkg.com/@gearbox-protocol/sdk-gov/-/sdk-gov-2.24.0.tgz#beac0328625bf81d12e5afde679cc2356c34299b"
integrity sha512-tStCaH3bN2ZCx3sQye/xNjO3zjiyj/V2Elama8qICxKOIGuWdKLwgIX7H+hxGAOBw7lEw5ypELkKZ/mH+eT3YA==
dependencies:
ethers "6.12.1"
humanize-duration-ts "^2.1.1"
Expand Down

0 comments on commit efa28d3

Please sign in to comment.