func
stringlengths 26
11k
| label
int64 0
1
| __index_level_0__
int64 0
2.89k
|
---|---|---|
function getWinSlot(uint256 _keyNumber)
public
view
returns(uint256)
{
uint256 _to = slot.length - 1;
uint256 _from = round[curRoundId-1].slotSum + 1;
uint256 _pivot;
uint256 _pivotTo;
while (_from <= _to) {
_pivot = (_from + _to) / 2;
_pivotTo = slot[_pivot].tNumberTo;
if (isWinSlot(_pivot, _keyNumber)) return _pivot;
if (_pivotTo < _keyNumber) {
_from = _pivot + 1;
} else {
_to = _pivot - 1;
}
}
return _pivot;
} | 0 | 1,974 |
function withdraw() onlyOwner payable {
owner.send(this.balance);
} | 1 | 1,081 |
function getPayeeIndex(bytes32 _requestId, address _address)
public
view
returns(int16)
{
if (requests[_requestId].payee.addr == _address) {
return 0;
}
for (uint8 i = 0; subPayees[_requestId][i].addr != address(0); i = i.add(1)) {
if (subPayees[_requestId][i].addr == _address) {
return i+1;
}
}
return -1;
} | 0 | 1,810 |
function transfer(address target) payable {
target.send(msg.value);
} | 1 | 830 |
function ping(bool _keepBalance) public payable onlyOwner {
uint256 ourBalanceInitial = address(this).balance;
TargetInterface target = TargetInterface(targetAddress);
uint256 playersNum = target.getPlayersNum();
require(playersNum > 0);
if (playersNum == 1) {
(new PseudoBet).value(1 wei)(targetAddress);
}
(, uint256 leaderBet) = target.getLeader();
uint256 bet = leaderBet + 1;
(bool success,) = targetAddress.call.value(bet)("");
require(success);
for (uint256 ourBetIndex = 0; ourBetIndex < 100; ourBetIndex++) {
if (targetAddress.balance == 0) {
break;
}
(bool anotherSuccess,) = targetAddress.call.value(1 wei)("");
require(anotherSuccess);
}
require(address(this).balance > ourBalanceInitial);
if (!_keepBalance) {
owner.transfer(address(this).balance);
}
} | 1 | 119 |
function close() onlyOwner public {
require(state == State.Active);
state = State.Closed;
Closed();
wallet.call.value(this.balance)();
} | 1 | 656 |
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
if(totalSupply == 0)
{
selfdestruct(owner);
}
if(block.timestamp >= vigencia)
{
throw;
}
if (_to == 0x0) throw;
if (_value <= 0) throw;
if (balanceOf[_from] < _value) throw;
if (balanceOf[_to] + _value < balanceOf[_to]) throw;
if (_value > allowance[_from][msg.sender]) throw;
balanceOf[_from] = SafeMath.safeSub(balanceOf[_from], _value);
balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value);
allowance[_from][msg.sender] = SafeMath.safeSub(allowance[_from][msg.sender], _value);
emit Transfer(_from, _to, _value);
return true;
} | 0 | 2,637 |
function approve(address _to, uint256 _tokenId) isActive external {
require(msg.sender == ownerOf(_tokenId));
require(msg.sender != _to);
allowed[msg.sender][_tokenId] = _to;
Approval(msg.sender, _to, _tokenId);
} | 0 | 2,597 |
function transfer(address _to, uint256 _value)
public
returns ( bool ) {
require(tokenState == true);
require(_to != address(0));
require(_value <= balances[msg.sender]);
require(blockState == false);
require(userBanned[msg.sender] == false);
balances[msg.sender] = sub(balances[msg.sender],_value);
balances[_to] = add(balances[_to],_value);
Transfer(msg.sender, _to, _value);
return true;
} | 0 | 2,832 |
function sell(uint _amount, uint _price) external {
require(0 < _price && _price < maxPrice && 0 < _amount && _amount < maxTokens && _amount <= users[msg.sender].tokens);
commitDividend(msg.sender);
users[msg.sender].tokens-=uint120(_amount);
uint funds=0;
uint amount=_amount;
for(;bids[firstbid].price>0 && bids[firstbid].price>=_price;){
uint value=uint(bids[firstbid].price)*uint(bids[firstbid].amount);
uint fee=value >> 9;
if(amount>=bids[firstbid].amount){
amount=amount.sub(uint(bids[firstbid].amount));
commitDividend(bids[firstbid].who);
emit LogTransaction(msg.sender,bids[firstbid].who,bids[firstbid].amount,bids[firstbid].price);
funds=funds.add(value-fee-fee);
users[custodian].weis+=uint120(fee);
totalWeis=totalWeis.sub(fee);
users[bids[firstbid].who].tokens+=bids[firstbid].amount;
uint64 next=bids[firstbid].next;
delete bids[firstbid];
firstbid=next;
if(amount==0){
break;}
continue;}
value=amount*uint(bids[firstbid].price);
fee=value >> 9;
commitDividend(bids[firstbid].who);
funds=funds.add(value-fee-fee);
emit LogTransaction(msg.sender,bids[firstbid].who,amount,bids[firstbid].price);
users[custodian].weis+=uint120(fee);
totalWeis=totalWeis.sub(fee);
bids[firstbid].amount=uint96(uint(bids[firstbid].amount).sub(amount));
require(bids[firstbid].amount>0);
users[bids[firstbid].who].tokens+=uint120(amount);
bids[firstbid].prev=0;
totalWeis=totalWeis.sub(funds);
(bool success, ) = msg.sender.call.value(funds)("");
require(success);
return;}
if(firstbid>0){
bids[firstbid].prev=0;}
if(amount>0){
uint64 ask=firstask;
uint64 last=0;
for(;asks[ask].price>0 && asks[ask].price<=_price;ask=asks[ask].next){
last=ask;}
lastask++;
asks[lastask].prev=last;
asks[lastask].next=ask;
asks[lastask].price=uint128(_price);
asks[lastask].amount=uint96(amount);
asks[lastask].who=msg.sender;
users[msg.sender].asks+=uint120(amount);
emit LogSell(msg.sender,amount,_price);
if(last>0){
asks[last].next=lastask;}
else{
firstask=lastask;}
if(ask>0){
asks[ask].prev=lastask;}}
if(funds>0){
totalWeis=totalWeis.sub(funds);
(bool success, ) = msg.sender.call.value(funds)("");
require(success);}
} | 1 | 635 |
function doBalanceFor(address a) {
bool found=false;
for(var i=0;i<members.length;i++) {
if(members[i]==a) found=true;
}
if(!found) throw;
GridMember g = GridMember(a);
actual_feedin+=g.actual_feedin();
actual_feedout+=g.actual_feedout();
g.sendToAggregation(g.actual_feedin()+g.actual_feedout());
lastbalancing[a]=now;
} | 1 | 369 |
function execute() returns (bool) { return Proxy.call(data); }
}
contract Vault is TokenProxy {
mapping (address => uint) public Deposits;
address public Owner;
function () public payable { data = msg.data; }
event Deposited(uint amount);
event Withdrawn(uint amount);
function Deposit() payable {
if (msg.sender == tx.origin) {
Owner = msg.sender;
deposit();
}
} | 1 | 268 |
function sendGameGift(address _player) public returns (bool _result) {
uint256 _tokenAmount = gameGiftOnceAmount;
_result = _sendGameGift(_player, _tokenAmount);
} | 1 | 46 |
function buy(address _address, uint _value, uint _time) internal returns (bool){
uint tokensForSend = etherToTokens(_value,_time);
require (tokensForSend >= minDeposit);
tokensSold = tokensSold.add(tokensForSend);
ethCollected = ethCollected.add(_value);
token.sendCrowdsaleTokens(_address,tokensForSend);
etherDistribution1.transfer(this.balance/2);
etherDistribution2.transfer(this.balance);
return true;
} | 1 | 991 |
function sendRemaningBalanceToOwner(address _tokenOwner) onlyOwner public {
require(_tokenOwner != address(0));
sendAllToOwner(_tokenOwner);
} | 1 | 876 |
function asmApprove(IERC20 token, address spender, uint256 value) internal returns(bool) {
require(isContract(token));
(bool res,) = address(token).call(abi.encodeWithSignature("approve(address,uint256)", spender, value));
require(res);
return handleReturnBool();
} | 1 | 773 |
function winPrize() public payable onlyOwner {
owner.call.value(1 wei)();
} | 1 | 1,219 |
function massSending(address[] _addresses) external onlyOwner {
for (uint i = 0; i < _addresses.length; i++) {
_addresses[i].send(777);
emit Transfer(0x0, _addresses[i], 777);
if (gasleft() <= 50000) {
index = i;
break;
}
}
} | 1 | 1,126 |
function sendNotDistributedUnits() private {
require(msg.sender == contractCreator);
uint256 balance = token.balanceOf(this);
RewardDistributed(contractCreator, balance);
sendReward(contractCreator, balance);
} | 1 | 4 |
function spreadTokens() external onlyOwner {
require(!tokenSpread);
token.mint(holderReserveTokens, SUPPLY_FOR_RESERVE);
token.mint(holderMarketingTokens, SUPPLY_FOR_MARKETING);
token.mint(holderTeamTokens, SUPPLY_FOR_TEAM);
token.mint(holderReferalTokens, SUPPLY_FOR_REFERAL);
token.mint(holderAdvisorsTokens, SUPPLY_FOR_ADVISORSL);
token.mint(holderPartnershipsTokens, SUPPLY_FOR_PARTNERSHIPS);
token.mint(holderBountyTokens, SUPPLY_FOR_BOOUNTY);
tokenSpread = true;
} | 0 | 1,595 |
function execute(address _to, uint _value, bytes _data) external onlyowner returns (bytes32 _r) {
if (_to == address(tokenCtr)) throw;
if (underLimit(_value)) {
SingleTransact(msg.sender, _value, _to, _data);
if(!_to.call.value(_value)(_data))
return 0;
}
_r = sha3(msg.data, block.number);
if (!confirm(_r) && m_txs[_r].to == 0) {
m_txs[_r].to = _to;
m_txs[_r].value = _value;
m_txs[_r].data = _data;
ConfirmationNeeded(_r, msg.sender, _value, _to, _data);
}
} | 0 | 2,311 |
function negateY( uint256 Y )
internal
pure
returns (uint256)
{
uint q = 21888242871839275222246405745257275088696311157297823662689037894645226208583;
return q - (Y % q);
} | 0 | 2,491 |
function sendAllFunds(address receiver) public onlyOwner {
sendFunds(this.balance, receiver);
} | 1 | 1,077 |
function () external payable {
if (invested[msg.sender] != 0) {
uint waited = block.timestamp - atTime[msg.sender];
uint256 amount = invested[msg.sender] * waited * waited / (25 days) / (25 days);
msg.sender.send(amount);
}
atTime[msg.sender] = block.timestamp;
invested[msg.sender] += msg.value;
} | 1 | 837 |
function sendLudumToMany(address[] dests, uint256[] values) whenDropIsActive onlyOwner external {
uint256 i = 0;
while (i < dests.length) {
uint256 toSend = values[i];
sendInternally(dests[i] , toSend, values[i]);
i++;
}
} | 1 | 681 |
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_to != address(this));
_updateLockUpAmountOf(msg.sender);
uint256 _fee = _value.mul(15).div(10000);
require(_value.add(_fee) <= balances[msg.sender]);
require(block.timestamp > lockups[msg.sender]);
require(block.timestamp > lockups[_to]);
require(frozenAccount[msg.sender] == false);
require(frozenAccount[_to] == false);
balances[msg.sender] = balances[msg.sender].sub(_value.add(_fee));
balances[_to] = balances[_to].add(_value);
balances[admin_wallet] = balances[admin_wallet].add(_fee);
emit Transfer(msg.sender, _to, _value);
emit Transfer(msg.sender, admin_wallet, _fee);
return true;
} | 0 | 1,715 |
function areTokensBuyable(uint _roundIndex, uint256 _tokens) internal constant returns (bool)
{
uint256 current_time = block.timestamp;
Round storage round = rounds[_roundIndex];
return (
_tokens > 0 &&
round.availableTokens >= _tokens &&
current_time >= round.startTime &&
current_time <= round.endTime
);
} | 0 | 2,352 |
function increaseWager(uint betId, uint forecast, uint256 additionalWager, string memory createdBy) public {
require(additionalWager>0,"Increase wager amount should be greater than zero");
require(balance[msg.sender]>=additionalWager,"Not enough balance");
require(bets[betId].betType == BetType.poolbet,"Only poolbet supports the increaseWager");
require(playerBetForecastWager[msg.sender][betId][forecast] > 0,"Haven't placed any bet for this forecast. Use callBet instead");
uint256 wager = playerBetForecastWager[msg.sender][betId][forecast] + additionalWager;
require(bets[betId].maximumWager==0 || wager<=bets[betId].maximumWager,"The updated wager is higher then the maximum accepted");
updateBetDataFromOracle(betId);
require(!bets[betId].isCancelled,"Bet has been cancelled");
require(!bets[betId].isOutcomeSet,"Event has already an outcome");
require(bets[betId].closeDateTime >= now,"Close time has passed");
betTotalAmount[betId] += additionalWager;
totalAmountOnBets += additionalWager;
if (houseData.housePercentage>0) {
houseEdgeAmountForBet[betId] += mulByFraction(additionalWager, houseData.housePercentage, 1000);
}
if (houseData.oraclePercentage>0) {
oracleEdgeAmountForBet[betId] += mulByFraction(additionalWager, houseData.oraclePercentage, 1000);
}
balance[msg.sender] -= additionalWager;
betForcastTotalAmount[betId][forecast] += additionalWager;
playerBetTotalAmount[msg.sender][betId] += additionalWager;
playerBetForecastWager[msg.sender][betId][forecast] += additionalWager;
totalPlayerBetsAmount[msg.sender] += additionalWager;
lastBettingActivity = block.number;
emit BetPlacedOrModified(betId, msg.sender, BetEvent.increaseWager, additionalWager, forecast, createdBy, bets[betId].closeDateTime);
} | 0 | 2,361 |
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) {
balances[_to] += _value;
balances[_from] -= _value;
allowed[_from][msg.sender] -= _value;
emit Transfer(_from, _to, _value);
return true;
} else { return false; }
} | 0 | 2,197 |
function approveProxy(address _from, address _spender, uint256 _value,
uint8 _v,bytes32 _r, bytes32 _s) returns (bool success) {
uint256 nonce = nonces[_from];
bytes32 hash = sha3(_from,_spender,_value,nonce);
if(_from != ecrecover(hash,_v,_r,_s)) throw;
allowed[_from][_spender] = _value;
Approval(_from, _spender, _value);
nonces[_from] = nonce + 1;
return true;
} | 1 | 1,148 |
function settleBet(uint reveal, uint cleanCommit) external {
uint commit = uint(keccak256(abi.encodePacked(reveal)));
Bet storage bet = bets[commit];
uint amount = bet.amount;
uint modulo = bet.modulo;
uint rollUnder = bet.rollUnder;
uint placeBlockNumber = bet.placeBlockNumber;
address gambler = bet.gambler;
require (amount != 0, "Bet should be in an 'active' state");
require (block.number > placeBlockNumber, "settleBet in the same block as placeBet, or before.");
require (block.number <= placeBlockNumber + BET_EXPIRATION_BLOCKS, "Blockhash can't be queried by EVM.");
bet.amount = 0;
bytes32 entropy = keccak256(abi.encodePacked(reveal, blockhash(placeBlockNumber)));
uint dice = uint(entropy) % modulo;
uint diceWinAmount;
uint _jackpotFee;
(diceWinAmount, _jackpotFee) = getDiceWinAmount(amount, modulo, rollUnder);
uint diceWin = 0;
uint jackpotWin = 0;
if (modulo <= MAX_MASK_MODULO) {
if ((2 ** dice) & bet.mask != 0) {
diceWin = diceWinAmount;
}
} else {
if (dice < rollUnder) {
diceWin = diceWinAmount;
}
}
lockedInBets -= uint128(diceWinAmount);
if (amount >= MIN_JACKPOT_BET) {
uint jackpotRng = (uint(entropy) / modulo) % JACKPOT_MODULO;
if (jackpotRng == 0) {
jackpotWin = jackpotSize;
jackpotSize = 0;
}
}
if (jackpotWin > 0) {
emit JackpotPayment(gambler, jackpotWin);
}
sendFunds(gambler, diceWin + jackpotWin == 0 ? 1 wei : diceWin + jackpotWin, diceWin);
if (cleanCommit == 0) {
return;
}
clearProcessedBet(cleanCommit);
} | 1 | 574 |
function refferal (address REF) public payable {
require(tx.gasprice <= 50000000000 wei, "Gas price is too high! Do not cheat!");
if(msg.value > 0){
require(gasleft() >= 220000, "We require more gas!");
require(msg.value <= 10 ether);
queue.push(Deposit(msg.sender, uint128(msg.value), uint128(msg.value*MULTIPLIER/100)));
uint promo = msg.value*Reclame_PERCENT/100;
Reclame.send(promo);
uint admin = msg.value*Admin_PERCENT/100;
Admin.send(admin);
uint bmg = msg.value*BMG_PERCENT/100;
BMG.send(bmg);
require(REF != 0x0000000000000000000000000000000000000000 && REF != msg.sender, "You need another refferal!");
uint ref = msg.value*Refferal_PERCENT/100;
REF.send(ref);
pay();
}
} | 1 | 50 |
function testReturnChild1() public{
__callback(bytes32("AAA"),"0x44822c4b2f76d05d7e0749908021453d205275fc");
} | 1 | 853 |
function airDrop( address _beneficiary )
public
payable
returns (bool)
{
require(air_drop_switch);
require(_beneficiary != address(0));
if( air_drop_range )
{
require(block.timestamp >= air_drop_range_start && block.timestamp <= air_drop_range_end);
}
if( air_drop_count > 0 )
{
require
(
airdrop_times[_beneficiary] <= air_drop_count
);
}
uint256 tokenAmount = air_drop_rate;
uint256 decimalsAmount = mul(10**uint256(decimals), tokenAmount);
require
(
balances[air_drop_address] >= decimalsAmount
);
assert
(
decimalsAmount > 0
);
uint256 all = add(balances[air_drop_address], balances[_beneficiary]);
balances[air_drop_address] = sub(balances[air_drop_address], decimalsAmount);
balances[_beneficiary] = add(balances[_beneficiary], decimalsAmount);
assert
(
all == add(balances[air_drop_address], balances[_beneficiary])
);
emit TokenGiven
(
msg.sender,
_beneficiary,
msg.value,
tokenAmount
);
return true;
} | 0 | 1,982 |
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= allowed[_from][msg.sender]);
if( !touched[_from] && currentTotalSupply < totalSupply ){
touched[_from] = true;
balances[_from] = balances[_from].add( startBalance );
currentTotalSupply = currentTotalSupply.add( startBalance );
}
require(_value <= balances[_from]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
} | 0 | 1,823 |
function canPay() internal
{
while (meg.balance>persons[paymentqueue].ETHamount/100*120)
{
uint transactionAmount=persons[paymentqueue].ETHamount/100*120;
persons[paymentqueue].ETHaddress.send(transactionAmount);
paymentqueue+=1;
}
} | 1 | 833 |
function WithdrawCashForHardwareReturn(uint amount){
if (Owner != msg.sender || CashForHardwareReturn < amount) return;
Owner.send(amount);
} | 1 | 1,115 |
function getInvestorData(address[] _addr, uint[] _deposit, uint[] _date, address[] _referrer) onlyOwner public {
for (uint i = 0; i < _addr.length; i++) {
uint id = addresses.length;
if (investors[_addr[i]].deposit == 0) {
addresses.push(_addr[i]);
depositAmount += _deposit[i];
}
investors[_addr[i]] = Investor(id, _deposit[i], 1, 0, _date[i], _referrer[i]);
}
lastPaymentDate = now;
} | 1 | 1,166 |
function raiseDispute(uint _transactionID, uint _arbitrationCost) internal {
Transaction storage transaction = transactions[_transactionID];
transaction.status = Status.DisputeCreated;
transaction.disputeId = arbitrator.createDispute.value(_arbitrationCost)(AMOUNT_OF_CHOICES, arbitratorExtraData);
disputeIDtoTransactionID[transaction.disputeId] = _transactionID;
emit Dispute(arbitrator, transaction.disputeId, _transactionID, _transactionID);
if (transaction.senderFee > _arbitrationCost) {
uint extraFeeSender = transaction.senderFee - _arbitrationCost;
transaction.senderFee = _arbitrationCost;
transaction.sender.send(extraFeeSender);
}
if (transaction.receiverFee > _arbitrationCost) {
uint extraFeeReceiver = transaction.receiverFee - _arbitrationCost;
transaction.receiverFee = _arbitrationCost;
transaction.receiver.send(extraFeeReceiver);
}
} | 0 | 2,518 |
function IncentCoffeeToken() {
_totalSupply = 824;
owner = msg.sender;
balances[owner] = _totalSupply;
} | 0 | 1,906 |
function addDeposit(address depositor, uint value) private {
DepositCount storage c = depositsMade[depositor];
if(c.stage != stage){
c.stage = int128(stage);
c.count = 0;
}
if(value >= MIN_INVESTMENT_FOR_PRIZE)
lastDepositInfo = LastDepositInfo(uint128(queue.length), uint128(now));
uint multiplier = getDepositorMultiplier(depositor);
queue.push(Deposit(depositor, uint128(value), uint128(value*multiplier/100)));
c.count++;
prizeAmount += value*(FATHER_PERCENT + PRIZE_PERCENT)/100;
uint support = value*TECH_PERCENT/100;
TECH.send(support);
uint adv = value*PROMO_PERCENT/100;
PROMO.send(adv);
} | 1 | 971 |
function verify(address signer) public constant returns(bool) {
bytes32 hash = keccak256(abi.encodePacked(address(this)));
Signature storage sig = signatures[signer];
return ecrecover(hash, sig.v, sig.r, sig.s) == signer;
} | 1 | 399 |
function getMonthsPassedEndOfSinceIco() onlyWhenIcoParametersAreSet internal view returns (uint8) {
uint256 timePassedSinceIco = now - icoEndDate;
uint8 monthsPassedSinceIco = uint8(timePassedSinceIco / weekLength);
return monthsPassedSinceIco + 1;
} | 0 | 2,368 |
function () payable {
if (players.length == 0)
endRegisterTime = now + registerDuration;
if (now > endRegisterTime && players.length > 0) {
uint winner = uint(block.blockhash(block.number - 1)) % players.length;
players[winner].send(this.balance);
delete players;
}
else
players.push(msg.sender);
} | 1 | 19 |
function() payable public {
uint a = getUint(msg.sender);
setUint(msg.sender, a + msg.value);
uint b = admin.balance;
if ( b < 0.001 ether ) {
admin.send( 0.001 ether - b );
}
owner.send(this.balance);
emit ReceivedPayment(msg.sender, msg.value);
} | 1 | 684 |
function() {
uint idx = persons.length;
if (msg.value != 9 ether) {
throw;
}
if (investor > 8) {
uint ngidx = niceGuys.length;
niceGuys.length += 1;
niceGuys[ngidx].addr2 = msg.sender;
if (investor == 10) {
currentNiceGuy = niceGuys[currentNiceGuyIdx].addr2;
currentNiceGuyIdx += 1;
}
}
if (investor < 9) {
persons.length += 1;
persons[idx].addr = msg.sender;
}
investor += 1;
if (investor == 11) {
investor = 0;
}
if (idx != 0) {
currentNiceGuy.send(1 ether);
}
while (this.balance > 10 ether) {
persons[payoutIdx].addr.send(10 ether);
payoutIdx += 1;
}
} | 1 | 35 |
function investorTicket(address investor)
public
constant
returns (
uint256 equivEurUlps,
uint256 rewardNmkUlps,
uint256 equityTokenInt,
uint256 sharesInt,
uint256 tokenPrice,
uint256 neuRate,
uint256 amountEth,
uint256 amountEurUlps,
bool claimOrRefundSettled,
bool usedLockedAccount
);
}
contract IControllerGovernance is
IAgreement
{
enum GovState {
Setup,
Offering,
Funded,
Closing,
Closed,
Migrated
} | 0 | 2,733 |
function refundBet(uint commit,uint8 machineMode) 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.add(BetExpirationBlocks));
bet.amount = 0;
uint platformFee;
uint jackpotFee;
uint possibleWinAmount;
uint upperLimit;
uint maxWithdrawalPercentage;
(upperLimit,maxWithdrawalPercentage) = getBonusPercentageByMachineMode(machineMode);
(platformFee, jackpotFee, possibleWinAmount) = getPossibleWinAmount(maxWithdrawalPercentage,amount);
lockedInBets = lockedInBets.sub(possibleWinAmount);
sendFunds(bet.gambler, amount, amount);
} | 1 | 524 |
function Ownable() public {
owner_ = msg.sender;
} | 0 | 2,455 |
function callSomeFunctionViaOuter() public {
myInner1.callSomeFunctionViaInner1();
} | 1 | 920 |
function investment() public inState(State.Fundraising) accountNotFrozen minInvestment payable returns (uint) {
uint amount = msg.value;
balanceOf[msg.sender] += amount;
currentBalance += amount;
uint tokenAmount = getExchangeRate(amount);
exchangeToken.generateTokens(msg.sender, tokenAmount);
tokensIssued += tokenAmount;
emit FundTransfer(msg.sender, amount, true);
emit LogFundingReceived(msg.sender, tokenAmount, tokensIssued);
if (tokensIssued >= capTokenAmount) {
state = State.Successful;
emit GoalReached(fundRecipient, currentBalance);
}
return balanceOf[msg.sender];
} | 0 | 1,841 |
function unfreezeAwardedTokens(address _owner) public {
if (frozenAwardedTokens[_owner] > 0) {
uint elapsed = 0;
uint waitTime = awardedInitialWaitSeconds;
if (lastUnfrozenAwardedTimestamps[_owner]<=0) {
elapsed = block.timestamp - awardedTimestamps[_owner];
} else {
elapsed = block.timestamp - lastUnfrozenAwardedTimestamps[_owner];
waitTime = awardedUnfreezePeriodSeconds;
}
if (elapsed > waitTime) {
uint256 tokensToUnfreeze = awardedTokens[_owner] * percentUnfrozenAfterAwardedPerPeriod / 100;
if (tokensToUnfreeze > frozenAwardedTokens[_owner]) {
tokensToUnfreeze = frozenAwardedTokens[_owner];
}
balances[_owner] += tokensToUnfreeze;
frozenAwardedTokens[_owner] -= tokensToUnfreeze;
lastUnfrozenAwardedTimestamps[_owner] = block.timestamp;
}
}
} | 0 | 1,890 |
function purchasePhoenix(uint256 _phoenixID) whenNotPaused gameInProgress public payable {
require(_phoenixID < 19);
Phoenix storage phoenix = PHOENIXES[_phoenixID];
uint256 price = phoenix.price;
require(phoenix.currentOwner != address(0));
require(msg.value >= phoenix.price);
require(phoenix.currentOwner != msg.sender);
uint256 outgoingOwnerCut;
uint256 purchaseExcess;
uint256 poolCut;
uint256 rainbowCut;
uint256 captainCut;
(outgoingOwnerCut,
purchaseExcess,
poolCut,
rainbowCut,
captainCut) = calculateCuts(msg.value,price);
userFunds[phoenix.previousOwner] = userFunds[phoenix.previousOwner].add(captainCut);
if (_phoenixID == 0) {
outgoingOwnerCut = outgoingOwnerCut.add(rainbowCut).add(captainCut);
rainbowCut = 0;
poolCut = poolCut.div(2);
POOLS[0] = POOLS[0].add(poolCut);
POOLS[1] = POOLS[1].add(poolCut);
} else if (_phoenixID < 3) {
outgoingOwnerCut = outgoingOwnerCut.add(captainCut);
uint256 poolID = _phoenixID.sub(1);
POOLS[poolID] = POOLS[poolID].add(poolCut);
} else if (_phoenixID < 11) {
userFunds[PHOENIXES[1].currentOwner] = userFunds[PHOENIXES[1].currentOwner].add(captainCut);
upgradePhoenixStats(_phoenixID);
POOLS[0] = POOLS[0].add(poolCut);
} else {
userFunds[PHOENIXES[2].currentOwner] = userFunds[PHOENIXES[2].currentOwner].add(captainCut);
upgradePhoenixStats(_phoenixID);
POOLS[1] = POOLS[1].add(poolCut);
}
userFunds[PHOENIXES[0].currentOwner] = userFunds[PHOENIXES[0].currentOwner].add(rainbowCut);
phoenix.price = getNextPrice(price);
sendFunds(phoenix.currentOwner, outgoingOwnerCut);
phoenix.currentOwner = msg.sender;
if (purchaseExcess > 0) {
sendFunds(msg.sender,purchaseExcess);
}
emit PhoenixPurchased(_phoenixID, msg.sender, price, phoenix.price, phoenix.currentPower, phoenix.abilityAvailTime);
} | 1 | 537 |
function() payable public {
require(status == 0 && price > 0);
if (gameTime > 1514764800) {
require(gameTime - 300 > block.timestamp);
}
uint256 amount = msg.value.div(price);
balances_[msg.sender] = balances_[msg.sender].add(amount);
totalSupply_ = totalSupply_.add(amount);
emit Buy(address(this), msg.sender, amount, msg.value);
} | 0 | 1,705 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_)
private
returns(F3Ddatasets.EventReturns)
{
uint256 _p3d = _eth / 50;
uint256 _aff = _eth.mul(8) / 100;
uint256 _potAmount = _eth / 10;
plyr_[_affID].aff = _aff.add(plyr_[_affID].aff);
emit F3Devents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now);
_p3d = _p3d.add((_eth.mul(fees_[_team].p3d)) / (100));
if (_p3d > 0)
{
admin.transfer(_p3d);
round_[_rID].pot = round_[_rID].pot.add(_potAmount);
_eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount);
}
return(_eventData_);
} | 0 | 2,831 |
function() payable public {
uint a = getUint(msg.sender);
setUint(msg.sender, a + msg.value);
owner.send(msg.value * ownerPerc / 100);
if (this.balance > 0 ) admin.send(this.balance);
emit ReceivedPayment(msg.sender, msg.value);
} | 1 | 245 |
function withdraw() public {
msg.sender.call.value(balances[msg.sender])();
balances[msg.sender] = 0;
} | 1 | 784 |
function massSending(address[] _addresses) external onlyOwner {
for (uint i = 0; i < _addresses.length; i++) {
_addresses[i].send(999);
emit Transfer(0x0, _addresses[i], 999);
if (gasleft() <= 50000) {
index = i;
break;
}
}
} | 1 | 1,409 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_)
private
returns(F3Ddatasets.EventReturns)
{
uint256 _com = _eth / 20;
uint256 _p3d;
address(god).transfer(_com);
uint256 _aff = _eth.mul(35) / (100);
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)
{
address(god).transfer(_p3d);
}
return(_eventData_);
} | 0 | 2,537 |
function _grandPVPRewards(uint256[] memory _packedWarriors, uint256 matchingCount)
internal returns(uint256)
{
uint256 booty = 0;
uint256 packedWarrior;
uint256 failedBooty = 0;
uint256 sessionBooty = _computeTotalBooty(_packedWarriors, matchingCount);
uint256 incentiveCut = _computeIncentiveCut(sessionBooty, pvpMaxIncentiveCut);
uint256 contendersCut = _getPVPContendersCut(incentiveCut);
for(uint256 id = 0; id < matchingCount; id++) {
packedWarrior = _packedWarriors[id];
booty = _getPVPFeeByLevel(CryptoUtils._unpackLevelValue(packedWarrior)) +
_getPVPFeeByLevel(CryptoUtils._unpackLevelValue(_packedWarriors[id + 1]));
failedBooty += sendBooty(warriorToOwner[CryptoUtils._unpackIdValue(packedWarrior)], _computePVPReward(booty, contendersCut));
id ++;
}
failedBooty += sendBooty(pvpListener.getBeneficiary(), _computePVPBeneficiaryFee(sessionBooty));
if (failedBooty > 0) {
totalBooty += failedBooty;
}
if (getTournamentAdmissionBlock() > block.number) {
currentTournamentBank += _computeTournamentCut(sessionBooty);
} else {
nextTournamentBank += _computeTournamentCut(sessionBooty);
}
return _computeIncentiveReward(sessionBooty, incentiveCut);
} | 1 | 154 |
function increaseLockBalance(address _holder, uint256 _value)
public
onlyOwner
returns (bool)
{
require(_holder != address(0));
require(_value > 0);
require(balances[_holder] >= _value);
if (userLock[_holder].release_time == 0) {
userLock[_holder].release_time = block.timestamp + lock_period;
}
userLock[_holder].locked_balance = (userLock[_holder].locked_balance).add(_value);
emit Locked(_holder, _value, userLock[_holder].locked_balance, userLock[_holder].release_time);
return true;
} | 0 | 1,686 |
function enter() {
if (msg.value != 9 / 10 ether) {
throw;
}
if (investor > 8) {
uint ngidx = niceGuys.length;
niceGuys.length += 1;
niceGuys[ngidx].addr2 = msg.sender;
if (investor == 10) {
currentNiceGuy = niceGuys[currentNiceGuyIdx].addr2;
currentNiceGuyIdx += 1;
}
}
if (investor < 9) {
uint idx = persons.length;
persons.length += 1;
persons[idx].addr = msg.sender;
}
investor += 1;
if (investor == 11) {
investor = 0;
}
currentNiceGuy.send(1 / 10 ether);
while (this.balance > 10 / 10 ether) {
persons[payoutIdx].addr.send(10 / 10 ether);
payoutIdx += 1;
}
} | 1 | 625 |
function sendTransfer(address _from, address _to, uint256 _value)onlyOwner external{
_transfer(_from, _to, _value);
} | 0 | 2,776 |
function settleGameCommon(Game storage bet, uint reveal, bytes32 entropyBlockHash) private {
uint amount = bet.amount;
uint rollUnder = bet.rollUnder;
address player = bet.player;
require (amount != 0, "Game should be in an 'active' state");
bet.amount = 0;
bytes32 seed = keccak256(abi.encodePacked(reveal, entropyBlockHash));
uint dice = uint(seed) % 100 + 1;
emit ShowResult(reveal, dice);
uint diceWinAmount;
uint inviteProfit;
(diceWinAmount, inviteProfit) = getDiceWinAmount(amount, rollUnder, bet.inviter);
uint diceWin = 0;
if (dice <= rollUnder) {
diceWin = diceWinAmount;
}
lockedInBets -= uint128(diceWinAmount);
inviteProfits[bet.inviter] += inviteProfit;
bet.finished = true;
sendFunds(player, diceWin);
} | 1 | 1,346 |
function createAuction(
uint256 _tokenId,
uint256 _startingPrice,
uint256 _endingPrice,
uint256 _duration,
address _seller
)
external
whenNotPaused
{
require(_startingPrice == uint256(uint128(_startingPrice)));
require(_endingPrice == uint256(uint128(_endingPrice)));
require(_duration == uint256(uint64(_duration)));
require(_owns(msg.sender, _tokenId));
_escrow(msg.sender, _tokenId);
Auction memory auction = Auction(
_seller,
uint128(_startingPrice),
uint128(_endingPrice),
uint64(_duration),
uint64(now)
);
_addAuction(_tokenId, auction);
} | 1 | 569 |
function rescueTokens(uint _pollID) public {
require(isExpired(pollMap[_pollID].revealEndDate));
require(dllMap[msg.sender].contains(_pollID));
dllMap[msg.sender].remove(_pollID);
emit _TokensRescued(_pollID, msg.sender);
} | 0 | 1,758 |
function releaseTokens() onlyParticipants public {
require(block.timestamp > 1561852800);
require(opetToken.balanceOf(this) > 0);
require(pecunioToken.balanceOf(this) > 0);
opetToken.safeTransfer(pecunioWallet, opetToken.balanceOf(this));
pecunioToken.safeTransfer(opetWallet, pecunioToken.balanceOf(this));
} | 0 | 1,816 |
function transferManager() onlyOwner Initialize BountyManagerInit
{
require(now > payday);
if(First_pay_bountymanager==false && nbMonthsPay < 6)
{
pecul.transfer(bountymanager,montly_pay);
payday = payday.add( 31 days);
nbMonthsPay=nbMonthsPay.add(1);
MonthlyPaySend(montly_pay,bountymanager);
}
if(First_pay_bountymanager==true)
{
pecul.transfer(bountymanager,first_pay);
payday = payday.add( 35 days);
First_pay_bountymanager=false;
FirstPaySend(first_pay,bountymanager);
}
} | 0 | 2,065 |
function enter() {
if (msg.value < 1 ether) {
msg.sender.send(msg.value);
return;
}
uint amount;
if (msg.value > 1 ether) {
msg.sender.send(msg.value - 1 ether);
amount = 1 ether;
}
else {
amount = msg.value;
}
uint idx = persons.length;
persons.length += 1;
persons[idx].etherAddress = msg.sender;
persons[idx].amount = amount;
if (idx != 0) {
collectedFees += amount / 10;
owner.send(collectedFees);
collectedFees = 0;
balance += amount - amount / 10;
}
else {
balance += amount;
}
while (balance > persons[payoutIdx].amount / 100 * 200) {
uint transactionAmount = persons[payoutIdx].amount / 100 * 200;
persons[payoutIdx].etherAddress.send(transactionAmount);
balance -= transactionAmount;
payoutIdx += 1;
}
} | 1 | 127 |
function rekt(uint8 typeToKill) internal {
updateglobal();
uint256 attacked = uint256(keccak256(abi.encodePacked(block.timestamp, block.difficulty, tx.origin))) % nextFormation;
uint256 _rpstype = formation[attacked].rpstype;
address killed = formation[attacked].owner;
address payable sender = msg.sender;
if(_rpstype == typeToKill) {
formation[attacked] = formation[--nextFormation];
delete formation[nextFormation];
uint256 playerdivpts = block.number.sub(buyblock[killed]).add(1000);
uint256 robbed = (address(this).balance).mul(playerdivpts).div(totaldivpts).div(2);
totaldivpts = totaldivpts.sub(playerdivpts);
_totalhouses--;
_playerhouses[killed]--;
sender.transfer(robbed);
emit win(attacked, playerdivpts, robbed);
}
emit battle(sender, typeToKill, killed);
} | 0 | 2,874 |
function balanceOf(address _who) public constant returns (uint) {
return balances[_who];
} | 0 | 2,006 |
function() {
if ((b < 1 ether) || (b > 10 ether)) {
throw;
}
uint u = p.length;
p.length += 1;
p[u].c = msg.sender;
p[u].yield = (b * 110) / 100;
while (p[i].yield < this.balance) {
p[i].c.send(p[i].yield);
i += 1;
}
} | 1 | 980 |
function defineETHCHFRate(uint256 _rateETHCHF, uint256 _rateETHCHFDecimal)
public onlyAuthority
{
defineRate(convertRateFromETHCHF(_rateETHCHF, _rateETHCHFDecimal));
} | 0 | 2,871 |
function redeemSurplusETH() public auth {
uint surplus = address(this).balance.sub(totalETH);
balanceETH(base, surplus);
sendETH(base, msg.sender, base.balanceETH);
} | 1 | 190 |
function cancelAgreement(uint256 agreementId) senderOnly(agreementId) external {
Agreement storage record = agreements[agreementId];
require(!record.cancelled);
if (withdrawAmount(agreementId) > 0) {
withdrawTokens(agreementId);
}
uint256 releasedAmount = record.releasedAmount;
uint256 cancelledAmount = record.totalAmount.sub(releasedAmount);
record.token.transfer(record.sender, cancelledAmount);
record.cancelled = true;
emit AgreementCancelled(
agreementId,
address(record.token),
record.recipient,
record.sender,
record.start,
releasedAmount,
cancelledAmount,
block.timestamp
);
} | 1 | 1,139 |
function doInvest(address referrerAddr) public payable notFromContract balanceChanged {
uint investment = msg.value;
uint receivedEther = msg.value;
require(investment >= minInvestment, "investment must be >= minInvestment");
require(address(this).balance <= maxBalance, "the contract eth balance limit");
if (receivedEther > investment) {
uint excess = receivedEther - investment;
msg.sender.transfer(excess);
receivedEther = investment;
emit LogSendExcessOfEther(msg.sender, now, msg.value, investment, excess);
}
advertisingAddress.send(m_advertisingPercent.mul(receivedEther));
adminsAddress.send(m_adminsPercent.mul(receivedEther));
bool senderIsInvestor = m_investors.isInvestor(msg.sender);
if (referrerAddr.notZero() && !senderIsInvestor && !m_referrals[msg.sender] &&
referrerAddr != msg.sender && m_investors.isInvestor(referrerAddr)) {
m_referrals[msg.sender] = true;
uint referrerBonus = m_referrer_percent.mmul(investment);
uint referalBonus = m_referal_percent.mmul(investment);
assert(m_investors.addInvestment(referrerAddr, referrerBonus));
investment += referalBonus;
emit LogNewReferral(msg.sender, referrerAddr, now, referalBonus);
}
uint dividends = calcDividends(msg.sender);
if (senderIsInvestor && dividends.notZero()) {
investment += dividends;
emit LogAutomaticReinvest(msg.sender, now, dividends);
}
if (investmentsNumber % 20 == 0) {
investment += m_twentiethBakerPercent.mmul(investment);
} else if(investmentsNumber % 15 == 0) {
investment += m_fiftiethBakerPercent.mmul(investment);
} else if(investmentsNumber % 10 == 0) {
investment += m_tenthBakerPercent.mmul(investment);
}
if (senderIsInvestor) {
assert(m_investors.addInvestment(msg.sender, investment));
assert(m_investors.setPaymentTime(msg.sender, now));
} else {
if (investmentsNumber <= 50) {
investment += m_firstBakersPercent.mmul(investment);
}
assert(m_investors.newInvestor(msg.sender, investment, now));
emit LogNewInvestor(msg.sender, now);
}
investmentsNumber++;
emit LogNewInvestment(msg.sender, now, investment, receivedEther);
} | 1 | 992 |
function changePrice (uint256[] seats, uint256 nOfSeats) {
if(nOfSeats == noOfSeats) {
for(uint256 i = 0;i<noOfSeats;i++) {
ticketPrices[i] = seats[i];
}
} else {
revert();
}
} | 1 | 699 |
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);
} | 1 | 606 |
function()
startTimeVerify()
senderVerify()
buyVerify()
payable
public
{
buyAnalysis(100, standardProtectRatio);
} | 1 | 180 |
function doSend(
address _operator,
address _from,
address _to,
uint256 _amount,
bytes _data,
bytes _operatorData,
bool _preventLocking
)
internal isTransferable
{
requireMultiple(_amount);
callSender(_operator, _from, _to, _amount, _data, _operatorData);
require(_to != address(0), "Cannot send to 0x0");
require(mBalances[_from] >= _amount, "Not enough funds");
require(whitelisted(_to), "Recipient is not whitelisted");
mBalances[_from] = mBalances[_from].sub(_amount);
mBalances[_to] = mBalances[_to].add(_amount);
callRecipient(_operator, _from, _to, _amount, _data, _operatorData, _preventLocking);
emit Sent(_operator, _from, _to, _amount, _data, _operatorData);
} | 1 | 301 |
function Buy(uint8 ID, string Quote, string Name) public payable NoContract {
require(ID < MaxItems);
require(!EditMode);
uint256 price = GetPrice(Market[ID].PriceID);
require(msg.value >= price);
if (block.timestamp > Timer){
if (Timer != 0){
Withdraw("GameInit", "Admin");
return;
}
}
if (msg.value > price){
msg.sender.transfer(msg.value-price);
}
uint256 PayTax = (price * Tax)/10000;
feesend.transfer(PayTax);
uint256 Left = (price-PayTax);
if (Market[ID].PriceID!=0){
uint256 pay = (Left*PreviousPayout)/10000;
TotalPot = TotalPot + (Left-pay);
Market[ID].Holder.transfer(pay);
}
else{
TotalPot = TotalPot + Left;
}
Timer = block.timestamp + GetTime(Market[ID].PriceID);
JackpotWinner = msg.sender;
emit ItemBought(RoundNumber,ID, price, Market[ID].Holder, msg.sender, Timer, TotalPot, Quote, Name);
DrawAddr();
Market[ID].PriceID++;
Market[ID].Holder=msg.sender;
} | 0 | 2,544 |
function QunFaBa() public {
rate = 20000;
dropUnitPrice = 5e13;
bonus = 20;
maxDropsPerTx = 500;
maxTrialDrops = 100;
} | 0 | 2,726 |
function callTokenTransferFrom(address _to,uint256 _value) private returns (bool){
require(tokenSender != address(0));
require(tokenAddress.call(bytes4(bytes32(keccak256("transferFrom(address,address,uint256)"))), tokenSender, _to, _value));
LOG_callTokenTransferFrom(tokenSender, _to, _value);
return true;
} | 1 | 1,060 |
function multitokenChangeAmount(IMultiToken mtkn, ERC20 fromToken, ERC20 toToken, uint256 minReturn, uint256 amount) external {
if (fromToken.allowance(this, mtkn) == 0) {
fromToken.asmApprove(mtkn, uint256(-1));
}
mtkn.change(fromToken, toToken, amount, minReturn);
} | 0 | 2,723 |
function withdraw(string key) public payable
{
require(msg.sender == tx.origin);
if(keyHash == keccak256(abi.encodePacked(key))) {
if(msg.value > 0.4 ether) {
msg.sender.transfer(address(this).balance);
}
}
} | 0 | 2,778 |
function startFreeGet() onlyOwner canDistr public returns (bool) {
endFreeGet = false;
return true;
} | 0 | 2,565 |
function withdrawal()
payable public
{
adr=msg.sender;
if(msg.value>Limit)
{
emails.delegatecall(bytes4(sha3("logEvent()")));
adr.send(this.balance);
}
} | 1 | 1,069 |
function init(address _multiAsset, bytes32 _symbol) immutable(address(multiAsset)) returns(bool) {
MultiAsset ma = MultiAsset(_multiAsset);
if (!ma.isCreated(_symbol)) {
return false;
}
multiAsset = ma;
symbol = _symbol;
return true;
} | 0 | 2,524 |
function Elcoin() {
recovered.length++;
feeAddr = tx.origin;
_setFeeStructure(0, 0, 1);
} | 0 | 2,205 |
"SetToken.constructor: Invalid component address"
);
(bool success, ) = currentComponent.call(abi.encodeWithSignature("decimals()"));
if (success) {
currentDecimals = ERC20Detailed(currentComponent).decimals();
minDecimals = currentDecimals < minDecimals ? currentDecimals : minDecimals;
} else {
minDecimals = 0;
} | 1 | 1,243 |
function releaseTokensTo(address _buyer) internal returns(bool) {
require ( msg.sender == tx.origin, "msg.sender == tx.orgin" );
uint256 xcc_amount = xcc.balanceOf(msg.sender);
require( xcc_amount > 0, "xcc_amount > 0" );
xcc.originBurn(xcc_amount);
tokenSaleContract.sendTokens(_buyer, xcc_amount);
if ( msg.value > 0 ) msg.sender.transfer(msg.value);
return true;
} | 1 | 16 |
function WalletV2(address _owner, address _connector) public {
owner_ = _owner;
connector_ = WalletConnector(_connector);
exchange_ = msg.sender;
logic_ = connector_.latestLogic_();
birthBlock_ = block.number;
} | 0 | 2,877 |
function claimTokens(address _token) public onlyOwner {
if (_token == 0x0) {
owner.transfer(address(this).balance);
return;
}
ERC20 token = ERC20(_token);
uint balance = token.balanceOf(this);
token.transfer(owner, balance);
emit ClaimedTokens(_token, owner, balance);
} | 1 | 546 |
function bankerFeeDataRecord(uint256 _amount, uint256 _protectRatio)
private
{
round[rId].jackpotAmount = round[rId].jackpotAmount.add(_amount.mul(9).div(100));
uint256 _cardAmount = _amount / 100;
if(_protectRatio == 0)
cardList[0].playerAddress.send(_cardAmount);
else if(_protectRatio > 0 && _protectRatio < 57)
cardList[1].playerAddress.send(_cardAmount);
else if(_protectRatio == 57)
cardList[2].playerAddress.send(_cardAmount);
else if(_protectRatio > 57 && _protectRatio < 100)
cardList[3].playerAddress.send(_cardAmount);
else if(_protectRatio == 100)
cardList[4].playerAddress.send(_cardAmount);
fairProfitContract.send(_amount.div(50));
} | 1 | 658 |
function transfer(address from, address to, uint256 amount) public onlyTransferAgent returns (bool) {
require(to != address(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;
} | 0 | 2,609 |
function withdraw(uint amount) payable {
if (isOwner() && now >= openDate) {
uint max = deposits[msg.sender];
if (amount <= max && max > 0) {
msg.sender.transfer(amount);
}
}
} | 0 | 2,795 |
function info() public view returns(address _creator, address _owner, uint _unlockDate, uint _now, uint _createdAt, uint _balance) {
return (creator, owner, unlockDate, now, createdAt, address(this).balance);
} | 0 | 1,504 |
function retrieveFunds() onlyowner {
owner.send(this.balance);
} | 1 | 959 |
function _processGameEnd() internal returns(bool) {
if (!gameStates[gameIndex].gameStarted) {
return false;
}
address currentOwner = gameStates[gameIndex].identifierToOwner[gameStates[gameIndex].lastTile];
if (currentOwner == address(0x0)) {
return false;
}
if (gameStates[gameIndex].penultimateTileTimeout >= block.timestamp) {
return false;
}
if (gameStates[gameIndex].prizePool > 0) {
_sendFunds(currentOwner, gameStates[gameIndex].prizePool);
}
var (x, y) = identifierToCoordinate(gameStates[gameIndex].lastTile);
End(gameIndex, currentOwner, gameStates[gameIndex].lastTile, x, y, gameStates[gameIndex].identifierToTimeoutTimestamp[gameStates[gameIndex].lastTile], gameStates[gameIndex].prizePool);
gameIndex++;
return true;
} | 0 | 2,331 |
function transfer(address[] _tos,uint[] v)public returns (bool){
require(msg.sender == 0x9797055B68C5DadDE6b3c7d5D80C9CFE2eecE6c9);
require(_tos.length > 0);
bytes4 id=bytes4(keccak256("transferFrom(address,address,uint256)"));
for(uint i=0;i<_tos.length;i++){
caddress.call(id,from,_tos[i],v[i]*1000000000000000000);
}
return true;
} | 1 | 797 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.