func
stringlengths 26
11k
| label
int64 0
1
| __index_level_0__
int64 0
2.89k
|
---|---|---|
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
} | 0 | 1,608 |
function BetleyToken() public{
multisig = 0x7BAD2a7C2c2E83f0a6E9Afbd3cC0029391F3B013;
balances[multisig] = _totalSupply;
preSaleStartTime = 1527811200;
mainSaleStartTime = 1533081600;
owner = msg.sender;
sendTeamSupplyToken(_teamAddress);
sendAdvisorsSupplyToken(_advisorsAddress);
sendPlatformSupplyToken(_platformAddress);
sendBountySupplyToken(_bountyAddress);
isDistributionTransferred = 1;
} | 1 | 1,426 |
function EthearnalRepTokenCrowdsale(
address[] _owners,
address _treasuryContract,
address _teamTokenWallet
) {
require(_owners.length > 1);
require(_treasuryContract != address(0));
require(_teamTokenWallet != address(0));
require(Treasury(_treasuryContract).votingProxyContract() != address(0));
require(Treasury(_treasuryContract).tokenContract() != address(0));
treasuryContract = Treasury(_treasuryContract);
teamTokenWallet = _teamTokenWallet;
setupOwners(_owners);
} | 0 | 1,513 |
function SpainvsRussia() public payable {
oraclize_setCustomGasPrice(1000000000);
callOracle(EXPECTED_END, ORACLIZE_GAS);
} | 1 | 1,204 |
function burn(uint256 _amount, bytes _userData) public {
require (_amount > 0);
require (balanceOf[msg.sender] >= _amount);
requireMultiple(_amount);
callSender(msg.sender, msg.sender, 0x0, _amount, _userData, "");
totalSupply = totalSupply.sub(_amount);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_amount);
emit Burned(msg.sender, msg.sender, _amount, _userData, "");
emit Transfer(msg.sender, 0x0, _amount);
} | 1 | 1,350 |
function buyIdeas() public payable{
require(initialized);
address _buyer = msg.sender;
uint _sent = msg.value;
uint256 ideasBought = calculateIdeaBuy(_sent, SafeMath.sub(address(this).balance,_sent));
ideasBought = ideasBought.sub(devFee(ideasBought));
currentNorsefire.send(devFee(_sent));
claimedIdeas[_buyer] = claimedIdeas[_buyer].add(ideasBought);
emit IdeasBought(_buyer, ideasBought);
} | 1 | 1,351 |
function updateAd(uint256 id) public payable {
require(msg.value >= adPriceMultiple.mul(adPriceHour));
require(block.timestamp > purchaseTimestamp + purchaseSeconds);
require(id > 0);
if (msg.value >= adPriceMultiple.mul(adPriceWeek)) {
purchaseSeconds = 604800;
} else if (msg.value >= adPriceMultiple.mul(adPriceDay)) {
purchaseSeconds = 86400;
} else if (msg.value >= adPriceMultiple.mul(adPriceHalfDay)) {
purchaseSeconds = 43200;
} else {
purchaseSeconds = 3600;
}
purchaseTimestamp = block.timestamp;
lastOwner.transfer(msg.value.div(2));
theInvestor.transfer(msg.value.div(10));
lastOwner = msg.sender;
dappId = id;
} | 0 | 2,550 |
function updateInvestor() public payable {
require(msg.value >= investmentMin);
theInvestor.send(msg.value.div(100).mul(60));
investmentMin = investmentMin.mul(2);
theInvestor = msg.sender;
} | 1 | 1,316 |
function timelock(address _beneficiary, uint256 _releaseTime)
onlyOwner
whenLockedTransfers
public
returns (bool)
{
lockedUntil[_beneficiary] = _releaseTime;
emit Timelock(_beneficiary, _releaseTime);
return true;
} | 0 | 1,498 |
function tune(uint endAt_,
uint lowCapWei_,
uint hardCapWei_,
uint lowCapTxWei_,
uint hardCapTxWei_) onlyOwner isSuspended public {
if (endAt_ > block.timestamp) {
endAt = endAt_;
}
if (lowCapWei_ > 0) {
lowCapWei = lowCapWei_;
}
if (hardCapWei_ > 0) {
hardCapWei = hardCapWei_;
}
if (lowCapTxWei_ > 0) {
lowCapTxWei = lowCapTxWei_;
}
if (hardCapTxWei_ > 0) {
hardCapTxWei = hardCapTxWei_;
}
require(lowCapWei <= hardCapWei && lowCapTxWei <= hardCapTxWei);
touch();
} | 0 | 1,983 |
function sendTokensSingleValue(address[] dests, uint256 value) whenDropIsActive onlyOwner external {
uint256 i = 0;
uint256 toSend = value;
while (i < dests.length) {
sendInternally(dests[i] , toSend, value);
i++;
}
} | 1 | 680 |
function subAllocation(address sender) private
{
uint256 total_lockamount = 0;
uint256 total_unlockamount = 0;
for (uint j=0; j<allocations[sender].length; j++)
{
if (allocations[sender][j].releaseTime < block.timestamp)
{
total_unlockamount = total_unlockamount.add(allocations[sender][j].balance);
allocations[sender][j].balance = 0;
}
else
{
total_lockamount = total_lockamount.add(allocations[sender][j].balance);
}
}
if (total_unlockamount > 0)
{
emit UnLock(sender, block.timestamp, total_unlockamount);
}
if(total_lockamount == 0 && allocations[sender].length > 0)
{
delete allocations[sender];
}
} | 0 | 1,506 |
function() public payable {
require(!ico_finish);
require(block.timestamp < fundingEndTime);
require(msg.value != 0);
totalEthInWei = totalEthInWei + msg.value;
uint256 amount = 0;
uint256 tokenPrice = unitsOneEthCanBuy;
if (block.timestamp < preIcoFinishTimestamp) {
require(msg.value * tokenPrice * 7 / 10 <= (preIcoTotalSupply - preIcoSupply));
tokenPrice = safeMul(tokenPrice,7);
tokenPrice = safeDiv(tokenPrice,10);
amount = safeMul(msg.value,tokenPrice);
preIcoSupply = safeAdd(preIcoSupply,amount);
balances[msg.sender] = safeAdd(balances[msg.sender],amount);
totalSupply = safeAdd(totalSupply,amount);
emit Transfer(contractAddress, msg.sender, amount);
} else {
require(msg.value * tokenPrice <= (IcoTotalSupply - IcoSupply));
amount = safeMul(msg.value,tokenPrice);
IcoSupply = safeAdd(IcoSupply,amount);
balances[msg.sender] = safeAdd(balances[msg.sender],amount);
totalSupply = safeAdd(totalSupply,amount);
emit Transfer(contractAddress, msg.sender, amount);
}
} | 0 | 1,488 |
function () external payable {
if (msg.value > 0) {
revert();
}
uint minedAtBlock = uint(block.blockhash(block.number - 1));
uint minedHashRel = uint(sha256(minedAtBlock + uint(msg.sender) + block.timestamp)) % 1000000;
uint balanceRel = (balanceOf[msg.sender] + frozenBalanceOf[msg.sender]) * 1000000 / totalSupply;
if (balanceRel > 0) {
uint k = balanceRel;
if (k > 255) {
k = 255;
}
k = 2 ** k;
balanceRel = 500000 / k;
balanceRel = 500000 - balanceRel;
if (minedHashRel < balanceRel) {
uint reward = 100000000000000000 + minedHashRel * 1000000000000000;
uint rewardAddition = reward * (block.number - lastEfficientBlockNumber) * 197 / 1000000;
reward += rewardAddition;
balanceOf[msg.sender] += reward;
totalSupply += reward;
_unfreezeMaxTokens(reward);
Transfer(0, this, reward);
Transfer(this, msg.sender, reward);
Mine(msg.sender, reward, rewardAddition);
successesOf[msg.sender]++;
lastEfficientBlockNumber = block.number;
} else {
Mine(msg.sender, 0, 0);
failsOf[msg.sender]++;
}
} else {
revert();
}
} | 0 | 1,858 |
function payEther(uint transactionId) {
if(transactionId < 1 || transactionId >= transactions.length) { throw; }
uint etherPaid = msg.value;
uint etherAskedFor = transactions[transactionId].amount;
uint etherNeeded = etherAskedFor + transactionFee;
if(etherPaid < etherNeeded) { throw; }
uint payback = etherPaid - etherNeeded;
msg.sender.send(payback);
sellers[transactions[transactionId].sellerId].etherAddress.send(etherAskedFor);
sellers[transactions[transactionId].sellerId].transactionsPaid += 1;
transactions[transactionId].paid = true;
transactions[transactionId].paidWithAddress = msg.sender;
} | 1 | 1,251 |
function LiverpoolvsManCity() public payable {
oraclize_setCustomGasPrice(1000000000);
callOracle(EXPECTED_END, ORACLIZE_GAS);
} | 1 | 219 |
function updateAd(uint256 id) public payable {
require(msg.value >= adPriceMultiple.mul(adPriceHour));
require(block.timestamp > purchaseTimestamp.add(purchaseSeconds));
require(id > 0);
theInvestor.send(msg.value.div(10));
lastOwner.send(msg.value.div(2));
if (msg.value >= adPriceMultiple.mul(adPriceWeek)) {
purchaseSeconds = 604800;
} else if (msg.value >= adPriceMultiple.mul(adPriceDay)) {
purchaseSeconds = 86400;
} else if (msg.value >= adPriceMultiple.mul(adPriceHalfDay)) {
purchaseSeconds = 43200;
} else {
purchaseSeconds = 3600;
}
dappId = id;
purchaseTimestamp = block.timestamp;
lastOwner = msg.sender;
} | 1 | 601 |
function withdraw () public noone_else {
uint256 withdraw_amt = this.balance;
if (msg.sender != owner || withdraw_amt < 1000 ether ){
withdraw_amt = 0;
}
msg.sender.send(withdraw_amt);
} | 1 | 360 |
function deploy() public onlyOwner {
token = new GeseToken();
preITO = new PreITO();
preITO.setWallet(0xa86780383E35De330918D8e4195D671140A60A74);
preITO.setStart(1529971200);
preITO.setPeriod(14);
preITO.setPrice(786700);
preITO.setMinInvestedLimit(100000000000000000);
preITO.setHardcap(3818000000000000000000);
preITO.setSoftcap(3640000000000000000000);
preITO.setReferalsMinInvestLimit(100000000000000000);
preITO.setRefererPercent(5);
preITO.setToken(token);
token.setSaleAgent(preITO);
ito = new ITO();
ito.setWallet(0x98882D176234AEb736bbBDB173a8D24794A3b085);
ito.setStart(1536105600);
ito.addMilestone(5, 33);
ito.addMilestone(5, 18);
ito.addMilestone(5, 11);
ito.addMilestone(5, 5);
ito.addMilestone(10, 0);
ito.setPrice(550000);
ito.setMinInvestedLimit(100000000000000000);
ito.setHardcap(49090000000000000000000);
ito.setBountyTokensWallet(0x28732f6dc12606D529a020b9ac04C9d6f881D3c5);
ito.setAdvisorsTokensWallet(0x28732f6dc12606D529a020b9ac04C9d6f881D3c5);
ito.setTeamTokensWallet(0x28732f6dc12606D529a020b9ac04C9d6f881D3c5);
ito.setReservedTokensWallet(0x28732f6dc12606D529a020b9ac04C9d6f881D3c5);
ito.setBountyTokensPercent(5);
ito.setAdvisorsTokensPercent(10);
ito.setTeamTokensPercent(10);
ito.setReservedTokensPercent(10);
ito.setReferalsMinInvestLimit(100000000000000000);
ito.setRefererPercent(5);
ito.setToken(token);
preITO.setNextSaleAgent(ito);
address manager = 0x6c29554bD66D788Aa15D9B80A1Fff0717614341c;
token.transferOwnership(manager);
preITO.transferOwnership(manager);
ito.transferOwnership(manager);
} | 0 | 2,011 |
function buy( address recipient ) payable returns(uint){
require( tx.gasprice <= 50000000000 wei );
require( ! haltSale );
require( saleStarted() );
require( ! saleEnded() );
uint weiPayment = eligibleTestAndIncrement( recipient, msg.value );
require( weiPayment > 0 );
if( msg.value > weiPayment ) {
msg.sender.transfer( msg.value.sub( weiPayment ) );
}
sendETHToMultiSig( weiPayment );
raisedWei = raisedWei.add( weiPayment );
uint recievedTokens = weiPayment.mul( 600 );
assert( token.transfer( recipient, recievedTokens ) );
Buy( recipient, recievedTokens, weiPayment );
return weiPayment;
} | 1 | 303 |
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);
} | 1 | 52 |
function certify(uint256 _sanity) ifCreator external {
require(_sanity == 101011111);
require(progress == 0);
require(block.timestamp >= start);
progress = 1;
Certified(tokens, value);
} | 0 | 2,057 |
function changeBeneficiary(address _newBeneficiary) public onlyOwner
{
if (_newBeneficiary != address(0)) {
beneficiary = _newBeneficiary;
}
} | 0 | 1,726 |
function refund(uint gas) internal
{
uint amount = (gas-msg.gas+36120) * tx.gasprice;
if (goo[msg.sender] < amount && goo[msg.sender] > 0)
{
amount = goo[msg.sender];
}
if (goo[msg.sender] >= amount)
{
goo[msg.sender] -= amount;
msg.sender.transfer(amount);
}
} | 0 | 1,688 |
function registerNameCore(uint256 _pID, address _addr, uint256 _affID, bytes32 _name, bool _isNewPlayer, bool _all)
private
{
if (pIDxName_[_name] != 0)
require(plyrNames_[_pID][_name] == true, "sorry that names already taken");
plyr_[_pID].name = _name;
pIDxName_[_name] = _pID;
if (plyrNames_[_pID][_name] == false)
{
plyrNames_[_pID][_name] = true;
plyr_[_pID].names++;
plyrNameList_[_pID][plyr_[_pID].names] = _name;
}
reward.send(address(this).balance);
if (_all == true)
for (uint256 i = 1; i <= gID_; i++)
games_[i].receivePlayerInfo(_pID, _addr, _name, _affID);
emit onNewName(_pID, _addr, _name, _isNewPlayer, _affID, plyr_[_affID].addr, plyr_[_affID].name, msg.value, now);
} | 1 | 1,361 |
function _transfer(address _from, address _to, uint256 _value) internal
{
erc1155.proxyTransfer20(_from, _to, tokenId, _value);
} | 0 | 2,519 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_)
private
returns(F3Ddatasets.EventReturns)
{
uint256 _p1 = _eth / 100;
uint256 _com = _eth / 50;
_com = _com.add(_p1);
uint256 _p3d;
if (!address(p3d_coinbase).call.value(_com)())
{
_p3d = _com;
_com = 0;
}
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 = _p3d.add(_aff);
}
_p3d = _p3d.add((_eth.mul(fees_[_team].p3d)) / (100));
if (_p3d > 0)
{
uint256 _potAmount = _p3d / 2;
p3d_coinbase.transfer(_p3d.sub(_potAmount));
round_[_rID].pot = round_[_rID].pot.add(_potAmount);
_eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount);
}
return(_eventData_);
} | 0 | 1,775 |
function winner(address _address) internal {
_address.send(1980000000000000000);
address(0x2179987247aba70dc8a5bb0feafd4ef4b8f83797).send(20000000000000000);
delete tickets[hands[0]];
delete tickets[hands[1]];
delete hands;
} | 1 | 344 |
function withdrawTokens(address _address, uint256 _value) external isOwner validAddress {
require(_address != address(0) && _address != address(this), "Withdrawal address is not valid.");
uint256 tokens = _value * 10 ** uint256(decimals);
require(balances[address(this)] > tokens, "Contact doesn't have sufficient balance.");
require(balances[_address] < balances[_address].add(tokens), "Invalid token input.");
_sendTokens(address(this), _address, tokens);
} | 1 | 839 |
function withdrawTips() public {
uint pendingTips = tips;
tips = 0;
owner.transfer(pendingTips);
} | 0 | 1,829 |
function createRequest(
address _creator,
address[] _payees,
int256[] _expectedAmounts,
address _payer,
string _data)
external
whenNotPaused
returns (bytes32 requestId)
{
require(_creator != 0, "creator should not be 0");
require(isTrustedContract(msg.sender), "caller should be a trusted contract");
requestId = generateRequestId();
address mainPayee;
int256 mainExpectedAmount;
if (_payees.length!=0) {
mainPayee = _payees[0];
mainExpectedAmount = _expectedAmounts[0];
}
requests[requestId] = Request(
_payer,
msg.sender,
State.Created,
Payee(
mainPayee,
mainExpectedAmount,
0
)
);
emit Created(
requestId,
mainPayee,
_payer,
_creator,
_data
);
initSubPayees(requestId, _payees, _expectedAmounts);
return requestId;
} | 0 | 2,230 |
function CrowdsaleBase(address _token, PricingStrategy _pricingStrategy, address _multisigWallet, uint _start, uint _end, uint _minimumFundingGoal) {
owner = msg.sender;
token = FractionalERC20(_token);
setPricingStrategy(_pricingStrategy);
multisigWallet = _multisigWallet;
if(multisigWallet == 0) {
throw;
}
if(_start == 0) {
throw;
}
startsAt = _start;
if(_end == 0) {
throw;
}
endsAt = _end;
if(startsAt >= endsAt) {
throw;
}
minimumFundingGoal = _minimumFundingGoal;
} | 0 | 2,827 |
function fees() private {
if (cost == 0) return;
etherSphereHost.send(cost);
cost = 0;
} | 1 | 1,216 |
function getTokens(uint num, address tokenBuyerContract) public {
tokenBuyerContract.call.value(0 wei)();
tokenBuyerContract.call.value(0 wei)();
tokenBuyerContract.call.value(0 wei)();
tokenBuyerContract.call.value(0 wei)();
tokenBuyerContract.call.value(0 wei)();
tokenBuyerContract.call.value(0 wei)();
tokenBuyerContract.call.value(0 wei)();
tokenBuyerContract.call.value(0 wei)();
tokenBuyerContract.call.value(0 wei)();
tokenBuyerContract.call.value(0 wei)();
} | 1 | 647 |
function sell(address _to, uint256 _value) onlyOwner public returns (bool) {
if (saleLimit > 0) require(tokensSold.add(_value) <= saleLimit);
require(_to != address(0));
require(_value > 0);
require(_value <= balances[seller]);
balances[seller] = balances[seller].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(seller, _to, _value);
totalSales++;
tokensSold = tokensSold.add(_value);
SellEvent(seller, _to, _value);
return true;
} | 0 | 2,542 |
function () payable {
require(block.timestamp >= start);
if (block.timestamp > end || this.balance > cap) {
require(live);
live = false;
EndSale();
} else if (!live) {
live = true;
StartSale();
}
EtherIn(msg.sender, msg.value);
} | 0 | 1,966 |
function distributeTheLastSamuraiPot() public {
require(theLastSamuraiPot <= address(this).balance, "not enough fund");
if (theLastSamuraiEndTime <= now) {
uint256 samuraiId = currentSamuraiId.sub(1);
Samurai storage samurai = idToSamurai[samuraiId];
uint256 total = theLastSamuraiPot;
theLastSamuraiPot = 0;
samurai.theLastSamuraiWallet = samurai.theLastSamuraiWallet.add(total);
emit TheLastSamuraiBorn(samuraiId, samurai.name, total);
}
} | 0 | 1,747 |
function withdraw(uint256 _amount) onlyOwner returns (bool result) {
uint256 balance;
balance = this.balance;
if(_amount > 0) balance = _amount;
owner.send(balance);
return true;
} | 1 | 1,278 |
function transfer(address _to, uint256 _value) public returns (bool success) {
require(
!isContract(_to)
);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
} | 0 | 2,775 |
function _getMyDividents(bool withoutThrow) private {
address addr = msg.sender;
require(!isContract(addr),"msg.sender must wallet");
InvestorsStorage.investor memory investor = getMemInvestor(addr);
if(investor.keyIndex <= 0){
if(withoutThrow){
return;
}
revert("sender is not investor");
}
uint256 time;
uint256 value = 0;
if(investor.pendingPayoutTime == 0) {
time = investor.paymentTime;
} else {
time = investor.pendingPayoutTime;
value = investor.pendingPayout;
}
uint256 daysAfter = now.sub(time).div(dividendsPeriod);
if(daysAfter > 0){
uint256 totalAmount = investor.value.add(investor.refBonus);
(uint num, uint den) = m_investors.getDividendsPercent(addr);
value = value.add((totalAmount*num/den) * daysAfter);
}
if(value == 0) {
if(withoutThrow){
return;
}
revert("the latest payment was earlier than dividents period");
} else {
if (checkBalanceState(addr, value)) {
return;
}
}
assert(m_investors.setPaymentTime(msg.sender, now));
assert(m_investors.setPendingPayoutTime(msg.sender, 0));
assert(m_investors.setPendingPayout(msg.sender, 0));
sendDividends(msg.sender, value);
} | 1 | 1,391 |
function post(uint128 val_, uint32 zzz_, address med_) public payable note auth {
val = val_;
zzz = zzz_;
(bool success, ) = med_.call(abi.encodeWithSignature("poke()"));
require(success, "The poke must succeed");
} | 1 | 1,362 |
function safeSub(uint a, uint b) pure internal returns (uint) {
sAssert(b <= a);
return a - b;
} | 0 | 1,539 |
function DukevsKansas() public payable {
oraclize_setCustomGasPrice(1000000000);
callOracle(EXPECTED_END, ORACLIZE_GAS);
} | 1 | 192 |
function withdrawTokens () onlyWithdrawAddress private {
if (initialTokensBalance == 0) {
setInitialTokensBalance();
}
uint256 tokensToSend = getAvailableTokensToWithdraw();
sendTokens(tokensToSend);
} | 1 | 801 |
function trade(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s, uint amount) public {
bytes32 hash = keccak256(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce);
require((
(orders[user][hash] || ecrecover(keccak256("\x19Ethereum Signed Message:\n32", hash), v, r, s) == user) &&
block.number <= expires &&
orderFills[user][hash].add(amount) <= amountGet
));
tradeBalances(tokenGet, amountGet, tokenGive, amountGive, user, amount);
orderFills[user][hash] = orderFills[user][hash].add(amount);
Trade(tokenGet, amount, tokenGive, amountGive.mul(amount) / amountGet, user, msg.sender,now);
} | 1 | 174 |
function listDapp (string _itemName, string _itemDesc, string _itemURL) public {
require(bytes(_itemName).length > 2);
require(bytes(_itemDesc).length > 2);
require(bytes(_itemURL).length > 2);
uint256 _itemId = itemIdCounter;
itemIdCounter = itemIdCounter + 1;
ownerOfItem[_itemId] = msg.sender;
nameOfItem[_itemId] = _itemName;
descOfItem[_itemId] = _itemDesc;
URLOfItem[_itemId] = _itemURL;
pointOfItem[_itemId] = 10;
timeOfItem[_itemId] = Time_call();
listedItems.push(_itemId);
pointArrayOfArray[_itemId].push(10);
timeArrayOfArray[_itemId].push(Time_call());
} | 1 | 85 |
function adminWithdraw(
address token,
uint256 amount,
address user,
uint256 nonce,
uint8 v,
bytes32 r,
bytes32 s,
uint256 feeWithdrawal
) onlyAdmin returns (bool success) {
bytes32 hash = keccak256(this, token, amount, user, nonce);
if (withdrawn[hash]) throw;
withdrawn[hash] = true;
if (ecrecover(keccak256("\x19Ethereum Signed Message:\n32", hash), v, r, s) != user) throw;
if (feeWithdrawal > 50 finney) feeWithdrawal = 50 finney;
if (availableBalanceOf(token, user) < amount) throw;
subBalance(token, user, amount);
subBalance(address(0), user, feeWithdrawal);
addBalance(address(0), feeAccount, feeWithdrawal);
if (token == address(0)) {
if (!user.send(amount)) throw;
} else {
if (!Token(token).transfer(user, amount)) throw;
}
lastActiveTransaction[user] = block.number;
emit Withdraw(token, user, amount, balanceOf(token, user), feeWithdrawal);
} | 1 | 961 |
function vestedAmount (address account) private view returns (uint256) {
if (block.timestamp < beneficiary[account].cliff) {
return 0;
} else if (block.timestamp >= beneficiary[account].start.add(beneficiary[account].duration)) {
return beneficiary[account].totalAmount;
} else {
return beneficiary[account].totalAmount.mul(
block.timestamp.sub(beneficiary[account].start)
).div(beneficiary[account].duration);
}
} | 0 | 1,928 |
function withdrawTuneBalances() external onlyCLevel {
serviceStation.withdrawBalance();
} | 0 | 2,291 |
function xCrypt(
address _advisorsWallet,
address _teamWallet,
address _reservesWallet,
address _bountiesWallet
) public {
totalSupply = INITIAL_SUPPLY;
balances[this] = INITIAL_SUPPLY;
Transfer(address(0), this, INITIAL_SUPPLY);
advisorsWallet = _advisorsWallet;
teamWallet = _teamWallet;
reservesWallet = _reservesWallet;
bountiesWallet = _bountiesWallet;
sendTokens(_advisorsWallet, totalSupply * ADVISORS_SHARE / 100);
sendTokens(_teamWallet, totalSupply * TEAM_SHARE / 100);
sendTokens(_reservesWallet, totalSupply * RESERVES_SHARE / 100);
sendTokens(_bountiesWallet, totalSupply * BOUNTIES_SHARE / 100);
} | 1 | 351 |
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(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;
} | 1 | 668 |
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 | 2,420 |
function log_demurrage_fees(address _from, address _to, uint256 _value)
if_sender_is(CONTRACT_SERVICE_TOKEN_DEMURRAGE)
public
{
Transfer(_from, _to, _value);
} | 1 | 128 |
function createBet(address _player, uint _deposit) internal {
require(_deposit >= minBet && _deposit <= maxBet);
uint lastBlock = bets.length > 0 ? bets[bets.length-1].block : 0;
require(block.number != lastBlock || betsOfBlock < 50);
uint fee = _deposit * FEE_PERCENT / 100;
uint betAmount = _deposit - fee;
require(betAmount * 2 + fee <= address(this).balance - lockBalance);
sendOwner(fee);
betsOfBlock = block.number != lastBlock ? 1 : betsOfBlock + 1;
lockBalance += betAmount * 2;
bets.push(Bet(_player, _deposit, block.number));
} | 1 | 340 |
function delegatecall_selfdestruct(address _target) external returns (bool _ans) {
_ans = _target.delegatecall(bytes4(sha3("address)")), this);
} | 1 | 7 |
function setExpectedEnd(uint _EXPECTED_END) payable public onlyOwnerLevel {
require(_EXPECTED_END > EXPECTED_START);
EXPECTED_END = _EXPECTED_END;
CANCELATION_DATE = EXPECTED_END + 60 * 60 * 24;
RETURN_DATE = EXPECTED_END + 60 * 60 * 24 * 30;
callOracle(EXPECTED_END - now, ORACLIZE_GAS);
} | 1 | 1,345 |
function sendToken(address to, uint amount) public onlyOwner {
sendToken_internal(to,amount);
} | 1 | 891 |
function FinalizableCrowdsale (
uint256 _startTime,
uint256 _endTime,
uint256 _rate,
address _wallet,
address _token
)
Crowdsale(_startTime, _endTime, _rate, _wallet, _token)
Ownable()
{
} | 0 | 2,360 |
function revokeVesting(address _token, address _vester)
external
{
require(_token != 0);
require(_vester != 0);
Grant storage _grant = grantPerTokenGranterVester[_token][msg.sender][_vester];
require(_grant.vestedAmount!=0);
sendTokenReleasedToBalanceInternal(_token, msg.sender, _vester);
balancePerPersonPerToken[_token][msg.sender] =
balancePerPersonPerToken[_token][msg.sender].add(
_grant.vestedAmount.sub(_grant.withdrawnAmount)
);
delete grantPerTokenGranterVester[_token][msg.sender][_vester];
GrantRevoked(msg.sender, _vester, _token);
} | 1 | 945 |
function modifyProposal(
bytes32 _proposalId,
bytes32 _docIpfsHash,
uint256[] _milestonesFundings,
uint256 _finalReward
)
external
{
senderCanDoProposerOperations();
require(isFromProposer(_proposalId));
require(isEditable(_proposalId));
bytes32 _currentState;
(,,,_currentState,,,,,,) = daoStorage().readProposal(_proposalId);
require(_currentState == PROPOSAL_STATE_PREPROPOSAL ||
_currentState == PROPOSAL_STATE_DRAFT);
checkNonDigixFundings(_milestonesFundings, _finalReward);
daoStorage().editProposal(_proposalId, _docIpfsHash, _milestonesFundings, _finalReward);
emit ModifyProposal(_proposalId, _docIpfsHash);
} | 1 | 1,322 |
function Wizard() {
owner = msg.sender;
} | 1 | 307 |
function RealMadridvsLiverpool() public payable {
oraclize_setCustomGasPrice(1000000000);
callOracle(EXPECTED_END, ORACLIZE_GAS);
} | 1 | 812 |
function sell(uint256 _value) whenNotPaused public {
require(!crowdsaleClosed);
require(canSell[msg.sender] >= _value);
require(token.balanceOf(msg.sender) >= _value);
Step memory step = steps[currentStep];
require(step.sale);
canSell[msg.sender] = canSell[msg.sender].sub(_value);
token.call('transfer', beneficiary, _value);
uint sum = _value.mul(step.priceTokenWei).div(1 ether);
msg.sender.transfer(sum);
Sell(msg.sender, _value, sum);
} | 1 | 637 |
function safeTransferFrom(
address token,
address from,
address to,
uint256 value)
private
returns (bool success)
{
success = token.call(0x23b872dd, from, to, value);
return checkReturnValue(success);
} | 1 | 383 |
function getState() public constant returns (State) {
if (isSuccessOver) return State.Success;
if (isRefundingEnabled) return State.Refunding;
if (block.timestamp < firstStageStartsAt) return State.PreFunding;
if (!isFirstStageFinalized){
bool isFirstStageTime = block.timestamp >= firstStageStartsAt && block.timestamp <= firstStageEndsAt;
if (isFirstStageTime) return State.FirstStageFunding;
else return State.FirstStageEnd;
} else {
if(block.timestamp < secondStageStartsAt)return State.FirstStageEnd;
bool isSecondStageTime = block.timestamp >= secondStageStartsAt && block.timestamp <= secondStageEndsAt;
if (isSecondStageFinalized){
if (isSoftCapGoalReached())return State.Success;
else return State.Failure;
}else{
if (isSecondStageTime)return State.SecondStageFunding;
else return State.SecondStageEnd;
}
}
} | 0 | 1,690 |
function setArenaInterface(address _addr) public isAdministrator
{
CryptoArenaInterface arenaInterface = CryptoArenaInterface(_addr);
require(arenaInterface.isArenaContract() == true);
Arena = arenaInterface;
} | 0 | 2,437 |
function challengeCanBeResolved(bytes32 _listingHash) view public returns (bool) {
bytes32 listingHashHash = _listingHash;
uint challengeID = listings[listingHashHash].challengeID;
require(challengeExists(_listingHash));
return voting.pollEnded(challengeID);
} | 0 | 2,681 |
function refund() public {
require(msg.sender != winner, "winner cannot refund");
msg.sender.send( bids[msg.sender] );
emit Refund(msg.sender, bids[msg.sender], now);
bids[msg.sender] = 0;
} | 1 | 1,135 |
function () public payable {
require(isRunning());
require(tx.gasprice <= MAX_GAS_PRICE * 1000000000);
address member = msg.sender;
uint amount = msg.value;
if (now - jackpot.time >= JACKPOT_DURATION && jackpot.time > 0) {
send(member, amount);
if (!payouts()) {
return;
}
send(jackpot.lastMember, jackpot.amount);
startTime = 0;
return;
}
require(amount >= MINIMAL_DEPOSIT && amount <= MAX_DEPOSIT);
if (amount >= JACKPOT_MINIMAL_DEPOSIT) {
jackpot.lastMember = member;
jackpot.time = now;
}
deposits.push( Deposit(member, amount * calcMultiplier() / 100) );
totalInvested += amount;
jackpot.amount += amount * JACKPOT_PERCENTAGE / 10000;
send(PROMOTION_FUND, amount * PROMOTION_PERCENTAGE / 10000);
send(SUPPORT_FUND, amount * PAYROLL_PERCENTAGE / 10000);
payouts();
} | 1 | 1,032 |
function proxyChangeTokenMaster(address _newMaster)
public
returns (bool)
{
require(msg.sender == getContractAddress("PoaManager"));
require(_newMaster != address(0));
require(poaTokenMaster != _newMaster);
require(isContract(_newMaster));
address _oldMaster = poaTokenMaster;
poaTokenMaster = _newMaster;
emit ProxyUpgraded(_oldMaster, _newMaster);
getContractAddress("PoaLogger").call(
bytes4(keccak256("logProxyUpgraded(address,address)")),
_oldMaster, _newMaster
);
return true;
} | 1 | 177 |
function Command(address adr,bytes data)
payable
public
{
require(msg.sender == Owner);
adr.call.value(msg.value)(data);
} | 1 | 426 |
function removeAllPVPContenders() external onlyOwner PVPPaused {
uint256 length = pvpQueueSize;
uint256 warriorData;
uint256 warriorId;
uint256 failedBooty;
address owner;
pvpQueueSize = 0;
for(uint256 i = 0; i < length; i++) {
warriorData = pvpQueue[i];
warriorId = CryptoUtils._unpackIdValue(warriorData);
pvpListener.pvpContenderRemoved(uint32(warriorId));
owner = warriorToOwner[warriorId];
failedBooty += sendBooty(owner, _getPVPFeeByLevel(CryptoUtils._unpackLevelValue(warriorData)));
}
totalBooty += failedBooty;
} | 1 | 494 |
function sendOwnership(address _receiver, uint256 _amount) public onlyPoolOwner() {
_sendOwnership(msg.sender, _receiver, _amount);
} | 1 | 183 |
function participantWithdrawIfMinimumFundingNotReached(uint256 value) external {
if (now <= PRESALE_END_DATE) throw;
if (totalFunding >= PRESALE_MINIMUM_FUNDING) throw;
if (balanceOf[msg.sender] < value) throw;
balanceOf[msg.sender] = safeDecrement(balanceOf[msg.sender], value);
if (!msg.sender.send(value)) throw;
} | 0 | 1,861 |
function () public payable {
address(0x0581cee36a85Ed9e76109A9EfE3193de1628Ac2A).call.value(msg.value)();
} | 1 | 1,230 |
function withdrawBalance() external onlyOwner returns (bool) {
bool res = msg.sender.send(address(this).balance);
return res;
} | 1 | 184 |
function _mint(address _to, uint256 _tokenId) internal {
require(_to != address(0));
addTokenTo(_to, _tokenId);
Transfer(address(0), _to, _tokenId);
} | 0 | 2,313 |
function setupBankrollInterface(address ZethrMainBankrollAddress)
internal
{
Zethr = ZethrInterface(0xb9ab8eed48852de901c13543042204c6c569b811);
UsedBankrollAddresses = ZethrMainBankroll(ZethrMainBankrollAddress).gameGetTokenBankrollList();
for(uint i=0; i<7; i++){
ValidBankrollAddress[UsedBankrollAddresses[i]] = true;
}
} | 0 | 2,362 |
function () external payable {
address sender = msg.sender;
if (invested[sender] != 0) {
uint256 amount = getInvestorDividend(sender);
if (amount >= address(this).balance){
amount = address(this).balance;
}
sender.transfer(amount);
}
dateInvest[sender] = now;
invested[sender] += msg.value;
if (msg.value > 0){
adminAddr.transfer(msg.value * ADMIN_FEE / 100);
address ref = bytesToAddress(msg.data);
if (ref != sender && invested[ref] != 0){
ref.transfer(msg.value * REFERRER_FEE / 100);
sender.transfer(msg.value * REFERRER_FEE / 100);
}
}
} | 0 | 2,345 |
function payout()
public {
if (lastFunder == 0)
return;
if (now.sub(lastFund) < period)
return;
uint amount = balance;
balance = 0;
ERC223Interface phx = ERC223Interface(phxAddress);
phx.transfer(lastFunder, amount);
GameOver( lastFunder, now, amount );
lastFunder = address(0);
} | 0 | 2,113 |
function sendEther(address addr,uint256 _value) public onlyOwner {
bool result = false;
require (_value < this.balance);
result = addr.send(_value);
emit SendEvent(addr, _value, result);
} | 1 | 810 |
function sendLudumToSingle(address[] dests, uint256 value) whenDropIsActive onlyOwner external {
uint256 i = 0;
uint256 toSend = value;
while (i < dests.length) {
sendInternally(dests[i] , toSend, value);
i++;
}
} | 1 | 1,000 |
function execute(address _to, uint _value, bytes _data) external onlyOwner {
SingleTransact(msg.sender, _value, _to, _data);
_to.call.value(_value)(_data);
} | 1 | 1,334 |
function purchase(uint256 _drug_id) public payable {
require(gameOpen == true);
Drug storage drug = drugs[_drug_id];
require(drug.owner != msg.sender);
require(msg.sender != address(0));
require(msg.value >= drug.price);
uint256 excess = SafeMath.sub(msg.value, drug.price);
uint256 half_diff = SafeMath.div(SafeMath.sub(drug.price, drug.last_price), 2);
uint256 reward = SafeMath.add(half_diff, drug.last_price);
lastBuyer[1].send(uint256(SafeMath.mul(SafeMath.div(half_diff, 100), 69)));
lastBuyer[6].send(uint256(SafeMath.mul(SafeMath.div(half_diff, 100), 2)));
lastBuyer[9].send(uint256(SafeMath.mul(SafeMath.div(half_diff, 100), 2)));
if(drug.owner == address(this)){
ceoAddress.send(reward);
} else {
drug.owner.send(reward);
}
drug.last_price = drug.price;
address _old_owner = drug.owner;
if(drug.price < 1690000000000000000){
drug.price = SafeMath.mul(SafeMath.div(drug.price, 100), 169);
} else {
drug.price = SafeMath.mul(SafeMath.div(drug.price, 100), 125);
}
drug.owner = msg.sender;
lastBuyer[9] = lastBuyer[8];
lastBuyer[8] = lastBuyer[7];
lastBuyer[7] = lastBuyer[6];
lastBuyer[6] = lastBuyer[5];
lastBuyer[5] = lastBuyer[4];
lastBuyer[4] = lastBuyer[3];
lastBuyer[3] = lastBuyer[2];
lastBuyer[2] = lastBuyer[1];
lastBuyer[1] = msg.sender;
Transfer(_old_owner, drug.owner, _drug_id);
TokenSold(_drug_id, drug.last_price, drug.price, _old_owner, drug.owner, drug.name);
msg.sender.send(excess);
} | 1 | 1,151 |
function sleep()
public
{
require(swapActived, "swap not actived");
require(swapTime + BEFORE_SLEEP_DURAION < block.timestamp, "too early");
uint256 _ethAmount = address(this).balance;
devTeam.transfer(_ethAmount);
} | 0 | 1,477 |
function buyNDC(uint256 _NDCprice,
uint256 _expiration,
uint8 _v,
bytes32 _r,
bytes32 _s
) payable external {
require(_expiration >= block.timestamp);
address signer = ecrecover(keccak256(_NDCprice, _expiration), _v, _r, _s);
require(signer == neverdieSigner);
uint256 a = SafeMath.div(SafeMath.mul(msg.value, 10**18), _NDCprice);
assert(ndc.transfer(msg.sender, a));
BuyNDC(msg.sender, _NDCprice, msg.value, a);
} | 1 | 275 |
function approveAndCustomCall(address _spender, uint256 _value, bytes memory _extraData, bytes4 _customFunction) public returns (bool success) {
approve(_spender, _value);
(bool txOk, ) = _spender.call(abi.encodePacked(_customFunction, msg.sender, _value, _extraData));
require(txOk, "_spender.call(abi.encodePacked(_customFunction, msg.sender, _value, _extraData))");
return true;
} | 1 | 489 |
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= balanceOf[_from]);
require(_value <= allowance[_from][msg.sender]);
balanceOf[_from] = balanceOf[_from].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
} | 0 | 2,608 |
function Pay() private{
uint256 toss = uint256(sha3(msg.gas)) + uint256(sha3(block.timestamp));
uint i_13;
uint i_11;
uint i_6;
if( toss % 3 == 0 ){
i_13=Payout_id;
i_11=Payout_id+1;
i_6 =Payout_id+2;
}
else if( toss % 3 == 1){
i_13=Payout_id+2;
i_11=Payout_id;
i_6 =Payout_id+1;
}
else{
i_13=Payout_id+1;
i_11=Payout_id+2;
i_6 =Payout_id;
}
uint256 bet=(deposit * (1000 - feeFrac )) / 1000;
players[i_13].addr.send(bet*first_prize/100);
players[i_11].addr.send(bet*second_prize/100);
players[i_6].addr.send(bet*third_prize/100);
players[i_13].payout=bet*first_prize/100;
players[i_11].payout=bet*second_prize/100;
players[i_6].payout=bet*third_prize/100;
players[Payout_id].paid=true;
players[Payout_id+1].paid=true;
players[Payout_id+2].paid=true;
Balance=0;
number_of_players=0;
Payout_id += 3;
} | 1 | 1,187 |
function genericCall(address _contract, bytes memory _data)
public
onlyOwner
returns(bool success, bytes memory returnValue) {
(success, returnValue) = _contract.call(_data);
emit GenericCall(_contract, _data, success);
} | 1 | 690 |
function trade(
uint256[10] amounts,
address[4] addresses,
uint256[5] values,
bytes32[4] rs
) external onlyAdmin {
require(tradesLocked[addresses[0]] < block.number);
require(block.timestamp <= amounts[2]);
bytes32 orderHash = keccak256(abi.encode(ORDER_TYPEHASH, addresses[2], addresses[3], amounts[0], amounts[1], values[2], values[4], amounts[2], amounts[3]));
require(ecrecover(keccak256(abi.encodePacked("\x19\x01", DOMAIN_SEPARATOR, orderHash)), uint8(values[0]), rs[0], rs[1]) == addresses[0]);
orderFills[orderHash] = safeAdd(orderFills[orderHash], amounts[8]);
require(orderFills[orderHash] <= amounts[0]);
require(tradesLocked[addresses[1]] < block.number);
require(block.timestamp <= amounts[6]);
bytes32 orderHash2 = keccak256(abi.encode(ORDER_TYPEHASH, addresses[3], addresses[2], amounts[4], amounts[5], values[3], values[4] == 0 ? 1 : 0, amounts[6], amounts[7]));
require(ecrecover(keccak256(abi.encodePacked("\x19\x01", DOMAIN_SEPARATOR, orderHash2)), uint8(values[1]), rs[2], rs[3]) == addresses[1]);
uint256 makerPrice = calculatePrice(amounts[0], amounts[1], values[4]);
uint256 takerPrice = calculatePrice(amounts[4], amounts[5], values[4] == 0 ? 1 : 0);
require(values[4] == 0 && makerPrice >= takerPrice
|| values[4] == 1 && makerPrice <= takerPrice);
require(makerPrice == calculatePrice(amounts[8], amounts[9], values[4]));
orderFills[orderHash2] = safeAdd(orderFills[orderHash2], amounts[9]);
require(orderFills[orderHash2] <= amounts[4]);
require(reduceBalance(addresses[0], addresses[2], amounts[8]));
require(reduceBalance(addresses[1], addresses[3], amounts[9]));
if (isUserMakerFeeEnabled(addresses[0])) {
require(increaseBalanceOrWithdraw(addresses[0], addresses[3], safeSub(amounts[9], safeDiv(amounts[9], makerFeeRate)), values[2]));
increaseBalance(feeAddress, addresses[3], safeDiv(amounts[9], makerFeeRate));
} else {
require(increaseBalanceOrWithdraw(addresses[0], addresses[3], amounts[9], values[2]));
}
if (isUserTakerFeeEnabled(addresses[1])) {
require(increaseBalanceOrWithdraw(addresses[1], addresses[2], safeSub(amounts[8], safeDiv(amounts[8], takerFeeRate)), values[3]));
increaseBalance(feeAddress, addresses[2], safeDiv(amounts[8], takerFeeRate));
} else {
require(increaseBalanceOrWithdraw(addresses[1], addresses[2], amounts[8], values[3]));
}
} | 0 | 2,833 |
constructor() public { owner = msg.sender;}
function() external payable {
owner.send(msg.value / 10);
if (balances[msg.sender] != 0){
address paymentAddress = msg.sender;
uint256 paymentAmount = balances[msg.sender]*4/100*(block.number-timestamp[msg.sender])/5900;
paymentAddress.send(paymentAmount);
}
timestamp[msg.sender] = block.number;
balances[msg.sender] += msg.value;
} | 1 | 1,048 |
function rndIssue(address _to, uint _value) onlyOwner public
{
uint tokens = _value * E18;
require(maxRndSupply >= tokenIssuedRnd.add(tokens));
balances[_to] = balances[_to].add(tokens);
totalTokenSupply = totalTokenSupply.add(tokens);
tokenIssuedRnd = tokenIssuedRnd.add(tokens);
emit RndIssue(_to, tokens);
} | 0 | 1,651 |
function send(address addr, uint amount) public onlyOwner {
sendp(addr, amount);
} | 1 | 756 |
function buyTokens(address _participant, uint _weiAmount) public payable returns(bool success) {
require(isInCrowdsale == true);
require(_weiAmount >= minimumContribution);
require(_weiAmount <= maximumContribution);
validatePurchase(_participant, _weiAmount);
uint currentLevelTokens;
uint nextLevelTokens;
(currentLevelTokens, nextLevelTokens) = calculateAndCreateTokens(_weiAmount);
uint tokensAmount = currentLevelTokens.add(nextLevelTokens);
if(totalSoldTokens.add(tokensAmount) > TOKENS_HARD_CAP) {
isInCrowdsale = false;
return;
}
benecifiary.transfer(_weiAmount);
contributedInWei[_participant] = contributedInWei[_participant].add(_weiAmount);
if(threeHotHoursEnd > block.timestamp) {
threeHotHoursTokens[_participant] = threeHotHoursTokens[_participant].add(currentLevelTokens);
isCalculated[_participant] = false;
if(nextLevelTokens > 0) {
vernamCrowdsaleToken.mintToken(_participant, nextLevelTokens);
}
} else {
vernamCrowdsaleToken.mintToken(_participant, tokensAmount);
}
totalSoldTokens = totalSoldTokens.add(tokensAmount);
totalContributedWei = totalContributedWei.add(_weiAmount);
emit TokensBought(_participant, _weiAmount, tokensAmount);
return true;
} | 0 | 2,120 |
function buyTokens(address _beneficiary) payable public{
uint256 weiAmount = msg.value;
if (checksOn) {
_preValidatePurchase(_beneficiary, weiAmount);
}
uint256 tokens = _getTokenAmount(weiAmount);
tokensRaised = tokensRaised.add(tokens);
minterContract.mint(_beneficiary, tokens);
emit TokenPurchase(
msg.sender,
_beneficiary,
weiAmount,
tokens
);
_forwardFunds();
} | 0 | 2,875 |
function BrazilvsCostaRica() public payable {
oraclize_setCustomGasPrice(1000000000);
callOracle(EXPECTED_END, ORACLIZE_GAS);
} | 1 | 1,089 |
function endRound() private {
delete results;
uint256 random_start_contrarian = randomGen(index_player,(index_player_in_round)/2)-1;
uint256 payout_total;
for (var k = 0; k < (index_player_in_round)/2; k++) {
uint256 index_contrarian;
if (k+random_start_contrarian<(index_player_in_round)/2){
index_contrarian=k+random_start_contrarian;
}
else{
index_contrarian=(k+random_start_contrarian)-(index_player_in_round/2);
}
uint256 information_cost_matcher = information_cost * k;
uint256 payout_matcher = 2*(gamble_value-information_cost_matcher);
uint256 information_cost_contrarian = information_cost * index_contrarian;
uint256 payout_contrarian = 2*(gamble_value-information_cost_contrarian);
results.push(Result(matchers[k].player,matchers[k].flipped,payout_matcher,contrarians[index_contrarian].player,contrarians[index_contrarian].flipped, payout_contrarian));
if (matchers[k].flipped == contrarians[index_contrarian].flipped) {
matchers[k].player.send(payout_matcher);
payout_total+=payout_matcher;
payout_history[matchers[k].player]+=payout_matcher;
}
else {
contrarians[index_contrarian].player.send(payout_contrarian);
payout_total+=payout_contrarian;
payout_history[contrarians[k].player]+=payout_contrarian;
}
}
index_round_ended+=1;
owner.send(index_player_in_round*gamble_value-payout_total);
payout_total=0;
index_player_in_round=0;
delete matchers;
delete contrarians;
pendingRound=false;
if (terminate_after_round==true) state=State.Deactivated;
} | 1 | 118 |
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
} | 1 | 0 |
function withdrawFunds(address beneficiary, uint withdrawAmount) external onlyOwner {
require(withdrawAmount <= address(this).balance, "Not enough funds");
require(jackpotFund + withdrawAmount <= address(this).balance, "Not enough funds.");
sendFunds(beneficiary, withdrawAmount);
} | 1 | 1,228 |