This commit is contained in:
owen05
2021-12-27 21:40:32 +08:00
parent b1b84f8818
commit 55fea6602f
10 changed files with 32 additions and 21 deletions

View File

@@ -168,7 +168,7 @@ contract FairFunding is Vesting {
// ============ Settle Functions ============
function settle() public isForceStop preventReentrant {
function settle() public isNotForceStop preventReentrant {
require(_FINAL_PRICE_ == 0 && isFundingEnd(), "CAN_NOT_SETTLE");
_FINAL_PRICE_ = getCurrentPrice();
if(_TOTAL_RAISED_FUNDS_ == 0) {
@@ -187,7 +187,7 @@ contract FairFunding is Vesting {
// ============ Funding Functions ============
function depositFunds(address to) external preventReentrant isForceStop returns(uint256 inputFund) {
function depositFunds(address to) external preventReentrant isNotForceStop returns(uint256 inputFund) {
require(isDepositOpen(), "DEPOSIT_NOT_OPEN");
uint256 currentFundBalance = IERC20(_FUNDS_ADDRESS_).balanceOf(address(this));

View File

@@ -142,7 +142,7 @@ contract InstantFunding is Vesting {
function depositFunds(address to)
external
preventReentrant
isForceStop
isNotForceStop
returns (uint256 newTokenAllocation)
{
require(isDepositOpen(), "DEPOSIT_NOT_OPEN");

View File

@@ -12,9 +12,11 @@ import {InitializableOwnable} from "../../lib/InitializableOwnable.sol";
import {ReentrancyGuard} from "../../lib/ReentrancyGuard.sol";
import {SafeMath} from "../../lib/SafeMath.sol";
import {IERC20} from "../../intf/IERC20.sol";
import {SafeERC20} from "../../lib/SafeERC20.sol";
contract Storage is InitializableOwnable, ReentrancyGuard {
using SafeMath for uint256;
using SafeERC20 for IERC20;
bool public _FORCE_STOP_ = false;
address public _QUOTA_;
@@ -58,7 +60,7 @@ contract Storage is InitializableOwnable, ReentrancyGuard {
// ============ Modifiers ============
modifier isForceStop() {
modifier isNotForceStop() {
require(!_FORCE_STOP_, "FORCE_STOP");
_;
}
@@ -69,6 +71,6 @@ contract Storage is InitializableOwnable, ReentrancyGuard {
_FORCE_STOP_ = true;
_TOTAL_TOKEN_AMOUNT_ = 0;
uint256 tokenAmount = IERC20(_TOKEN_ADDRESS_).balanceOf(address(this));
IERC20(_TOKEN_ADDRESS_).transfer(_OWNER_, tokenAmount);
IERC20(_TOKEN_ADDRESS_).safeTransfer(_OWNER_, tokenAmount);
}
}

View File

@@ -52,6 +52,8 @@ contract Vesting is Storage {
cliffRate = _LP_CLIFF_RATE_;
}
require(timestamp >= vestingStart, "NOT_START_TO_CLAIM");
uint256 timePast = timestamp.sub(vestingStart);
if (timePast < vestingDuration) {
uint256 remainingTime = vestingDuration.sub(timePast);
@@ -94,12 +96,12 @@ contract Vesting is Storage {
DecimalMath.ONE,
isOpenTWAP
);
IERC20(_TOKEN_ADDRESS_).transferFrom(msg.sender, _INITIAL_POOL_, initialTokenAmount);
IERC20(_TOKEN_ADDRESS_).safeTransferFrom(msg.sender, _INITIAL_POOL_, initialTokenAmount);
if(totalUsedRaiseFunds > _INITIAL_FUND_LIQUIDITY_) {
IERC20(_FUNDS_ADDRESS_).transfer(_INITIAL_POOL_, _INITIAL_FUND_LIQUIDITY_);
IERC20(_FUNDS_ADDRESS_).safeTransfer(_INITIAL_POOL_, _INITIAL_FUND_LIQUIDITY_);
}else {
IERC20(_FUNDS_ADDRESS_).transfer(_INITIAL_POOL_, totalUsedRaiseFunds);
IERC20(_FUNDS_ADDRESS_).safeTransfer(_INITIAL_POOL_, totalUsedRaiseFunds);
}
(_TOTAL_LP_, , ) = IDVM(_INITIAL_POOL_).buyShares(address(this));