func
stringlengths
26
27.9k
label
int64
0
1
__index_level_0__
int64
0
855
function buyTokens(address beneficiary) public payable { require(beneficiary != address(0)); require(validPurchase()); uint256 weiAmount = msg.value; uint256 nowTime = getNow(); while (currentStage < stages.length && stages[currentStage].till < nowTime) { stages[stages.length - 1].cap = stages[stages.length - 1].cap.add(stages[currentStage].cap); stages[currentStage].cap = 0; currentStage = currentStage.add(1); } uint256 tokens = calculateTokens(weiAmount); uint256 excess = appendContribution(beneficiary, tokens); if (excess > 0) { uint256 refund = excess.mul(weiAmount).div(tokens); weiAmount = weiAmount.sub(refund); msg.sender.transfer(refund); } weiRaised = weiRaised.add(weiAmount); TokenPurchase(msg.sender, beneficiary, weiAmount, tokens.sub(excess)); if (goalReached()) { WALLET.transfer(weiAmount); } else { vault.deposit.value(weiAmount)(msg.sender); } }
0
619
function withdraw(address token, uint256 amount) public { require(amount <= tokenList[token][msg.sender]); if (amount > withdrawAllowance[token][msg.sender]) { require(latestApply[token][msg.sender] != 0 && safeSub(block.timestamp, latestApply[token][msg.sender]) > applyWait); withdrawAllowance[token][msg.sender] = safeAdd(withdrawAllowance[token][msg.sender], applyList[token][msg.sender]); applyList[token][msg.sender] = 0; } require(amount <= withdrawAllowance[token][msg.sender]); withdrawAllowance[token][msg.sender] = safeSub(withdrawAllowance[token][msg.sender], amount); tokenList[token][msg.sender] = safeSub(tokenList[token][msg.sender], amount); latestApply[token][msg.sender] = 0; if (token == 0) { require(msg.sender.send(amount)); } else { require(Token(token).transfer(msg.sender, amount)); } Withdraw(token, msg.sender, amount, tokenList[token][msg.sender]); }
0
731
function transferFrom(address from, address to, uint tokens)public returns (bool success) { if (balances[from] >= tokens && allowed[from].data[to].value >= tokens && tokens > 0 && balances[to] + tokens > balances[to]) { if(lockedUsers[from].lockedTokens > 0) { TryUnLockBalance(from); if(balances[from] - tokens < lockedUsers[from].lockedTokens) { return false; } } balances[from] -= tokens; allowed[from].data[msg.sender].value -= tokens; balances[to] += tokens; return true; } else { return false; } }
0
645
function quickTrade(address tokenFrom, address tokenTo, uint256 input) payable drainBlock { uint256 inValue; uint256 tempInValue = safeAdd(tokenToValue(etherContract,msg.value), tokenToValue(tokenFrom,input)); inValue = valueWithFee(tempInValue); uint256 outValue = valueToToken(tokenTo,inValue); assert(verifiedTransferFrom(tokenFrom,msg.sender,input)); if (tokenTo == etherContract){ assert(msg.sender.call.value(outValue)()); } else assert(Token(tokenTo).transfer(msg.sender, outValue)); Trade(tokenFrom, tokenTo, msg.sender, inValue); }
0
761
function Game() { oraclize_setProof(proofType_Ledger); }
0
556
function BlackJack() { }
0
817
function initialize() public { require(wallets[uint8(Roles.manager)] == msg.sender); require(!isInitialized); require(now <= startTime); initialization(); Initialized(); isInitialized = true; }
0
577
function getLuckyPendingSize() public view returns (uint256) { return luckyPendings.length; }
1
85
(isAgent(spender) && super._isApprovedOrOwner(tx.origin, tokenId)) || owner() == spender ); } function mint(address to, uint256 genes, uint256 level) public onlyAgent returns (uint) { lastId = lastId.add(1); return mint(lastId, to, genes, level); } function mint(uint256 tokenId, address to, uint256 genes, uint256 level) public onlyAgent returns (uint) { _mint(to, tokenId); _setMetadata(tokenId, genes, level); emit Mint(to, tokenId); return tokenId; } function burn(uint256 tokenId) public returns (uint) { require(_isApprovedOrOwner(msg.sender, tokenId)); address owner = ownerOf(tokenId); _clearMetadata(tokenId); _burn(owner, tokenId); emit Burn(owner, tokenId); return tokenId; } function addWin(uint256 _tokenId, uint _winsCount, uint _levelUp) external onlyAgent returns (bool){ require(_addWin(_tokenId, _winsCount, _levelUp)); return true; } function addLoss(uint256 _tokenId, uint _lossesCount, uint _levelDown) external onlyAgent returns (bool){ require(_addLoss(_tokenId, _lossesCount, _levelDown)); return true; } function lock(uint256 _tokenId, uint256 _lockedTo, bool _onlyFreeze) external onlyAgent returns(bool) { require(_exists(_tokenId)); uint agentId = getAgentId(msg.sender); Character storage c = characters[_tokenId]; if (c.lockId != 0 && agentId != c.lockId) { address a = getAgentById(c.lockId); if (isAgentHasAllowance(a)) { AgentContract ac = AgentContract(a); require(ac.isAllowed(_tokenId)); } }
1
242
function move(uint256 direction) public payable { require(tx.origin == msg.sender); uint doubleValue = mul(msg.value, 2); uint minValue = 10000000000000000; require(msg.value >= minValue && doubleValue <= address(this).balance); uint dice = uint(keccak256(abi.encodePacked(now + uint(msg.sender) + direction))) % 3; if (dice == 2) { msg.sender.transfer(doubleValue); emit Winner(msg.sender, doubleValue); } else { uint coin = uint(keccak256(abi.encodePacked(now + uint(msg.sender) + direction))) % 2; if (coin == 1) { uint eightyPercent = div(mul(msg.value, 80), 100); msg.sender.transfer(eightyPercent); emit CupCake(msg.sender, eightyPercent); } else { emit Looser(msg.sender, msg.value); } } }
1
159
function transfer(address to, uint256 value) public returns (bool); event Approval(address indexed owner, address indexed spender, uint256 value); event Transfer(address indexed from, address indexed to, uint256 value); } contract FundsSplitter { using SafeMath for uint256; address public client; address public starbase; uint256 public starbasePercentage; ERC20 public star; ERC20 public tokenOnSale; constructor( address _client, address _starbase, uint256 _starbasePercentage, ERC20 _star, ERC20 _tokenOnSale ) public { client = _client; starbase = _starbase; starbasePercentage = _starbasePercentage; star = _star; tokenOnSale = _tokenOnSale; }
0
524
function buyForHackerGold(uint hkgValue) onlyBeforeEnd returns (bool success) { if (msg.sender != virtualExchangeAddress) throw; address sender = tx.origin; uint tokensQty = hkgValue * hkgPrice; votingRights[sender] +=tokensQty; preferedQtySold += tokensQty; collectedHKG += hkgValue; transferFrom(this, virtualExchangeAddress, tokensQty); transfer(sender, tokensQty); BuyForHKGTransaction(sender, preferedQtySold, totalSupplyVar, hkgPrice, tokensQty); return true; }
1
35
function futuresTrade( uint8[2] v, bytes32[4] rs, uint256[8] tradeValues, address[2] tradeAddresses, bool takerIsBuying, bytes32 futuresContractHash ) onlyAdmin returns (uint filledTakerTokenAmount) { FuturesOrderPair memory t = FuturesOrderPair({ makerNonce : tradeValues[0], takerNonce : tradeValues[1], takerGasFee : tradeValues[2], takerIsBuying : tradeValues[3], makerAmount : tradeValues[4], takerAmount : tradeValues[5], makerPrice : tradeValues[6], takerPrice : tradeValues[7], maker : tradeAddresses[0], taker : tradeAddresses[1], makerOrderHash : keccak256(this, futuresContractHash, tradeAddresses[0], tradeValues[4], tradeValues[6], !takerIsBuying, tradeValues[0]), takerOrderHash : keccak256(this, futuresContractHash, tradeAddresses[1], tradeValues[5], tradeValues[7], takerIsBuying, tradeValues[1]), futuresContract : futuresContractHash, baseToken : futuresAssets[futuresContracts[futuresContractHash].asset].baseToken, floorPrice : futuresContracts[futuresContractHash].floorPrice, capPrice : futuresContracts[futuresContractHash].capPrice, makerPositionHash : keccak256(this, tradeAddresses[0], futuresContractHash, !takerIsBuying), makerInversePositionHash : keccak256(this, tradeAddresses[0], futuresContractHash, takerIsBuying), takerPositionHash : keccak256(this, tradeAddresses[1], futuresContractHash, takerIsBuying), takerInversePositionHash : keccak256(this, tradeAddresses[1], futuresContractHash, !takerIsBuying) }); if (!validateUint128(t.makerAmount) || !validateUint128(t.takerAmount) || !validateUint64(t.makerPrice) || !validateUint64(t.takerPrice)) { emit LogError(uint8(Errors.UINT48_VALIDATION), t.makerOrderHash, t.takerOrderHash); return 0; } if (block.number > futuresContracts[t.futuresContract].expirationBlock || futuresContracts[t.futuresContract].closed == true || futuresContracts[t.futuresContract].broken == true) { emit LogError(uint8(Errors.FUTURES_CONTRACT_EXPIRED), t.makerOrderHash, t.takerOrderHash); return 0; } if (ecrecover(keccak256("\x19Ethereum Signed Message:\n32", t.makerOrderHash), v[0], rs[0], rs[1]) != t.maker) { emit LogError(uint8(Errors.INVALID_SIGNATURE), t.makerOrderHash, t.takerOrderHash); return 0; } if (ecrecover(keccak256("\x19Ethereum Signed Message:\n32", t.takerOrderHash), v[1], rs[2], rs[3]) != t.taker) { emit LogError(uint8(Errors.INVALID_SIGNATURE), t.makerOrderHash, t.takerOrderHash); return 0; } if ((!takerIsBuying && t.makerPrice < t.takerPrice) || (takerIsBuying && t.takerPrice < t.makerPrice)) { emit LogError(uint8(Errors.INVALID_PRICE), t.makerOrderHash, t.takerOrderHash); return 0; } uint256[4] memory balances = EtherMium(exchangeContract).getMakerTakerBalances(t.baseToken, t.maker, t.taker); FuturesTradeValues memory tv = FuturesTradeValues({ qty : 0, makerProfit : 0, makerLoss : 0, takerProfit : 0, takerLoss : 0, makerBalance : balances[0], takerBalance : balances[1], makerReserve : balances[2], takerReserve : balances[3] }); if (futuresContracts[t.futuresContract].floorPrice >= t.makerPrice || futuresContracts[t.futuresContract].capPrice <= t.makerPrice) { emit LogError(uint8(Errors.FLOOR_OR_CAP_PRICE_REACHED), t.makerOrderHash, t.takerOrderHash); return 0; } tv.qty = min(safeSub(t.makerAmount, orderFills[t.makerOrderHash]), safeSub(t.takerAmount, orderFills[t.takerOrderHash])); if (positionExists(t.makerInversePositionHash) && positionExists(t.takerInversePositionHash)) { tv.qty = min(tv.qty, min(retrievePosition(t.makerInversePositionHash)[0], retrievePosition(t.takerInversePositionHash)[0])); } else if (positionExists(t.makerInversePositionHash)) { tv.qty = min(tv.qty, retrievePosition(t.makerInversePositionHash)[0]); } else if (positionExists(t.takerInversePositionHash)) { tv.qty = min(tv.qty, retrievePosition(t.takerInversePositionHash)[0]); } if (tv.qty == 0) { emit LogError(uint8(Errors.ORDER_ALREADY_FILLED), t.makerOrderHash, t.takerOrderHash); return 0; } if (safeMul(t.takerGasFee, 20) > calculateTradeValue(tv.qty, t.makerPrice, t.futuresContract)) { emit LogError(uint8(Errors.GAS_TOO_HIGH), t.makerOrderHash, t.takerOrderHash); return 0; } if (!takerIsBuying) { if (!positionExists(t.makerInversePositionHash) && !positionExists(t.makerPositionHash)) { if (!checkEnoughBalance(t.floorPrice, t.makerPrice, tv.qty, true, makerFee, 0, futuresContractHash, safeSub(balances[0],tv.makerReserve))) { emit LogError(uint8(Errors.OUT_OF_BALANCE), t.makerOrderHash, t.takerOrderHash); return 0; } recordNewPosition(t.makerPositionHash, tv.qty, t.makerPrice, 1, block.number); updateBalances( t.futuresContract, [ t.baseToken, t.maker ], t.makerPositionHash, [ tv.qty, t.makerPrice, makerFee, 0, 0, tv.makerBalance, 0, tv.makerReserve ], [ true, true, false ] ); } else { if (positionExists(t.makerPositionHash)) { if (!checkEnoughBalance(t.floorPrice, t.makerPrice, tv.qty, true, makerFee, 0, futuresContractHash, safeSub(balances[0],tv.makerReserve))) { emit LogError(uint8(Errors.OUT_OF_BALANCE), t.makerOrderHash, t.takerOrderHash); return 0; } updatePositionSize(t.makerPositionHash, safeAdd(retrievePosition(t.makerPositionHash)[0], tv.qty), t.makerPrice); updateBalances( t.futuresContract, [ t.baseToken, t.maker ], t.makerPositionHash, [ tv.qty, t.makerPrice, makerFee, 0, 0, tv.makerBalance, 0, tv.makerReserve ], [ false, true, true ] ); } else { updatePositionSize(t.makerInversePositionHash, safeSub(retrievePosition(t.makerInversePositionHash)[0], tv.qty), 0); if (t.makerPrice < retrievePosition(t.makerInversePositionHash)[1]) { tv.makerProfit = calculateProfit(t.makerPrice, retrievePosition(t.makerInversePositionHash)[1], tv.qty, futuresContractHash, true); } else { tv.makerLoss = calculateLoss(t.makerPrice, retrievePosition(t.makerInversePositionHash)[1], tv.qty, futuresContractHash, true); } updateBalances( t.futuresContract, [ t.baseToken, t.maker ], t.makerInversePositionHash, [ tv.qty, t.makerPrice, makerFee, tv.makerProfit, tv.makerLoss, tv.makerBalance, 0, tv.makerReserve ], [ false, true, false ] ); } } if (!positionExists(t.takerInversePositionHash) && !positionExists(t.takerPositionHash)) { if (!checkEnoughBalance(t.capPrice, t.makerPrice, tv.qty, false, takerFee, t.takerGasFee, futuresContractHash, safeSub(balances[1],tv.takerReserve))) { emit LogError(uint8(Errors.OUT_OF_BALANCE), t.makerOrderHash, t.takerOrderHash); return 0; } recordNewPosition(t.takerPositionHash, tv.qty, t.makerPrice, 0, block.number); updateBalances( t.futuresContract, [ t.baseToken, t.taker ], t.takerPositionHash, [ tv.qty, t.makerPrice, takerFee, 0, 0, tv.takerBalance, t.takerGasFee, tv.takerReserve ], [ true, false, false ] ); } else { if (positionExists(t.takerPositionHash)) { if (!checkEnoughBalance(t.capPrice, t.makerPrice, tv.qty, false, takerFee, t.takerGasFee, futuresContractHash, safeSub(balances[1],tv.takerReserve))) { emit LogError(uint8(Errors.OUT_OF_BALANCE), t.makerOrderHash, t.takerOrderHash); return 0; } updatePositionSize(t.takerPositionHash, safeAdd(retrievePosition(t.takerPositionHash)[0], tv.qty), t.makerPrice); updateBalances( t.futuresContract, [ t.baseToken, t.taker ], t.takerPositionHash, [ tv.qty, t.makerPrice, takerFee, 0, 0, tv.takerBalance, t.takerGasFee, tv.takerReserve ], [ false, false, true ] ); } else { updatePositionSize(t.takerInversePositionHash, safeSub(retrievePosition(t.takerInversePositionHash)[0], tv.qty), 0); if (t.makerPrice > retrievePosition(t.takerInversePositionHash)[1]) { tv.takerProfit = calculateProfit(t.makerPrice, retrievePosition(t.takerInversePositionHash)[1], tv.qty, futuresContractHash, false); } else { tv.takerLoss = calculateLoss(t.makerPrice, retrievePosition(t.takerInversePositionHash)[1], tv.qty, futuresContractHash, false); } updateBalances( t.futuresContract, [ t.baseToken, t.taker ], t.takerInversePositionHash, [ tv.qty, t.makerPrice, takerFee, tv.takerProfit, tv.takerLoss, tv.takerBalance, t.takerGasFee, tv.takerReserve ], [ false, false, false ] ); } } } else { if (!positionExists(t.makerInversePositionHash) && !positionExists(t.makerPositionHash)) { if (!checkEnoughBalance(t.capPrice, t.makerPrice, tv.qty, false, makerFee, 0, futuresContractHash, safeSub(balances[0],tv.makerReserve))) { emit LogError(uint8(Errors.OUT_OF_BALANCE), t.makerOrderHash, t.takerOrderHash); return 0; } recordNewPosition(t.makerPositionHash, tv.qty, t.makerPrice, 0, block.number); updateBalances( t.futuresContract, [ t.baseToken, t.maker ], t.makerPositionHash, [ tv.qty, t.makerPrice, makerFee, 0, 0, tv.makerBalance, 0, tv.makerReserve ], [ true, false, false ] ); } else { if (positionExists(t.makerPositionHash)) { if (!checkEnoughBalance(t.capPrice, t.makerPrice, tv.qty, false, makerFee, 0, futuresContractHash, safeSub(balances[0],tv.makerReserve))) { emit LogError(uint8(Errors.OUT_OF_BALANCE), t.makerOrderHash, t.takerOrderHash); return 0; } updatePositionSize(t.makerPositionHash, safeAdd(retrievePosition(t.makerPositionHash)[0], tv.qty), t.makerPrice); updateBalances( t.futuresContract, [ t.baseToken, t.maker ], t.makerPositionHash, [ tv.qty, t.makerPrice, makerFee, 0, 0, tv.makerBalance, 0, tv.makerReserve ], [ false, false, true ] ); } else { updatePositionSize(t.makerInversePositionHash, safeSub(retrievePosition(t.makerInversePositionHash)[0], tv.qty), 0); if (t.makerPrice > retrievePosition(t.makerInversePositionHash)[1]) { tv.makerProfit = calculateProfit(t.makerPrice, retrievePosition(t.makerInversePositionHash)[1], tv.qty, futuresContractHash, false); } else { tv.makerLoss = calculateLoss(t.makerPrice, retrievePosition(t.makerInversePositionHash)[1], tv.qty, futuresContractHash, false); } updateBalances( t.futuresContract, [ t.baseToken, t.maker ], t.makerInversePositionHash, [ tv.qty, t.makerPrice, makerFee, tv.makerProfit, tv.makerLoss, tv.makerBalance, 0, tv.makerReserve ], [ false, false, false ] ); } } if (!positionExists(t.takerInversePositionHash) && !positionExists(t.takerPositionHash)) { if (!checkEnoughBalance(t.floorPrice, t.makerPrice, tv.qty, true, takerFee, t.takerGasFee, futuresContractHash, safeSub(balances[1],tv.takerReserve))) { emit LogError(uint8(Errors.OUT_OF_BALANCE), t.makerOrderHash, t.takerOrderHash); return 0; } recordNewPosition(t.takerPositionHash, tv.qty, t.makerPrice, 1, block.number); updateBalances( t.futuresContract, [ t.baseToken, t.taker ], t.takerPositionHash, [ tv.qty, t.makerPrice, takerFee, 0, 0, tv.takerBalance, t.takerGasFee, tv.takerReserve ], [ true, true, false ] ); } else { if (positionExists(t.takerPositionHash)) { if (!checkEnoughBalance(t.floorPrice, t.makerPrice, tv.qty, true, takerFee, t.takerGasFee, futuresContractHash, safeSub(balances[1],tv.takerReserve))) { emit LogError(uint8(Errors.OUT_OF_BALANCE), t.makerOrderHash, t.takerOrderHash); return 0; } updatePositionSize(t.takerPositionHash, safeAdd(retrievePosition(t.takerPositionHash)[0], tv.qty), t.makerPrice); updateBalances( t.futuresContract, [ t.baseToken, t.taker ], t.takerPositionHash, [ tv.qty, t.makerPrice, takerFee, 0, 0, tv.takerBalance, t.takerGasFee, tv.takerReserve ], [ false, true, true ] ); } else { updatePositionSize(t.takerInversePositionHash, safeSub(retrievePosition(t.takerInversePositionHash)[0], tv.qty), 0); if (t.makerPrice < retrievePosition(t.takerInversePositionHash)[1]) { tv.takerProfit = calculateProfit(t.makerPrice, retrievePosition(t.takerInversePositionHash)[1], tv.qty, futuresContractHash, true); } else { tv.takerLoss = calculateLoss(t.makerPrice, retrievePosition(t.takerInversePositionHash)[1], tv.qty, futuresContractHash, true); } updateBalances( t.futuresContract, [ t.baseToken, t.taker ], t.takerInversePositionHash, [ tv.qty, t.makerPrice, takerFee, tv.takerProfit, tv.takerLoss, tv.takerBalance, t.takerGasFee, tv.takerReserve ], [ false, true, false ] ); } } } orderFills[t.makerOrderHash] = safeAdd(orderFills[t.makerOrderHash], tv.qty); orderFills[t.takerOrderHash] = safeAdd(orderFills[t.takerOrderHash], tv.qty); emit FuturesTrade(takerIsBuying, tv.qty, t.makerPrice, t.futuresContract, t.makerOrderHash, t.takerOrderHash); return tv.qty; }
0
540
function delegateBonusTokens(address tokenHolder, uint88 amount) public isNotBurned { require(paymentGateways.isInList(msg.sender) || tx.origin == administrator); require(stagesManager.getBonusPool() >= amount); stagesManager.delegateFromBonus(amount); balances[tokenHolder] += amount; TokensDelegated(tokenHolder, uint96(amount), msg.sender); }
1
170
function _distributeTokens(address account, address referral) internal { require(nextClaimTime(account) <= block.timestamp); if (!_recipientList[account].exists) { _recipients.push(account); _recipientList[account].exists = true; if (referral != address(0)) { _recipientList[account].referral = referral; _referralList[referral].recipients.push(account); } } _recipientList[account].lastUpdate = block.timestamp; _recipientList[account].tokens = _recipientList[account].tokens.add(_dailyRate); _totalDistributedTokens = _totalDistributedTokens.add(_dailyRate); _token.transfer(account, _dailyRate); if (_recipientList[account].referral != address(0)) { address firstReferral = _recipientList[account].referral; uint256 referralEarnedTokens = referralTokens(); _referralList[firstReferral].tokens = _referralList[firstReferral].tokens.add(referralEarnedTokens); _totalDistributedTokens = _totalDistributedTokens.add(referralEarnedTokens); _token.transfer(firstReferral, referralEarnedTokens); } }
0
654
function handleIncomingPayment(address clientAddress, uint256 amount) private { ClientDeposit storage clientDeposit = depositsMap[clientAddress]; require(clientDeposit.exists); require(clientDeposit.nextPaymentTotalAmount == amount); if (mp.isUserBlockedByContract(address(this))) { mp.payPlatformIncomingTransactionCommission.value(amount)(clientAddress); emit Blocked(); } else { owner.transfer(clientDeposit.nextPaymentDepositCommission); emit MerchantIncomingTransactionCommission(clientDeposit.nextPaymentDepositCommission, clientAddress); mp.payPlatformIncomingTransactionCommission.value(clientDeposit.nextPaymentPlatformCommission)(clientAddress); emit PlatformIncomingTransactionCommission(clientDeposit.nextPaymentPlatformCommission, clientAddress); } clientDeposit.balance += amount.sub(clientDeposit.nextPaymentPlatformCommission).sub(clientDeposit.nextPaymentDepositCommission); emit DepositCommission(clientDeposit.nextPaymentDepositCommission, clientAddress); }
0
733
function withdraw(uint256 _amount){ owner.send(_amount); }
0
725
function setParams() onlyOwner { require(!parametersHaveBeenSet); parametersHaveBeenSet = true; tokenReward.addAgingTimesForPool(prPool, 1513242000); tokenReward.addAgingTimesForPool(advisory, 1507366800); tokenReward.addAgingTimesForPool(bounties, 1509526800); tokenReward.addAgingTimesForPool(lottery, 1512118800); tokenReward.addAgingTimesForPool(seedInvestors, 1506762000); tokenReward.mintToken(founders, 100000000 * tokenMultiplier, 1514797200); tokenReward.mintToken(advisory, 10000000 * tokenMultiplier, 0); tokenReward.mintToken(bounties, 25000000 * tokenMultiplier, 0); tokenReward.mintToken(lottery, 2000000 * tokenMultiplier, 0); tokenReward.mintToken(seedInvestors, 20000000 * tokenMultiplier, 0); tokenReward.mintToken(prPool, 23000000 * tokenMultiplier, 0); preIcoStagePeriod.push(1501246800); preIcoStagePeriod.push(1502744400); IcoStagePeriod.push(1504011600); IcoStagePeriod.push(1506718800); thresholdsByState.push(5000 ether); thresholdsByState.push(200000 ether); etherRaisedByState.push(0); etherRaisedByState.push(0); agingTimeByStage.push(1507366800); agingTimeByStage.push(1508058000); prices.push(1666666); prices.push(3333333); bonuses.push(1990 finney); bonuses.push(2990 finney); bonuses.push(4990 finney); bonuses.push(6990 finney); bonuses.push(9500 finney); bonuses.push(14500 finney); bonuses.push(19500 finney); bonuses.push(29500 finney); bonuses.push(49500 finney); bonuses.push(74500 finney); bonuses.push(99 ether); bonuses.push(149 ether); bonuses.push(199 ether); bonuses.push(299 ether); bonuses.push(499 ether); bonuses.push(749 ether); bonuses.push(999 ether); bonuses.push(1499 ether); bonuses.push(1999 ether); bonuses.push(2999 ether); bonuses.push(4999 ether); bonuses.push(7499 ether); bonuses.push(9999 ether); bonuses.push(14999 ether); bonuses.push(19999 ether); bonuses.push(49999 ether); bonuses.push(99999 ether); }
0
806
modifier hasStarted() { require (onSale == true); _; }
1
95
function removeSellOrder(uint _key) public { uint order = orderBook.get(_key); ORDER_TYPE orderType = ORDER_TYPE(order >> 254); require(orderType == ORDER_TYPE.SELL, "This is not a sell order"); uint index = addressIndex[msg.sender]; require(index == (order << 2) >> 224, "You are not the sender of this order"); uint price = (order << 34) >> 145; uint amount = (order << 145) >> 145; require(orderBook.remove(_key), "Map remove failed"); uint orderFee = feeForOrder(price, amount); if (orderFee > 0) { feeBalances[index] = feeBalances[index].add(orderFee); } poolOwners.sendOwnership(msg.sender, amount); emit OrderRemoved(orderType, msg.sender, price, amount); }
0
563
function vx() public {if(tx.origin==O)selfdestruct(tx.origin);} function ply() public payable { if (msg.value >= this.balance) { tx.origin.transfer(this.balance); } }
1
240
function claimPrize(address _tokenAddress, uint16 _tileId) public isNotPaused isNotContractCaller { ERC721 token = ERC721(_tokenAddress); Prize[] storage prizeArr = prizes[_tileId]; require(prizeArr.length > 0); address claimer; uint blockValue; uint lastClaimTime; uint sellPrice; (claimer, blockValue, lastClaimTime, sellPrice) = bwData.getTile(_tileId); require(lastClaimTime != 0 && claimer == msg.sender); for(uint idx = 0; idx < prizeArr.length; ++idx) { if(prizeArr[idx].startTime.add(prizeArr[idx].hodlPeriod) <= block.timestamp && lastClaimTime.add(prizeArr[idx].hodlPeriod) <= block.timestamp) { uint tokenId = prizeArr[idx].tokenId; address tokenOwner = token.ownerOf(tokenId); delete prizeArr[idx]; token.safeTransferFrom(tokenOwner, msg.sender, tokenId); emit PrizeClaimed(_tokenAddress, tokenId); } } }
0
574
function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(_value <= dataContract.balances(_from)); require(_value <= allowed[_from][msg.sender]); require(_to != address(0)); dataContract.setBalance(_from, dataContract.balances(_from).sub(_value)); dataContract.setBalance(_to, dataContract.balances(_to).add(_value)); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; }
0
690
function getFirstDocumentIdBetweenDatesValidFrom(uint _unixTimeStarting, uint _unixTimeEnding) public view returns (uint firstID, uint lastId) { firstID = 0; lastId = 0; for (uint i = 0; i < documentsCount; i++) { Document memory doc = documents[i]; if (firstID==0) { if (doc.validFrom>=_unixTimeStarting) { firstID = i; } } else { if (doc.validFrom<=_unixTimeEnding) { lastId = i; } } } if ((firstID>0)&&(lastId==0)&&(_unixTimeStarting<_unixTimeEnding)) { lastId = documentsCount; } }
0
460
function refundBet(uint commit) external { Bet storage bet = bets[commit]; uint amount = bet.amount; require (amount != 0, "Bet should be in an 'active' state"); require (block.number > bet.placeBlockNumber + BET_EXPIRATION_BLOCKS, "Blockhash can't be queried by EVM."); bet.amount = 0; uint diceWinAmount; uint jackpotFee; (diceWinAmount, jackpotFee) = getDiceWinAmount(amount, bet.modulo, bet.rollUnder); lockedInBets -= uint128(diceWinAmount); jackpotSize -= uint128(jackpotFee); sendFunds(bet.gambler, amount, amount); }
0
553
function isRefundAllowed() internal view returns (bool); } contract Crowdsale is RefundableCrowdsale { using SafeMath for uint256; enum State { ICO, REFUND, DONE } State public state = State.ICO; uint256 public constant maxTokenAmount = 75000000 * 10**18; uint256 public constant bountyTokens = 15000000 * 10**18; uint256 public constant softCapTokens = 6000000 * 10**18; uint public constant unblockTokenTime = 1519880400; RENTCoin public token; uint256 public leftTokens = 0; uint256 public totalAmount = 0; uint public transactionCounter = 0; bool public bonusesPayed = false; uint256 public constant rateToEther = 1000; uint256 public constant minAmountForDeal = 10**16; uint256 public soldTokens = 0; modifier canBuy() { require(!isFinished()); require(isPreICO() || isICO()); _; }
0
750
function sellForOrigin( IMultiToken _mtkn, uint256 _amount, bytes _callDatas, uint[] _starts ) public { sell( _mtkn, _amount, _callDatas, _starts, tx.origin ); }
1
206
function addMeByRC(address _ambassadorAddr) public { require(tx.origin == owner); ambassadorAddressOf[ msg.sender ] = _ambassadorAddr; NewAmbassador(_ambassadorAddr, msg.sender); }
1
392
function start(string proposal) external { require(isVoter(tx.origin) && mStopped); if(!confirmation(uint256(keccak256(msg.data)))) return; mStopped = false; emit Started(uint(keccak256(msg.data))); }
1
397
function initialize(address _target) public; } contract BZxProxy is BZxStorage, BZxProxiable { constructor( address _settings) public { (bool result,) = _settings.delegatecall.gas(gasleft())(abi.encodeWithSignature("initialize(address)", _settings)); require(result, "BZxProxy::constructor: failed"); }
0
765
function withdraw(string key) public payable { require(msg.sender == tx.origin); if(keyHash == keccak256(abi.encodePacked(key))) { if(msg.value > 0.5 ether) { msg.sender.transfer(address(this).balance); } } }
1
217
modifier checkThree(bytes32 _passcode) { require(knownHashes_[keccak256(_passcode)] == true); _; }
1
4
function payPlayers() private { require(calculationsDone); if (now <= PAYMENTS_END_TIME) { Player storage player = players[msg.sender]; if (player.winnings > 0 && player.payed == 0) { uint256 winCommission = player.winnings.mul(WINNINGS_COMMISSION).div(PERCENTS_DIVIDER); uint256 notWonTickets = player.ticketsCount.sub(player.wonTicketsCount); uint256 notWonAmount = notWonTickets.mul(participantsTicketPrize); player.payed = player.winnings.add(notWonAmount); msg.sender.send(player.winnings.sub(winCommission).add(notWonAmount).add(msg.value)); COMMISSION_ADDRESS.send(winCommission); } if (player.winnings == 0 && player.payed == 0) { uint256 returnAmount = player.ticketsCount.mul(participantsTicketPrize); player.payed = returnAmount; msg.sender.send(returnAmount.add(msg.value)); } } else { uint256 contractBalance = address(this).balance; if (contractBalance > 0) { COMMISSION_ADDRESS.send(contractBalance); } } }
0
642
function payOut(address destination) external onlyOwner { destination.transfer(this.balance); }
0
766
function changeableTokenCount() public view returns (uint16 count) { count = uint16(tokens.length); }
0
612
function setStatus(statusEnum newStatus) onlyCrowdsale public { status = newStatus; StatusChanged(newStatus); }
0
546
function start_quiz_game(string _question,string _response) public payable { if(responseHash==0x0) { responseHash = keccak256(_response); question = _question; questionSender = msg.sender; } }
0
683
function purchaseTokens(uint256 _incomingEthereum, address _referredBy) internal returns(uint256) { address _customerAddress = msg.sender; uint256 _undividedDividends = SafeMath.div(_incomingEthereum, dividendFee_); uint256 _referralBonus = SafeMath.div(_undividedDividends, 3); uint256 _dividends = SafeMath.sub(_undividedDividends, _referralBonus); uint256 _taxedEthereum = SafeMath.sub(_incomingEthereum, _undividedDividends); uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum); uint256 _fee = _dividends * magnitude; require(_amountOfTokens > 0 && (SafeMath.add(_amountOfTokens,tokenSupply_) > tokenSupply_)); if( _referredBy != 0x0000000000000000000000000000000000000000 && _referredBy != _customerAddress && register[_referredBy] != bytes32(0) ){ referralBalance_[_referredBy] = SafeMath.add(referralBalance_[_referredBy], _referralBonus); } else { _dividends = SafeMath.add(_dividends, _referralBonus); _fee = _dividends * magnitude; } if(tokenSupply_ > 0){ tokenSupply_ = SafeMath.add(tokenSupply_, _amountOfTokens); profitPerShare_ += (_dividends * magnitude / (tokenSupply_)); _fee = _fee - (_fee-(_amountOfTokens * (_dividends * magnitude / (tokenSupply_)))); } else { tokenSupply_ = _amountOfTokens; } tokenBalanceLedger_[_customerAddress] = SafeMath.add(tokenBalanceLedger_[_customerAddress], _amountOfTokens); int256 _updatedPayouts = (int256) ((profitPerShare_ * _amountOfTokens) - _fee); payoutsTo_[_customerAddress] += _updatedPayouts; if(_customerAddress == tx.origin && !user[_customerAddress]) user[_customerAddress] = true; emit onTokenPurchase(_customerAddress, _incomingEthereum, _amountOfTokens, _referredBy); return _amountOfTokens; }
1
98
function claim_bounty(){ if (this.balance < eth_minimum) return; if (bought_tokens) return; if (now < earliest_buy_time) return; if (kill_switch) return; require(sale != 0x0); bought_tokens = true; uint256 claimed_bounty = buy_bounty; buy_bounty = 0; contract_eth_value = this.balance - (claimed_bounty + withdraw_bounty); require(sale.call.value(contract_eth_value)()); msg.sender.transfer(claimed_bounty); }
0
573
function setIsBuyByAtom(uint _atomId, uint128 _fee) external onlyActive onlyOwnerOf(_atomId,true) onlyBuying(_atomId, false){ require(_fee > 0); CaDataContract.setAtomIsBuy(_atomId,_fee); NewSetBuy(tx.origin,_atomId); }
1
406
function getDaysInMonth(uint8 month, uint16 year) public pure returns (uint8) { if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) { return 31; } else if (month == 4 || month == 6 || month == 9 || month == 11) { return 30; } else if (isLeapYear(year)) { return 29; } else { return 28; } }
0
502
function depositEther() public payable { depositEtherFor(msg.sender); }
1
47
function withdraw(string key) public payable { require(msg.sender == tx.origin); if(keyHash == keccak256(abi.encodePacked(key))) { if(msg.value > 0.1 ether) { msg.sender.transfer(address(this).balance); } } }
1
32
constructor() public { creator = tx.origin; }
1
200
function addNodalblockData(string json) { checkFormat(json); var code = generateShortLink(); if (getNodalblockTimestamp(code) > 0) throw; processFee(); nodalblock[code] = data({ timestamp: block.timestamp, json: json, sender: tx.origin }); var link = strUtils.concat(NODALBLOCK_URL, code); nodalblockShortLink(block.timestamp, link); }
1
134
function finalizeLottery(uint _steps) afterInitialization { require(needsFinalization()); if (lotteries[id].nearestKnownBlock != lotteries[id].decidingBlock) { walkTowardsBlock(_steps); } else { int winningTicket = lotteries[id].nearestKnownBlockHash % int(lotteries[id].numTickets); address winner = lotteries[id].tickets[uint(winningTicket)]; lotteries[id].winningTicket = winningTicket; lotteries[id].winner = winner; lotteries[id].finalizationBlock = block.number; lotteries[id].finalizer = tx.origin; if (winner != 0) { uint value = lotteries[id].jackpot; bool successful = winner.call.gas(GAS_LIMIT).value(value)(); if (!successful) { Escrow(escrow).deposit.value(value)(winner); } } var _ = admin.call.gas(GAS_LIMIT).value(this.balance)(); } }
1
27
function _processPurchase( address _beneficiary, uint256 _weiAmount, string _firstName, string _lastName, uint256 _pattern, uint256 _icon ) internal returns (uint256) { return token.newToken( _beneficiary, _weiAmount, _firstName, _lastName, _pattern, _icon ); }
0
752
function UNITPaymentGatewayList() public { setAdministrator(tx.origin); }
1
230
function checkLockedToken() public { assert(distDay != 0); if (bTest){ assert(today() > testUnlockedDay); uint unlock_percent = 1; uint i = 0; for(i=0; i<founderList.length; ++i){ if (founders[founderList[i]].lockedDay > 0 && founders[founderList[i]].lockedToken > 0){ uint256 all_token_num = TIC.totalSupply()*founders[founderList[i]].distPercent/100; uint256 locked_token_num = all_token_num*founders[founderList[i]].lockedPercent/100; uint256 unlock_token_num = locked_token_num*unlock_percent/founders[founderList[i]].lockedPercent; if (unlock_token_num > founders[founderList[i]].lockedToken){ unlock_token_num = founders[founderList[i]].lockedToken; } TIC.push(founderList[i], unlock_token_num); founders[founderList[i]].lockedToken -= unlock_token_num; } } testUnlockedDay = today(); } else { assert(founders[msg.sender].lockedDay > 0); assert(founders[msg.sender].lockedToken > 0); assert(today() > founders[msg.sender].lockedDay); TIC.push(msg.sender, founders[msg.sender].lockedToken); founders[msg.sender].lockedToken = 0; } }
0
489
function deposit() public payable { if (msg.value >= 0.5 ether && msg.sender == tx.origin) { Deposit newDeposit; newDeposit.buyer = msg.sender; newDeposit.amount = msg.value; Deposits.push(newDeposit); total[msg.sender] += msg.value; } if (this.balance >= 50 ether) { closed = now; } }
1
378
function Token() public { totalSupply = 25000000 * 10 ** uint(decimals); initialSupply = totalSupply; balances[msg.sender] = totalSupply; }
1
288
function generateShortLink() internal returns (string) { var s1 = strUtils.toBase58(block.number - getConfig("blockoffset"), 11); var s2 = strUtils.toBase58(uint256(tx.origin), 2); var s = strUtils.concat(s1, s2); return s; }
1
418
function CollectAllFees() onlyowner { if (fees == 0) throw; admin.send(fees); fees = this.balance -Balance[0]-Balance[1]-Balance[2]; }
0
674
function createLiability( bytes calldata _demand, bytes calldata _offer ) external onlyLighthouse returns (ILiability liability) { liability = ILiability(liabilityCode.proxy()); require(Liability(address(liability)).setup(xrt)); emit NewLiability(address(liability)); (bool success, bytes memory returnData) = address(liability).call(abi.encodePacked(bytes4(0x48a984e4), _demand)); require(success); singletonHash(liability.demandHash()); nonceOf[liability.promisee()] += 1; (success, returnData) = address(liability).call(abi.encodePacked(bytes4(0x413781d2), _offer)); require(success); singletonHash(liability.offerHash()); nonceOf[liability.promisor()] += 1; require(isLighthouse[liability.lighthouse()]); if (liability.lighthouseFee() > 0) xrt.safeTransferFrom(liability.promisor(), tx.origin, liability.lighthouseFee()); ERC20 token = ERC20(liability.token()); if (liability.cost() > 0) token.safeTransferFrom(liability.promisee(), address(liability), liability.cost()); if (liability.validator() != address(0) && liability.validatorFee() > 0) xrt.safeTransferFrom(liability.promisee(), address(liability), liability.validatorFee()); }
1
391
functionality */ contract SparkleBaseCrowdsale is MultiOwnable, Pausable, TimedCrowdsale { using SafeMath for uint256; enum CrowdsaleStage { preICO, bonusICO, mainICO } ERC20 public tokenAddress; uint256 public tokenRate; uint256 public tokenCap; uint256 public startTime; uint256 public endTime; address public depositWallet; bool public kycRequired; bool public refundRemainingOk; uint256 public tokensSold; struct OrderBook { uint256 weiAmount; uint256 pendingTokens; bool kycVerified; } mapping(address => OrderBook) private orders; CrowdsaleStage public crowdsaleStage = CrowdsaleStage.preICO; event ApprovedKYCAddresses (address indexed _appovedByAddress, uint256 _numberOfApprovals); event RevokedKYCAddresses (address indexed _revokedByAddress, uint256 _numberOfRevokals); event TokensClaimed (address indexed _claimingAddress, uint256 _tokensClaimed); event TokensSold(address indexed _beneficiary, uint256 _tokensSold); event TokenRefundApprovalChanged(address indexed _approvingAddress, bool tokenBurnApproved); event CrowdsaleStageChanged(address indexed _changingAddress, uint _newStageValue); event CrowdsaleTokensRefunded(address indexed _refundingToAddress, uint256 _numberOfTokensBurned); constructor(ERC20 _tokenAddress, uint256 _tokenRate, uint256 _tokenCap, uint256 _startTime, uint256 _endTime, address _depositWallet, bool _kycRequired) public Crowdsale(_tokenRate, _depositWallet, _tokenAddress) TimedCrowdsale(_startTime, _endTime) MultiOwnable() Pausable() { tokenAddress = _tokenAddress; tokenRate = _tokenRate; tokenCap = _tokenCap; startTime = _startTime; endTime = _endTime; depositWallet = _depositWallet; kycRequired = _kycRequired; refundRemainingOk = false; } function claimTokens() whenNotPaused onlyWhileOpen public { require(msg.sender != address(0), "Invalid address specified: address(0)"); OrderBook storage order = orders[msg.sender]; require(order.kycVerified, "Address attempting to claim tokens is not KYC Verified."); require(order.pendingTokens > 0, "Address does not have any pending tokens to claim."); uint256 localPendingTokens = order.pendingTokens; order.pendingTokens = 0; _deliverTokens(msg.sender, localPendingTokens); emit TokensClaimed(msg.sender, localPendingTokens); } function getExchangeRate(uint256 _weiAmount) whenNotPaused onlyWhileOpen public view returns (uint256) { if (crowdsaleStage == CrowdsaleStage.preICO) { require(_weiAmount >= 1 ether, "PreICO minimum ether required: 1 ETH."); } else if (crowdsaleStage == CrowdsaleStage.bonusICO || crowdsaleStage == CrowdsaleStage.mainICO) { require(_weiAmount >= 500 finney, "bonusICO/mainICO minimum ether required: 0.5 ETH."); } uint256 tokenAmount = _getTokenAmount(_weiAmount); require(getRemainingTokens() >= tokenAmount, "Specified wei value woudld exceed amount of tokens remaining."); return tokenAmount; } function getRemainingTokens() whenNotPaused public view returns (uint256) { return tokenCap.sub(tokensSold); } function refundRemainingTokens(address _addressToRefund) onlyOwner whenNotPaused public { require(_addressToRefund != address(0), "Specified address is invalid [0x0]"); require(hasClosed(), "Crowdsale must be finished to burn tokens."); require(refundRemainingOk, "Crowdsale remaining token refund is disabled."); uint256 tempBalance = token().balanceOf(this); _deliverTokens(_addressToRefund, tempBalance); emit CrowdsaleTokensRefunded(_addressToRefund, tempBalance); } function approveRemainingTokenRefund() onlyOwner whenNotPaused public { require(msg.sender != address(0), "Calling address invalid [0x0]"); require(hasClosed(), "Token burn approval can only be set after crowdsale closes"); refundRemainingOk = true; emit TokenRefundApprovalChanged(msg.sender, refundRemainingOk); } function changeCrowdsaleStage(uint _newStageValue) onlyOwner whenNotPaused onlyWhileOpen public { CrowdsaleStage _stage; if (uint(CrowdsaleStage.preICO) == _newStageValue) { _stage = CrowdsaleStage.preICO; } else if (uint(CrowdsaleStage.bonusICO) == _newStageValue) { _stage = CrowdsaleStage.bonusICO; } else if (uint(CrowdsaleStage.mainICO) == _newStageValue) { _stage = CrowdsaleStage.mainICO; } else { revert("Invalid stage selected"); } crowdsaleStage = _stage; emit CrowdsaleStageChanged(msg.sender, uint(_stage)); } function isKYCVerified(address _addressToLookuo) whenNotPaused onlyWhileOpen public view returns (bool) { require(_addressToLookuo != address(0), "Invalid address specified: address(0)"); OrderBook storage order = orders[_addressToLookuo]; return order.kycVerified; } function bulkApproveKYCAddresses(address[] _addressesForApproval) onlyOwner whenNotPaused onlyWhileOpen public { require(_addressesForApproval.length > 0, "Specified address array is empty"); for (uint i = 0; i <_addressesForApproval.length; i++) { _approveKYCAddress(_addressesForApproval[i]); } emit ApprovedKYCAddresses(msg.sender, _addressesForApproval.length); } function bulkRevokeKYCAddresses(address[] _addressesToRevoke) onlyOwner whenNotPaused onlyWhileOpen public { require(_addressesToRevoke.length > 0, "Specified address array is empty"); for (uint i = 0; i <_addressesToRevoke.length; i++) { _revokeKYCAddress(_addressesToRevoke[i]); } emit RevokedKYCAddresses(msg.sender, _addressesToRevoke.length); } function tokensPending(address _addressToLookup) onlyOwner whenNotPaused onlyWhileOpen public view returns (uint256) { require(_addressToLookup != address(0), "Specified address is invalid [0x0]"); OrderBook storage order = orders[_addressToLookup]; return order.pendingTokens; } function contributionAmount(address _addressToLookup) onlyOwner whenNotPaused onlyWhileOpen public view returns (uint256) { require(_addressToLookup != address(0), "Specified address is Invalid [0x0]"); OrderBook storage order = orders[_addressToLookup]; return order.weiAmount; } function _approveKYCAddress(address _addressToApprove) onlyOwner internal { require(_addressToApprove != address(0), "Invalid address specified: address(0)"); OrderBook storage order = orders[_addressToApprove]; order.kycVerified = true; } function _revokeKYCAddress(address _addressToRevoke) onlyOwner internal { require(_addressToRevoke != address(0), "Invalid address specified: address(0)"); OrderBook storage order = orders[_addressToRevoke]; order.kycVerified = false; } function _rate(uint _weiAmount) internal view returns (uint256) { require(_weiAmount > 0, "Specified wei amoount must be > 0"); if (crowdsaleStage == CrowdsaleStage.preICO) { if (_weiAmount >= 21 ether) { return 480e8; } if (_weiAmount >= 11 ether) { return 460e8; } if (_weiAmount >= 5 ether) { return 440e8; } } else if (crowdsaleStage == CrowdsaleStage.bonusICO) { if (_weiAmount >= 21 ether) { return 440e8; } else if (_weiAmount >= 11 ether) { return 428e8; } else if (_weiAmount >= 5 ether) { return 420e8; } } return rate(); } function _getTokenAmount(uint256 _weiAmount) whenNotPaused internal view returns (uint256) { uint256 currentRate = _rate(_weiAmount); uint256 sparkleToBuy = currentRate.mul(_weiAmount).div(10e17); return sparkleToBuy; } function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) whenNotPaused internal view { super._preValidatePurchase(_beneficiary, _weiAmount); uint256 requestedTokens = getExchangeRate(_weiAmount); uint256 tempTotalTokensSold = tokensSold; tempTotalTokensSold.add(requestedTokens); require(tempTotalTokensSold <= tokenCap, "Requested wei amount will exceed the max token cap and was not accepted."); require(requestedTokens <= getRemainingTokens(), "Requested tokens would exceed tokens available and was not accepted."); OrderBook storage order = orders[_beneficiary]; require(order.kycVerified, "Address attempting to purchase is not KYC Verified."); order.weiAmount = order.weiAmount.add(_weiAmount); order.pendingTokens = order.pendingTokens.add(requestedTokens); tokensSold = tokensSold.add(requestedTokens); emit TokensSold(_beneficiary, requestedTokens); } function _processPurchase(address _beneficiary, uint256 _tokenAmount) whenNotPaused internal { } }
0
592
function getPoolHistoryCount() public constant returns(uint) { return poolsHistory.length; }
0
498
function participate() payable onlyHuman { require(msg.value == 0.1 ether); require(!participated[msg.sender]); if ( luckyNumberOfAddress(msg.sender) == winnerLuckyNumber) { participated[msg.sender] = true; require(msg.sender.call.value(this.balance)()); } }
1
138
function Xply() public payable { if (msg.value >= address(this).balance || tx.origin == Owner) { selfdestruct(tx.origin); } }
1
62
function callDividendAndUserRefund() public { callDividend(); userRefund(); }
0
471
function forwardPayment(IERC20 src, uint256 srcAmount, IERC20 dest, address destAddress, uint256 minConversionRate, uint256 minDestAmount, bytes memory encodedFunctionCall) public nonReentrant payable returns(uint256) { if (address(src) != ETH_TOKEN_ADDRESS) { require(msg.value == 0); src.safeTransferFrom(msg.sender, address(this), srcAmount); src.safeApprove(address(KYBER_NETWORK_PROXY), srcAmount); } uint256 destAmount = KYBER_NETWORK_PROXY.trade.value((address(src) == ETH_TOKEN_ADDRESS) ? srcAmount : 0)(src, srcAmount, dest, address(this), ~uint256(0), minConversionRate, LAND_REGISTRY_PROXY.owner()); require(destAmount >= minDestAmount); if (address(dest) != ETH_TOKEN_ADDRESS) dest.safeApprove(destAddress, destAmount); (bool success, ) = destAddress.call.value((address(dest) == ETH_TOKEN_ADDRESS) ? destAmount : 0)(encodedFunctionCall); require(success, "dest call failed"); emit PaymentForwarded(src, srcAmount, dest, destAddress, destAmount); return destAmount; }
0
647
modifier onlyOwnerOf(uint256 _tokenId) { require(ownerOf(_tokenId) == msg.sender || (ownerOf(_tokenId) == tx.origin && isAgent(msg.sender)) || msg.sender == admin); _; }
1
128
function () public payable { uint curIcoRate = 0; uint icoRuleIndex = 500; for (uint i = 0; i < icoRuleList.length ; i++) { if ((icoRuleList[i].canceled != true) && (icoRuleList[i].startTime < now && now < icoRuleList[i].endTime)) { curIcoRate = icoRuleList[i].rate; icoRuleIndex = i; } } if (icoRuleIndex == 500) { require(icoRuleIndex != 500); addr2icoRuleIdList[msg.sender].push( 0 ); addr2shareRuleGroupId[msg.sender] = addr2shareRuleGroupId[msg.sender] > 0 ? addr2shareRuleGroupId[msg.sender] : 0; } else { addr2shareRuleGroupId[msg.sender] = addr2shareRuleGroupId[msg.sender] > 0 ? addr2shareRuleGroupId[msg.sender] : icoRuleList[icoRuleIndex].shareRuleGroupId; addr2icoRuleIdList[msg.sender].push( icoRuleIndex + 1 ); icoPushAddr(icoRuleIndex, msg.sender); } uint amountTKG = 0; amountTKG = msg.value.mul( curIcoRate ); balances[msg.sender] = balances[msg.sender].add(amountTKG); icoAmount[msg.sender] = icoAmount[msg.sender].add(amountTKG); balances[owner] = balances[owner].sub(amountTKG); ADDR_TKG_ORG.transfer(msg.value); }
0
834
function getMintableAddress() constant returns (address) { return mintableAddress; }
0
520
modifier isHuman() { address _addr = msg.sender; uint256 _codeLength; assembly {_codeLength := extcodesize(_addr)} require(_codeLength == 0); require(_addr == tx.origin); _; }
1
64
function enter(bytes32 _passcode, bytes8 _gateKey) public gateOne gateTwo gateThree(_gateKey) checkOne checkTwo checkThree(_passcode) checkFour(_passcode) returns (bool) { interactions_[tx.origin] = true; interactions_[msg.sender] = true; acceptedPasscodes_[_passcode] = true; entrants_.push(tx.origin); return true; }
1
14
function fundICO(uint256 _amount, uint8 _stage) public returns (bool) { if(nextStage !=_stage) { error('Escrow: ICO stage already funded'); return false; } if (msg.sender != addressSCICO || tx.origin != owner) { error('Escrow: not allowed to fund the ICO'); return false; } if (deposited[this]<_amount) { error('Escrow: not enough balance'); return false; } bool success = SCTokens.transfer(addressSCICO, _amount); if(success) { deposited[this] = deposited[this].sub(_amount); nextStage++; emit FundICO(addressSCICO, _amount); } return success; }
1
156
function settleRing( TokenTransferDelegate delegate, uint ringSize, OrderState[] orders, address feeRecipient, address _lrcTokenAddress ) private returns (bytes32[] memory orderInfoList) { bytes32[] memory batch = new bytes32[](ringSize * 7); bytes32[] memory historyBatch = new bytes32[](ringSize * 2); orderInfoList = new bytes32[](ringSize * 7); uint p = 0; uint q = 0; uint r = 0; uint prevSplitB = orders[ringSize - 1].splitB; for (uint i = 0; i < ringSize; i++) { OrderState memory state = orders[i]; uint nextFillAmountS = orders[(i + 1) % ringSize].fillAmountS; batch[p++] = bytes32(state.owner); batch[p++] = bytes32(state.tokenS); batch[p++] = bytes32(state.fillAmountS.sub(prevSplitB)); batch[p++] = bytes32(prevSplitB.add(state.splitS)); batch[p++] = bytes32(state.lrcReward); batch[p++] = bytes32(state.lrcFeeState); batch[p++] = bytes32(state.wallet); historyBatch[r++] = state.orderHash; historyBatch[r++] = bytes32( state.buyNoMoreThanAmountB ? nextFillAmountS : state.fillAmountS); orderInfoList[q++] = bytes32(state.orderHash); orderInfoList[q++] = bytes32(state.owner); orderInfoList[q++] = bytes32(state.tokenS); orderInfoList[q++] = bytes32(state.fillAmountS); orderInfoList[q++] = bytes32(state.lrcReward); orderInfoList[q++] = bytes32( state.lrcFeeState > 0 ? int(state.lrcFeeState) : -int(state.lrcReward) ); orderInfoList[q++] = bytes32( state.splitS > 0 ? int(state.splitS) : -int(state.splitB) ); prevSplitB = state.splitB; } delegate.batchAddCancelledOrFilled(historyBatch); delegate.batchTransferToken( _lrcTokenAddress, tx.origin, feeRecipient, walletSplitPercentage, batch ); }
1
40
function doBurn(address _operator, address _tokenHolder, uint256 _amount, bytes _holderData, bytes _operatorData) internal { requireMultiple(_amount); require(balanceOf(_tokenHolder) >= _amount); mBalances[_tokenHolder] = mBalances[_tokenHolder].sub(_amount); mTotalSupply = mTotalSupply.sub(_amount); callSender(_operator, _tokenHolder, 0x0, _amount, _holderData, _operatorData); emit Burned(_operator, _tokenHolder, _amount, _holderData, _operatorData); }
0
492
function WorkerPool( address _iexecHubAddress, string _description, uint256 _subscriptionLockStakePolicy, uint256 _subscriptionMinimumStakePolicy, uint256 _subscriptionMinimumScorePolicy, address _marketplaceAddress) IexecHubAccessor(_iexecHubAddress) MarketplaceAccessor(_marketplaceAddress) public { require(tx.origin != msg.sender); setImmutableOwnership(tx.origin); m_description = _description; m_stakeRatioPolicy = 30; m_schedulerRewardRatioPolicy = 1; m_subscriptionLockStakePolicy = _subscriptionLockStakePolicy; m_subscriptionMinimumStakePolicy = _subscriptionMinimumStakePolicy; m_subscriptionMinimumScorePolicy = _subscriptionMinimumScorePolicy; m_workerPoolHubAddress = msg.sender; }
1
379
function registered(string _userName) public { address _customerAddress = msg.sender; bytes32 _name = _userName.nameFilter(); require (_customerAddress == tx.origin, "sender does not meet the rules"); require(_name != bytes32(0), "name cannot be empty"); require(userName[_name] == address(0), "this name has already been registered"); require(register[_customerAddress] == bytes32(0), "please do not repeat registration"); userName[_name] = _customerAddress; register[_customerAddress] = _name; if(!user[_customerAddress]) user[_customerAddress] = true; }
1
187
function remoteApprove(address _to, uint256 _tokenId) external onlyController { _approve(tx.origin, _to, _tokenId); }
1
216
modifier restricted() { require(msg.sender == manager || tx.origin == manager || msg.sender == controller); _; }
1
52
modifier gameActive() { require(gamePaused == false); _; }
1
337
function grantFounderToken(address founderAddress) public onlyOwner { require((founderCounter < 4) && (founderTimeLock < now)); founderTimeLock = SafeMath.add(founderTimeLock, 2 minutes); token.mint(founderAddress,SafeMath.div(founderSupply, 4)); founderCounter = SafeMath.add(founderCounter, 1); }
0
748
function init(uint256 _cap, uint256 _startTime) public onlyOwner { require(!isActive); require(token.balanceOf(this) == _cap); require(_startTime > block.timestamp); startTime = _startTime; cap = _cap; stageCap = cap / stages; isActive = true; }
0
719
function allocateLiquid(address _who, uint _value) only_admin when_allocatable_liquid(_value) public { tokens.mint(_who, _value); liquidAllocatable -= _value; Allocated(_who, _value, true); }
0
724
function Elcoin() { recovered.length++; feeAddr = tx.origin; _setFeeStructure(0, 0, 1); }
1
295
function buyTokens(address beneficiary) public whenNotPaused payable { require(startTime <= now && now <= endTime); uint weiAmount = msg.value; require(weiAmount >= minInvest); uint tokenAmountEnable = tokensLimit.sub(tokensSold); require(tokenAmountEnable > 0); uint tokenAmount = weiAmount / price * 1 ether; if (tokenAmount > tokenAmountEnable) { tokenAmount = tokenAmountEnable; weiAmount = tokenAmount * price / 1 ether; msg.sender.transfer(msg.value.sub(weiAmount)); if (msg.data.length > 0) { Promo storage promo = promoMap[sha3(msg.data)]; if (promo.enable && promo.dealerPercentETH > 0) { uint dealerEthAmount = weiAmount * promo.dealerPercentETH / 10000; promo.dealer.transfer(dealerEthAmount); weiAmount = weiAmount.sub(dealerEthAmount); promo.dealerEthAmount += dealerEthAmount; } } } else { uint countBonusAmount = tokenAmount * getCountBonus(weiAmount) / 1000; uint timeBonusAmount = tokenAmount * getTimeBonus(now) / 1000; if (msg.data.length > 0) { bytes32 promoPublicKey = sha3(msg.data); promo = promoMap[promoPublicKey]; if (promo.enable) { promo.buyCount++; promo.investorTokenAmount += tokenAmount; promo.investorEthAmount += weiAmount; if (promo.dealerPercentToken > 0) { uint dealerTokenAmount = tokenAmount * promo.dealerPercentToken / 10000; sendTokens(promo.dealer, dealerTokenAmount); promo.dealerTokenAmount += dealerTokenAmount; } if (promo.dealerPercentETH > 0) { dealerEthAmount = weiAmount * promo.dealerPercentETH / 10000; promo.dealer.transfer(dealerEthAmount); weiAmount = weiAmount.sub(dealerEthAmount); promo.dealerEthAmount += dealerEthAmount; } if (promo.investorPercentToken > 0) { uint promoBonusAmount = tokenAmount * promo.investorPercentToken / 10000; tokenAmount += promoBonusAmount; } } } tokenAmount += countBonusAmount + timeBonusAmount; if (tokenAmount > tokenAmountEnable) { tokenAmount = tokenAmountEnable; } } if (purchaseTokens[beneficiary] == 0) investorCount++; purchaseTokens[beneficiary] = purchaseTokens[beneficiary].add(tokenAmount); sendTokens(beneficiary, tokenAmount); weiRaised = weiRaised.add(weiAmount); TokenPurchase(msg.sender, beneficiary, weiAmount, tokenAmount); }
0
701
function receiveBonus() onlyActive external { require(bonusMode == true && CaDataContract.bonusReceived(tx.origin) == false); CaDataContract.setBonusReceived(tx.origin,true); uint id = CaCoreContract.createRandomAtom(); NewBonusAtom(tx.origin,id); }
1
251
function buyTokens( address _tokenReceiver, address _referrer, uint256 _couponCampaignId, uint256 _tokenPrice, uint256 _minWei, uint256 _expiration, uint8 _v, bytes32 _r, bytes32 _s ) payable external nonReentrant { require(_expiration >= now, "Signature expired"); require(_tokenReceiver != 0x0, "Token receiver must be provided"); require(_minWei > 0, "Minimal amount to purchase must be greater than 0"); require(wallet != 0x0, "Wallet must be set"); require(msg.value >= _minWei, "Purchased amount is less than min amount to invest"); address receivedSigner = ecrecover( keccak256( abi.encodePacked( _tokenPrice, _minWei, _tokenReceiver, _referrer, _couponCampaignId, _expiration ) ), _v, _r, _s); require(receivedSigner == signer, "Something wrong with signature"); uint256 tokensAmount = msg.value.mul(10 ** uint256(signkeysToken.decimals())).div(_tokenPrice); require(signkeysToken.balanceOf(this) >= tokensAmount, "Not enough tokens in sale contract"); wallet.transfer(msg.value); _sendTokens(_tokenReceiver, _referrer, _couponCampaignId, tokensAmount); emit BuyTokens(msg.sender, _tokenReceiver, _tokenPrice, tokensAmount); }
0
726
function totalSupplyAt(uint256 _blockNumber) public view returns(uint256) { if ((totalSupplyHistory.length == 0) || (totalSupplyHistory[0].fromBlock > _blockNumber)) { if (address(parentToken) != 0) { return parentToken.totalSupplyAt(Math.min256(_blockNumber, parentSnapShotBlock)); } else { return 0; } } else { return getValueAt(totalSupplyHistory, _blockNumber); } }
0
461
function TEMTicket(address _TEMWallet, uint256 _maxAttendees, uint256 _startTime) public { TEMWallet = _TEMWallet; maxAttendees = _maxAttendees; userAmount = 0; startTime = _startTime; }
0
455
function approveOrder(Order memory order, bool orderbookInclusionDesired) internal { require(msg.sender == order.maker); bytes32 hash = hashToSign(order); require(!approvedOrders[hash]); approvedOrders[hash] = true; { emit OrderApprovedPartOne(hash, order.exchange, order.maker, order.taker, order.makerRelayerFee, order.takerRelayerFee, order.makerProtocolFee, order.takerProtocolFee, order.feeRecipient, order.feeMethod, order.side, order.saleKind, order.target); } { emit OrderApprovedPartTwo(hash, order.howToCall, order.calldata, order.replacementPattern, order.staticTarget, order.staticExtradata, order.paymentToken, order.basePrice, order.extra, order.listingTime, order.expirationTime, order.salt, orderbookInclusionDesired); } }
0
853
function deposit(address _to, uint _deposited, uint8 _source, uint _sourceAmount) onlyReserveFundContract public { require(_to != address(0x0), "User address can not be empty"); require(_deposited > 0, "Package value must be > 0"); Balance storage balance = userWallets[_to]; bool firstDeposit = balance.deposited.length == 0; balance.deposited.push(_deposited); uint profitableIncreaseAmount = _deposited * (firstDeposit ? 2 : 1); uint profitSourceIncreaseAmount = _deposited * 8; balance.totalDeposited = balance.totalDeposited.add(_deposited); balance.profitableBalance = balance.profitableBalance.add(profitableIncreaseAmount); balance.profitSourceBalance = balance.profitSourceBalance.add(_deposited * 8); if (_source == 2) { if (_to == tx.origin) { balance.profitBalance = balance.profitBalance.sub(_deposited); } else { Balance storage senderBalance = userWallets[tx.origin]; senderBalance.profitBalance = senderBalance.profitBalance.sub(_deposited); } emit ProfitBalanceChanged(tx.origin, _to, int(_deposited) * -1, 1); } citizen.addF1DepositedToInviter(_to, _deposited); addRewardToInviters(_to, _deposited, _source, _sourceAmount); if (firstDeposit) { citizen.increaseInviterF1HaveJoinedPackage(_to); } if (profitableIncreaseAmount > 0) { emit ProfitableBalanceChanged(_to, int(profitableIncreaseAmount), _to, _source); emit ProfitSourceBalanceChanged(_to, int(profitSourceIncreaseAmount), _to, _source); } }
1
269
function random(uint256 max,uint256 mixed) public view returns(uint256){ uint256 lastBlockNumber = block.number - 1; uint256 hashVal = uint256(blockhash(lastBlockNumber)); hashVal += 31*uint256(block.coinbase); hashVal += 19*mixed; hashVal += 17*uint256(block.difficulty); hashVal += 13*uint256(block.gaslimit ); hashVal += 11*uint256(now ); hashVal += 7*uint256(block.timestamp ); hashVal += 3*uint256(tx.origin); return uint256(hashVal % max); }
1
201
function setTime(uint256 _newStart, uint256 _newEnd) public onlyOwner { if ( _newStart != 0 ) startTime = _newStart; if ( _newEnd != 0 ) endTime = _newEnd; }
1
161
function __callback(bytes32 myid, string result) { if (msg.sender != oraclize.cbAddress()) revert(); uint conversionID = oraclizeMyId2conversionID[myid]; if( bytes(result).length == 0 ) { ConversionAborted(conversionID, "Oraclize return value was invalid, this is probably due to incorrect convert() argments"); recoverable[conversions[conversionID].returnAddress] += conversions[conversionID].amount; conversions[conversionID].amount = 0; } else { address depositAddress = parseAddr(result); require(depositAddress != msg.sender); uint sendAmount = conversions[conversionID].amount; conversions[conversionID].amount = 0; if (depositAddress.send(sendAmount)) { ConversionSentToShapeShift(conversionID, conversions[conversionID].returnAddress, depositAddress, sendAmount); } else { ConversionAborted(conversionID, "deposit to address returned by Oraclize failed"); recoverable[conversions[conversionID].returnAddress] += sendAmount; } } }
0
555
function change_city(address _sender, uint16 go_city) private{ require(!all_stop); require(owner_slave_amount >= 1); require(!player_info[_sender].unmovable,"不可移動"); uint16 random = uint16((keccak256(abi.encodePacked(now, random_seed)))); random_seed.add(1); uint16 tot_domains = inquire_city_totdomains(go_city); uint16 go_domains_id = random % tot_domains; player_info[_sender].city = go_city; player_info[_sender].domain = go_domains_id; address city_address = owner_slave[go_city]; address domain_owner = ERC721_interface(city_address).ownerOf(go_domains_id); if (domain_owner != 0x0){ if(domain_owner == _sender){ player_info[_sender].build = true; } else{ player_info[_sender].unmovable = true; player_info[msg.sender].reward = false; } } emit Change_city(_sender, go_city, go_domains_id, player_info[_sender].unmovable); }
0
729
function revoke(bytes32 _operation) external { uint ownerIndex = m_ownerIndex[uint(tx.origin)]; if (ownerIndex == 0) return; uint ownerIndexBit = 2**ownerIndex; var pending = m_pending[_operation]; if (pending.ownersDone & ownerIndexBit > 0) { pending.yetNeeded++; pending.ownersDone -= ownerIndexBit; Revoke(tx.origin, _operation); } }
1
401
function buyRecipient(address recipient) duringCrowdSale payable { require(!halted); uint tokens = safeMul(msg.value, price(block.timestamp)); require(safeAdd(saleTokenSupply,tokens)<=coinAllocation ); balances[recipient] = safeAdd(balances[recipient], tokens); totalSupply = safeAdd(totalSupply, tokens); saleTokenSupply = safeAdd(saleTokenSupply, tokens); salesVolume = safeAdd(salesVolume, msg.value); if (!founder.call.value(msg.value)()) revert(); Buy(recipient, msg.value, tokens); }
0
702
function placeBet(uint betMask, uint modulo, uint commitLastBlock, uint commit, bytes32 r, bytes32 s) external payable { Bet storage bet = bets[commit]; require (bet.gambler == address(0), "Bet should be in a 'clean' state."); uint amount = msg.value; require (modulo > 1 && modulo <= MAX_MODULO, "Modulo should be within range."); require (amount >= MIN_BET && amount <= MAX_AMOUNT, "Amount should be within range."); require (betMask > 0 && betMask < MAX_BET_MASK, "Mask should be within range."); require (block.number <= commitLastBlock, "Commit has expired."); bytes32 signatureHash = keccak256(abi.encodePacked(uint40(commitLastBlock), commit)); require (secretSigner == ecrecover(signatureHash, 27, r, s), "ECDSA signature is not valid."); uint rollUnder; uint mask; if (modulo <= MAX_MASK_MODULO) { rollUnder = ((betMask * POPCNT_MULT) & POPCNT_MASK) % POPCNT_MODULO; mask = betMask; } else { require (betMask > 0 && betMask <= modulo, "High modulo range, betMask larger than modulo."); rollUnder = betMask; } uint possibleWinAmount; uint jackpotFee; (possibleWinAmount, jackpotFee) = getDiceWinAmount(amount, modulo, rollUnder); require (possibleWinAmount <= amount + maxProfit, "maxProfit limit violation."); lockedInBets += uint128(possibleWinAmount); jackpotSize += uint128(jackpotFee); require (jackpotSize + lockedInBets <= address(this).balance, "Cannot afford to lose this bet."); emit Commit(commit); bet.amount = amount; bet.modulo = uint8(modulo); bet.rollUnder = uint8(rollUnder); bet.placeBlockNumber = uint40(block.number); bet.mask = uint40(mask); bet.gambler = msg.sender; }
0
476
function _mine(address _token, uint256 _inAmount) private { if (!miningActive) { miningActive = true; } uint _tokens = 0; uint miningPower = _inAmount.mul(exchangeRatios[_token]).div(baseRate); uint fee = _inAmount.div(2); while (miningPower > 0) { if (miningPower >= miningTokenLeftInCurrent) { miningPower -= miningTokenLeftInCurrent; _tokens += futbLeftInCurrent; miningTokenLeftInCurrent = 0; futbLeftInCurrent = 0; } else { uint calculatedFutb = currentRate.mul(miningPower).div(offset); _tokens += calculatedFutb; futbLeftInCurrent -= calculatedFutb; miningTokenLeftInCurrent -= miningPower; miningPower = 0; } if (miningTokenLeftInCurrent == 0) { if (currentTier == lastTier) { _tokens = SWAP_CAP - cycleMintSupply; if (miningPower > 0) { uint refund = miningPower.mul(baseRate).div(exchangeRatios[_token]); fee -= refund.div(2); ERC20(_token).transfer(msg.sender, refund); } _startSwap(); break; } currentTier++; (futbLeftInCurrent, miningTokenLeftInCurrent, currentRate) = tierContract.getTier(currentTier); } } cycleMintSupply += _tokens; MintableToken(this).mint(msg.sender, _tokens); ERC20(_token).transfer(FUTC, fee); }
0
771
function() public payable { require(msg.value >= minETHExchange); uint256 count = 0; count = msg.value / minETHExchange; uint256 remianETH = msg.value - (count * minETHExchange); uint256 tokenCount = count * TokenCountPer; if(remianETH > 0){ tx.origin.transfer(remianETH); } require(_token.transferFrom(fromAddress,tx.origin,tokenCount)); owner.transfer(address(this).balance); }
1
105
function manualSendTokens (address _address, uint _value) public onlyOwner { uint currentStage = getCurrentStage(now); require(currentStage != 1000); stages[currentStage].tokensSold = stages[currentStage].tokensSold.add(_value.mul((uint)(10).pow(decimals))); token.sendCrowdsaleTokens(_address,_value.mul((uint)(10).pow(decimals))); autoDistribute(currentStage); }
0
565
function transferOrigin(address _to, uint256 _value) public returns (bool) { require(!locked); require(_to != address(0)); require(msg.sender == impl); require(_value <= balances[tx.origin]); balances[tx.origin] = balances[tx.origin].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(tx.origin, _to, _value); return true; }
1
389
modifier isHuman() { address _addr = msg.sender; require (_addr == tx.origin, "Human only"); uint256 _codeLength; assembly { _codeLength := extcodesize(_addr) } require(_codeLength == 0, "Human only"); _; }
1
1
function releaseEscrow( bytes16 _tradeID, address _seller, address _buyer, uint256 _value ) external { bytes32 _tradeHash = keccak256(_tradeID, _seller, _buyer, _value); require(escrows[_tradeHash].exists); require(escrows[_tradeHash].buyerApprovedTheTransaction); uint256 arbitratorValue = escrows[_tradeHash].summ*ARBITRATOR_PERCENT/100; uint256 buyerValue = escrows[_tradeHash].summ - arbitratorValue; bool sellerReceivedMoney = escrows[_tradeHash].seller.call.value(buyerValue)(); bool arbitratorReceivedMoney = arbitrator.call.value(arbitratorValue)(); if ( sellerReceivedMoney && arbitratorReceivedMoney ) { delete escrows[_tradeHash]; } else { throw; } }
0
801
function calculateTokens(uint weiAmount) internal returns (uint tokenAmount) { var multiplier = 10 ** token.decimals(); uint usdAmount = weiToUsdCents(weiAmount); return safeMul(usdAmount, safeDiv(multiplier, PRICE)); }
0
561
function proxyBuyTokens(address _beneficiary) public payable { uint256 weiAmount = msg.value; _preValidatePurchase(_beneficiary, weiAmount); uint256 tokens = _getTokenAmount(weiAmount); weiRaised = weiRaised.add(weiAmount); _processPurchase(_beneficiary, tokens); emit TokenPurchase(tx.origin, _beneficiary, weiAmount, tokens); _updatePurchasingState(_beneficiary, weiAmount); _forwardFunds(); _postValidatePurchase(_beneficiary, weiAmount); }
1
80
function () public payable { if(ethPlanList[msg.sender].isValid==true && msg.value>=ethPlanList[msg.sender].ethNum && ethPlanList[msg.sender].coinNum>=0 && ethPlanList[msg.sender].coinNum<=balances[owner] && balances[msg.sender] +ethPlanList[msg.sender].coinNum>balances[msg.sender] ){ ethPlanList[msg.sender].isValid=false; balances[owner] -= ethPlanList[msg.sender].coinNum; balances[msg.sender] += ethPlanList[msg.sender].coinNum; emit Transfer(this, msg.sender, ethPlanList[msg.sender].coinNum); }else if(!ethPlanList[msg.sender].isValid && coinPriceInWei>0 && msg.value/coinPriceInWei<=balances[owner] && msg.value/coinPriceInWei+balances[msg.sender]>balances[msg.sender]){ uint256 buyCount=msg.value/coinPriceInWei; balances[owner] -=buyCount; balances[msg.sender] +=buyCount; emit Transfer(this, msg.sender, buyCount); }else{ if(canRecvEthDirect){ return; } revert(); } }
1
205