enable/disable oracle; remove isPriceValid modifier

This commit is contained in:
tracy
2022-06-24 21:41:59 +08:00
parent eb631f6255
commit 857f7d7fc0
5 changed files with 30 additions and 20 deletions

View File

@@ -38,20 +38,12 @@ contract DPPTrader is DPPVault {
event RChange(PMMPricing.RState newRState);
modifier isPriceValid() {
if (_IS_ORACLE_ENABLED) {
bool isFeasible = IOracle(_I_).isFeasible(address(_BASE_TOKEN_));
require(isFeasible, "ORACLE_PRICE_INVALID");
}
_;
}
// ============ Trade Functions ============
function sellBase(address to)
external
preventReentrant
isPriceValid
returns (uint256 receiveQuoteAmount)
{
uint256 baseBalance = _BASE_TOKEN_.balanceOf(address(this));
@@ -87,7 +79,6 @@ contract DPPTrader is DPPVault {
function sellQuote(address to)
external
preventReentrant
isPriceValid
returns (uint256 receiveBaseAmount)
{
uint256 quoteBalance = _QUOTE_TOKEN_.balanceOf(address(this));
@@ -128,7 +119,7 @@ contract DPPTrader is DPPVault {
uint256 quoteAmount,
address _assetTo,
bytes calldata data
) external isPriceValid preventReentrant {
) external preventReentrant {
address assetTo = _assetTo;
_transferBaseOut(assetTo, baseAmount);
_transferQuoteOut(assetTo, quoteAmount);