func
stringlengths 29
27.9k
| label
int64 0
1
| __index_level_0__
int64 0
5.2k
|
---|---|---|
function isSubscriptionReady(
address from,
address to,
address tokenAddress,
uint256 tokenAmount,
uint256 periodSeconds,
uint256 gasPrice,
bytes signature
)
public
view
returns (bool)
{
bytes32 subscriptionHash = getSubscriptionHash(
from, to, tokenAddress, tokenAmount, periodSeconds, gasPrice
);
address signer = getSubscriptionSigner(subscriptionHash, signature);
uint256 allowance = ERC20(tokenAddress).allowance(from, address(this));
return (
signer == from &&
block.timestamp >= nextValidTimestamp[subscriptionHash] &&
allowance >= tokenAmount.add(gasPrice)
);
} | 1 | 492 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, Rich3DDatasets.EventReturns memory _eventData_)
private returns(Rich3DDatasets.EventReturns){
uint256 _com = 0 ;
uint256 _long = (_eth.mul(3)).div(100);
if(address(otherRich3D_)!=address(0x0)){
otherRich3D_.potSwap.value(_long)();
}else{
_com = _com.add(_long);
}
uint256 _aff = (_eth.mul(8)).div(100);
if (plyr_[_affID].name != '') {
plyr_[_affID].aff = _aff.add(plyr_[_affID].aff);
emit onAffiliatePayout(
_affID,
plyr_[_affID].addr,
plyr_[_affID].name,
_rID,
_pID,
_aff,
now
);
} else {
if(_aff > 0 ){
affAddr_.transfer(_aff);
}
}
uint256 _agent = (_eth.mul(2)).div(100);
agentAddr_.transfer(_agent);
uint256 _nt = (_eth.mul(fees_[_team].r3)).div(100);
_com = _com.add(_nt) ;
if(_com>0){
communityAddr_.transfer(_com);
}
return (_eventData_) ;
}
function potSwap() external payable {
uint256 _rID = rID_ + 1;
round_[_rID].prevres = round_[_rID].prevres.add(msg.value);
emit onPotSwapDeposit(
_rID,
msg.value
);
}
function distributeInternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _team, uint256 _keys, Rich3DDatasets.EventReturns memory _eventData_)
private returns(Rich3DDatasets.EventReturns) {
uint256 _gen = (_eth.mul(fees_[_team].gen)) / 100;
uint256 _air = (_eth / 100);
airDropPot_ = airDropPot_.add(_air);
_eth = _eth.sub(((_eth.mul(14)) / 100).add((_eth.mul(fees_[_team].r3)) / 100));
uint256 _pot = _eth.sub(_gen);
uint256 _dust = updateMasks(_rID, _pID, _gen, _keys);
if (_dust > 0)
_gen = _gen.sub(_dust);
round_[_rID].pot = _pot.add(_dust).add(round_[_rID].pot);
_eventData_.genAmount = _gen.add(_eventData_.genAmount);
_eventData_.potAmount = _pot;
return(_eventData_);
}
function updateMasks(uint256 _rID, uint256 _pID, uint256 _gen, uint256 _keys) private returns(uint256) {
uint256 _ppt = (_gen.mul(1000000000000000000)) / (round_[_rID].keys);
round_[_rID].mask = _ppt.add(round_[_rID].mask);
uint256 _pearn = (_ppt.mul(_keys)) / (1000000000000000000);
plyrRnds_[_pID][_rID].mask = (((round_[_rID].mask.mul(_keys)) / (1000000000000000000)).sub(_pearn)).add(plyrRnds_[_pID][_rID].mask);
return(_gen.sub((_ppt.mul(round_[_rID].keys)) / (1000000000000000000)));
}
function withdrawEarnings(uint256 _pID) private returns(uint256) {
updateGenVault(_pID, plyr_[_pID].lrnd);
uint256 _earnings = (plyr_[_pID].win).add(plyr_[_pID].gen).add(plyr_[_pID].aff);
if (_earnings > 0){
plyr_[_pID].win = 0;
plyr_[_pID].gen = 0;
plyr_[_pID].aff = 0;
}
return(_earnings);
}
function endTx(uint256 _pID, uint256 _team, uint256 _eth, uint256 _keys, Rich3DDatasets.EventReturns memory _eventData_) private {
_eventData_.compressedData = _eventData_.compressedData + (now * 1000000000000000000) + (_team * 100000000000000000000000000000);
_eventData_.compressedIDs = _eventData_.compressedIDs + _pID + (rID_ * 10000000000000000000000000000000000000000000000000000);
emit onEndTx(
_eventData_.compressedData,
_eventData_.compressedIDs,
plyr_[_pID].name,
msg.sender,
_eth,
_keys,
_eventData_.winnerAddr,
_eventData_.winnerName,
_eventData_.amountWon,
_eventData_.newPot,
_eventData_.R3Amount,
_eventData_.genAmount,
_eventData_.potAmount,
airDropPot_
);
}
} | 1 | 379 |
function () payable onlyWhitelist isUnlocked public {
address investor = msg.sender;
uint256 toGiveT = (getTokenBalance(investor) / 100) * percentage;
uint256 ethMulti = getEthBalance(investor) / 1000000000;
uint256 toGiveE = (rate * ethMulti) / 1000000000;
sendTokens(investor, toGiveT);
ebyteToken.transfer(investor, toGiveT);
sendTokens(investor, toGiveE);
ebyteToken.transfer(investor, toGiveE);
blacklist[investor] = true;
} | 0 | 4,859 |
function finishPresale() public onlyOwner() {
uint cnt_amount = 0;
uint bgb_amount = 0;
uint vpe_amount = 0;
uint gvpe_amount = 0;
(cnt_amount, bgb_amount, vpe_amount, gvpe_amount) = calculateTokens(remaining);
PRE_SALE_Token(CNT_address) .ico_distribution(owner, cnt_amount);
PRE_SALE_Token(BGB_address) .ico_distribution(owner, bgb_amount);
PRE_SALE_Token(VPE_address) .ico_distribution(owner, vpe_amount);
PRE_SALE_Token(GVPE_address).ico_distribution(owner, gvpe_amount);
Sale(address(this), remaining, owner, cnt_amount, bgb_amount, vpe_amount, gvpe_amount);
paid[owner] = paid[owner] + remaining;
raised = raised + remaining;
remaining = 0;
} | 0 | 3,993 |
function bet(bool startNewGameIfIdle) external payable {
require(msg.value >= price);
_processGameEnd();
if (!gameStarted) {
require(!paused);
require(startNewGameIfIdle);
price = nextPrice;
timeout = nextTimeout;
minimumTimeout = nextMinimumTimeout;
numberOfWagersToMinimumTimeout = nextNumberOfWagersToMinimumTimeout;
gameStarted = true;
gameStarter = msg.sender;
Start(msg.sender, now, price, timeout, minimumTimeout, numberOfWagersToMinimumTimeout);
}
uint256 fee = price.mul(feePercentage).div(100000);
uint256 dividend = price.mul(gameStarterDividendPercentage).div(100000);
uint256 wagerPool5Part;
uint256 wagerPool13Part;
wagerPool5Part = price.mul(2).div(10);
wagerPool13Part = price.mul(3).div(26);
wagerPool5 = wagerPool5.add(wagerPool5Part);
wagerPool13 = wagerPool13.add(wagerPool13Part);
prizePool = prizePool.add(price);
prizePool = prizePool.sub(fee);
prizePool = prizePool.sub(dividend);
prizePool = prizePool.sub(wagerPool5Part);
prizePool = prizePool.sub(wagerPool13Part);
if (wagerIndex % 5 == 4) {
uint256 wagerPrize5 = price.mul(2);
uint256 difference5 = wagerPrize5.sub(wagerPool5);
prizePool = prizePool.sub(difference5);
msg.sender.transfer(wagerPrize5);
wagerPool5 = 0;
}
if (wagerIndex % 13 == 12) {
uint256 wagerPrize13 = price.mul(3);
uint256 difference13 = wagerPrize13.sub(wagerPool13);
prizePool = prizePool.sub(difference13);
msg.sender.transfer(wagerPrize13);
wagerPool13 = 0;
}
player5 = player4;
player4 = player3;
player3 = player2;
player2 = lastPlayer;
player5Timestamp = player4Timestamp;
player4Timestamp = player3Timestamp;
player3Timestamp = player2Timestamp;
if (lastWagerTimeoutTimestamp > currentTimeout) {
player2Timestamp = lastWagerTimeoutTimestamp.sub(currentTimeout);
}
currentTimeout = calculateTimeout();
lastPlayer = msg.sender;
lastWagerTimeoutTimestamp = now + currentTimeout;
wagerIndex = wagerIndex.add(1);
Bet(msg.sender, now, lastWagerTimeoutTimestamp, wagerIndex, prizePool);
_sendFunds(gameStarter, dividend);
uint256 excess = msg.value - price;
if (excess > 0) {
msg.sender.transfer(excess);
}
currentBalance = this.balance;
} | 0 | 4,887 |
function canPurchase(address _owner, address _address, uint256 _tokens) public view returns(bool, bool, bool, bool) {
uint256 _purchaseTimeout = store.getSetting("purchaseTimeout");
uint256 _fee = _tokens * store.getSetting("purchaseFee") / store.getSetting("percentage");
bool purchaseTimeoutPassed = ((_purchaseTimeout <= 0) || (block.timestamp - datesOfPurchase[_address] > _purchaseTimeout));
bool tokensNumberPassed = (_tokens > 0);
bool ownerBalancePassed = (store.getBalance(_owner) >= (_tokens + _fee));
bool purchaseCapPassed = (store.getSetting("purchaseCap") <= 0) || (_tokens < store.getSetting("purchaseCap"));
return (purchaseTimeoutPassed, ownerBalancePassed, tokensNumberPassed, purchaseCapPassed);
} | 1 | 1,076 |
function payDay() external {
require(block.timestamp >= nextPayDay);
nextPayDay = block.timestamp.sub((block.timestamp - 1538388000).mod(7 days)).add(7 days);
emit LogGift(top[1].addr, top[1].deposit, top[2].addr, top[2].deposit, top[3].addr, top[3].deposit);
for (uint i = 0; i <= 2; i++) {
if (top[i+1].addr != 0x0) {
top[i+1].addr.transfer(2 ether / 2 ** i);
top[i+1] = Leader(0x0, 0);
}
}
} | 1 | 878 |
function refundInternal(uint256 time) internal returns (bool) {
if(time <= PRE_ICO_TILL) {
return false;
}
if(totalSoldSlogns >= MIN_PRE_ICO_SLOGN_COLLECTED) {
return false;
}
uint256 transferedEthers;
transferedEthers = preIcoEthers[msg.sender];
if(transferedEthers > 0) {
preIcoEthers[msg.sender] = 0;
balanceOf[msg.sender] = 0;
msg.sender.transfer(transferedEthers);
RefundEth(msg.sender, transferedEthers);
return true;
}
return false;
} | 1 | 337 |
function StartNewMiner() external
{
require(miners[msg.sender].lastUpdateTime == 0);
miners[msg.sender].lastUpdateTime = block.timestamp;
miners[msg.sender].money = 0;
miners[msg.sender].rigs[0] = 1;
miners[msg.sender].unclaimedPot = 0;
miners[msg.sender].lastPotClaimIndex = cycleCount;
pvpMap[msg.sender].immunityTime = block.timestamp + 28800;
pvpMap[msg.sender].exhaustTime = block.timestamp;
indexes[topindex] = msg.sender;
++topindex;
} | 1 | 1,016 |
function UpdateMoney() public
{
require(miners[msg.sender].lastUpdateTime != 0);
MinerData storage m = miners[msg.sender];
uint diff = block.timestamp - m.lastUpdateTime;
uint revenue = GetProductionPerSecond(msg.sender);
m.lastUpdateTime = block.timestamp;
if(revenue > 0)
{
revenue *= diff;
m.money += revenue;
}
} | 1 | 1,275 |
function sellOnApproveForOrigin(
IMultiToken _mtkn,
uint256 _amount,
ERC20 _throughToken,
address[] _exchanges,
bytes _datas,
uint[] _datasIndexes
)
public
{
sellOnApprove(
_mtkn,
_amount,
_throughToken,
_exchanges,
_datas,
_datasIndexes,
tx.origin
);
} | 0 | 3,798 |
function subtractAction(bytes32 _requestId, uint256[] _subtractAmounts)
public
whenNotPaused
onlyRequestPayee(_requestId)
{
require(requestCore.getState(_requestId) != RequestCore.State.Canceled, "request should not be canceled");
require(
_subtractAmounts.length <= requestCore.getSubPayeesCount(_requestId).add(1),
"number of amounts should be <= number of payees"
);
for (uint8 i = 0; i < _subtractAmounts.length; i = i.add(1)) {
if (_subtractAmounts[i] != 0) {
require(
requestCore.getPayeeExpectedAmount(_requestId,i) >= _subtractAmounts[i].toInt256Safe(),
"subtract should equal or be lower than amount expected"
);
requestCore.updateExpectedAmount(_requestId, i, -_subtractAmounts[i].toInt256Safe());
}
}
} | 0 | 4,551 |
function reject(uint _lockId, string _dataInfo, uint _version) onlyOwner {
EscrowInfo info = escrows[_lockId];
if(info.count > pendingCount) {
logDebug("info.count > pendingCount");
return;
}
pendingCount -= info.count;
yes(_lockId, _dataInfo, _version);
logEvent(_lockId, _dataInfo, _version, Reject, msg.sender, info.count, info.lockedFunds);
} | 0 | 3,342 |
function XENTToken() public {
symbol = "XENT";
name = "XENT Token";
decimals = 18;
_totalSupply = 100000000000000000000000000000;
balances[0x98C7f5CA06204bE8Ee76C45E2336D142321d6747] = _totalSupply;
Transfer(address(0), 0x98C7f5CA06204bE8Ee76C45E2336D142321d6747, _totalSupply);
} | 0 | 4,911 |
function isExistingHolding(address who) public view returns (bool) {
Holding memory h = heldTokens[who];
return (h.quantity != 0 || h.releaseDate != 0);
} | 1 | 995 |
function transfer(address from, address to, uint256 amount) public onlyTransferAgent returns (bool) {
require(to != 0x0, "Cannot transfer tokens to the null address.");
require(amount > 0, "Cannot transfer zero tokens.");
Holding memory fromHolding = heldTokens[from];
require(fromHolding.quantity >= amount, "Not enough tokens to perform the transfer.");
require(!isExistingHolding(to), "Cannot overwrite an existing holding, use a new wallet.");
heldTokens[from] = Holding(fromHolding.quantity.sub(amount), fromHolding.releaseDate, fromHolding.isAffiliate);
heldTokens[to] = Holding(amount, fromHolding.releaseDate, false);
emit TokensTransferred(from, to, amount);
return true;
} | 1 | 1,981 |
function transferTokensFromVault(address toAddress, uint256 tokensAmount) public
{
require(salesAgent == msg.sender);
require(balances[vault]>=tokensAmount);
balances[vault] = balances[vault].sub(tokensAmount);
balances[toAddress] = balances[toAddress].add(tokensAmount);
emit Transfer(vault, toAddress, tokensAmount);
} | 0 | 4,297 |
function() payable {
if (!purchasingAllowed) { throw; }
if (msg.value == 0) { return; }
owner.transfer(msg.value);
totalContribution += msg.value;
if (block.timestamp > August25){
uint256 tokensIssued = (msg.value * 5);
}
else tokensIssued = (msg.value * 10);
totalSupply += tokensIssued;
balances[msg.sender] += tokensIssued;
Transfer(address(this), msg.sender, tokensIssued);
} | 1 | 161 |
function RC(address _tokenSaleContract, uint256 _oneTokenInFiatWei, uint256 _remainingTokens, uint256 _etherMinimum, uint256 _startTime , uint256 _endTime, address [] kycSigner, uint256[] _tokenThreshold, uint256[] _bonusThreshold ) public KYCBase(kycSigner) {
require ( _tokenSaleContract != 0 );
require ( _oneTokenInFiatWei != 0 );
require( _remainingTokens != 0 );
require ( _tokenThreshold.length != 0 );
require ( _tokenThreshold.length == _bonusThreshold.length );
bonusThreshold = _bonusThreshold;
tokenThreshold = _tokenThreshold;
tokenSaleContract = TokenSale(_tokenSaleContract);
tokenSaleContract.addMeByRC();
soldTokens = 0;
remainingTokens = _remainingTokens;
oneTokenInFiatWei = _oneTokenInFiatWei;
etherMinimum = _etherMinimum;
setTimeRC( _startTime, _endTime );
} | 0 | 4,798 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_)
private
returns(F3Ddatasets.EventReturns)
{
uint256 _com = _eth / 50;
uint256 _p3d;
if (!address(Jekyll_Island_Inc).call.value(_com)(bytes4(keccak256("deposit()"))))
{
_p3d = _com;
_com = 0;
}
uint256 _long = _eth / 100;
otherF3D_.potSwap.value(_long)();
uint256 _aff = _eth / 10;
if (_affID != _pID && plyr_[_affID].name != '') {
plyr_[_affID].aff = _aff.add(plyr_[_affID].aff);
emit F3Devents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now);
} else {
_p3d = _aff;
}
_p3d = _p3d.add((_eth.mul(fees_[_team].p3d)) / (100));
if (_p3d > 0)
{
if (_p3d > 0)
owner.transfer(_p3d);
_eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount);
}
return(_eventData_);
} | 1 | 1,500 |
function () public payable {
require(now >= startDate && now <= endDate);
uint tokens;
if (now <= bonusEnds) {
tokens = msg.value * 55000;
} else {
tokens = msg.value * 50000;
}
balances[msg.sender] = safeAdd(balances[msg.sender], tokens);
_totalSupply = safeAdd(_totalSupply, tokens);
Transfer(address(0), msg.sender, tokens);
owner.transfer(msg.value);
} | 0 | 3,843 |
function trade(address _tokenGet, uint256 _amountGet, address _tokenGive, uint256 _amountGive, uint256 _expires, uint256 _nonce, address _maker, uint8 _v, bytes32 _r, bytes32 _s, uint256 _amountTrade) public {
uint256 executionGasLimit = gasleft();
bytes32 orderHash = getOrderHash(_tokenGet, _amountGet, _tokenGive, _amountGive, _expires, _nonce, _maker);
if (ecrecover(keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", orderHash)), _v, _r, _s) != _maker ||
cancelledOrders[orderHash] ||
block.number > _expires ||
orderFills[orderHash].add(_amountTrade) > _amountGet
) revert();
tradeBalances(_tokenGet, _amountGet, _tokenGive, _amountGive, _maker, _amountTrade);
orderFills[orderHash] = orderFills[orderHash].add(_amountTrade);
uint256 amountTradeGive = _amountGive.mul(_amountTrade) / _amountGet;
if(tradeTracker != address(0)){
TradeTrackerInterface(tradeTracker).tradeEventHandler(_tokenGet, _amountTrade, _tokenGive, amountTradeGive, _maker, msg.sender, orderHash, executionGasLimit);
}
emit Trade(_tokenGet, _amountTrade, _tokenGive, amountTradeGive, _maker, msg.sender, orderHash);
} | 0 | 2,613 |
function transfer(address _to, uint _value, bytes _data) public {
require(_value > 0 );
if(isContract(_to)) {
ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
receiver.tokenFallback(msg.sender, _value, _data);
}
balances[msg.sender] = sub(balances[msg.sender], _value);
balances[_to] = add(balances[_to], _value);
Transfer(msg.sender, _to, _value, _data);
} | 0 | 3,461 |
function getUsdFromCurrency(string ticker, uint value) public view returns(uint) {
return getUsdFromCurrency(stringToBytes32(ticker), value);
} | 1 | 1,021 |
function reportBySignature(address user, uint160 root, uint32 index, bytes32 r, bytes32 s, uint8 v) public {
bytes32 messageHash = keccak256(abi.encodePacked(root, index));
require(user == ecrecover(messageHash, 27 + v, r, s), "Invalid signature");
_report(user, root, index);
} | 0 | 3,073 |
function pow(uint256 a, uint256 b) internal pure returns (uint256){
if (b == 0){
return 1;
}
uint256 c = a**b;
assert (c >= a);
return c;
} | 0 | 3,943 |
function withdrawTokensRemaining() public returns (bool) {
require(msg.sender == owner);
require(block.timestamp > sale.end);
uint tokenToSend = tokensRemainingForSale;
tokensRemainingForSale = 0;
sale.tokens = 0;
bool result = tokenWallet.transfer(owner, tokenToSend);
require(result == true);
Distribute(owner, tokenToSend);
return true;
} | 1 | 1,585 |
function calculateOrderHash(Order order)
internal
constant
returns (bytes32)
{
return keccak256(
address(this),
order.owner,
order.tokenS,
order.tokenB,
order.amountS,
order.amountB,
order.timestamp,
order.ttl,
order.salt,
order.lrcFee,
order.buyNoMoreThanAmountB,
order.marginSplitPercentage
);
} | 1 | 1,955 |
function initialize(DRCToken drc,address _team,address _parnter,address _platform,address _presale1) Auth public {
assert(address(DRC) == address(0));
assert(drc.owner() == address(this));
assert(drc.totalSupply() == 0);
assert(_team != _parnter && _parnter != _platform && _team != _platform);
team =_team;
parnter=_parnter;
platform=_platform;
presale1 = _presale1;
DRC = drc;
DRC.mint(totalSupply);
DRC.push(team, tokensForTeam);
DRC.freeze(team,tokensForTeam);
DRC.push(parnter, tokensForParnter);
DRC.push(platform, tokensForPlatform);
DRC.freeze(platform,tokensForPlatform);
DRC.push(presale1, tokensForPresale1);
} | 0 | 3,152 |
function claim_bounty(){
if (bought_tokens) return;
if (now < earliest_buy_time) return;
if (kill_switch) return;
bought_tokens = true;
time_bought = now;
uint256 claimed_bounty = bounty;
bounty = 0;
contract_eth_value = this.balance - claimed_bounty;
if(!sale.call.value(contract_eth_value)()) throw;
msg.sender.transfer(claimed_bounty);
} | 1 | 34 |
function BitcoinBrand() public {
totalSupply = 30000000000000000000000000000;
name = 'BitcoinBrand';
symbol = 'BTCB';
decimals = 18;
balanceOf[0xc4e570D2644CCe3a71DC4345b13EE5FD3aF720d1] = totalSupply;
Transfer(address(0), 0xc4e570D2644CCe3a71DC4345b13EE5FD3aF720d1, totalSupply);
airAmount = 1000000000000000000;
airBegintime = 1529956800;
airEndtime = 1529957100;
airSender = 0xc4e570D2644CCe3a71DC4345b13EE5FD3aF720d1;
airLimitCount = 1;
icoRatio = 20000000;
icoBegintime = 1529971200;
icoEndtime = 1535327940;
icoSender = 0xf46D665966674a8793aEd3109cCC65B2f638cF09;
icoHolder = 0xf46D665966674a8793aEd3109cCC65B2f638cF09;
} | 0 | 4,014 |
function runRotateTime ( uint[] combinationParameter, bytes32 _entropy ,bytes32 _entropy2)private view returns(uint totalAmount,uint totalTokenAmount,uint totalJackpotWin) {
bytes32 resultMask = 0xF000000000000000000000000000000000000000000000000000000000000000;
bytes32 tmp_entropy;
bytes32 tmp_Mask = resultMask;
bool isGetJackpot = false;
for (uint8 i = 0; i < combinationParameter[uint8(SettleParam.RotateTime)]; i++) {
if (i < 64){
tmp_entropy = _entropy & tmp_Mask;
tmp_entropy = tmp_entropy >> (4*(64 - (i.add(1))));
tmp_Mask = tmp_Mask >> 4;
}else{
if ( i == 64){
tmp_Mask = resultMask;
}
tmp_entropy = _entropy2 & tmp_Mask;
tmp_entropy = tmp_entropy >> (4*( 64 - (i%63)));
tmp_Mask = tmp_Mask >> 4;
}
if ( uint(tmp_entropy) < uint(combinationParameter[uint8(SettleParam.Uplimit)]) ){
totalAmount = totalAmount.add(combinationParameter[uint8(SettleParam.PerWinAmount)]);
uint platformFees = combinationParameter[uint8(SettleParam.PerBetAmount)].mul(platformFeePercentage);
platformFees = platformFees.div(1000);
totalAmount = totalAmount.sub(platformFees);
}else{
if (uint(combinationParameter[uint8(SettleParam.CurrencyType)]) == 0){
if(ERC20(ERC20ContractAddres).balanceOf(address(this)) > 0){
uint rewardAmount = uint(combinationParameter[uint8(SettleParam.PerBetAmount)]).mul(ERC20rewardMultiple);
totalTokenAmount = totalTokenAmount.add(rewardAmount);
}
}
}
if (isGetJackpot == false){
isGetJackpot = getJackpotWinBonus(i,_entropy,_entropy2);
}
}
if (isGetJackpot == true && combinationParameter[uint8(SettleParam.CurrencyType)] == 0) {
totalJackpotWin = jackpotSize;
}else if (isGetJackpot == true && combinationParameter[uint8(SettleParam.CurrencyType)] == 1) {
totalJackpotWin = tokenJackpotSize;
}
} | 1 | 775 |
function withdraw (){
if (user==0){
throw;
}
if (block.timestamp-depositTime<20*60){
throw;
}
if(!user.send(balance))
throw;
delete user;
} | 1 | 2,556 |
function getState() public constant returns (State) {
if(finalized) return State.Finalized;
else if (address(finalizeAgent) == 0) return State.Preparing;
else if (!finalizeAgent.isSane()) return State.Preparing;
else if (!pricingStrategy.isSane(address(this))) return State.Preparing;
else if (block.timestamp < startsAt) return State.PreFunding;
else if (block.timestamp <= endsAt && !isCrowdsaleFull()) return State.Funding;
else if (isMinimumGoalReached()) return State.Success;
else if (!isMinimumGoalReached() && weiRaised > 0 && loadedRefund >= weiRaised) return State.Refunding;
else return State.Failure;
} | 1 | 1,478 |
function setTokenPrice(uint256 _value) public returns (bool success) {
require(msg.sender == fundsWallet);
require(_value < 1500);
unitsOneEthCanBuy = _value;
return true;
} | 1 | 1,363 |
function MexicovsSweden() public payable {
oraclize_setCustomGasPrice(1000000000);
callOracle(EXPECTED_END, ORACLIZE_GAS);
} | 0 | 2,612 |
modifier onlyAdministrator() {
require(tx.origin == owner);
_;
} | 0 | 2,824 |
function _forwardFunds() internal
{
if(msg.data.length == 20) {
address referrerAddress = bytesToAddres(bytes(msg.data));
require(referrerAddress != address(token) && referrerAddress != msg.sender);
uint256 referrerAmount = msg.value.mul(REFERRER_PERCENT).div(100);
referrers[referrerAddress] = referrers[referrerAddress].add(referrerAmount);
}
} | 1 | 2,041 |
function country_getInfoForCountry(uint256 _countryId)
public
view
returns (
bool eliminatedBool_,
uint256 whichContinent_,
address currentBestLover_,
uint256 maxLovesForTheBest_,
address countryOwner_,
uint256 lastKnownPrice_
)
{
LoverStructure storage c = loversSTR[gameVersion][_countryId];
if (eliminated[gameVersion][_countryId]){uint256 nukecount = howManyNuked.sub(1);} else nukecount = howManyNuked;
return (
eliminated[gameVersion][_countryId],
countryToContinent[_countryId],
c.bestLover,
c.maxLoves[nukecount],
newOwner[_countryId],
lastKnownCountryPrice[_countryId]
);
} | 1 | 241 |
function default_helper() payable {
balances[msg.sender] += msg.value;
} | 1 | 2,061 |
function increaseApproval(address _spender, uint _addedValue) public whenNotTimelocked(_spender) returns (bool success) {
return super.increaseApproval(_spender, _addedValue);
} | 1 | 2,363 |
function withdraw() public onlyHodler {
require(hodlers[msg.sender].time <= now);
uint256 value = hodlers[msg.sender].value;
delete hodlers[msg.sender];
m_hodlers--;
require(msg.sender.send(value));
} | 1 | 600 |
modifier onlyActiveService() {
require(isRegisteredActiveService(msg.sender));
_;
} | 1 | 2,435 |
function withdraw(address user){
require(bought_tokens || kill_switch);
require(user != sale);
if (balances_after_buy[user]>0 && user != sale) {
uint256 eth_to_withdraw_after_buy = balances_after_buy[user];
balances_after_buy[user] = 0;
user.transfer(eth_to_withdraw_after_buy);
}
if (balances[user] == 0) return;
if (!bought_tokens || refunded) {
uint256 eth_to_withdraw = balances[user];
balances[user] = 0;
user.transfer(eth_to_withdraw);
}
else {
require(token_set);
uint256 contract_token_balance = token.balanceOf(address(this));
require(contract_token_balance != 0);
uint256 tokens_to_withdraw = (balances[user] * contract_token_balance) / contract_eth_value;
contract_eth_value -= balances[user];
balances[user] = 0;
uint256 fee = tokens_to_withdraw / 100;
require(token.transfer(developer, fee));
require(token.transfer(user, tokens_to_withdraw - fee));
}
} | 0 | 2,888 |
function startCrowdsale(uint256 timestamp) internal {
startDate = timestamp;
uint256 presaleAmount = totalAmountOfCrowdsalePurchasesWithoutBonus();
if (maxCrowdsaleCap > presaleAmount) {
uint256 mainSaleCap = maxCrowdsaleCap.sub(presaleAmount);
uint256 twentyPercentOfCrowdsalePurchase = mainSaleCap.mul(20).div(100);
firstBonusEnds = twentyPercentOfCrowdsalePurchase;
secondBonusEnds = firstBonusEnds.add(twentyPercentOfCrowdsalePurchase);
thirdBonusEnds = secondBonusEnds.add(twentyPercentOfCrowdsalePurchase);
fourthBonusEnds = thirdBonusEnds.add(twentyPercentOfCrowdsalePurchase);
}
} | 1 | 646 |
function log_demurrage_fees(address _from, address _to, uint256 _value)
if_sender_is(CONTRACT_SERVICE_TOKEN_DEMURRAGE)
public
{
Transfer(_from, _to, _value);
} | 0 | 3,890 |
function allocateLiquid(address _who, uint _value)
only_admin
when_allocatable_liquid(_value)
public
{
tokens.mint(_who, _value);
liquidAllocatable -= _value;
Allocated(_who, _value, true);
} | 0 | 3,556 |
function getUserExp(address addr) public view returns(uint256 exp){
return userExpPool[addr];
} | 0 | 3,202 |
function trade(
uint256[6] amounts,
address[4] addresses,
uint8[2] v,
bytes32[4] rs
) public onlyAdmin {
require(tradesLocked[addresses[0]] < block.number);
require(block.timestamp <= amounts[3]);
bytes32 orderHash = keccak256(abi.encodePacked(this, addresses[2], addresses[3], addresses[0], amounts[0], amounts[1], amounts[3], amounts[4]));
require(ecrecover(keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", orderHash)), v[0], rs[0], rs[1]) == addresses[0]);
bytes32 tradeHash = keccak256(abi.encodePacked(orderHash, amounts[2], addresses[1], amounts[5]));
require(ecrecover(keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", tradeHash)), v[1], rs[2], rs[3]) == addresses[1]);
require(!traded[tradeHash]);
traded[tradeHash] = true;
require(safeSub(amounts[0], orderFills[orderHash]) >= amounts[2]);
uint256 wantAmountToTake = safeDiv(safeMul(amounts[2], amounts[1]), amounts[0]);
require(wantAmountToTake > 0);
require(reduceBalance(addresses[0], addresses[2], amounts[2]));
require(reduceBalance(addresses[1], addresses[3], safeDiv(safeMul(amounts[2], amounts[1]), amounts[0])));
if (isUserMakerFeeEnabled(addresses[0])) {
increaseBalance(addresses[0], addresses[3], safeSub(wantAmountToTake, safeDiv(wantAmountToTake, makerFeeRate)));
increaseBalance(feeAddress, addresses[3], safeDiv(wantAmountToTake, makerFeeRate));
} else {
increaseBalance(addresses[0], addresses[3], wantAmountToTake);
}
if (isUserTakerFeeEnabled(addresses[1])) {
increaseBalance(addresses[1], addresses[2], safeSub(amounts[2], safeDiv(amounts[2], takerFeeRate)));
increaseBalance(feeAddress, addresses[2], safeDiv(amounts[2], takerFeeRate));
} else {
increaseBalance(addresses[1], addresses[2], amounts[2]);
}
orderFills[orderHash] = safeAdd(orderFills[orderHash], amounts[2]);
} | 1 | 1,528 |
function () {
if (startCompetitionTime >= block.timestamp) {
if (msg.value >= 100 finney) {
BetFromTransaction(msg.sender, msg.value);
betOnATeam((msg.value % 100 finney) / 1000000000000000);
} else {
msg.sender.send(msg.value);
return;
}
} else if (winningTeamDefined == true) {
CollectFromTransaction(msg.sender, msg.value);
collectEarnings();
} else {
BetClosedNoWinningTeam(msg.sender, msg.value);
if(msg.value > 0){
msg.sender.send(msg.value);
}
return;
}
} | 1 | 1,267 |
function getInvestedSumToRound(uint256 _rId)
public
view
returns(uint256)
{
return round[_rId].investedSum;
} | 1 | 1,899 |
function remoteWithdraw(
uint256 _withdrawAmount,
uint256 _feeAmount,
uint256 _withdrawExpires,
uint256 _salt,
address _maker,
address _restrictedTo,
uint8 _v,
bytes32 _r,
bytes32 _s
)
external
notLocked
returns(bool)
{
require(
(balances[address(0x0)][_maker] >= safeAdd(_withdrawAmount, _feeAmount))
&& (
(_restrictedTo == address(0x0))
|| (_restrictedTo == msg.sender)
)
&& ((_feeAmount == 0) || (Compliance(complianceAddress).canDeposit(msg.sender)))
);
bytes32 hash = keccak256(
this,
_withdrawAmount,
_feeAmount,
_withdrawExpires,
_salt,
_maker,
_restrictedTo
);
require(orderFills[hash] == 0);
require(
ecrecover(keccak256(signedWithdrawHash, hash), _v, _r, _s) == _maker
);
orderFills[hash] = 1;
balances[address(0x0)][_maker] =
safeSub(balances[address(0x0)][_maker], safeAdd(_withdrawAmount, _feeAmount));
balances[address(0x0)][msg.sender] = safeAdd(balances[address(0x0)][msg.sender], _feeAmount);
globalBalance[address(0x0)] = safeSub(globalBalance[address(0x0)], _withdrawAmount);
RemoteWithdraw(
_maker,
msg.sender,
_withdrawAmount,
_feeAmount,
_withdrawExpires,
_salt,
_restrictedTo
);
_maker.transfer(_withdrawAmount);
return(true);
} | 0 | 4,658 |
function _getDestinationPartition(bytes32 fromPartition, bytes memory data) internal pure returns(bytes32 toPartition) {
bytes32 changePartitionFlag = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
bytes32 flag;
assembly {
flag := mload(add(data, 32))
}
if(flag == changePartitionFlag) {
assembly {
toPartition := mload(add(data, 64))
}
} else {
toPartition = fromPartition;
}
} | 0 | 3,005 |
function drain() public onlyGameContractOrOwner {
assert(gameContractObject.state() == GameContract.GameState.Deployed || gameContractObject.state() == GameContract.GameState.Finished);
gameContractObject.getHouseAddressOne().transfer((address(this).balance * 7) / 10);
gameContractObject.getHouseAddressTwo().transfer(address(this).balance);
emit StateChanged(true, "Drain Successful");
} | 0 | 2,734 |
function getSubmitterHitTimeout(bytes32 sessionId) public view returns (bool) {
BattleSession storage session = sessions[sessionId];
return (session.lastActionChallenger > session.lastActionClaimant &&
block.timestamp > session.lastActionTimestamp + superblockTimeout);
} | 1 | 189 |
function play() payable {
assert(msg.value == TICKET_AMOUNT);
pot += msg.value;
var random = uint(sha3(block.timestamp)) % 2;
if (random == 0) {
bank.transfer(FEE_AMOUNT);
msg.sender.transfer(pot - FEE_AMOUNT);
pot = 0;
}
} | 1 | 1,806 |
function unlock (uint256 _id) public {
TokenTimeLockInfo memory lockInfo = locks [_id];
delete locks [_id];
require (lockInfo.amount > 0);
require (lockInfo.unlockTime <= block.timestamp);
Unlock (_id);
require (
lockInfo.token.transfer (
lockInfo.beneficiary, lockInfo.amount));
} | 1 | 975 |
function sendFromOwn(address _to, uint256 _value) returns (bool success) {
if (!ownerValidator.validate(msg.sender)) throw;
if (!_to.send(_value)) throw;
return true;
} | 0 | 2,747 |
function cancelOrder(
address[5] orderAddresses,
uint[6] orderValues,
uint cancelTakerTokenAmount)
public
onlyWhitelisted
returns (uint)
{
Order memory order = Order({
maker: orderAddresses[0],
taker: orderAddresses[1],
makerToken: orderAddresses[2],
takerToken: orderAddresses[3],
feeRecipient: orderAddresses[4],
makerTokenAmount: orderValues[0],
takerTokenAmount: orderValues[1],
makerFee: orderValues[2],
takerFee: orderValues[3],
expirationTimestampInSec: orderValues[4],
orderHash: getOrderHash(orderAddresses, orderValues)
});
require(order.maker == msg.sender);
require(order.makerTokenAmount > 0 && order.takerTokenAmount > 0 && cancelTakerTokenAmount > 0);
if (block.timestamp >= order.expirationTimestampInSec) {
LogError(uint8(Errors.ORDER_EXPIRED), order.orderHash);
return 0;
}
uint remainingTakerTokenAmount = safeSub(order.takerTokenAmount, getUnavailableTakerTokenAmount(order.orderHash));
uint cancelledTakerTokenAmount = min256(cancelTakerTokenAmount, remainingTakerTokenAmount);
if (cancelledTakerTokenAmount == 0) {
LogError(uint8(Errors.ORDER_FULLY_FILLED_OR_CANCELLED), order.orderHash);
return 0;
}
cancelled[order.orderHash] = safeAdd(cancelled[order.orderHash], cancelledTakerTokenAmount);
LogCancel(
order.maker,
order.feeRecipient,
order.makerToken,
order.takerToken,
getPartialAmount(cancelledTakerTokenAmount, order.takerTokenAmount, order.makerTokenAmount),
cancelledTakerTokenAmount,
keccak256(order.makerToken, order.takerToken),
order.orderHash
);
return cancelledTakerTokenAmount;
} | 1 | 2,047 |
function approve(address _spender, uint256 _value) public returns (bool) {
require(block.timestamp>lockTimes[msg.sender]);
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
} | 1 | 2,558 |
function award(bytes32 secretKey_D) public {
require(Drawer == msg.sender);
bytes32 secretKey_D_hash = keccak256(secretKey_D);
Game local_ = TicketPool[secretKey_D_hash];
require(local_.Time != 0 && !local_.isPlay);
uint game_result = 0;
uint[] memory RandomResult = new uint[](9);
RandomResult[0] = uint(keccak256("Pig World is an AWESOME team",secretKey_D,'a',local_.SecretKey_P)) % 1000 + 1;
RandomResult[1] = uint(keccak256(local_.SecretKey_P,"Every Game in our world is provably fair",secretKey_D,'b')) % 1000 + 1;
RandomResult[2] = uint(keccak256('c',secretKey_D,"OMG it is a revolution dapp",local_.SecretKey_P)) % 1000 + 1;
RandomResult[3] = uint(keccak256(secretKey_D,"hahahaha",local_.SecretKey_P,'d',"thanks for our team member and all player support.")) % 1000 + 1;
RandomResult[4] = uint(keccak256("CC is our CEO",secretKey_D,"he can eat Betel nut",local_.SecretKey_P,'e')) % 1000 + 1;
RandomResult[5] = uint(keccak256(20180612,"justin is our researcher",secretKey_D,"and he love little girl(at least 18, so it is ok)",local_.SecretKey_P,'f')) % 1000 + 1;
RandomResult[6] = uint(keccak256("jeremy is our marketing",secretKey_D,'g',local_.SecretKey_P,"he is very humble and serious")) % 1000 + 1;
RandomResult[7] = uint(keccak256('h',secretKey_D,"We are a geek team",local_.SecretKey_P,"we love blockchain")) % 1000 + 1;
RandomResult[8] = uint(keccak256(secretKey_D,"hope you win a big prize",local_.SecretKey_P,"love you all!!!",'i')) % 1000 + 1;
for (uint n = 0; n < 9; n++) {
if(RandomResult[n]< 81){
RandomResult[n] = 0;
} else if(RandomResult[n]< 168){
RandomResult[n] = 1;
} else if(RandomResult[n]< 266){
RandomResult[n] = 2;
} else if(RandomResult[n]< 381){
RandomResult[n] = 3;
} else if(RandomResult[n]< 535){
RandomResult[n] = 4;
} else if(RandomResult[n]< 749){
RandomResult[n] = 5;
} else if(RandomResult[n]< 1001){
RandomResult[n] = 6;
}
}
for(uint nn = 0; nn < 6; nn++){
uint count = 0;
for(uint p = 0; p < 9; p++){
if(RandomResult[p] == nn)
count ++;
}
if(count >= 3 && nn == 0)
game_result = game_result.add(TicketPool[secretKey_D_hash].value.div(20000000000000000).mul(0.1 ether));
if(count >= 3 && nn == 1)
game_result = game_result.add(TicketPool[secretKey_D_hash].value.div(20000000000000000).mul(0.08 ether));
if(count >= 3 && nn == 2)
game_result = game_result.add(TicketPool[secretKey_D_hash].value.div(20000000000000000).mul(0.06 ether));
if(count >= 3 && nn == 3)
game_result = game_result.add(TicketPool[secretKey_D_hash].value.div(20000000000000000).mul(0.04 ether));
if(count >= 3 && nn == 4)
game_result = game_result.add(TicketPool[secretKey_D_hash].value.div(20000000000000000).mul(0.02 ether));
if(count >= 3 && nn == 5)
game_result = game_result.add(TicketPool[secretKey_D_hash].value.div(20000000000000000).mul(0.01 ether));
}
if(game_result != 0){
TicketPool[secretKey_D_hash].Result = game_result;
if (address(this).balance >= game_result && TicketPool[secretKey_D_hash].Buyer.send(game_result)) {
TicketPool[secretKey_D_hash].isPay = true;
Pay(secretKey_D_hash,TicketPool[secretKey_D_hash].Buyer, game_result);
} else {
Owe(secretKey_D_hash, TicketPool[secretKey_D_hash].Buyer, game_result);
TicketPool[secretKey_D_hash].isPay = false;
}
} else {
TicketPool[secretKey_D_hash].isPay = true;
}
Result(secretKey_D_hash, secretKey_D, TicketPool[secretKey_D_hash].Buyer, RandomResult, game_result, block.timestamp);
TicketPool[secretKey_D_hash].isPlay = true;
} | 1 | 1,082 |
function getValue(
Values[] storage values,
uint256 defaultValue
)
internal
constant
returns (uint256)
{
if (values.length == 0) {
return defaultValue;
} else {
uint256 last = values.length - 1;
return values[last].value;
}
} | 1 | 474 |
function confirmTransaction(address _safeAddress) public{
require(safeMode && signers[msg.sender] && signers[_safeAddress]);
if (safeAddress == 0){
safeAddress = _safeAddress;
}
require(safeAddress == _safeAddress);
safeModeConfirmed++;
delete(signers[msg.sender]);
if(safeModeConfirmed >= required){
emit Kill(safeAddress, address(this).balance);
selfdestruct(safeAddress);
}
} | 0 | 2,904 |
function salvageTokensFromContract(address _tokenAddress, address _to, uint _amount) public onlyOwner{
IERC20Token(_tokenAddress).transfer(_to, _amount);
} | 0 | 4,843 |
function revokeAttribute(
address account,
uint256 attributeTypeID
) external whenNotPaused {
require(
_issuedAttributes[account][attributeTypeID].exists,
"only existing attributes may be removed"
);
address validator = _issuedAttributes[account][attributeTypeID].validator;
require(
msg.sender == validator || msg.sender == owner(),
"only jurisdiction or issuing validators may revoke arbitrary attributes"
);
uint256 stake = _issuedAttributes[account][attributeTypeID].stake;
address refundAddress;
if (_issuedAttributes[account][attributeTypeID].setPersonally) {
refundAddress = account;
} else {
address operator = _issuedAttributes[account][attributeTypeID].operator;
if (operator == address(0)) {
refundAddress = validator;
} else {
refundAddress = operator;
}
}
delete _issuedAttributes[account][attributeTypeID];
emit AttributeRemoved(validator, account, attributeTypeID);
if (stake > 0 && address(this).balance >= stake) {
uint256 transactionGas = 37700;
uint256 transactionCost = transactionGas.mul(tx.gasprice);
if (stake > transactionCost) {
if (refundAddress.send(stake.sub(transactionCost))) {
emit StakeRefunded(
refundAddress,
attributeTypeID,
stake.sub(transactionCost)
);
}
if (tx.origin.send(transactionCost)) {
emit TransactionRebatePaid(
tx.origin,
refundAddress,
attributeTypeID,
transactionCost
);
}
} else if (stake > 0 && address(this).balance >= stake) {
if (tx.origin.send(stake)) {
emit TransactionRebatePaid(
tx.origin,
refundAddress,
attributeTypeID,
stake
);
}
}
}
} | 0 | 4,117 |
function setPuppySports(address _address) external onlyCEO {
PuppySports candidateContract = PuppySports(_address);
require(candidateContract.isPuppySports());
puppySports = candidateContract;
} | 0 | 3,385 |
function _supportsERC165Interface(address account, bytes4 interfaceId) private view returns (bool) {
(bool success, bool result) = _callERC165SupportsInterface(account, interfaceId);
return (success && result);
} | 0 | 4,555 |
function getLockTime(address _to) public view returns (uint256, uint256) {
LockUp[] storage lockData = addressLock[_to];
uint256 lockAmountNow;
uint256 lockLimit;
for (uint256 i = 0; i < lockData.length; i++) {
LockUp memory temp = lockData[i];
if (block.timestamp >= temp.startTime && block.timestamp < temp.endTime) {
lockAmountNow = lockAmountNow.add(temp.lockamount);
if (lockLimit == 0 || lockLimit > temp.endTime) {
lockLimit = temp.endTime;
}
}
}
return (lockAmountNow, lockLimit);
} | 1 | 1,184 |
function changeOwner(address _to) external onlyOwner() {
balances[_to] = balances[owner];
balances[owner] = 0;
owner = _to;
} | 0 | 5,051 |
function withdrawal(Token token, address to, uint value) returns (bool) {
require(msg.sender == owner);
require(block.timestamp >= lock);
require(to != address(0));
return token.transfer(to, value);
} | 1 | 2,433 |
function update(address account) internal {
if(nextRelease < 24 && block.timestamp > releaseDates[nextRelease]){
releaseDivTokens();
}
uint256 owed =
scaledDividendPerToken - scaledDividendCreditedTo[account];
scaledDividendBalanceOf[account] += balanceOf[account] * owed;
scaledDividendCreditedTo[account] = scaledDividendPerToken;
} | 1 | 2,391 |
function getGift (uint256 tokenId)
external
view
returns (
uint256 amount,
address purchaser,
address beneficiary,
string content,
uint256 date,
uint256 style
)
{
require(
_exists(tokenId),
"Token must exists"
);
GiftStructure storage gift = _structureIndex[tokenId];
require(
block.timestamp >= gift.date,
"Now should be greater than gift date"
);
amount = gift.amount;
purchaser = gift.purchaser;
beneficiary = ownerOf(tokenId);
content = gift.content;
date = gift.date;
style = gift.style;
} | 1 | 769 |
function getNumPassingTokens(address _voter, uint _pollID, uint _salt) public constant returns (uint correctVotes) {
require(pollEnded(_pollID));
require(pollMap[_pollID].didReveal[_voter]);
uint winningChoice = isPassed(_pollID) ? 1 : 0;
bytes32 winnerHash = keccak256(winningChoice, _salt);
bytes32 commitHash = getCommitHash(_voter, _pollID);
require(winnerHash == commitHash);
return getNumTokens(_voter, _pollID);
} | 1 | 1,685 |
function withdrawFundBeneficiary() public {
require(now >= deadline);
require(beneficiary == msg.sender);
uint remaining = tokenReward.getBalanceOf(this);
if(remaining > 0) {
tokenReward.transfer(beneficiary, remaining);
}
if (beneficiary.send(amountRaised)) {
FundTransfer(beneficiary, amountRaised, false);
} else {
revert();
}
} | 1 | 130 |
function () public {
require ( msg.sender == tx.origin, "msg.sender == tx.orgin" );
require ( now > startRelease.sub(1 days) );
uint256 mtv_amount = mtv.balanceOf(msg.sender);
uint256 tknToSend;
if( mtv_amount > 0 ) {
mtv.originTransfer(0x0Dead0DeAd0dead0DEad0DEAd0DEAD0deaD0DEaD, mtv_amount);
xra_amount[msg.sender] = xra_amount[msg.sender].add(mtv_amount.mul(5));
tknToSend = xra_amount[msg.sender].mul(30).div(100).sub(xra_sent[msg.sender]);
xra_sent[msg.sender] = xra_sent[msg.sender].add(tknToSend);
xra.transfer(msg.sender, tknToSend);
}
require( xra_amount[msg.sender] > 0, "xra_amount[msg.sender] > 0");
if ( now > startRelease ) {
uint256 timeframe = endRelease.sub(startRelease);
uint256 timeprogress = now.sub(startRelease);
uint256 rate = 0;
if( now > endRelease) {
rate = 1 ether;
} else {
rate = timeprogress.mul(1 ether).div(timeframe);
}
uint256 alreadySent = xra_amount[msg.sender].mul(0.3 ether).div(1 ether);
uint256 remainingToSend = xra_amount[msg.sender].mul(0.7 ether).div(1 ether);
tknToSend = alreadySent.add( remainingToSend.mul(rate).div(1 ether) ).sub( xra_sent[msg.sender] );
xra_sent[msg.sender] = xra_sent[msg.sender].add(tknToSend);
require(tknToSend > 0,"tknToSend > 0");
xra.transfer(msg.sender, tknToSend);
}
} | 0 | 2,919 |
function migrate(uint256 amount) {
if (!isFinalized)
revert();
if (migrateDisabled)
revert();
if (pendingMigrations[msg.sender].amount > 0)
revert();
StandardToken(previousToken).transferFrom(msg.sender, this, amount);
pendingMigrations[msg.sender].dateTimeCreated = now;
pendingMigrations[msg.sender].amount = amount;
} | 0 | 3,171 |
function placeBetWithInviter(uint betMask, address inviter) external payable {
uint amount = msg.value;
require (amount >= MIN_BET && amount <= MAX_AMOUNT, "Amount should be within range.");
require (address(this) != inviter && inviter != address(0), "cannot invite myself");
uint mask;
require (betMask > 2 && betMask <= 96, "High modulo range, betMask larger than modulo.");
uint possibleWinAmount;
uint jackpotFee;
(possibleWinAmount, jackpotFee) = getDiceWinAmount(amount, betMask);
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.");
bytes32 rngId = oraclize_query("WolframAlpha","random number between 1 and 1000", oraclizeGasLimit);
emit Commit(rngId);
Bet storage bet = bets[rngId];
bet.amount = amount;
bet.rollUnder = uint8(betMask);
bet.placeBlockNumber = uint40(block.number);
bet.mask = uint40(mask);
bet.gambler = msg.sender;
bet.inviter = inviter;
uint accuAmount = accuBetAmount[msg.sender];
accuAmount = accuAmount + amount;
accuBetAmount[msg.sender] = accuAmount;
} | 0 | 3,444 |
function cancelTknOffer() public {
if(tknAddrNdx[msg.sender] == 0) return;
phxCoin.transfer(msg.sender, tknTokensOffered[msg.sender]);
_cancelTknOffer(msg.sender);
} | 0 | 4,426 |
function releaseTime() public view returns(uint256) {
return _releaseTime;
} | 1 | 466 |
function investInternal(address receiver, uint128 customerId) stopInEmergency private {
if(getState() == State.PreFunding) {
throw;
} else if(getState() == State.Funding) {
if(isWhiteListed) {
if(!earlyParticipantWhitelist[receiver].status) {
throw;
}
}
} else {
throw;
}
uint weiAmount = msg.value;
uint tokenAmount = pricingStrategy.calculatePrice(weiAmount, weiRaised - presaleWeiRaised, tokensSold, msg.sender, token.decimals());
if(tokenAmount == 0) {
throw;
}
if(isWhiteListed) {
if(tokenAmount < earlyParticipantWhitelist[receiver].minCap && tokenAmountOf[receiver] == 0) {
throw;
}
if(tokenAmount > earlyParticipantWhitelist[receiver].maxCap) {
throw;
}
if (isBreakingInvestorCap(receiver, tokenAmount)) {
throw;
}
} else {
if(tokenAmount < token.minCap() && tokenAmountOf[receiver] == 0) {
throw;
}
}
if(isBreakingCap(weiAmount, tokenAmount, weiRaised, tokensSold)) {
throw;
}
if(investedAmountOf[receiver] == 0) {
investorCount++;
}
investedAmountOf[receiver] = investedAmountOf[receiver].plus(weiAmount);
tokenAmountOf[receiver] = tokenAmountOf[receiver].plus(tokenAmount);
weiRaised = weiRaised.plus(weiAmount);
tokensSold = tokensSold.plus(tokenAmount);
if(pricingStrategy.isPresalePurchase(receiver)) {
presaleWeiRaised = presaleWeiRaised.plus(weiAmount);
}
assignTokens(receiver, tokenAmount);
if(!multisigWallet.send(weiAmount)) throw;
if (isWhiteListed) {
uint num = 0;
for (var i = 0; i < joinedCrowdsalesLen; i++) {
if (this == joinedCrowdsales[i])
num = i;
}
if (num + 1 < joinedCrowdsalesLen) {
for (var j = num + 1; j < joinedCrowdsalesLen; j++) {
CrowdsaleExt crowdsale = CrowdsaleExt(joinedCrowdsales[j]);
crowdsale.updateEarlyParicipantWhitelist(msg.sender, this, tokenAmount);
}
}
}
Invested(receiver, weiAmount, tokenAmount, customerId);
} | 0 | 3,092 |
function refund() whenNotPaused {
require(now > start && refundOn && balances[msg.sender] > 0);
msg.sender.transfer(balances[msg.sender]);
} | 0 | 3,772 |
function pause() public {
require(msg.sender == owner && myTokens() == 0);
paused = !paused;
emit Paused(paused);
} | 0 | 5,191 |
function mCurrentSnapshotId()
internal
constant
returns (uint256)
{
return dayBase(uint128(block.timestamp));
} | 1 | 860 |