code review modifyupdate

This commit is contained in:
牛涛涛
2021-01-07 21:36:27 +08:00
parent aba6b84683
commit 784c443834
3 changed files with 5 additions and 25 deletions

View File

@@ -83,22 +83,9 @@ contract DPPVault is DPPStorage {
_QUOTE_RESERVE_ = uint128(quoteBalance);
_BASE_TARGET_ = uint120(baseBalance);
_QUOTE_TARGET_ = uint120(quoteBalance);
_setRState();
_RState_ = uint16(PMMPricing.RState.ONE);
}
function _setRState() internal {
if (_BASE_RESERVE_ == _BASE_TARGET_ && _QUOTE_RESERVE_ == _QUOTE_TARGET_) {
_RState_ = uint16(PMMPricing.RState.ONE);
} else if (_BASE_RESERVE_ > _BASE_TARGET_ && _QUOTE_RESERVE_ < _QUOTE_TARGET_) {
_RState_ = uint16(PMMPricing.RState.BELOW_ONE);
} else if (_BASE_RESERVE_ < _BASE_TARGET_ && _QUOTE_RESERVE_ > _QUOTE_TARGET_) {
_RState_ = uint16(PMMPricing.RState.ABOVE_ONE);
} else {
require(false, "R_STATE_WRONG");
}
}
function ratioSync() external preventReentrant onlyOwner {
uint256 baseBalance = _BASE_TOKEN_.balanceOf(address(this));
uint256 quoteBalance = _QUOTE_TOKEN_.balanceOf(address(this));
@@ -115,13 +102,6 @@ contract DPPVault is DPPStorage {
}
}
function setTarget(uint256 baseTarget, uint256 quoteTarget) public preventReentrant onlyOwner {
require(baseTarget <= uint120(-1) && quoteTarget <= uint120(-1), "OVERFLOW");
_BASE_TARGET_ = uint120(baseTarget);
_QUOTE_TARGET_ = uint120(quoteTarget);
_setRState();
}
function reset(
address assetTo,
uint256 newLpFeeRate,