audit fix01
This commit is contained in:
@@ -257,7 +257,13 @@ contract DPPTrader is DPPVault {
|
||||
}
|
||||
|
||||
function _sync() internal {
|
||||
_BASE_RESERVE_ = _BASE_TOKEN_.balanceOf(address(this));
|
||||
_QUOTE_RESERVE_ = _QUOTE_TOKEN_.balanceOf(address(this));
|
||||
uint256 baseBalance = _BASE_TOKEN_.balanceOf(address(this));
|
||||
uint256 quoteBalance = _QUOTE_TOKEN_.balanceOf(address(this));
|
||||
if(baseBalance != _BASE_RESERVE_) {
|
||||
_BASE_RESERVE_ = baseBalance;
|
||||
}
|
||||
if(quoteBalance != _QUOTE_RESERVE_) {
|
||||
_QUOTE_RESERVE_ = quoteBalance;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,9 +81,9 @@ contract DPPVault is DPPStorage {
|
||||
function _setRState() internal {
|
||||
if (_BASE_RESERVE_ == _BASE_TARGET_ && _QUOTE_RESERVE_ == _QUOTE_TARGET_) {
|
||||
_RState_ = PMMPricing.RState.ONE;
|
||||
} else if (_BASE_RESERVE_ > _BASE_TARGET_) {
|
||||
} else if (_BASE_RESERVE_ > _BASE_TARGET_ && _QUOTE_RESERVE_ < _QUOTE_TARGET_) {
|
||||
_RState_ = PMMPricing.RState.BELOW_ONE;
|
||||
} else if (_QUOTE_RESERVE_ > _QUOTE_TARGET_) {
|
||||
} else if (_BASE_RESERVE_ < _BASE_TARGET_ && _QUOTE_RESERVE_ > _QUOTE_TARGET_) {
|
||||
_RState_ = PMMPricing.RState.ABOVE_ONE;
|
||||
} else {
|
||||
require(false, "R_STATE_WRONG");
|
||||
|
||||
@@ -92,6 +92,8 @@ contract DVMFunding is DVMVault {
|
||||
_burn(msg.sender, shareAmount);
|
||||
_transferBaseOut(to, baseAmount);
|
||||
_transferQuoteOut(to, quoteAmount);
|
||||
_sync();
|
||||
|
||||
if (data.length > 0) {
|
||||
IDODOCallee(to).DVMSellShareCall(
|
||||
msg.sender,
|
||||
@@ -101,7 +103,7 @@ contract DVMFunding is DVMVault {
|
||||
data
|
||||
);
|
||||
}
|
||||
_sync();
|
||||
|
||||
emit SellShares(msg.sender, to, shareAmount, _SHARES_[msg.sender]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,9 +20,9 @@ import {InitializableMintableERC20} from "../external/ERC20/InitializableMintabl
|
||||
contract ERC20Factory is Ownable {
|
||||
// ============ Templates ============
|
||||
|
||||
address public _CLONE_FACTORY_;
|
||||
address public _ERC20_TEMPLATE_;
|
||||
address public _MINTABLE_ERC20_TEMPLATE_;
|
||||
address public immutable _CLONE_FACTORY_;
|
||||
address public immutable _ERC20_TEMPLATE_;
|
||||
address public immutable _MINTABLE_ERC20_TEMPLATE_;
|
||||
|
||||
// ============ Events ============
|
||||
|
||||
|
||||
Reference in New Issue
Block a user