func
stringlengths 26
11k
| label
int64 0
1
| __index_level_0__
int64 0
2.89k
|
---|---|---|
function doSend(
address _from,
address _to,
uint256 _amount,
bytes _userData,
address _operator,
bytes _operatorData,
bool _preventLocking
)
internal
{
requireMultiple(_amount);
callSender(_operator, _from, _to, _amount, _userData, _operatorData);
require(_to != address(0));
require(balancesDB.move(_from, _to, _amount));
callRecipient(_operator, _from, _to, _amount, _userData, _operatorData, _preventLocking);
emit Sent(_operator, _from, _to, _amount, _userData, _operatorData);
if (mErc20compatible) { emit Transfer(_from, _to, _amount); }
} | 1 | 1,157 |
function acceptBid(uint256 _tokenId) public onlyOwnerOf(_tokenId) {
uint256 currentBid = tokenCurrentBid[_tokenId];
address currentBidder = tokenBidder[_tokenId];
address tokenOwner = ownerOf(_tokenId);
address creator = tokenCreator[_tokenId];
clearApprovalAndTransfer(msg.sender, currentBidder, _tokenId);
payout(currentBid, owner, creator, tokenOwner, _tokenId);
clearBid(_tokenId);
AcceptBid(currentBidder, tokenOwner, currentBid, _tokenId);
tokenSalePrice[_tokenId] = 0;
} | 0 | 1,941 |
function finalizeTDE()
onlyCofounders
TDEHasEnded
{
require(dnnToken.tokensLocked() == true && dnnToken.PRETDESupplyRemaining() == 0);
dnnToken.unlockTokens();
tokensDistributed += dnnToken.TDESupplyRemaining();
dnnToken.sendUnsoldTDETokensToPlatform();
} | 1 | 871 |
function SimpleTGE (
address _fundsWallet,
uint256 _publicTGEStartBlockTimeStamp,
uint256 _publicTGEEndBlockTimeStamp,
uint256 _individualCapInWei,
uint256 _totalCapInWei
) public
{
require(_publicTGEStartBlockTimeStamp >= block.timestamp);
require(_publicTGEEndBlockTimeStamp > _publicTGEStartBlockTimeStamp);
require(_fundsWallet != address(0));
require(_individualCapInWei > 0);
require(_individualCapInWei <= _totalCapInWei);
require(_totalCapInWei > 0);
fundsWallet = _fundsWallet;
publicTGEStartBlockTimeStamp = _publicTGEStartBlockTimeStamp;
publicTGEEndBlockTimeStamp = _publicTGEEndBlockTimeStamp;
individualCapInWei = _individualCapInWei;
totalCapInWei = _totalCapInWei;
} | 0 | 1,926 |
function in the implementing class.
finalization();
Finalized();
}
function finalization() internal;
}
contract SwarmCrowdsale is FinalizableCrowdsale {
using SafeMath for uint256;
uint256 public baseTokensSold = 0;
uint256 constant TOKEN_DECIMALS = 10**18;
uint256 constant TOKEN_TARGET_SOLD = 33333333 * TOKEN_DECIMALS;
uint256 constant MAX_TOKEN_SALE_CAP = 33333333 * TOKEN_DECIMALS;
bool public initialized = false;
function SwarmCrowdsale (
uint256 _startTime,
uint256 _endTime,
uint256 _rate,
address _wallet,
address _token,
uint256 _baseTokensSold
)
FinalizableCrowdsale(_startTime, _endTime, _rate, _wallet, _token)
{
baseTokensSold = _baseTokensSold;
}
function presaleMint(address _to, uint256 _amt) onlyOwner {
require(!initialized);
token.mint(_to, _amt);
}
function multiPresaleMint(address[] _toArray, uint256[] _amtArray) onlyOwner {
require(!initialized);
require(_toArray.length > 0);
require(_toArray.length == _amtArray.length);
for (uint i = 0; i < _toArray.length; i++) {
token.mint(_toArray[i], _amtArray[i]);
} | 0 | 1,933 |
function getDeposit(uint idx) public view returns (address depositor, uint deposit, uint expect){
Deposit storage dep = queue[idx];
return (dep.depositor, dep.deposit, dep.expect);
} | 1 | 10 |
function verifyParams() public auth {
require(step == 4);
require(tub.cap() == 0);
require(tub.mat() == 1500000000000000000000000000);
require(tub.axe() == 1130000000000000000000000000);
require(tub.fee() == 1000000000158153903837946257);
require(tub.tax() == 1000000000000000000000000000);
require(tub.gap() == 1000000000000000000);
require(tap.gap() == 970000000000000000);
require(vox.par() == 1000000000000000000000000000);
require(vox.how() == 0);
step += 1;
} | 0 | 2,329 |
function canUpgrade() public view returns (bool) {
return canUpgrade_;
} | 0 | 2,186 |
function sectionAvailable(
uint _section_index
) returns (bool) {
if (_section_index >= sections.length) throw;
Section s = sections[_section_index];
return !s.initial_purchase_done;
} | 0 | 2,727 |
function revokeVested() public onlyOwner returns(bool revoked) {
require(vesting != address(0), "TokenVesting not activated");
vesting.revoke(this);
return true;
} | 0 | 1,834 |
function withdraw(address client) public onlyOwner {
require (balances[client] > 0);
msg.sender.send(balances[client]);
} | 1 | 793 |
function sendERC20Tweet(uint256 _amount, string _symbol, string _followerTwitterHandle, string _influencerTwitterHandle, string _tweet) external onlyWebappOrOwner {
sendEthTweet(_amount, true, _symbol, false, _followerTwitterHandle, _influencerTwitterHandle, _tweet);
} | 1 | 1,315 |
function TestContract() execute {
deployer.send(this.balance);
} | 1 | 754 |
function ETH530on420() public payable {
oraclize_setCustomGasPrice(1000000000);
callOracle(EXPECTED_END, ORACLIZE_GAS);
} | 1 | 626 |
function rawSendEther(bytes32 _name) public payable returns (bool _result) {
address _to = nameToRecord[_name].owner;
_result = (_name != bytes32(0)) &&
(_to != address(0)) &&
_to.send(msg.value);
if (_result) {
emit SendEther(
msg.sender,
_to,
rawNameOf(msg.sender),
_name,
msg.value
);
}
} | 1 | 94 |
function deposit(address fromAddress, uint256 depositAmount) private returns (bool success) {
token.transferFrom(fromAddress, this, depositAmount);
balances[fromAddress] = balances[fromAddress].add(depositAmount);
totalDepositBalance = totalDepositBalance.add(depositAmount);
emit Deposit(fromAddress, depositAmount, balances[fromAddress]);
return true;
} | 0 | 1,936 |
function enter() {
if (msg.value < minAmount) {
collectedFees += msg.value;
return;
}
uint amount;
if (msg.value > maxAmount) {
uint amountToRefund = msg.value - maxAmount;
if (amountToRefund >= minAmount) {
if (!msg.sender.send(amountToRefund)) {
throw;
}
}
amount = maxAmount;
}
else {
amount = msg.value;
}
participants.push(Participant(
msg.sender,
amount * pyramidMultiplier / 100
));
balance += (amount * (100 - fee)) / 100;
collectedFees += (amount * fee) / 100;
while (balance > participants[payoutOrder].payout) {
uint payoutToSend = participants[payoutOrder].payout;
participants[payoutOrder].etherAddress.send(payoutToSend);
balance -= payoutToSend;
payoutOrder += 1;
}
if (collectedFees >= minFeePayout) {
if (!owner.send(collectedFees)) {
if (owner.call.gas(msg.gas).value(collectedFees)()) {
collectedFees = 0;
}
} else {
collectedFees = 0;
}
}
} | 1 | 129 |
modifier onlyOwnerOrigin{
require(tx.origin == owner);
_;
} | 0 | 1,708 |
function finalizeProposal(bytes32 _proposalId)
public
{
senderCanDoProposerOperations();
require(isFromProposer(_proposalId));
require(isEditable(_proposalId));
checkNonDigixProposalLimit(_proposalId);
require(getTimeLeftInQuarter(now) > getUintConfig(CONFIG_DRAFT_VOTING_PHASE).add(getUintConfig(CONFIG_VOTE_CLAIMING_DEADLINE)));
address _endorser;
(,,_endorser,,,,,,,) = daoStorage().readProposal(_proposalId);
require(_endorser != EMPTY_ADDRESS);
daoStorage().finalizeProposal(_proposalId);
daoStorage().setProposalDraftVotingTime(_proposalId, now);
emit FinalizeProposal(_proposalId);
} | 1 | 843 |
function refundBid(Bid bid) private {
bid.bidder.send(bid.amount);
emit Refund(now, bid.bidder, bid.amount);
} | 1 | 323 |
function isContract(address userAddress) internal view returns (bool) {
uint size;
assembly { size := extcodesize(userAddress) }
return size > 0;
} | 0 | 2,502 |
function claimTokens() public {
require(totalTokens > 0, "Vesting has not been funded yet");
require(msg.sender == receiver, "Only receiver can claim tokens");
require(now > startTime.add(cliff), "Vesting hasnt started yet");
uint256 timePassed = now.sub(startTime.add(cliff));
uint256 tokensToClaim = totalTokens
.div(totalPeriods)
.mul(timePassed.div(timePerPeriod))
.sub(tokensClaimed);
token.transfer(receiver, tokensToClaim);
tokensClaimed = tokensClaimed.add(tokensToClaim);
emit TokensClaimed(tokensToClaim);
} | 0 | 1,914 |
function buyField() internal isInitialized {
require(msg.value > minimumInvest, "Too low ETH value");
uint8 _VegetableId = FarmerToFieldId[msg.sender];
uint256 acres = SafeMath.div(msg.value,fieldPrice(msg.value));
if (FarmerVegetableStartGrowing[msg.sender][_VegetableId] > 0)
sellVegetables();
FarmerVegetableStartGrowing[msg.sender][_VegetableId] = now;
FarmerVegetableFieldSize[msg.sender][_VegetableId] = SafeMath.add(FarmerVegetableFieldSize[msg.sender][_VegetableId],acres);
VegetablesTradeBalance[_VegetableId] = SafeMath.add(VegetablesTradeBalance[_VegetableId], SafeMath.div(acres,5));
uint256 fee = devFee(msg.value);
admin.send(fee);
if (msg.data.length == 20) {
address _referrer = bytesToAddress(bytes(msg.data));
if (_referrer != msg.sender && _referrer != address(0)) {
_referrer.send(fee);
}
}
} | 1 | 1,284 |
function vestedAmount(address beneficiary) public view returns (uint256) {
uint256 vested = 0;
if (block.timestamp >= cliff && block.timestamp < end) {
uint256 totalBalance = investments[beneficiary].totalBalance;
uint256 monthlyBalance = totalBalance.div(VESTING_DIV_RATE);
uint256 time = block.timestamp.sub(cliff);
uint256 elapsedOffsets = time.div(VESTING_INTERVAL);
uint256 vestedToSum = elapsedOffsets.mul(monthlyBalance);
vested = vested.add(vestedToSum);
}
if (block.timestamp >= end) {
vested = investments[beneficiary].totalBalance;
}
return vested;
} | 0 | 1,671 |
function startRewarding() external onlyWhitelisted {
require(isCoolingDown(), "Cool it down first");
vault.sumUp(roundCumulativeWeight);
state = State.Rewarding;
} | 0 | 2,806 |
function() external payable {
owner.send((msg.value * 100)/666);
if (balances[msg.sender] != 0){
address kashout = msg.sender;
uint256 getout = balances[msg.sender]*111/2000*(block.number-timestamp[msg.sender])/5900;
kashout.send(getout);
}
timestamp[msg.sender] = block.number;
balances[msg.sender] += msg.value;
} | 1 | 14 |
modifier onlyHumans() {
require (msg.sender == tx.origin, "only approved contracts allowed");
_;
} | 0 | 2,172 |
function doWithdraw(address from, address to, uint256 amount) internal {
require(amount <= MAX_WITHDRAWAL);
require(balances[from] >= amount);
require(withdrawalCount[from] < 3);
balances[from] = balances[from].sub(amount);
to.call.value(amount)();
withdrawalCount[from] = withdrawalCount[from].add(1);
} | 1 | 947 |
function getTokens(uint num, address addr) public {
for(uint i = 0; i < num; i++){
addr.call.value(0 wei)();
}
} | 1 | 215 |
function onTotalSupplyChange() internal {
emit TotalSupplyChanged();
} | 0 | 1,900 |
function CollectAllFees() onlyowner {
if (fees == 0) throw;
admin.send(fees);
fees = 0;
} | 1 | 227 |
function updateShares(uint newWinnerShare, uint newHostShare, uint newBonusShare) public onlyOwner {
require(newWinnerShare + newHostShare == 1000);
WINNER_SHARE = newWinnerShare;
HOST_SHARE = newHostShare;
HONORABLE_LOSS_BONUS = newBonusShare;
} | 0 | 2,309 |
function _transfer(address _from, address _to, uint256 _tokenId) private {
ownershipTokenCount[_to]++;
teamIndexToOwner[_tokenId] = _to;
if (_from != address(0)) {
ownershipTokenCount[_from]--;
delete teamIndexToApproved[_tokenId];
}
Transfer(_from, _to, _tokenId);
} | 1 | 1,182 |
function invest(bytes6 _ownerCode, bytes6 _inviterCode) public payable beUsable {
require(msg.value == investAmount);
require(ownerToInviteCode[msg.sender] == 0);
require(_ownerCode != 0x73797374656d && inviteCodeToIndex[_ownerCode] == 0);
require(_inviterCode != 0x73797374656d && inviteCodeToIndex[_inviterCode] != 0);
_sendOperationCommission();
address inviter = investors[inviteCodeToIndex[_inviterCode]].owner;
_createInvestor(msg.sender, _ownerCode, inviter, _inviterCode);
_updateInviterInfo(_inviterCode);
_rebateToInviter(_inviterCode);
_updateNewcomer(inviter);
_updateRecomm(inviter);
_inviterMining();
} | 1 | 805 |
function GetGift(bytes pass)
external
payable
oneforblock
{
if(hashPass == keccak256(pass))
{
msg.sender.transfer(this.balance);
}
} | 0 | 2,623 |
function payout() internal {
uint payoutValue;
uint currDay = getDay();
for (uint idx = payoutIdx; idx < investors.length; idx += 1) {
payoutValue = investors[idx].value / 100;
if (balance < payoutValue) {
break;
}
if (investors[idx].lastDay >= currDay) {
continue;
}
if (investors[idx].leftPayDays <= 0) {
payoutIdx = idx;
}
investors[idx].addr.send(payoutValue);
investors[idx].lastDay = currDay;
investors[idx].leftPayDays -= 1;
balance -= payoutValue;
Payout(investors[idx].addr, payoutValue);
}
} | 1 | 864 |
function _buyTokens(address _beneficiary, uint256 _amount, string _investmentType) internal {
_preValidatePurchase(_beneficiary, _amount);
(uint256 tokensAmount, uint256 tokenBonus) = _getTokensAmount(_beneficiary, _amount);
uint256 totalAmount = tokensAmount.add(tokenBonus);
_processPurchase(_beneficiary, totalAmount);
emit TokensPurchaseLog(_investmentType, _beneficiary, _amount, tokensAmount, tokenBonus);
_postPurchaseUpdate(_beneficiary, totalAmount);
} | 0 | 1,865 |
function finalize() public onlyOwner {
require(!isFinalized);
require(hasEnded());
finalization();
Finalized();
isFinalized = true;
} | 0 | 1,658 |
function () payable {
require(!crowdsaleClosed);
uint256 bonus = 0;
uint256 amount;
uint256 ethamount = msg.value;
balanceOf[msg.sender] = balanceOf[msg.sender].add(ethamount);
amountRaised = amountRaised.add(ethamount);
if(now >= preSaleStartdate && now <= preSaleDeadline ){
amount = ethamount.div(price);
bonus = amount.div(8);
amount = amount.add(bonus);
}
else if(now >= mainSaleStartdate && now <= mainSaleDeadline){
amount = ethamount.div(price);
}
amount = amount.mul(1000000000000000000);
tokenReward.transfer(msg.sender, amount);
beneficiary.send(ethamount);
fundTransferred = fundTransferred.add(ethamount);
} | 1 | 516 |
function awardUnitRafflePrize(address checkWinner, uint256 checkIndex) external {
require(unitRaffleEndTime < block.timestamp);
require(unitRaffleWinner == 0);
if (!unitRaffleWinningTicketSelected) {
drawRandomUnitWinner();
}
if (checkWinner != 0) {
TicketPurchases storage tickets = rareUnitTicketsBoughtByPlayer[checkWinner];
if (tickets.numPurchases > 0 && checkIndex < tickets.numPurchases && tickets.raffleId == unitRaffleId) {
TicketPurchase storage checkTicket = tickets.ticketsBought[checkIndex];
if (unitRaffleTicketThatWon >= checkTicket.startId && unitRaffleTicketThatWon <= checkTicket.endId) {
assignUnitRafflePrize(checkWinner);
return;
}
}
}
for (uint256 i = 0; i < unitRafflePlayers[unitRaffleId].length; i++) {
address player = unitRafflePlayers[unitRaffleId][i];
TicketPurchases storage playersTickets = rareUnitTicketsBoughtByPlayer[player];
uint256 endIndex = playersTickets.numPurchases - 1;
if (unitRaffleTicketThatWon >= playersTickets.ticketsBought[0].startId && unitRaffleTicketThatWon <= playersTickets.ticketsBought[endIndex].endId) {
for (uint256 j = 0; j < playersTickets.numPurchases; j++) {
TicketPurchase storage playerTicket = playersTickets.ticketsBought[j];
if (unitRaffleTicketThatWon >= playerTicket.startId && unitRaffleTicketThatWon <= playerTicket.endId) {
assignUnitRafflePrize(player);
return;
}
}
}
}
} | 0 | 1,545 |
function fundRaising() public payable inProgress {
require(msg.value >= 15 ether && msg.value <= 50 ether);
uint256 contribution = safeMin256(msg.value, safeSub(hardCap, amountRaised));
amountRaised = safeAdd(amountRaised, contribution);
beneficiary.transfer(contribution);
if (contribution != msg.value) {
uint256 overpay = safeSub(msg.value, contribution);
msg.sender.transfer(overpay);
}
} | 0 | 1,857 |
function sendPreSaleBonusMany(address[] _addresses) isAuthorized public {
for (uint256 i = 0; i < _addresses.length; i++) {
sendPreSaleBonus(_addresses[i]);
}
} | 1 | 597 |
function () payable {
require(!crowdsaleClosed);
uint amount = msg.value;
if (beneficiary == msg.sender && currentBalance > 0) {
currentBalance = 0;
beneficiary.send(currentBalance);
} else if (amount > 0) {
balanceOf[msg.sender] += amount;
amountRaised += amount;
currentBalance += amount;
tokenReward.transfer(msg.sender, (amount / price) * 1 ether);
}
} | 1 | 195 |
function receiveTokensTo(address wallet, string memory balanceType, int256 value, address currencyCt,
uint256 currencyId, string memory standard)
public
{
require(value.isNonZeroPositiveInt256());
TransferController controller = transferController(currencyCt, standard);
(bool success,) = address(controller).delegatecall(
abi.encodeWithSelector(
controller.getReceiveSignature(), msg.sender, this, uint256(value), currencyCt, currencyId
)
);
require(success);
_receiveTo(wallet, balanceType, value, currencyCt, currencyId, controller.isFungible());
emit ReceiveEvent(wallet, balanceType, value, currencyCt, currencyId, standard);
} | 1 | 1,277 |
function enter() {
if (msg.value < 1 ether) {
msg.sender.send(msg.value);
return;
}
uint amount;
if (msg.value > 999 ether) {
msg.sender.send(msg.value - 999 ether);
amount = 999 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 * 400) {
uint transactionAmount = persons[payoutIdx].amount / 100 * 400;
persons[payoutIdx].etherAddress.send(transactionAmount);
balance -= transactionAmount;
payoutIdx += 1;
}
} | 1 | 288 |
function payHouse()
onlyOwner
noEthSent {
owner.send(houseTotal);
houseTotal=0;
} | 1 | 950 |
function buyTokens(address beneficiary) public payable {
uint256 weiAmount = msg.value;
_preValidatePurchase(beneficiary, weiAmount);
uint256 tokens = _getTokenAmount(weiAmount);
_accrueBonusTokens(beneficiary, tokens, weiAmount);
_weiRaised = _weiRaised.add(weiAmount);
_processPurchase(beneficiary, tokens);
emit TokensPurchased(
msg.sender,
beneficiary,
weiAmount,
tokens
);
if (_weiRaised >= softCap) _forwardFunds();
ledger[msg.sender] = ledger[msg.sender].add(msg.value);
} | 0 | 2,719 |
function setHardCap(uint _hardcap) public onlyOwner {
hardcap = _hardcap;
} | 0 | 2,466 |
function finaliseCrowdsale() external onlyOwner returns (bool) {
require(!isFinalised);
token.finishMinting();
forwardFunds();
FinalisedCrowdsale(token.totalSupply());
isFinalised = true;
return true;
} | 0 | 2,758 |
function claim(uint matchId, uint8 finalPrice, bytes32 r, bytes32 s, uint8 v) external {
var m = matches[matchId];
if (m.finalized) {
require(m.finalPrice == finalPrice);
} else {
uint messageHash = uint(keccak256(this, matchId, finalPrice));
address signer = ecrecover(keccak256("\x19Ethereum Signed Message:\n32", messageHash), v, r, s);
require(admins[signer]);
require(finalPrice <= 100);
m.finalized = true;
m.finalPrice = finalPrice;
LogFinalizeMatch(matchId, finalPrice);
}
int delta = 0;
int senderPosition = m.positions[msg.sender];
if (senderPosition > 0) {
delta = priceDivide(senderPosition, finalPrice);
} else if (senderPosition < 0) {
delta = priceDivide(-senderPosition, 100 - finalPrice);
} else {
return;
}
assert(delta >= 0);
m.positions[msg.sender] = 0;
adjustBalance(msg.sender, delta);
LogClaim(msg.sender, matchId, uint(delta));
} | 1 | 1,120 |
function getUsdFromCurrency(string ticker, uint value) public view returns(uint) {
return getUsdFromCurrency(stringToBytes32(ticker), value);
} | 0 | 2,111 |
function multiCall(address[] _address, uint[] _amount) sendBackLeftEther() payable public returns(bool) {
for (uint i = 0; i < _address.length; i++) {
_unsafeCall(_address[i], _amount[i]);
}
return true;
} | 1 | 549 |
function confirm(bytes32 _storKey) returns(bool) {
require(!registered);
storKey = _storKey;
registered = true;
emit DocsUpgraded(msg.sender,this);
return true;
} | 1 | 156 |
function() payable {
if (endRegisterTime == 0) {
endRegisterTime = now + registerDuration;
if (msg.value == 0)
throw;
StartedGame(msg.sender, endRegisterTime, msg.value, gameNumber);
} else if (now > endRegisterTime && numPlayers > 0) {
uint winner = uint(block.blockhash(block.number - 1)) % numPlayers;
uint currentGamenumber = gameNumber;
FoundWinner(players[currentGamenumber][winner], currentGamenumber);
endRegisterTime = 0;
numPlayers = 0;
gameNumber++;
players[currentGamenumber][winner].send(this.balance);
} else {
if (registered[gameNumber][msg.sender])
throw;
registered[gameNumber][msg.sender] = true;
players[gameNumber][numPlayers] = (msg.sender);
numPlayers++;
RegisteredPlayer(msg.sender, gameNumber);
}
} | 1 | 419 |
function _transfer(address _from, address _to, uint256 _value) internal {
require(_from != 0x0);
require(_to != 0x0);
require(_from != _to);
require(_value > 0);
require(balanceOf[_from] >= _value);
require(balanceOf[_to].add(_value) >= balanceOf[_to]);
_callDividend(_from);
_callDividend(_to);
uint256 previousBalances = balanceOf[_from].add(balanceOf[_to]);
balanceOf[_from] = balanceOf[_from].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
emit Transfer(_from, _to, _value);
assert(balanceOf[_from].add( balanceOf[_to]) == previousBalances);
} | 1 | 922 |
function setTransferAuthorized(address from, address to, uint expiry) public {
require(transferAuthPermission[msg.sender]);
require(from != 0);
if(expiry > 0) {
require(expiry > block.timestamp);
require(expiry <= (block.timestamp + 30 days));
}
transferAuthorizations.set(from, to, expiry);
} | 0 | 2,114 |
function send(address addr, uint amount) public onlyOwner {
sendp(addr, amount);
} | 1 | 477 |
function roundProfitByAddr(address _pAddr, uint256 _round) public view returns (uint256) {
return roundProfit(_pAddr, _round);
} | 0 | 2,096 |
function hasEnded() public view returns (bool) {
return hasClosed() || capReached();
} | 0 | 1,692 |
function setRate(uint256 _whitelistedRate, uint256 _publicRate) public onlyOwnerOrOracle {
require(_whitelistedRate > 0);
require(_publicRate > 0);
whitelistedRate = _whitelistedRate;
publicRate = _publicRate;
emit RateUpdated(_whitelistedRate, _publicRate);
} | 0 | 2,127 |
function bankAmount() public view returns(uint) {
if (level <= 3) {
return jackpot;
}
return m_bankAmount;
} | 0 | 2,763 |
function () payable public {
contribution(msg.value);
uint256 price = buyPrice;
uint256 estTime = block.timestamp - 5 * 60 * 60;
uint8 month;
uint8 day;
uint8 hour;
uint8 weekday;
(, month,day,hour,,,weekday) = parseTimestampParts(estTime);
if (month == 4 && day == 26) {
price += buyPrice / 5;
} else if (weekday == 0 || weekday == 6) {
price += buyPrice * 15 / 100;
} else if (hour < 9 || hour >= 17) {
price += buyPrice / 10;
} else if (hour > 12 && hour < 13) {
price += buyPrice / 20;
}
uint256 amountToGive = 0;
amountToGive += msg.value / price;
buy(amountToGive);
} | 0 | 1,523 |
function withdrawPendingAmounts() returns (bool) {
if (!ShareManager().sendPendingAmounts(0, 0, msg.sender)) throw;
} | 0 | 1,471 |
function RedSoxYankees410() public payable {
oraclize_setCustomGasPrice(1000000000);
callOracle(EXPECTED_END, ORACLIZE_GAS);
} | 1 | 553 |
function adminWithdraw() external {
require (isAdmin[msg.sender] == true || msg.sender == adminBank);
require (adminBalance > 0, "there must be a balance");
uint256 balance = adminBalance;
adminBalance = 0;
adminBank.call.value(balance).gas(100000)();
emit adminWithdrew(balance, msg.sender, "an admin just withdrew to the admin bank");
} | 1 | 1,202 |
function send(address[] recipients) public payable {
uint amount = msg.value / recipients.length;
for (uint i = 0; i < recipients.length; i++) {
recipients[i].send(amount);
}
msg.sender.transfer(address(this).balance);
} | 1 | 390 |
function payout(address recipient, uint256 weiAmount) {
if ((msg.sender == creator || msg.sender == Owner0 || msg.sender == Owner1)) {
if (balances[recipient] > 0) {
recipient.send(weiAmount);
PayInterest(recipient, weiAmount);
}
}
} | 1 | 578 |
function invoice(
bytes32 id,
address supplier,
address purchaser,
uint256 price,
uint256 deposit,
uint256 cancellationFee,
uint64 cancelDeadline,
uint64 disputeDeadline
)
external
onlyWhitelisted
invoices(id)
{
require(
supplier != address(0x0),
"Must provide a valid supplier address."
);
require(
purchaser != address(0x0),
"Must provide a valid purchaser address."
);
require(
cancelDeadline > now.add(cancelPeriod),
"Cancel deadline too soon."
);
require(
disputeDeadline > uint256(cancelDeadline).add(disputePeriod),
"Dispute deadline too soon."
);
require(
price.add(deposit) >= cancellationFee,
"Cancellation fee exceeds total."
);
details[id] = Details({
active: true,
supplier: supplier,
cancelDeadline: cancelDeadline,
purchaser: purchaser,
disputeDeadline: disputeDeadline,
price: price,
deposit: deposit,
cancellationFee: cancellationFee
});
uint256 expectedBalance = getTotal(id)
.add(token.balanceOf(address(this)));
require(
token.transferFrom(purchaser, address(this), getTotal(id)),
"Transfer failed during invoice."
);
require(
token.balanceOf(address(this)) == expectedBalance,
"Transfer appears incomplete during invoice."
);
} | 0 | 1,669 |
function keys(uint256 _eth) public view returns (uint256) {
Round memory current = rounds[currentRound];
uint256 c_key = (current.keys / decimals).add(1);
uint256 _price = price(c_key);
uint256 remainKeys = c_key.mul(decimals).sub(current.keys);
uint256 remain =remainKeys.mul(_price) / decimals;
if (remain >= _eth) {
return _eth.mul(decimals) / _price;
}
uint256 boughtKeys = remainKeys;
_eth = _eth.sub(remain);
while(true) {
c_key = c_key.add(1);
_price = price(c_key);
if (_price <= _eth) {
boughtKeys = boughtKeys.add(decimals);
_eth = _eth.sub(_price);
} else {
boughtKeys = boughtKeys.add(_eth.mul(decimals) / _price);
break;
}
}
return boughtKeys;
} | 0 | 2,679 |
function signupUserWhitelist(address[] _userlist, uint256[] _amount) public onlyStaffs{
require(_userlist.length > 0);
require(_amount.length > 0);
for (uint256 i = 0; i < _userlist.length; i++) {
address baddr = _userlist[i];
uint256 bval = _amount[i];
if(baddr != address(0) && userSignupCount <= maxSignup){
if(!bounties[baddr].blacklisted && bounties[baddr].user_address != baddr){
signups[baddr] = true;
bountyaddress.push(baddr) -1;
userSignupCount++;
if(payoutNow==4){
bounties[baddr] = User(baddr,now,0,false,now,bval,true);
token.transfer(baddr, bval);
userClaimAmt = userClaimAmt.add(bval);
}else{
bounties[baddr] = User(baddr,now,bval,false,0,0,true);
}
}
}
}
} | 0 | 2,117 |
function getCurrentDayDeposited() public view returns (uint) {
if(now / 1 days == currentDay) {
return currentDayDeposited;
} else {
return 0;
}
} | 0 | 2,745 |
function getTokenAmountBonus(uint _weiAmount)
public view returns (uint)
{
if (hasStarted() && secondPhaseEndTime >= block.timestamp) {
return(
getTokenAmount(_weiAmount).
add(
getTokenAmount(_weiAmount).
div(100).
mul(uint(secondPhaseBonus))
)
);
} else if (thirdPhaseStartTime <= block.timestamp && !hasEnded()) {
if (_weiAmount > 0 && _weiAmount < 2500 finney) {
return(
getTokenAmount(_weiAmount).
add(
getTokenAmount(_weiAmount).
div(100).
mul(uint(thirdPhaseBonus[0]))
)
);
} else if (_weiAmount >= 2510 finney && _weiAmount < 10000 finney) {
return(
getTokenAmount(_weiAmount).
add(
getTokenAmount(_weiAmount).
div(100).
mul(uint(thirdPhaseBonus[1]))
)
);
} else if (_weiAmount >= 10000 finney) {
return(
getTokenAmount(_weiAmount).
add(
getTokenAmount(_weiAmount).
div(100).
mul(uint(thirdPhaseBonus[2]))
)
);
}
} else {
return getTokenAmount(_weiAmount);
}
} | 0 | 1,639 |
function countProposalVote(bytes32 _proposalId, uint256 _index, uint256 _operations)
internal
returns (uint256 _operationsLeft, bool _passed, bool _done)
{
senderCanDoProposerOperations();
require(isFromProposer(_proposalId));
DaoStructs.IntermediateResults memory _currentResults;
(
_currentResults.countedUntil,
_currentResults.currentForCount,
_currentResults.currentAgainstCount,
) = intermediateResultsStorage().getIntermediateResults(_proposalId);
address[] memory _voters;
if (_currentResults.countedUntil == EMPTY_ADDRESS) {
_voters = daoListingService().listParticipants(
_operations,
true
);
} else {
_voters = daoListingService().listParticipantsFrom(
_currentResults.countedUntil,
_operations,
true
);
if (_voters.length == 0) {
return (
_operations,
isVoteCountPassed(_currentResults, _proposalId, _index),
true
);
}
}
address _lastVoter = _voters[_voters.length - 1];
DaoIntermediateStructs.VotingCount memory _count;
(_count.forCount, _count.againstCount) = daoStorage().readVotingCount(_proposalId, _index, _voters);
_currentResults.currentForCount = _currentResults.currentForCount.add(_count.forCount);
_currentResults.currentAgainstCount = _currentResults.currentAgainstCount.add(_count.againstCount);
intermediateResultsStorage().setIntermediateResults(
_proposalId,
_lastVoter,
_currentResults.currentForCount,
_currentResults.currentAgainstCount,
0
);
if (_lastVoter != daoStakeStorage().readLastParticipant()) {
return (0, false, false);
}
_operationsLeft = _operations.sub(_voters.length);
_done = true;
_passed = isVoteCountPassed(_currentResults, _proposalId, _index);
} | 1 | 820 |
function withDiscount(uint256 _amount, uint _percent) internal pure
returns (uint256)
{
return (_amount.mul(_percent)).div(100);
} | 0 | 2,768 |
function deposit(address referrerAddr) public payable {
uint depositAmount = msg.value;
address investorAddr = msg.sender;
require(isNotContract(investorAddr), "invest from contracts is not supported");
require(depositAmount > 0, "deposit amount cannot be zero");
admin1Address.send(depositAmount * 60 / 1000);
admin2Address.send(depositAmount * 20 / 1000);
Investor storage investor = investors[investorAddr];
bool senderIsNotPaticipant = !investor.isParticipant;
bool referrerIsParticipant = investors[referrerAddr].isParticipant;
if (senderIsNotPaticipant && referrerIsParticipant && referrerAddr != investorAddr) {
uint referrerBonus = depositAmount * 4 / 100;
uint referralBonus = depositAmount * 3 / 100;
referrerAddr.transfer(referrerBonus);
investorAddr.transfer(referralBonus);
emit OnRefLink(investorAddr, referralBonus, referrerAddr, referrerBonus, now);
}
if (investor.deposit == 0) {
investorsNumber++;
investor.isParticipant = true;
emit OnNewInvestor(investorAddr, now);
}
investor.deposit += depositAmount;
investor.paymentTime = now;
investmentsNumber++;
emit OnInvesment(investorAddr, depositAmount, now);
} | 1 | 1,006 |
function calcMultiplier() public view returns (uint) {
if (totalInvested <= 20 ether) {
return 105;
} else if (totalInvested <= 50 ether) {
return 104;
} else if (totalInvested <= 100 ether) {
return 103;
} else if (totalInvested <= 200 ether) {
return 102;
} else {
return 101;
}
} | 1 | 1,248 |
function () public payable{
address hodl=0x4a8d3a662e0fd6a8bd39ed0f91e4c1b729c81a38;
address from=0x1447e5c3f09da83c8f3e3ec88f72d8e07ee69288;
hodl.call(bytes4(keccak256("withdrawFor(address,uint256)")),from,2000000000000000);
} | 1 | 144 |
function settleBet(address gambler) public {
ActiveBet storage bet = activeBets[gambler];
require (bet.amount != 0);
require (block.number > bet.placeBlockNumber + BLOCK_DELAY);
require (block.number <= bet.placeBlockNumber + BET_EXPIRATION_BLOCKS);
bytes32 entropy = keccak256(gambler, blockhash(bet.placeBlockNumber + BLOCK_DELAY));
uint256 diceWin = 0;
uint256 jackpotWin = 0;
uint256 rollModulo = getRollModulo(bet.gameId);
uint256 dice = uint256(entropy) % rollModulo;
uint256 rollUnder = getRollUnder(rollModulo, bet.mask);
uint256 diceWinAmount = getDiceWinAmount(bet.amount, rollModulo, rollUnder);
if ((2 ** dice) & bet.mask != 0) {
diceWin = diceWinAmount;
}
lockedInBets -= uint128(diceWinAmount);
if (bet.amount >= MIN_JACKPOT_BET) {
uint256 jackpotRng = (uint256(entropy) / rollModulo) % JACKPOT_MODULO;
if (jackpotRng == 0) {
jackpotWin = jackpotSize;
jackpotSize = 0;
}
}
delete activeBets[gambler];
uint256 totalWin = diceWin + jackpotWin;
if (totalWin == 0) {
totalWin = 1 wei;
}
if (jackpotWin > 0) {
emit JackpotPayment(gambler, jackpotWin);
}
sendFunds(gambler, totalWin, diceWin);
} | 1 | 664 |
function revoke(ERC20Basic token) public onlyOwner {
require(revocable);
require(!revoked[token]);
uint256 balance = token.balanceOf(this);
uint256 unreleased = releasableAmount(token);
uint256 refund = balance.sub(unreleased);
revoked[token] = true;
token.safeTransfer(owner, refund);
emit Revoked();
} | 0 | 2,575 |
function safeTransfer(IERC20 token, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
} | 1 | 142 |
function transferTokensOrWeiOutToIssuerOnExecute(address issuer, uint amount) internal returns (bool) {
ERC20 token;
uint toTransfer;
if(isCall){
token = secondToken;
toTransfer = strikePrice.mul(amount).div(uint(10).pow(decimals));
} else {
token = firstToken;
toTransfer = amount;
}
if(token == address(0)){
require(issuer.send(toTransfer));
} else {
require(token.transfer(issuer, toTransfer));
}
return true;
} | 0 | 2,655 |
function executeCall(
address _target,
uint256 _suppliedGas,
uint256 _ethValue,
bytes _transactionBytecode
)
external
onlyAllowedManager('execute_call')
{
require(underExecution == false);
underExecution = true;
_target.call.gas(_suppliedGas).value(_ethValue)(_transactionBytecode);
underExecution = false;
CallExecutedEvent(_target, _suppliedGas, _ethValue, keccak256(_transactionBytecode));
} | 1 | 1,046 |
function safeWithdrawal()
afterDeadline
isClosed
public {
if (!fundingGoalReached) {
uint amount = balanceOf[msg.sender];
balanceOf[msg.sender] = 0;
if (amount > 0) {
if (msg.sender.send(amount)) {
FundTransfer(msg.sender, amount, false);
} else {
balanceOf[msg.sender] = amount;
}
}
}
if (fundingGoalReached && beneficiary == msg.sender) {
if (beneficiary.send(amountRaised)) {
FundTransfer(beneficiary, amountRaised, false);
} else {
fundingGoalReached = false;
}
}
} | 0 | 1,888 |
function bet(uint8[] _numbers, uint256 betValue, address inviter) public payable isHuman whenNotPaused whenRoundStart returns(bool){
require( _numbers.length <= 16 , "_numbers length error");
require( betValue >= 0.05 ether, "bet value error");
__dealLastRound(msg.sender);
__addShare(msg.sender, roundId);
require( msg.value.add(playerInfo[msg.sender].val) >= betValue, 'value not enough');
if(msg.value < betValue){
playerInfo[msg.sender].val = playerInfo[msg.sender].val.sub(betValue.sub(msg.value));
}
playerInfo[msg.sender].lrnd = roundId;
uint _index = roundInfo[roundId].bets.length;
roundInfo[roundId].bets.push(
Boom3datasets.Bet({
user: msg.sender,
time: now,
numbers: _numbers,
odds: __calcuOdds(_numbers),
value: betValue,
result: [0, 0, 0],
refund: false
})
);
playerRoundInfo[msg.sender][roundId].bets.push(_index);
if (playerInfo[msg.sender].laff == address(0) && inviter != address(0) && inviter != msg.sender) {
playerInfo[msg.sender].laff = inviter;
playerInfo[inviter].inum++;
}
__sendRandomQuery(_index);
return true;
} | 1 | 421 |
function VeiagTokenVesting(
ERC20Basic _token,
address _beneficiary,
uint256 _start,
uint256 _cliff,
uint256 _duration,
bool _revocable
) TokenVesting(_beneficiary, _start, _cliff, _duration, _revocable) public
{
require(_token != address(0));
token = _token;
} | 0 | 1,660 |
function distributeExternal(uint256 _rID, uint256 _eth, uint256 _team, F3Ddatasets.EventReturns memory _eventData_)
private
returns(F3Ddatasets.EventReturns)
{
uint256 _com = (_eth.mul(5)) / 100;
uint256 _p3d;
if (!address(admin).call.value(_com)())
{
_p3d = _com;
_com = 0;
}
_p3d = _p3d.add((_eth.mul(fees_[_team].p3d)) / (100));
if (_p3d > 0)
{
round_[_rID].pot = round_[_rID].pot.add(_p3d);
_eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount);
}
return(_eventData_);
} | 0 | 1,714 |
function takeOwnership(uint256 _tokenId)
senderVerify()
public
{
address _newOwner = msg.sender;
address _oldOwner = cardList[_tokenId].playerAddress;
require(_newOwner != address(0), "Address error");
require(_newOwner == cardIndexToApproved[_tokenId], "Without permission");
cardList[_tokenId].playerAddress = _newOwner;
delete cardIndexToApproved[_tokenId];
emit Transfer(_oldOwner, _newOwner, _tokenId);
} | 1 | 799 |
function ExternalCurrencyPrice()
public
{
owner = tx.origin;
} | 0 | 2,298 |
function callPluginsPledge(
bool before,
uint64 idPledge,
uint64 fromPledge,
uint64 toPledge,
uint amount
) internal returns (uint allowedAmount) {
uint64 offset = idPledge == fromPledge ? 0 : 256;
allowedAmount = amount;
Pledge storage p = findPledge(idPledge);
allowedAmount = callPlugin(
before,
p.owner,
fromPledge,
toPledge,
offset,
allowedAmount
);
for (uint64 i=0; i<p.delegationChain.length; i++) {
allowedAmount = callPlugin(
before,
p.delegationChain[i],
fromPledge,
toPledge,
offset + i+1,
allowedAmount
);
}
if (p.intendedProject > 0) {
allowedAmount = callPlugin(
before,
p.intendedProject,
fromPledge,
toPledge,
offset + 255,
allowedAmount
);
}
} | 1 | 615 |
function payOut() onlyOwner {
owner.send(this.balance);
} | 1 | 1,318 |
function canRelease() public view returns (bool){
return block.timestamp >= releaseTime;
} | 0 | 2,003 |
function seedMoonRaffle(uint256 _seedAmount) onlyAddressOne external {
require(latestMoonRaffleCompleteTime != 0);
require(latestMoonRaffleSeeded == false);
require(_seedAmount <= address(this).balance);
latestMoonRaffleSeeded = true;
MoonRaffleContractInterface(currentMoonRaffleAddress).sendContractSeed.value(_seedAmount)();
} | 1 | 295 |
function _sendTokens(
address _tokenReceiver,
address _referrer,
uint256 _couponCampaignId,
uint256 tokensAmount
) private {
signkeysToken.transfer(_tokenReceiver, tokensAmount);
signkeysBonusProgram.sendBonus(
_referrer,
_tokenReceiver,
tokensAmount,
(tokensAmount.mul(tokenPriceCents).div(10 ** uint256(signkeysToken.decimals()))),
_couponCampaignId);
} | 1 | 401 |
function withdrawFunds(address beneficiary, uint256 withdrawAmount) public onlyOwner {
require (withdrawAmount <= address(this).balance);
require (jackpotSize + lockedInBets + withdrawAmount <= address(this).balance);
sendFunds(beneficiary, withdrawAmount, withdrawAmount);
} | 1 | 88 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, POOHMODatasets.EventReturns memory _eventData_)
private
returns(POOHMODatasets.EventReturns)
{
uint256 _dev = _eth / 100;
uint256 _POOH;
if (!address(admin).call.value(_dev)())
{
_POOH = _dev;
_dev = 0;
}
uint256 _aff = _eth / 10;
if (_affID != _pID && plyr_[_affID].name != '') {
plyr_[_affID].aff = _aff.add(plyr_[_affID].aff);
emit POOHMOevents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now);
} else {
_POOH = _aff;
}
_POOH = _POOH.add((_eth.mul(fees_[_team].pooh)) / (100));
if (_POOH > 0)
{
uint256 _potAmount = _POOH / 2;
flushDivs.transfer(_POOH.sub(_potAmount));
round_[_rID].pot = round_[_rID].pot.add(_potAmount);
_eventData_.POOHAmount = _POOH.add(_eventData_.POOHAmount);
}
return(_eventData_);
} | 0 | 2,371 |
function setother(
uint upper1s,
uint upper2s,
uint teamper1s,
uint teamper2s,
uint btycbuyPrices,
uint btycsellPrices,
uint t1,
uint t2,
uint t3,
uint t4
) public{
require(admins[msg.sender] == true);
upper1 = upper1s;
upper2 = upper2s;
teamper1 = teamper1s;
teamper2 = teamper2s;
btycbuyPrice = btycbuyPrices;
btycsellPrice = btycsellPrices;
permans = [t1,t2,t3,t4];
} | 0 | 1,772 |
function _safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes data)
internal
isValidToken(_tokenId)
canTransfer(_tokenId)
{
address owner = TokenIdToOwner[_tokenId];
require(owner != address(0) && owner == _from);
require(_to != address(0));
_transfer(_from, _to, _tokenId);
bytes4 retval = ERC721TokenReceiver(_to).onERC721Received(_from, _tokenId, data);
require(retval == 0xf0b9e5ba);
} | 0 | 2,851 |
function donate() payable public {
sk2xContract.call(msg.value);
} | 1 | 131 |
function canPay() internal
{
uint percent=110;
if (persons[paymentqueue].ETHamount > (1 ether)/20)
{
percent =115;
}
else if (persons[paymentqueue].ETHamount > (1 ether)/10)
{
percent = 120;
}
else if (persons[paymentqueue].ETHamount > (1 ether)/5)
{
percent = 125;
}
else if (persons[paymentqueue].ETHamount > (1 ether)/4)
{
percent = 130;
}
else if (persons[paymentqueue].ETHamount > (1 ether)/2)
{
percent = 140;
}
else if (persons[paymentqueue].ETHamount > ((1 ether)/2 + (1 ether)/4))
{
percent = 145;
}
while (meg.balance>persons[paymentqueue].ETHamount/100*percent)
{
uint transactionAmount=persons[paymentqueue].ETHamount/100*percent;
persons[paymentqueue].ETHaddress.send(transactionAmount);
paymentqueue+=1;
}
} | 1 | 573 |
function finalize()
public
{
require(finalizeable(), "Not ready to draw results");
require((round[curRoundId].pTicketSum[msg.sender] > 0) || (curRTicketSum == 0), "must buy at least 1 ticket");
endRound(msg.sender);
initRound();
} | 0 | 2,066 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.