-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from Gearbox-protocol/crvusd-price-feed
feat: crvUSD price feed
- Loading branch information
Showing
10 changed files
with
92 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
// Gearbox Protocol. Generalized leverage for DeFi protocols | ||
// (c) Gearbox Foundation, 2023. | ||
pragma solidity ^0.8.17; | ||
|
||
import {SingleAssetLPPriceFeed} from "../SingleAssetLPPriceFeed.sol"; | ||
import {PriceFeedType} from "@gearbox-protocol/sdk/contracts/PriceFeedType.sol"; | ||
import {WAD} from "@gearbox-protocol/core-v2/contracts/libraries/Constants.sol"; | ||
|
||
interface IPool { | ||
function price_oracle() external view returns (uint256); | ||
} | ||
|
||
/// @title crvUSD price feed | ||
/// @notice Computes crvUSD price as product of crvUSD-USDC stableswap pool exchange rate and USDC price feed. | ||
/// While crvUSD is not an LP token itself, the pricing logic is fairly similar, so existing infrastructure | ||
/// is reused. Particularly, the same bounding mechanism is applied to the pool exchange rate. | ||
contract CurveUSDPriceFeed is SingleAssetLPPriceFeed { | ||
uint256 public constant override version = 3_00; | ||
PriceFeedType public constant override priceFeedType = PriceFeedType.CURVE_USD_ORACLE; | ||
|
||
constructor(address addressProvider, address _crvUSD, address _pool, address _priceFeed, uint32 _stalenessPeriod) | ||
SingleAssetLPPriceFeed(addressProvider, _crvUSD, _pool, _priceFeed, _stalenessPeriod) | ||
{ | ||
_initLimiter(); | ||
} | ||
|
||
function getLPExchangeRate() public view override returns (uint256) { | ||
return IPool(lpContract).price_oracle(); | ||
} | ||
|
||
function getScale() public pure override returns (uint256) { | ||
return WAD; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters