Skip to content
Permalink
Browse files

Foundation issue fix + Ref tokens form greylist fix + Destroy tokens …

…from LockedToken after Refund fix
  • Loading branch information...
slivlen committed Apr 17, 2018
1 parent f312226 commit 5a2c8710a0031e800a821b36093c001d522d52da
Showing with 23 additions and 5 deletions.
  1. +16 −5 Crowdsale.sol
  2. +7 −0 Fund.sol
@@ -72,6 +72,7 @@ contract TheAbyssDAICO is Ownable, SafeMath, Pausable, ISimpleCrowdsale {
uint256 public BNB_MIN_CONTRIB = 1000 ether; // 1K BNB
mapping(address => uint256) public bnbContributions;
uint256 public totalBNBContributed = 0;
bool public bnbWithdrawEnabled = false;

uint256 public hardCap = 0; // World hard cap will be set right before Token Sale
uint256 public softCap = 0; // World soft cap will be set right before Token Sale
@@ -414,7 +415,7 @@ contract TheAbyssDAICO is Ownable, SafeMath, Pausable, ISimpleCrowdsale {
) external payable checkCap {
require(msg.sender == address(reservationFund));
require(msg.value > 0);

rawTokenSupply = safeAdd(rawTokenSupply, tokenAmount);
processPayment(contributor, msg.value, tokenAmount, tokenBonusAmount, false);
}

@@ -433,22 +434,21 @@ contract TheAbyssDAICO is Ownable, SafeMath, Pausable, ISimpleCrowdsale {
*/
function finalizeCrowdsale() public onlyOwner {
if(
(totalEtherContributed >= safeSub(hardCap, 20 ether) && totalBNBContributed >= safeSub(BNB_HARD_CAP, 10000 ether)) ||
totalEtherContributed >= safeSub(hardCap, 1000 ether) ||
(now >= SALE_END_TIME && totalEtherContributed >= softCap)
) {
fund.onCrowdsaleEnd();
reservationFund.onCrowdsaleEnd();
// BNB transfer
bnbToken.transfer(bnbTokenWallet, bnbToken.balanceOf(address(this)));
bnbWithdrawEnabled = true;

// Referral
uint256 referralTokenAmount = safeDiv(rawTokenSupply, 10);
token.issue(referralTokenWallet, referralTokenAmount);

// Foundation
uint256 foundationTokenAmount = safeDiv(token.totalSupply(), 2); // 20%
token.issue(address(lockedTokens), foundationTokenAmount);
lockedTokens.addTokens(foundationTokenWallet, foundationTokenAmount, now + 365 days);

uint256 suppliedTokenAmount = token.totalSupply();

// Reserve
@@ -480,6 +480,17 @@ contract TheAbyssDAICO is Ownable, SafeMath, Pausable, ISimpleCrowdsale {
token.finishIssuance();
}

/**
* @dev Withdraw bnb after crowdsale if crowdsale is not in refund mode
*/
function withdrawBNB() public onlyOwner {
require(bnbWithdrawEnabled);
// BNB transfer
if(bnbToken.balanceOf(address(this)) > 0) {
bnbToken.transfer(bnbTokenWallet, bnbToken.balanceOf(address(this)));
}
}

/**
* @dev Function is called by contributor to refund BNB token payments if crowdsale failed to reach soft cap
*/
@@ -29,6 +29,7 @@ contract Fund is ICrowdsaleFund, SafeMath, MultiOwnable {
address public bountyTokenWallet;
address public companyTokenWallet;
address public advisorTokenWallet;
address public lockedTokenAddress;

uint256 public tap;
uint256 public lastWithdrawTime = 0;
@@ -95,6 +96,11 @@ contract Fund is ICrowdsaleFund, SafeMath, MultiOwnable {
token = ManagedToken(_tokenAddress);
}

function setLockedTokenAddress(address _lockedTokenAddress) public onlyOwner {
require(address(lockedTokenAddress) == address(0));
lockedTokenAddress = _lockedTokenAddress;
}

/**
* @dev Process crowdsale contribution
*/
@@ -189,6 +195,7 @@ contract Fund is ICrowdsaleFund, SafeMath, MultiOwnable {
function enableRefund() internal {
require(state == FundState.TeamWithdraw);
state = FundState.Refund;
token.destroy(lockedTokenAddress, token.balanceOf(lockedTokenAddress));
token.destroy(companyTokenWallet, token.balanceOf(companyTokenWallet));
token.destroy(reserveTokenWallet, token.balanceOf(reserveTokenWallet));
token.destroy(foundationTokenWallet, token.balanceOf(foundationTokenWallet));

1 comment on commit 5a2c871

@adobetienduc

This comment has been minimized.

Copy link

adobetienduc commented on 5a2c871 Apr 17, 2018

@slivlen , why so many errors?

Please sign in to comment.
You can’t perform that action at this time.