add reset protection mechanism
This commit is contained in:
@@ -95,22 +95,26 @@ contract DPPAdmin is InitializableOwnable {
|
||||
uint256 newI,
|
||||
uint256 newK,
|
||||
uint256 baseOutAmount,
|
||||
uint256 quoteOutAmount
|
||||
) external notFreezed {
|
||||
uint256 quoteOutAmount,
|
||||
uint256 minBaseReserve,
|
||||
uint256 minQuoteReserve
|
||||
) external notFreezed returns (bool) {
|
||||
require(
|
||||
msg.sender == _OWNER_ ||
|
||||
(msg.sender == IDODOApprove(_DODO_APPROVE_).getDODOProxy() &&
|
||||
operator == _OPERATOR_),
|
||||
"RESET FORBIDDEN!"
|
||||
);
|
||||
IDPP(_DPP_).reset(
|
||||
return IDPP(_DPP_).reset(
|
||||
msg.sender,
|
||||
newLpFeeRate,
|
||||
newMtFeeRate,
|
||||
newI,
|
||||
newK,
|
||||
baseOutAmount,
|
||||
quoteOutAmount
|
||||
quoteOutAmount,
|
||||
minBaseReserve,
|
||||
minQuoteReserve
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -78,8 +78,11 @@ contract DPPVault is DPPStorage {
|
||||
uint256 newI,
|
||||
uint256 newK,
|
||||
uint256 baseOutAmount,
|
||||
uint256 quoteOutAmount
|
||||
) public preventReentrant onlyOwner {
|
||||
uint256 quoteOutAmount,
|
||||
uint256 minBaseReserve,
|
||||
uint256 minQuoteReserve
|
||||
) public preventReentrant onlyOwner returns (bool) {
|
||||
require(_BASE_RESERVE_ >= minBaseReserve && _QUOTE_RESERVE_ >= minQuoteReserve, "Reserve amount is not enough");
|
||||
_LP_FEE_RATE_MODEL_.setFeeRate(newLpFeeRate);
|
||||
_MT_FEE_RATE_MODEL_.setFeeRate(newMtFeeRate);
|
||||
_I_.set(newI);
|
||||
@@ -89,6 +92,7 @@ contract DPPVault is DPPStorage {
|
||||
_resetTargetAndReserve();
|
||||
_checkIK();
|
||||
emit Reset(newLpFeeRate, newMtFeeRate);
|
||||
return true;
|
||||
}
|
||||
|
||||
function _setRState() internal {
|
||||
|
||||
Reference in New Issue
Block a user