Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: StakedaoEcrvPricer #441

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
refactor: store underlying as address - StakedaoEcrvPricer
CruzMolina committed Aug 19, 2021
commit 3775dd344c08598eca49aaf077f11e5a6c049194
13 changes: 6 additions & 7 deletions contracts/pricers/StakedaoEcrvPricer.sol
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@

pragma solidity 0.6.10;

import {ERC20Interface} from "../interfaces/ERC20Interface.sol";
import {ICurve} from "../interfaces/ICurve.sol";
import {IStakeDao} from "../interfaces/IStakeDao.sol";
import {OracleInterface} from "../interfaces/OracleInterface.sol";
@@ -30,14 +29,14 @@ contract StakedaoEcrvPricer {
/// @notice curve pool
ICurve public curve;

/// @notice underlying asset for this lpToken
ERC20Interface public underlying;
/// @notice lpToken that this pricer will a get price for
IStakeDao public lpToken;

/// @notice opyn oracle address
OracleInterface public oracle;

/// @notice lpToken that this pricer will a get price for
IStakeDao public lpToken;
/// @notice underlying asset for this lpToken
address public underlying;

/**
* @param _lpToken lpToken asset
@@ -57,7 +56,7 @@ contract StakedaoEcrvPricer {
require(_curve != address(0), "P4");

lpToken = IStakeDao(_lpToken);
underlying = ERC20Interface(_underlying);
underlying = _underlying;
oracle = OracleInterface(_oracle);
curve = ICurve(_curve);
}
@@ -79,7 +78,7 @@ contract StakedaoEcrvPricer {
* @param _expiryTimestamp expiry to set a price for
*/
function setExpiryPriceInOracle(uint256 _expiryTimestamp) external {
(uint256 underlyingPriceExpiry, ) = oracle.getExpiryPrice(address(underlying), _expiryTimestamp);
(uint256 underlyingPriceExpiry, ) = oracle.getExpiryPrice(underlying, _expiryTimestamp);
require(underlyingPriceExpiry > 0, "P6");
uint256 lpTokenPrice = _underlyingPriceToYtokenPrice(underlyingPriceExpiry);
oracle.setExpiryPrice(address(lpToken), _expiryTimestamp, lpTokenPrice);