add twap switch

This commit is contained in:
owen05
2021-01-19 17:10:46 +08:00
parent 059778b27b
commit 8b683af08f
34 changed files with 519 additions and 174 deletions

View File

@@ -30,7 +30,8 @@ contract CP is CPVesting {
function init(
address[] calldata addressList,
uint256[] calldata timeLine,
uint256[] calldata valueList
uint256[] calldata valueList,
bool isOpenTWAP
) external {
/*
Address List
@@ -94,6 +95,8 @@ contract CP is CPVesting {
_TOTAL_BASE_ = _BASE_TOKEN_.balanceOf(address(this));
_IS_OPEN_TWAP_ = isOpenTWAP;
require(address(this).balance == _SETTEL_FUND_, "SETTLE_FUND_NOT_MATCH");
}
}

View File

@@ -91,7 +91,8 @@ contract CPFunding is CPStorage {
_poolQuoteToken,
3e15, // 0.3% lp feeRate
poolI,
DecimalMath.ONE
DecimalMath.ONE,
_IS_OPEN_TWAP_
);
uint256 avgPrice = unUsedBase == 0 ? _I_ : DecimalMath.divCeil(poolQuote, unUsedBase);

View File

@@ -22,6 +22,7 @@ contract CPStorage is InitializableOwnable, ReentrancyGuard {
uint256 internal constant _SETTLEMENT_EXPIRE_ = 86400 * 7;
uint256 internal constant _SETTEL_FUND_ = 200 finney;
bool public _IS_OPEN_TWAP_ = false;
// ============ Timeline ============