Compatible with rebase token
This commit is contained in:
@@ -36,6 +36,12 @@ contract DPPAdmin is InitializableOwnable {
|
||||
_DODO_APPROVE_ = dodoApprove;
|
||||
}
|
||||
|
||||
//For Rebase Token
|
||||
function sync() external notFreezed onlyOwner {
|
||||
IDPP(_DPP_).sync();
|
||||
}
|
||||
|
||||
|
||||
function setFreezeTimestamp(uint256 timestamp) external notFreezed onlyOwner {
|
||||
_FREEZE_TIMESTAMP_ = timestamp;
|
||||
}
|
||||
|
||||
@@ -57,6 +57,19 @@ contract DPPVault is DPPStorage {
|
||||
|
||||
// ============ Set States ============
|
||||
|
||||
function sync() external preventReentrant onlyOwner {
|
||||
uint256 baseBalance = _BASE_TOKEN_.balanceOf(address(this));
|
||||
uint256 quoteBalance = _QUOTE_TOKEN_.balanceOf(address(this));
|
||||
if (baseBalance != _BASE_RESERVE_) {
|
||||
_BASE_TARGET_ = _BASE_TARGET_.mul(baseBalance).div(_BASE_RESERVE_);
|
||||
_BASE_RESERVE_ = baseBalance;
|
||||
}
|
||||
if (quoteBalance != _QUOTE_RESERVE_) {
|
||||
_QUOTE_TARGET_ = _QUOTE_TARGET_.mul(quoteBalance).div(_QUOTE_RESERVE_);
|
||||
_QUOTE_RESERVE_ = quoteBalance;
|
||||
}
|
||||
}
|
||||
|
||||
function setTarget(uint256 baseTarget, uint256 quoteTarget) public preventReentrant onlyOwner {
|
||||
_BASE_TARGET_ = baseTarget;
|
||||
_QUOTE_TARGET_ = quoteTarget;
|
||||
|
||||
@@ -45,6 +45,8 @@ interface IDPP {
|
||||
|
||||
function setSell(bool open) external;
|
||||
|
||||
function sync() external;
|
||||
|
||||
//==============================
|
||||
|
||||
function retrieve(
|
||||
|
||||
@@ -68,6 +68,11 @@ contract DVMVault is DVMStorage {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function sync() external preventReentrant {
|
||||
_sync();
|
||||
}
|
||||
|
||||
// ============ Asset Out ============
|
||||
|
||||
function _transferBaseOut(address to, uint256 amount) internal {
|
||||
|
||||
Reference in New Issue
Block a user