add comments
This commit is contained in:
@@ -213,6 +213,15 @@ contract FairFunding is Vesting {
|
||||
}
|
||||
}
|
||||
|
||||
function claimToken(address to) external {
|
||||
require(isSettled(), "NOT_SETTLED");
|
||||
uint256 totalAllocation = getUserTokenAllocation(msg.sender);
|
||||
_claimToken(to, totalAllocation);
|
||||
}
|
||||
|
||||
|
||||
// ============ Ownable Functions ============
|
||||
|
||||
function withdrawUnallocatedToken(address to) external preventReentrant onlyOwner {
|
||||
require(isSettled(), "NOT_SETTLED");
|
||||
require(_FINAL_PRICE_ == _LOWER_LIMIT_PRICE_, "NO_TOKEN_LEFT");
|
||||
@@ -227,12 +236,6 @@ contract FairFunding is Vesting {
|
||||
_initializeLiquidity(initialTokenAmount, totalUsedRaiseFunds, lpFeeRate, isOpenTWAP);
|
||||
}
|
||||
|
||||
function claimToken(address to) external {
|
||||
require(isSettled(), "NOT_SETTLED");
|
||||
uint256 totalAllocation = getUserTokenAllocation(msg.sender);
|
||||
_claimToken(to, totalAllocation);
|
||||
}
|
||||
|
||||
function claimFund(address to) external preventReentrant onlyOwner {
|
||||
require(isSettled(), "NOT_SETTLED");
|
||||
uint256 totalUsedRaiseFunds = DecimalMath.mulFloor(_TOTAL_RAISED_FUNDS_, _USED_FUND_RATIO_);
|
||||
|
||||
@@ -25,7 +25,6 @@ contract InstantFunding is Vesting {
|
||||
uint256 public _END_PRICE_;
|
||||
|
||||
mapping(address => uint256) _FUNDS_USED_;
|
||||
// mapping(address => uint256) _FUNDS_UNUSED_;
|
||||
mapping(address => uint256) _TOKEN_ALLOCATION_;
|
||||
uint256 public _TOTAL_ALLOCATED_TOKEN_;
|
||||
|
||||
@@ -134,10 +133,6 @@ contract InstantFunding is Vesting {
|
||||
return _TOKEN_ALLOCATION_[user];
|
||||
}
|
||||
|
||||
// function getUserFundsUnused(address user) public view returns (uint256) {
|
||||
// return _FUNDS_UNUSED_[user];
|
||||
// }
|
||||
|
||||
function getUserFundsUsed(address user) public view returns (uint256) {
|
||||
return _FUNDS_USED_[user];
|
||||
}
|
||||
@@ -173,7 +168,6 @@ contract InstantFunding is Vesting {
|
||||
_FUNDS_RESERVE_ = _FUNDS_RESERVE_.add(fundUsed);
|
||||
|
||||
IERC20(_FUNDS_ADDRESS_).safeTransfer(to, inputFund.sub(fundUsed));
|
||||
// _FUNDS_UNUSED_[to] = _FUNDS_UNUSED_[to].add(inputFund.sub(fundUsed));
|
||||
} else {
|
||||
_FUNDS_USED_[to] = _FUNDS_USED_[to].add(inputFund);
|
||||
_TOTAL_RAISED_FUNDS_ = _TOTAL_RAISED_FUNDS_.add(inputFund);
|
||||
@@ -184,12 +178,12 @@ contract InstantFunding is Vesting {
|
||||
_TOTAL_ALLOCATED_TOKEN_ = _TOTAL_ALLOCATED_TOKEN_.add(newTokenAllocation);
|
||||
}
|
||||
|
||||
// function withdrawFunds(address to, uint256 amount) external preventReentrant {
|
||||
// require(_FUNDS_UNUSED_[msg.sender] >= amount, "UNUSED_FUND_NOT_ENOUGH");
|
||||
// _FUNDS_UNUSED_[msg.sender] = _FUNDS_UNUSED_[msg.sender].sub(amount);
|
||||
// _FUNDS_RESERVE_ = _FUNDS_RESERVE_.sub(amount);
|
||||
// IERC20(_FUNDS_ADDRESS_).safeTransfer(to, amount);
|
||||
// }
|
||||
function claimToken(address to) external {
|
||||
uint256 totalAllocation = getUserTokenAllocation(msg.sender);
|
||||
_claimToken(to, totalAllocation);
|
||||
}
|
||||
|
||||
// ============ Ownable Functions ============
|
||||
|
||||
function withdrawUnallocatedToken(address to) external preventReentrant onlyOwner {
|
||||
require(isFundingEnd(), "CAN_NOT_WITHDRAW");
|
||||
@@ -202,11 +196,6 @@ contract InstantFunding is Vesting {
|
||||
_initializeLiquidity(initialTokenAmount, _TOTAL_RAISED_FUNDS_, lpFeeRate, isOpenTWAP);
|
||||
}
|
||||
|
||||
function claimToken(address to) external {
|
||||
uint256 totalAllocation = getUserTokenAllocation(msg.sender);
|
||||
_claimToken(to, totalAllocation);
|
||||
}
|
||||
|
||||
function claimFund(address to) external preventReentrant onlyOwner {
|
||||
_claimFunds(to,_TOTAL_RAISED_FUNDS_);
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ contract Storage is InitializableOwnable, ReentrancyGuard {
|
||||
_;
|
||||
}
|
||||
|
||||
// ============ Ownable Control ============
|
||||
function forceStop() external onlyOwner {
|
||||
require(block.timestamp < _START_TIME_, "FUNDING_ALREADY_STARTED");
|
||||
_FORCE_STOP_ = true;
|
||||
|
||||
@@ -61,6 +61,8 @@ contract Vesting is Storage {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ============ Internal Function ============
|
||||
function _claimToken(address to, uint256 totalAllocation) internal {
|
||||
uint256 remainingToken = DecimalMath.mulFloor(
|
||||
getRemainingRatio(block.timestamp,0),
|
||||
|
||||
Reference in New Issue
Block a user