init DPP test
This commit is contained in:
@@ -15,7 +15,7 @@ import {SafeMath} from "../../lib/SafeMath.sol";
|
||||
import {DecimalMath} from "../../lib/DecimalMath.sol";
|
||||
import {SafeERC20} from "../../lib/SafeERC20.sol";
|
||||
import {Ownable} from "../../lib/Ownable.sol";
|
||||
import {ISmartApprove} from '../../intf/ISmartApprove.sol';
|
||||
import {ISmartApprove} from "../../intf/ISmartApprove.sol";
|
||||
|
||||
contract DPPVault is DPPStorage {
|
||||
using SafeMath for uint256;
|
||||
@@ -50,7 +50,7 @@ contract DPPVault is DPPStorage {
|
||||
_QUOTE_TARGET_ = quoteTarget;
|
||||
_checkStatus();
|
||||
}
|
||||
|
||||
|
||||
function _syncReserve() internal {
|
||||
_BASE_RESERVE_ = _BASE_TOKEN_.balanceOf(address(this));
|
||||
_QUOTE_RESERVE_ = _QUOTE_TOKEN_.balanceOf(address(this));
|
||||
@@ -72,10 +72,15 @@ contract DPPVault is DPPStorage {
|
||||
uint256 baseOutAmount,
|
||||
uint256 quoteOutAmount
|
||||
) public {
|
||||
require(msg.sender == ISmartApprove(_DODO_SMART_APPROVE_).getSmartSwap() && from == _OPERATOR_, "RESET FORBIDDEN!");
|
||||
require(
|
||||
msg.sender == _OWNER_ ||
|
||||
(msg.sender == ISmartApprove(_DODO_SMART_APPROVE_).getSmartSwap() &&
|
||||
from == _OPERATOR_),
|
||||
"RESET FORBIDDEN!"
|
||||
);
|
||||
require(newK > 0 && newK <= 10**18, "K OUT OF RANGE!");
|
||||
if(baseOutAmount > 0) _transferBaseOut(from, baseOutAmount);
|
||||
if(quoteOutAmount > 0) _transferQuoteOut(from, quoteOutAmount);
|
||||
if (baseOutAmount > 0) _transferBaseOut(from, baseOutAmount);
|
||||
if (quoteOutAmount > 0) _transferQuoteOut(from, quoteOutAmount);
|
||||
_resetTargetAndReserve();
|
||||
_LP_FEE_RATE_MODEL_.setFeeRate(newLpFeeRate);
|
||||
_MT_FEE_RATE_MODEL_.setFeeRate(newMtFeeRate);
|
||||
|
||||
Reference in New Issue
Block a user