add reset protection mechanism

This commit is contained in:
owen05
2020-12-18 11:27:45 +08:00
parent 83c8bbaa85
commit 0c77f9c9fe
9 changed files with 72 additions and 78 deletions

View File

@@ -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 {