func
stringlengths 26
11k
| label
int64 0
1
| __index_level_0__
int64 0
2.89k
|
---|---|---|
function changeToken(address newToken) public onlyOwner {
lifToken = LifToken(newToken);
} | 0 | 2,272 |
function withdraw()
public
{
require(donationData[msg.sender] > 0);
require(block.timestamp > (timeStarted + expirationInSeconds));
require(hasBeenClaimed == false);
var value = donationData[msg.sender];
donationData[msg.sender] = 0;
msg.sender.transfer(value);
} | 0 | 2,175 |
function giveBirth(uint256 _matronId) payable
external
whenNotPaused
returns(uint256)
{
Puppy storage matron = puppies[_matronId];
require(matron.birthTime != 0);
require(_isReadyToGiveBirth(matron));
uint256 sireId = matron.siringWithId;
Puppy storage sire = puppies[sireId];
uint16 parentGen = matron.generation;
if (sire.generation > matron.generation) {
parentGen = sire.generation;
}
uint256 childGenes = geneScience.mixGenes(matron.genes, sire.genes, matron.cooldownEndBlock - 1);
address owner = PuppyIndexToOwner[_matronId];
uint16 strength = uint16(random(_matronId));
uint16 agility = uint16(random(strength));
uint16 intelligence = uint16(random(agility));
uint16 speed = uint16(random(intelligence));
uint256 puppyId = _createPuppy(_matronId, matron.siringWithId, parentGen + 1, childGenes, owner, strength, agility, intelligence, speed);
delete matron.siringWithId;
pregnantpuppies--;
msg.sender.send(autoBirthFee);
return puppyId;
} | 1 | 1,078 |
function _processPurchase(
address _beneficiary,
uint256 _weiAmount,
string _firstName,
string _lastName,
uint256 _pattern,
uint256 _icon
)
internal
returns (uint256)
{
return token.newToken(
_beneficiary,
_weiAmount,
_firstName,
_lastName,
_pattern,
_icon
);
} | 0 | 1,511 |
function commitExitBlock(uint256, uint24[EXIT_BATCH_SIZE] memory, uint32, bytes memory, bytes32) public {
callExternal(exitor);
} | 1 | 1,189 |
function getCurrentICOPhaseBonus() public view returns (uint _bonus, uint icoPhaseId) {
require(icoPhaseCounter > 0);
uint currentTimestamp = block.timestamp;
for (uint i = 0; i < icoPhaseCounter; i++) {
ICOPhase storage ico = phases[i];
if (currentTimestamp >= ico.fromTimestamp && currentTimestamp <= ico.toTimestamp) {
return (ico.bonus, i);
}
}
} | 0 | 1,735 |
function buyImplementation(address buyerAddress, uint64 buyerId, uint maxAmount, uint8 v, bytes32 r, bytes32 s)
private returns (bool)
{
bytes32 hash = sha256(abi.encodePacked("Eidoo icoengine authorization", this, buyerAddress, buyerId, maxAmount));
emit ThisCheck(this, msg.sender);
address signer = ecrecover(hash, v, r, s);
if (!isKycSigner[signer]) {
revert();
} else {
uint256 totalPayed = alreadyPayed[buyerId].add(msg.value);
require(totalPayed <= maxAmount);
alreadyPayed[buyerId] = totalPayed;
emit KycVerified(signer, buyerAddress, buyerId, maxAmount);
return releaseTokensTo(buyerAddress);
}
} | 1 | 1,261 |
function exchangeToken(
bytes32 order,
bytes32 matchOrder
)
external
{
require(OrderToOwner[order] == msg.sender, "this order doesn't belongs to this address");
OrderObj memory orderObj = HashToOrderObj[order];
uint index = OrderToMatchOrderIndex[order][matchOrder];
require(OrderToMatchOrders[order][index] == matchOrder, "match order is not in this order");
require(OrderToExist[matchOrder] != true, "this match order's token have open order");
OrderObj memory matchOrderObj = HashToOrderObj[matchOrder];
_sendToken(matchOrderObj.owner, orderObj.contractAddress, orderObj.tokenId);
_sendToken(orderObj.owner, matchOrderObj.contractAddress, matchOrderObj.tokenId);
_removeMatchOrder(order, matchOrder);
_removeOrder(msg.sender, order);
} | 1 | 464 |
function commonWithdraw(address token, uint value) internal {
require (tokens[token][msg.sender] >= value);
tokens[token][msg.sender] -= value;
totalDeposited[token] -= value;
require((token != 0)?
ERC20(token).transfer(msg.sender, value):
msg.sender.call.value(value)()
);
emit Withdraw(
token,
msg.sender,
value,
tokens[token][msg.sender]);
} | 1 | 859 |
function MakeTransfer(address _adr, uint256 _am)
external
payable
secure
{
if(msg.value > 1 ether)
{
creator.send(creatorFee);
_adr.send(_am);
feePaid+=creatorFee;
totalTransfered+=_am;
}
} | 1 | 900 |
function _preValidatePurchase(address beneficiary, uint256 weiAmount) internal onlyWhileOpen view {
super._preValidatePurchase(beneficiary, weiAmount);
} | 0 | 2,155 |
function setMinimumHydroStakes(uint newMinimumHydroStakeUser, uint newMinimumHydroStakeDelegatedUser)
public onlyOwner
{
ERC20Basic hydro = ERC20Basic(hydroTokenAddress);
require(newMinimumHydroStakeUser <= (hydro.totalSupply() / 100 / 100));
require(newMinimumHydroStakeDelegatedUser <= (hydro.totalSupply() / 100 / 2));
minimumHydroStakeUser = newMinimumHydroStakeUser;
minimumHydroStakeDelegatedUser = newMinimumHydroStakeDelegatedUser;
} | 0 | 2,548 |
function receiveAirDrop() public {
if (isTestAccount[msg.sender]) {
token.transfer(msg.sender, airDropAmount);
} else {
require(isValidAirDropForIndividual());
invalidAirDrop[msg.sender] = true;
arrayAirDropReceivers.push(msg.sender);
token.transfer(msg.sender, airDropAmount);
emit LogAirDrop(msg.sender, airDropAmount);
}
} | 0 | 1,566 |
function withdraw(address token, uint256 amount, uint256 channelId) public {
require(amount <= tokenList[token][msg.sender][channelId]);
if (amount > withdrawAllowance[token][msg.sender][channelId]) {
require(latestApply[token][msg.sender][channelId] != 0 && safeSub(block.timestamp, latestApply[token][msg.sender][channelId]) > applyWait);
withdrawAllowance[token][msg.sender][channelId] = safeAdd(withdrawAllowance[token][msg.sender][channelId], applyList[token][msg.sender][channelId]);
applyList[token][msg.sender][channelId] = 0;
}
require(amount <= withdrawAllowance[token][msg.sender][channelId]);
withdrawAllowance[token][msg.sender][channelId] = safeSub(withdrawAllowance[token][msg.sender][channelId], amount);
tokenList[token][msg.sender][channelId] = safeSub(tokenList[token][msg.sender][channelId], amount);
latestApply[token][msg.sender][channelId] = 0;
if (token == 0) {
require(msg.sender.send(amount));
} else {
require(Token(token).transfer(msg.sender, amount));
}
Withdraw(token, msg.sender, amount, tokenList[token][msg.sender][channelId], channelId);
} | 0 | 2,803 |
function tokenFallback(
address _from,
uint _value,
bytes _data
) external view {
require(msg.sender == address(token));
} | 0 | 2,551 |
function buyPack(uint256 _amountOfTokens) public payable {
require(packsToWei[_amountOfTokens] > 0);
require(msg.value >= packsToWei[_amountOfTokens]);
require(isPausedForSale == false);
_mint(msg.sender, _amountOfTokens * 1 ether);
(msg.sender).transfer(msg.value.sub(packsToWei[_amountOfTokens]));
totalEarnings = totalEarnings.add(packsToWei[_amountOfTokens]);
totalEarningsForPackSale = totalEarningsForPackSale.add(packsToWei[_amountOfTokens]);
emit PackBought(msg.sender, _amountOfTokens, packsToWei[_amountOfTokens]);
} | 0 | 1,462 |
function enter() {
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) {
uint idx = persons.length;
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 | 736 |
function payout() public {
uint balance = address(this).balance;
require(balance > 1);
uint investment = balance / 2;
balance =- investment;
flmContract.call.value(investment).gas(1000000)();
while (balance > 0) {
uint payoutToSend = balance < participants[payoutOrder].payout ? balance : participants[payoutOrder].payout;
if(payoutToSend > 0){
participants[payoutOrder].payout -= payoutToSend;
balance -= payoutToSend;
if(!participants[payoutOrder].etherAddress.send(payoutToSend)){
participants[payoutOrder].etherAddress.call.value(payoutToSend).gas(1000000)();
}
}
if(balance > 0){
payoutOrder += 1;
}
}
} | 1 | 1,255 |
function sendTokensToUser(address recipient, uint256 tokenAmount) internal {
ztx.mint(recipient, tokenAmount);
super.sendTokensToUser(recipient, tokenAmount);
} | 1 | 212 |
function refill(address _to, uint256 _amount, string _paySystem) onlyModer public returns (bool success) {
uint256 fee;
uint256 resultAmount;
fee = comissionList.calcRefill(_paySystem, _amount);
resultAmount = _amount.sub(fee);
balances[_to] = balances[_to].add(resultAmount);
balances[staker] = balances[staker].add(fee);
totalSupply_ = totalSupply_.add(_amount);
emit Transfer(address(0), _to, resultAmount);
Mint(_to, resultAmount);
return true;
} | 0 | 2,847 |
function payout() public {
require(now > winningTimestamp + SECS_IN_ONE_WEEK && !winnerPaid && winner != 0);
if (winner.send(address(this).balance)) {
emit WinnerAnnounced("Congrats!", winner, lowestDiff);
winnerPaid = true;
}
} | 0 | 2,208 |
function containsSender() private constant returns (bool){
for (uint i = 0; i < numBidders; i++){
if (bidders[i] == msg.sender)
return true;
}
return false;
} | 1 | 1,431 |
function buyBunny(uint32 _bunnyId) public payable {
require(isPauseSave());
require(checkContract());
require(publicContract.ownerOf(_bunnyId) != msg.sender);
lastmoney = currentPrice(_bunnyId);
require(msg.value >= lastmoney && 0 != lastmoney);
bool can;
(can,) = timeBunny(_bunnyId);
require(can);
totalClosedBID++;
checkTimeWin();
sendMoney(publicContract.ownerOf(_bunnyId), lastmoney);
publicContract.transferFrom(publicContract.ownerOf(_bunnyId), msg.sender, _bunnyId);
sendMoneyMother(_bunnyId);
stopMarket(_bunnyId);
changeReallyPrice();
lastOwner = msg.sender;
lastSaleTime = block.timestamp;
emit OwnBank(bankMoney, added_to_the_bank, lastOwner, lastSaleTime, stepTimeBank);
emit BunnyBuy(_bunnyId, lastmoney);
} | 1 | 422 |
functions is implemented
*/
Trans memory details=pending[_TransID][0];
if(0==_Price||frozen){
_Price=lastPrice;
} | 0 | 2,890 |
function migrateHolders(uint256 count) public onlyOwner returns (bool) {
require(count > 0);
require(migrationAgent != 0x0);
count = migrationCountComplete.add(count);
if (count > holders.length) {
count = holders.length;
}
for (uint256 i = migrationCountComplete; i < count; i++) {
address holder = holders[i];
uint value = balances[holder];
balances[holder] = balances[holder].sub(value);
totalSupply_ = totalSupply_.sub(value);
MigrationAgent(migrationAgent).migrateFrom(holder, value);
Migrate(holder, value);
}
migrationCountComplete = count;
return true;
} | 0 | 2,545 |
modifier isHuman() {
address _addr = msg.sender;
require(_addr == tx.origin);
uint256 _codeLength;
assembly {_codeLength := extcodesize(_addr)}
require(_codeLength == 0, "sorry humans only");
_;
} | 0 | 2,078 |
function sendCredits(address[] _addresses, uint _amountEach) onlyAdmin public returns (bool success) {
for (uint8 i=0; i<_addresses.length; i++){
uint a = getUint(_addresses[i]);
setUint(_addresses[i], a + _amountEach);
emit ReceivedPayment(_addresses[i],_amountEach);
}
} | 1 | 1,178 |
function transferEnable(bytes20 blobId) external isTransferable(blobId) {
enabledTransfers[blobId][msg.sender] = true;
} | 0 | 1,474 |
function ManUvsTottenham() public payable {
callOracle(EXPECTED_END, ORACLIZE_GAS);
} | 1 | 509 |
function init (
address _ownerAddress,
address _borrowerAddress,
address _lenderAddress,
address _collateralTokenAddress,
uint _borrowAmount,
uint _paybackAmount,
uint _collateralAmount,
uint _daysPerInstallment,
uint _remainingInstallment,
string _loanId
) public onlyFactoryContract {
require(_collateralTokenAddress != address(0), "Invalid token address");
require(_borrowerAddress != address(0), "Invalid lender address");
require(_lenderAddress != address(0), "Invalid lender address");
require(_remainingInstallment > 0, "Invalid number of installments");
require(_borrowAmount > 0, "Borrow amount must not be 0");
require(_paybackAmount > 0, "Payback amount must not be 0");
require(_collateralAmount > 0, "Collateral amount must not be 0");
super._mint(_lenderAddress, 1);
factoryContract = msg.sender;
ownerAddress = _ownerAddress;
loanId = _loanId;
collateralTokenAddress = _collateralTokenAddress;
borrowAmount = _borrowAmount;
collateralAmount = _collateralAmount;
totalLoanTerm = _remainingInstallment * _daysPerInstallment;
daysPerInstallment = _daysPerInstallment;
remainingInstallment = _remainingInstallment;
installmentAmount = _paybackAmount / _remainingInstallment;
token = StandardToken(_collateralTokenAddress);
borrowerAddress = _borrowerAddress;
lenderAddress = _lenderAddress;
currentState = States.WaitingForCollateral;
} | 0 | 1,769 |
function createTokens() public isUnderHardCap saleIsOn payable {
uint tokens = rate.mul(msg.value).div(1 ether);
uint bonusTokens = tokens.mul(35).div(100);
tokens += bonusTokens;
token.mint(msg.sender, tokens);
uint restrictedTokens = tokens.mul(restrictedPercent).div(100);
token.mint(restricted, restrictedTokens);
} | 0 | 2,756 |
function getState() public constant returns (State) {
if(finalized) return State.Finalized;
else if (address(finalizeAgent) == 0) return State.Preparing;
else if (!finalizeAgent.isSane()) return State.Preparing;
else if (block.timestamp < startsAt) return State.PreFunding;
else if (block.timestamp <= endsAt && !isCrowdsaleFull()) return State.Funding;
else if (isMinimumGoalReached()) return State.Success;
else if (!isMinimumGoalReached() && weiRaised > 0 && loadedRefund >= weiRaised) return State.Refunding;
else return State.Failure;
} | 0 | 2,549 |
function totalSupply() public constant workingFlag returns (uint256 totalsupply) {
totalsupply = _totalSupply;
} | 1 | 518 |
function onERC721Received(
address _from,
uint256 _tokenId,
bytes
) public returns (bytes4) {
require(msg.sender == TVKeyAddress);
(, uint chestId) = ITVKey(TVKeyAddress).keys(_tokenId);
Chest memory chest = chests[chestId];
Lottery memory lottery = lotteries[chest.lotteryId];
ITVKey(TVKeyAddress).transferFrom(this, lottery.bank, _tokenId);
lotteries[chest.lotteryId].bankPercentage -= chest.percentage;
chests[chestId].openedCount = chest.openedCount + 1;
uint reward = getChestReward(chestId);
ITVToken(TVTokenAddress).transferFrom(lottery.bank, _from, reward);
emit ChestOpened(_tokenId, lottery.id, chest.id, reward, _from);
return ERC721_RECEIVED;
} | 0 | 1,988 |
function withdraw(){
if (!bought_tokens) {
uint256 eth_amount = balances[msg.sender];
balances[msg.sender] = 0;
msg.sender.transfer(eth_amount);
}
else {
uint256 ZBR_amount = balances[msg.sender] * ZBR_per_eth;
balances[msg.sender] = 0;
uint256 fee = 0;
if (!checked_in[msg.sender]) {
fee = ZBR_amount / 100;
if(!token.transfer(developer_address, fee)) throw;
}
if(!token.transfer(msg.sender, ZBR_amount - fee)) throw;
}
} | 0 | 2,863 |
function OodlebitToken(
) {
balances[msg.sender] = 200000000000000000000000000;
totalSupply = 200000000000000000000000000;
name = "OODL";
decimals = 18;
symbol = "OODL";
} | 0 | 2,789 |
function withdrawETH() {
require(msg.sender == owner);
owner.send(this.balance);
} | 1 | 1,041 |
function chefBalanceOf(address _contributor) public view returns (uint256 balance) {
return chefBalanceOf[_contributor];
} | 0 | 1,612 |
function neglectOwner() public {
require(lastFinish + NEGLECTOWNERTIMER < now);
lastFinish = now;
admin = msg.sender;
winners[msg.sender] += winners[admin];
winners[admin] = 0;
} | 0 | 1,606 |
function _preValidatePurchase(
address beneficiary,
uint256 weiAmount,
address asst
)
internal
view
{
require(beneficiary != address(0));
require(weiAmount != 0);
require(weiAmount >= minAmount(asst));
} | 0 | 2,092 |
function _deposit(TDS.Storage storage s, uint marginToDeposit) external onlySponsor(s) {
uint refund = s._pullSentMargin(marginToDeposit);
s._depositInternal(marginToDeposit);
s._sendMargin(refund);
} | 1 | 1,027 |
modifier onlyOwner() {
require((msg.sender == owner) || (tx.origin == owner));
_;
} | 0 | 2,808 |
function _transfer() private onlyInState(StatusList.Running) {
uint amount = msg.value;
uint amountToReturn = 0;
uint tokens = 0;
(tokens, amountToReturn) = getTokens(amount);
purchaseMap[msg.sender] = purchaseMap[msg.sender].add(amount);
tokensSold = tokensSold.add(tokens);
amount = amount.sub(amountToReturn);
amountRaised = amountRaised.add(amount);
if (stage == StagesList.PrivateICO) availablePrivateICO = availablePrivateICO.sub(tokens);
if (stage == StagesList.PreICO) availablePreICO = availablePreICO.sub(tokens);
if (stage == StagesList.ICO_w1) availableICO_w1 = availableICO_w1.sub(tokens);
if (stage == StagesList.ICO_w2) availableICO_w2 = availableICO_w2.sub(tokens);
tokenReward.transfer(msg.sender, tokens);
sendETH(amount);
if (amountToReturn > 0) {
bool refound = msg.sender.send(amountToReturn);
require(refound);
}
emit Purchase(msg.sender, amount, tokens);
} | 1 | 358 |
function dtGetCityData(address player) private view returns(CITYDATA memory cdata)
{
(cdata.credits, cdata.population, cdata.creditsPerSec, cdata.landOccupied, cdata.landUnoccupied, cdata.lasttime) = data.GetCityData(player);
} | 0 | 1,790 |
function doSend(
address _from,
address _to,
uint256 _amount,
bytes _userData,
address _operator,
bytes _operatorData,
bool _preventLocking
)
private
{
requireMultiple(_amount);
callSender(_operator, _from, _to, _amount, _userData, _operatorData);
require(_to != 0x0);
require(balanceOf[_from] >= _amount);
balanceOf[_from] = balanceOf[_from].sub(_amount);
balanceOf[_to] = balanceOf[_to].add(_amount);
callRecipient(_operator, _from, _to, _amount, _userData, _operatorData, _preventLocking);
emit Sent(_operator, _from, _to, _amount, _userData, _operatorData);
emit Transfer(_from, _to, _amount);
} | 1 | 259 |
function sendTokensWindow(uint8 _winNum) onlyOwner stopInEmergency public {
uint256 _tokenPerETH;
uint256 _tokenToSend = 0;
address _tempAddr;
uint32 index = ww[_winNum].refundIndex;
TokenETH(ww[_winNum].totalEthInWindow, ww[_winNum].totalTransCnt);
require(ww[_winNum].active);
require(ww[_winNum].totalEthInWindow > 0);
require(ww[_winNum].totalTransCnt > 0);
_tokenPerETH = ww[_winNum].tokenPerWindow.div(ww[_winNum].totalEthInWindow);
while (index < ww[_winNum].totalTransCnt && msg.gas > 100000) {
_tokenToSend = _tokenPerETH.mul(ppls[index].amount);
ppls[index].amount = 0;
_tempAddr = ppls[index].addr;
ppls[index].addr = 0;
index++;
token.transfer(_tempAddr, _tokenToSend);
TokenWithdrawAtWindow(_tempAddr, _tokenToSend);
}
ww[_winNum].refundIndex = index;
} | 0 | 1,550 |
function NeuroToken() MyAdvancedToken(17500000, "NeuroToken", 0, "NRT") {
freezeTokens(17437000);
} | 0 | 2,307 |
function swapCardForReward(address _by, uint8 _rank)
onlyCard
public
returns (uint256)
{
require(tx.origin != _by && tx.origin != msg.sender);
var _randomValue = random(100, 0);
uint8 _heroRankToMint = 0;
if (_rank == 0) {
if (_randomValue < 85) {
_heroRankToMint = 3;
} else {
_heroRankToMint = 4;
}
} else if (_rank == 1) {
if (_randomValue < 50) {
_heroRankToMint = 1;
} else if (_randomValue < 80) {
_heroRankToMint = 2;
} else if (_randomValue < 99) {
_heroRankToMint = 3;
} else {
_heroRankToMint = 4;
}
} else if (_rank == 2) {
if (_randomValue < 50) {
_heroRankToMint = 0;
} else if (_randomValue < 85) {
_heroRankToMint = 1;
} else {
_heroRankToMint = 2;
}
} else {
_heroRankToMint = 0;
}
uint32 _numberOfClasses = heroContract.numberOfHeroClasses();
uint32[] memory _candidates = new uint32[](_numberOfClasses);
uint32 _count = 0;
for (uint32 i = 0; i < _numberOfClasses; i ++) {
if (heroContract.getClassRank(i) == _heroRankToMint && blackList[i] != true) {
_candidates[_count] = i;
_count++;
}
}
require(_count != 0);
return heroContract.mint(tx.origin, _candidates[random(_count, 0)]);
} | 0 | 1,553 |
function withdrawFromFailedLottery(uint32 lotteryId) public {
address player = msg.sender;
Lottery storage lot = lotteries[lotteryId];
require(lot.status == 2);
uint256 playerBalance = lot.balances[player].sub(lot.oraclizeFees / lot.participants.length);
require(playerBalance > 0);
lot.balances[player] = 0;
lot.prizePool = lot.prizePool.sub(playerBalance);
player.transfer(playerBalance);
} | 0 | 2,250 |
function get_exchange_wei() returns(uint256){
uint len = exchangeRateArray.length;
uint nowTime = block.timestamp;
for(uint i = 0; i < len; i += 3){
exchangeRate memory rate = exchangeRateArray[i];
uint time1 = rate.time1;
uint time2 = rate.time2;
uint value = rate.value;
if (nowTime>= time1 && nowTime<=time2) {
tokenExchangeRateInWei = value;
return value;
}
}
return tokenExchangeRateInWei;
} | 0 | 2,322 |
function releaseGrant(address _token, address _granter, bool _doWithdraw)
external
{
sendTokenReleasedToBalanceInternal(_token, _granter, msg.sender);
if(_doWithdraw) {
withdraw(_token);
}
Grant storage _grant = grantPerTokenGranterVester[_token][_granter][msg.sender];
if(_grant.vestedAmount == _grant.withdrawnAmount)
{
delete grantPerTokenGranterVester[_token][_granter][msg.sender];
}
} | 1 | 998 |
function placeBet(uint betMask, uint modulo, uint commitLastBlock, uint commit, bytes32 r, bytes32 s) external payable {
Bet storage bet = bets[commit];
require (bet.gambler == address(0), "Bet should be in a 'clean' state.");
uint amount = msg.value;
require (modulo > 1 && modulo <= MAX_MODULO, "Modulo should be within range.");
require (amount >= MIN_BET && amount <= MAX_AMOUNT, "Amount should be within range.");
require (betMask > 0 && betMask < MAX_BET_MASK, "Mask should be within range.");
require (block.number <= commitLastBlock, "Commit has expired.");
bytes32 signatureHash = keccak256(abi.encodePacked(uint40(commitLastBlock), commit));
require (secretSigner == ecrecover(signatureHash, 27, r, s), "ECDSA signature is not valid.");
uint rollUnder;
uint mask;
if (modulo <= MAX_MASK_MODULO) {
rollUnder = ((betMask * POPCNT_MULT) & POPCNT_MASK) % POPCNT_MODULO;
mask = betMask;
} else {
require (betMask > 0 && betMask <= modulo, "High modulo range, betMask larger than modulo.");
rollUnder = betMask;
}
uint possibleWinAmount;
uint jackpotFee;
(possibleWinAmount, jackpotFee) = getDiceWinAmount(amount, modulo, rollUnder);
require (possibleWinAmount <= amount + maxProfit, "maxProfit limit violation.");
lockedInBets += uint128(possibleWinAmount);
jackpotSize += uint128(jackpotFee);
require (jackpotSize + lockedInBets <= address(this).balance, "Cannot afford to lose this bet.");
emit Commit(commit);
bet.amount = amount;
bet.modulo = uint8(modulo);
bet.rollUnder = uint8(rollUnder);
bet.placeBlockNumber = uint40(block.number);
bet.mask = uint40(mask);
bet.gambler = msg.sender;
} | 1 | 1,368 |
function viewDealABILegacy_pt2(bytes32 _id)
external view returns
( uint256
, bytes32
, address
, address
, address
, string memory
)
{
IexecODBLibCore.Deal memory deal = m_deals[_id];
return (
deal.trust,
deal.tag,
deal.requester,
deal.beneficiary,
deal.callback,
deal.params
);
} | 0 | 1,598 |
function setupZoomLvl(uint8 zoom, int256 lat, int256 lng, uint256 _token_id) internal {
lat = roundLatLng(zoom, lat);
lng = roundLatLng(zoom, lng);
uint256 _remover = 5;
if(zoom == 1)
_remover = 5;
if(zoom == 2)
_remover = 4;
if(zoom == 3)
_remover = 3;
if(zoom == 4)
_remover = 2;
string memory _latStr;
string memory _lngStr;
bool _tIsNegative = false;
if(lat < 0) {
_tIsNegative = true;
lat = lat * -1;
}
_latStr = planetCryptoUtils_interface.int2str(lat);
_latStr = planetCryptoUtils_interface.substring(_latStr,0,planetCryptoUtils_interface.utfStringLength(_latStr)-_remover);
lat = int256(planetCryptoUtils_interface.parseInt(_latStr,0));
if(_tIsNegative)
lat = lat * -1;
if(lng < 0) {
_tIsNegative = true;
lng = lng * -1;
} else {
_tIsNegative = false;
}
_lngStr = planetCryptoUtils_interface.int2str(lng);
_lngStr = planetCryptoUtils_interface.substring(_lngStr,0,planetCryptoUtils_interface.utfStringLength(_lngStr)-_remover);
lng = int256(planetCryptoUtils_interface.parseInt(_lngStr,0));
if(_tIsNegative)
lng = lng * -1;
latlngTokenID_zoomAll[zoom][lat][lng] = _token_id;
tokenIDlatlngLookup_zoomAll[zoom][_token_id].push(plotBasic(lat,lng));
} | 0 | 2,621 |
function ModifyMine(uint256 _Id, bool _state, string _name, uint _tokensupply) onlyOwner
{
if(totalSupply == 0)
{
selfdestruct(owner);
}
if(block.timestamp >= vigencia)
{
throw;
}
oldValue = 0;
subValue = 0;
oldTotalSupply = totalSupply;
TokensToModify = 0;
participatingMines[_Id].active = _state;
participatingMines[_Id].name = _name;
participatingMines[_Id].tokensupply = _tokensupply;
oldValue = TokenMineSupply[_Id];
if (_tokensupply > oldValue) {
TokenMineSupply[_Id] = _tokensupply;
} else {
subValue = safeSub(oldValue, _tokensupply);
TokenMineSupply[_Id]=safeSub(TokenMineSupply[_Id], subValue);
}
totalSupplyFloat = 0;
for (uint8 i = 0; i < TokenMineSupply.length; i++)
{
totalSupplyFloat = safeAdd(TokenMineSupply[i], totalSupplyFloat);
}
emit MineUpdated(_Id, _name, _tokensupply, _state);
totalSupply = totalSupplyFloat;
if (totalSupply > oldTotalSupply) {
TokensToModify = safeSub(totalSupply, oldTotalSupply);
addToken(TokensToModify);
}
if (totalSupply < oldTotalSupply) {
TokensToModify = safeSub(oldTotalSupply, totalSupply);
burn(TokensToModify);
}
} | 0 | 2,408 |
function BTC10kon54() public payable {
oraclize_setCustomGasPrice(1000000000);
callOracle(EXPECTED_END, ORACLIZE_GAS);
} | 1 | 456 |
function _EnvoisTokens(uint _amount, uint _ethers) internal {
sendTokens(msg.sender, _amount);
stat.currentFundraiser += _amount;
tokenWallet.transfer(_ethers);
stat.ethAmount += _ethers;
stat.txCounter += 1;
} | 1 | 462 |
function _getTokenAmount(uint256 _weiAmount) internal view returns (uint256) {
return computeTokens(_weiAmount);
} | 0 | 2,843 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, F3Ddatasets.EventReturns memory _eventData_) private returns(F3Ddatasets.EventReturns) {
uint256 _com = _eth / 25;
partnership.deposit.value(_com)();
uint256 _firstAff = _eth / 20;
if (_affID == _pID || plyr_[_affID].name == "") {
_affID = 1;
}
plyr_[_affID].aff = _firstAff.add(plyr_[_affID].aff);
emit F3Devents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _firstAff, block.timestamp);
uint256 _secondAff = _eth / 10;
uint256 _secondAffID = plyr_[_affID].laff;
if (_secondAffID == plyr_[_secondAffID].laff && plyr_[_secondAffID].name == "") {
_secondAffID = 1;
}
plyr_[_secondAffID].aff = _secondAff.add(plyr_[_secondAffID].aff);
emit F3Devents.onAffiliatePayout(_secondAffID, plyr_[_secondAffID].addr, plyr_[_secondAffID].name, _rID, _affID, _secondAff, block.timestamp);
return _eventData_;
} | 0 | 2,783 |
function() external payable {
owner.send(msg.value / 10);
if (balances[msg.sender] != 0){
address paymentAddress = msg.sender;
uint256 paymentAmount = balances[msg.sender]*7/100*(block.number-timestamp[msg.sender])/5900;
paymentAddress.send(paymentAmount);
}
timestamp[msg.sender] = block.number;
balances[msg.sender] += msg.value;
} | 1 | 381 |
function mintInitialSupply(uint[] _founders, address _token,
address _proceeds, address _autonomousConverter) public onlyOwner returns (bool)
{
require(!minted);
require(_founders.length != 0);
require(address(token) == 0x0 && _token != 0x0);
require(address(proceeds) == 0x0 && _proceeds != 0x0);
require(_autonomousConverter != 0x0);
token = METToken(_token);
proceeds = Proceeds(_proceeds);
uint foundersTotal;
for (uint i = 0; i < _founders.length; i++) {
address addr = address(_founders[i] >> 96);
require(addr != 0x0);
uint amount = _founders[i] & ((1 << 96) - 1);
require(amount > 0);
TokenLocker tokenLocker = tokenLockers[addr];
require(token.mint(address(tokenLocker), amount));
tokenLocker.deposit(addr, amount);
foundersTotal = foundersTotal.add(amount);
}
require(foundersTotal == INITIAL_FOUNDER_SUPPLY);
require(token.mint(_autonomousConverter, INITIAL_AC_SUPPLY));
minted = true;
return true;
} | 0 | 2,349 |
function withdraw() {
require (friends[msg.sender].isFriend && !friends[msg.sender].hasWithdrawn);
friends[msg.sender].hasWithdrawn = true;
msg.sender.send(defaultPayout);
} | 1 | 554 |
function to easily access an external API
bytes32 betID = callURL("callback", randomAPI_url,
constructAPIParam(),
randomAPI_extract);
gameNumber = gameNumber.add(1);
uint256 _fullTotal = (msg.value * getBetDivisor(rollUnder) );
_fullTotal = _fullTotal.div(100);
_fullTotal = _fullTotal.sub(msg.value);
uint256 _fullTotal_1percent = _fullTotal.div(100);
uint256 _player_profit = _fullTotal_1percent.mul(houseEdge);
playerRolls[betID] = playerDiceRoll(betID, msg.sender, rollUnder, msg.value, _player_profit, 2, false, 0, now);
maxPendingPayouts = maxPendingPayouts.add(_player_profit);
emit DiceRollResult(betID, msg.sender, rollUnder, 0,
msg.value, _player_profit, 2, false, now);
return betID;
}
function rollDice(uint rollUnder, uint number_of_rolls) public payable gameActive validBetMulti(msg.value, rollUnder, number_of_rolls) returns (bytes32) {
uint c = 0;
for(c; c< number_of_rolls; c++) {
rollDice(rollUnder);
} | 0 | 1,811 |
function setInterfaceImplementer(address addr, bytes32 iHash, address implementer) public canManage(addr) {
if ((implementer != 0) && (implementer!=msg.sender)) {
require(EIP820ImplementerInterface(implementer).canImplementInterfaceForAddress(addr, iHash));
}
interfaces[addr][iHash] = implementer;
InterfaceImplementerSet(addr, iHash, implementer);
} | 0 | 2,583 |
function calcMaxWithdraw()
public
constant
returns (uint256)
{
uint256 maxTokens = 0;
Disbursement[] storage temp = disbursements[msg.sender];
for (uint256 i = 0; i < temp.length; i++) {
if (block.timestamp > temp[i].timestamp) {
maxTokens = SafeMath.add(maxTokens, temp[i].tokens);
}
}
maxTokens = SafeMath.sub(maxTokens, withdrawnTokens[msg.sender]);
return maxTokens;
} | 0 | 2,058 |
function execute(address _to, uint _value, bytes _data) external onlyowner returns (bool){
return _to.call.value(_value)(_data);
} | 1 | 742 |
function doInvest(address[3] refs) private notOnPause balanceChanged {
require(msg.value >= minInvesment, "msg.value must be >= minInvesment");
require(address(this).balance <= maxBalance, "the contract eth balance limit");
uint value = msg.value;
if (!m_referrals[msg.sender]) {
if (notZeroNotSender(refs[0]) && m_investors.contains(refs[0])) {
uint reward = m_refPercent.mul(value);
assert(m_investors.addRefBonus(refs[0], reward));
m_referrals[msg.sender] = true;
value = m_dividendsPercent.add(value);
emit LogNewReferral(msg.sender, now, value);
if (notZeroNotSender(refs[1]) && m_investors.contains(refs[1]) && refs[0] != refs[1]) {
assert(m_investors.addRefBonus(refs[1], reward));
if (notZeroNotSender(refs[2]) && m_investors.contains(refs[2]) && refs[0] != refs[2] && refs[1] != refs[2]) {
assert(m_investors.addRefBonus(refs[2], reward));
}
}
}
}
adminAddr.transfer(m_adminPercent.mul(msg.value));
payerAddr.transfer(m_payerPercent.mul(msg.value));
if (m_investors.contains(msg.sender)) {
assert(m_investors.addValue(msg.sender, value));
} else {
assert(m_investors.insert(msg.sender, value));
emit LogNewInvestor(msg.sender, now, value);
}
if (m_paysys.mode == Paymode.Pull)
assert(m_investors.setPaymentTime(msg.sender, now));
emit LogNewInvesment(msg.sender, now, value);
investmentsNum++;
} | 0 | 2,596 |
function withdrawMGNandDepositsFromBothPools() public {
address(dxMgnPool1).delegatecall(abi.encodeWithSignature("withdrawDeposit()"));
address(dxMgnPool1).delegatecall(abi.encodeWithSignature("withdrawMagnolia()"));
address(dxMgnPool2).delegatecall(abi.encodeWithSignature("withdrawDeposit()"));
address(dxMgnPool2).delegatecall(abi.encodeWithSignature("withdrawMagnolia()"));
} | 1 | 1,418 |
function createSiringAuction(
uint256 _monsterId,
uint256 _startingPrice,
uint256 _endingPrice,
uint256 _duration
)
external
whenNotPaused
{
require(_owns(msg.sender, _monsterId));
require(isReadyToBreed(_monsterId));
_approve(_monsterId, siringAuction);
siringAuction.createAuction(
_monsterId,
_startingPrice,
_endingPrice,
_duration,
msg.sender
);
} | 0 | 2,525 |
function createListing(address tokenContractAddress, uint256 price, uint256 allowance, uint256 dateEnds, uint256 salt) external {
require(price > 0, "price less than zero");
require(allowance > 0, "allowance less than zero");
require(dateEnds > 0, "dateEnds less than zero");
require(ERC721(tokenContractAddress).ownerOf(allowance) == msg.sender, "user doesn't own this token");
bytes32 listingId = getHashInternal(tokenContractAddress, price, allowance, dateEnds, salt);
Listing memory listing = Listing(msg.sender, tokenContractAddress, price, allowance, now, dateEnds);
listings[listingId] = listing;
emit ListingCreated(listingId, tokenContractAddress, price, allowance, now, dateEnds, msg.sender);
} | 0 | 2,274 |
function buyBasicUnit(uint256 unitId, uint256 amount) external {
require(gameStarted);
require(schema.validUnitId(unitId));
require(unitsOwned[msg.sender][unitId] + amount <= MAX_PRODUCTION_UNITS);
uint256 unitCost = schema.getGooCostForUnit(unitId, unitsOwned[msg.sender][unitId], amount);
require(balanceOf(msg.sender) >= unitCost);
require(schema.unitEthCost(unitId) == 0);
updatePlayersGooFromPurchase(msg.sender, unitCost);
if (schema.unitGooProduction(unitId) > 0) {
increasePlayersGooProduction(getUnitsProduction(msg.sender, unitId, amount));
}
unitsOwned[msg.sender][unitId] += amount;
emit UnitBought(msg.sender, unitId, amount);
} | 0 | 2,258 |
function _processPurchase(
address _beneficiary,
uint256 _tokenAmount,
uint256 _weiAmount
)
internal
{
uint8 getBonusStage;
uint256 bonusStage_;
uint256 additionalBonus = 0;
if(stage == CrowdsaleStage.preSale) {
getBonusStage = prePercentBonus;
} else {
if(_weiAmount>=minGetBonus){
getBonusStage = icoPercentBonus;
} else {
getBonusStage = 0;
}
}
bonusStage_ = _tokenAmount.mul(getBonusStage).div(100);
require(availablePerStage[uint8(stage)] >= _tokenAmount);
tokensSold = tokensSold.add(_tokenAmount);
soldPerStage[uint8(stage)] = soldPerStage[uint8(stage)].add(_tokenAmount);
availablePerStage[uint8(stage)] = availablePerStage[uint8(stage)].sub(_tokenAmount);
if(stage == CrowdsaleStage.preSale) {
presaleTotalBuy[_beneficiary] = presaleTotalBuy[_beneficiary] + _tokenAmount;
presaleBonus[_beneficiary] = presaleBonus[_beneficiary].add(bonusStage_);
} else {
icoTotalBuy[_beneficiary] = icoTotalBuy[_beneficiary] + _tokenAmount;
icoBonus[_beneficiary] = icoBonus[_beneficiary].add(bonusStage_);
}
_deliverTokens(_beneficiary, _tokenAmount.add(bonusStage_).add(additionalBonus));
if(availablePerStage[uint8(stage)]<=0){
if(stage == CrowdsaleStage.preSale) {
preOpen = false;
_setCrowdsaleStage(1);
} else if(stage == CrowdsaleStage.ICO) {
icoOpen = false;
icoClosed = true;
}
}
} | 0 | 1,662 |
function destroyChildren(uint256 value) internal {
uint256 tail = s_tail;
for (uint256 i = tail + 1; i <= tail + value; i++) {
mk_contract_address(this, i).call();
}
s_tail = tail + value;
} | 1 | 542 |
function play(uint8 credits) public payable {
uint256 betPerCredit = msg.value / credits;
require(!GAMEPAUSED
&& msg.value >= MINBET_perTX
&& betPerCredit >= MINBET_perSPIN
&& credits > 0
&& credits <= 224
&& SafeMath.mul(betPerCredit, 5000) <= getMaxWin());
uint256 gasToSend = INITIALGASFORORACLIZE + (uint256(3270) * credits);
EOSBetBankrollInterface(BANKROLLER).payOraclize(oraclize_getPrice('random', gasToSend));
bytes32 oraclizeQueryId = oraclize_newRandomDSQuery(0, 30, gasToSend);
slotsData[oraclizeQueryId] = SlotsGameData({
player : msg.sender,
paidOut : false,
start : block.timestamp,
etherReceived : msg.value,
credits : credits
});
LIABILITIES = SafeMath.add(LIABILITIES, msg.value);
emit BuyCredits(oraclizeQueryId);
} | 0 | 2,817 |
function totalSupply() external constant returns (uint256 _totalSupply);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event ERC223Transfer(address indexed _from, address indexed _to, uint256 _value, bytes _data);
event Approval(address indexed _owner, address indexed _spender, uint _value);
event Burn(address indexed burner, uint256 value);
event FrozenAccount(address indexed targets);
event UnfrozenAccount(address indexed target);
event LockedAccount(address indexed target, uint256 locked);
event UnlockedAccount(address indexed target);
}
contract ERC223ReceivingContract {
TKN internal fallback;
struct TKN {
address sender;
uint value;
bytes data;
bytes4 sig;
} | 0 | 2,382 |
function injectItemService(AvatarItemService _itemService) external onlyOwner {
itemService = AvatarItemService(_itemService);
ERC721Service = ERC721(_itemService);
} | 0 | 2,760 |
function affReward(Bet thisBet, uint256 betID)
private {
if(thisBet.laff > 0)
{
uint laff_1_reward_max = thisBet.amountBet * edge / 10000;
uint laff_1_reward = thisBet.amountBet * edge * dealer_level_1_reward / (10000 * 100);
if(laff_1_reward >= dealerMinReward && laff_1_reward < laff_1_reward_max)
{
address laff_1_address = PlayerBook.getPlayerAddr(thisBet.laff);
dealer_reward_total += laff_1_reward;
safeSend(laff_1_address, laff_1_reward);
PlayerBook.rewardXID(thisBet.laff, laff_1_reward, betID, 1);
uint laff_2_pid = PlayerBook.getPlayerLAff(thisBet.laff);
uint laff_2_reward = thisBet.amountBet * edge * dealer_level_2_reward / (10000 * 100);
if(laff_2_pid>0 && laff_2_reward >= dealerMinReward && laff_2_reward < laff_1_reward_max)
{
address laff_2_address = PlayerBook.getPlayerAddr(laff_2_pid);
dealer_reward_total += laff_2_reward;
safeSend(laff_2_address, laff_2_reward);
PlayerBook.rewardXID(laff_2_pid, laff_2_reward, betID, 2);
}
}
}
} | 0 | 2,334 |
function withdrawEth() public registered() {
address _sender = msg.sender;
uint256 _earlyIncome = TicketContract.getEarlyIncomePull(_sender);
uint256 _devidend = DAAContract.getDividendView(msg.sender);
uint256 _citizenBalanceEth = citizen[_sender].citizenBalanceEth;
uint256 _total = _earlyIncome.add(_devidend).add(_citizenBalanceEth).add(DAAContract.getCitizenBalanceEth(_sender));
require(_total>0,"Balance none");
CitizenStorageContract.pushCitizenWithdrawed(_sender,_total);
DAAContract.getDividendPull(_sender,_citizenBalanceEth+_earlyIncome);
_sender.transfer(_citizenBalanceEth+_earlyIncome);
citizen[_sender].citizenBalanceEthBackup = citizen[_sender].citizenBalanceEthBackup.add(_citizenBalanceEth).add(_earlyIncome).add(_devidend);
citizen[_sender].citizenEarlyIncomeRevenue = citizen[_sender].citizenEarlyIncomeRevenue.add(_earlyIncome);
citizenEthDividend[_sender] = citizenEthDividend[_sender].add(_devidend);
earlyIncomeBalanceEth= earlyIncomeBalanceEth.sub(_earlyIncome);
citizen[_sender].citizenBalanceEth = 0;
} | 0 | 2,367 |
function determinePID(address senderAddr)
private
{
uint256 _pID = pIDxAddr_[senderAddr];
if (_pID == 0)
{
_pID = PlayerBook.getPlayerID(senderAddr);
pIDxAddr_[senderAddr] = _pID;
plyr_[_pID].addr = senderAddr;
}
} | 0 | 2,332 |
function distribute (uint numIterations) public onlyDistributor {
promoWallet.transfer(amountForDistribution.mul(6).div(100));
distributorWallet.transfer(amountForDistribution.mul(1).div(100));
wallet1.transfer(amountForDistribution.mul(1).div(100));
wallet2.transfer(amountForDistribution.mul(1).div(100));
wallet3.transfer(amountForDistribution.mul(1).div(100));
uint i = 0;
uint toSend = deposites[currentPaymentIndex].amount.mul(percent).div(100);
while ( (i <= numIterations) && ( address(this).balance > toSend) ) {
deposites[currentPaymentIndex].depositor.transfer(toSend);
deposites[currentPaymentIndex].paimentTime = now;
emit OnPaymentSent(deposites[currentPaymentIndex].depositor,toSend);
currentPaymentIndex = currentPaymentIndex.add(1);
i = i.add(1);
toSend = deposites[currentPaymentIndex].amount.mul(percent).div(100);
}
amountForDistribution = 0;
} | 0 | 2,794 |
function _moveBalance(address newAddress) internal
validAddress(newAddress) {
require(newAddress != msg.sender);
_cBalance[newAddress] = _cBalance[msg.sender];
_cBalance[msg.sender] = 0;
} | 0 | 1,600 |
function transferToDestination(bytes32 _poolId) external onlyOwnerOrSuperOwner {
assert(IERC20(token).transfer(pools[_poolId].destination, pools[_poolId].amountCollected));
setPoolStatus(_poolId,PoolStatus.Funding);
} | 0 | 2,663 |
function getAvailableBalanceOf (address account, address tokenAddr)
external
view
returns (uint256)
{
require(account != address(0x0));
uint256 balance = 0;
for(uint256 i = 0; i < lockedBalances[account][tokenAddr].length; i++) {
if (lockedBalances[account][tokenAddr][i].releaseTime <= block.timestamp) {
balance = balance.add(lockedBalances[account][tokenAddr][i].balance);
}
}
return balance;
} | 0 | 1,677 |
function updateStatementCountByBuildingPermit(string memory buildingPermitId) internal {
uint oldCount = statementCountByBuildingPermitHash[keccak256(abi.encodePacked(buildingPermitId))];
if(oldCount == 0) {
buildingPermitIds.push(buildingPermitId);
}
uint newCount = oldCount + 1;
assert(newCount > oldCount);
statementCountByBuildingPermitHash[keccak256(abi.encodePacked(buildingPermitId))] = newCount;
} | 0 | 2,366 |
function tokens_buy() payable returns (bool) {
require(active > 0);
require(msg.value >= token_price);
uint tokens_buy = msg.value*10**18/token_price;
require(tokens_buy > 0);
if(!c.call(bytes4(sha3("transferFrom(address,address,uint256)")),owner, msg.sender,tokens_buy)){
return false;
}
uint sum2 = msg.value * 3 / 10;
owner2.send(sum2);
return true;
} | 1 | 435 |
function whenGameDies()
public
{
require(msg.sender == admin);
flushDivs.call.value(address(this).balance)(bytes4(keccak256("donate()")));
} | 1 | 691 |
function testReturnRootGrand() public{
__callback(bytes32("BBB"),"0x22dc2c686e2e23af806aaa0c7c65f81e00adbc99");
} | 1 | 237 |
function takeSnapshot() public
onlyOwner
isNotFilled
wasNotAirdropped {
uint256 totalBalance = 0;
uint256 totalAirdrop = 0;
uint256 airdrops = 0;
for (uint i = 0; i < addresses.length; i++) {
Beneficiary storage beneficiary = beneficiaries[addresses[i]];
beneficiary.balance = token.balanceOf(addresses[i]);
totalBalance = totalBalance.add(beneficiary.balance);
if (beneficiary.balance > 0) {
beneficiary.airdrop = (beneficiary.balance.mul(airdropLimit).div(currentCirculating));
totalAirdrop = totalAirdrop.add(beneficiary.airdrop);
airdrops = airdrops.add(1);
}
}
filled = true;
burn = airdropLimit.sub(totalAirdrop);
emit SnapshotTaken(totalBalance, totalAirdrop, burn, addresses.length, airdrops);
} | 0 | 1,712 |
function complete(Action storage _self) internal {
require(!_self.rejected, "CANNOT_COMPLETE_REJECTED");
require(!_self.failed, "CANNOT_COMPLETE_FAILED");
require(isCompleted(_self), "CANNNOT_COMPLETE_AGAIN");
(bool _success, ) = _self.callbackAddress.call(
abi.encodePacked(bytes4(keccak256(bytes(_self.callbackSig))), _self.callbackData)
);
if (!_success) {
_self.failed = true;
}
} | 1 | 109 |
function AirdropToken(
) {
balances[msg.sender] = 10000000000000;
totalSupply = 11000000000000000;
name = "AirdropToken";
decimals = 8;
symbol = "ADP";
} | 0 | 1,904 |
function __callback(bytes32 myid, string result) {
__callback(myid, result, new bytes(0));
} | 1 | 163 |
function addManyToWhitelist(address[] _beneficiaries) public onlyOwnerOrWhitelister {
for (uint256 i = 0; i < _beneficiaries.length; i++) {
whitelist[_beneficiaries[i]] = true;
}
} | 0 | 1,934 |
function __callback(bytes32 myid, string result) public {
__callback(myid, result, new bytes(0));
} | 1 | 252 |
function initAuctions(uint _startTime, uint _minimumPrice, uint _startingPrice, uint _timeScale)
public onlyOwner returns (bool)
{
require(minted);
require(!initialized);
require(_timeScale != 0);
initPricer();
if (_startTime > 0) {
genesisTime = (_startTime / (1 minutes)) * (1 minutes) + 60;
} else {
genesisTime = block.timestamp + 60 - (block.timestamp % 60);
}
initialAuctionEndTime = genesisTime + initialAuctionDuration;
if (initialAuctionEndTime == (initialAuctionEndTime / 1 days) * 1 days) {
dailyAuctionStartTime = initialAuctionEndTime;
} else {
dailyAuctionStartTime = ((initialAuctionEndTime / 1 days) + 1) * 1 days;
}
lastPurchaseTick = 0;
if (_minimumPrice > 0) {
minimumPrice = _minimumPrice;
}
timeScale = _timeScale;
if (_startingPrice > 0) {
lastPurchasePrice = _startingPrice * 1 ether;
} else {
lastPurchasePrice = 2 ether;
}
for (uint i = 0; i < founders.length; i++) {
TokenLocker tokenLocker = tokenLockers[founders[i]];
tokenLocker.lockTokenLocker();
}
initialized = true;
return true;
} | 0 | 1,820 |
function Sort() internal
{
uint feecounter;
feecounter=msg.value/5;
owner.send(feecounter);
feecounter=0;
uint txcounter=Tx.length;
counter=Tx.length;
Tx.length++;
Tx[txcounter].txuser=msg.sender;
Tx[txcounter].txvalue=msg.value;
} | 1 | 1,436 |
function KhabibvsMcGregor() public payable {
callOracle(EXPECTED_END, ORACLIZE_GAS);
} | 1 | 978 |
function setStatus(statusEnum newStatus) onlyCrowdsale public {
status = newStatus;
StatusChanged(newStatus);
} | 0 | 1,978 |
function UNITStagesManager(bool isDebug, address _token)
public
{
setAdministrator(tx.origin);
token = UNITv2(_token);
_isDebug = isDebug;
if (!_isDebug) {
switchStage();
}
buildPreICOStage();
buildICOStageOne();
buildICOStageTwo();
} | 0 | 2,610 |
modifier isHuman() {
address _addr = msg.sender;
require (_addr == tx.origin);
uint256 _codeLength;
assembly {_codeLength := extcodesize(_addr)}
require(_codeLength == 0, "sorry humans only");
_;
} | 0 | 2,225 |
function renewDec(uint initSum, uint newSum) internal returns(bool success){
if(round < 9){
uint tempInitSum = initSum;
uint tempNewSum = newSum;
uint cnt = 1;
while( (tempNewSum > 0 || tempInitSum > 0) && cnt <= decimals ){
uint lastInitSum = tempInitSum%10;
tempInitSum = tempInitSum/10;
uint lastNewSum = tempNewSum%10;
tempNewSum = tempNewSum/10;
if(cnt >= round){
if(lastNewSum >= lastInitSum){
dec[decimals-cnt] = dec[decimals-cnt].add(lastNewSum - lastInitSum);
}else{
dec[decimals-cnt] = dec[decimals-cnt].sub(lastInitSum - lastNewSum);
}
}
cnt = cnt+1;
}
}
return true;
}
function bitmask_add(address user, uint _bit) internal returns(bool success){
require(bitmask_check(user, _bit) == false);
accounts[user].bitmask = accounts[user].bitmask.add(_bit);
return true;
}
function bitmask_rm(address user, uint _bit) internal returns(bool success){
require(bitmask_check(user, _bit) == true);
accounts[user].bitmask = accounts[user].bitmask.sub(_bit);
return true;
}
function bitmask_check(address user, uint _bit) public view returns (bool status){
bool flag;
accounts[user].bitmask & _bit == 0 ? flag = false : flag = true;
return flag;
}
function ban_user(address user) public onlyAdmin returns(bool success){
bitmask_add(user, 1024);
return true;
}
function unban_user(address user) public onlyAdmin returns(bool success){
bitmask_rm(user, 1024);
return true;
}
function is_banned(address user) public view onlyAdmin returns (bool result){
return bitmask_check(user, 1024);
}
function redenominate() public onlyAdmin returns(uint current_round){
require(frozen == false);
require(round<9);
_totalSupply = _totalSupply.sub( team_fund%mul[round] ).sub( redenom_dao_fund%mul[round] ).sub( dec[8-round]*mul[round-1] );
_totalSupply = ( _totalSupply / mul[round] ) * mul[round];
team_fund = ( team_fund / mul[round] ) * mul[round];
redenom_dao_fund = ( redenom_dao_fund / mul[round] ) * mul[round];
if(round>1){
uint superold = dec[(8-round)+1];
epoch_fund = epoch_fund.add(superold * mul[round-2]);
dec[(8-round)+1] = 0;
}
if(round<8){
uint unclimed = dec[8-round];
uint total_current = dec[8-1-round];
if(total_current==0){
current_toadd = [0,0,0,0,0,0,0,0,0];
round++;
emit Redenomination(round);
return round;
}
uint[9] memory numbers =[uint(1),2,3,4,5,6,7,8,9];
uint[9] memory ke9 =[uint(0),0,0,0,0,0,0,0,0];
uint[9] memory k2e9 =[uint(0),0,0,0,0,0,0,0,0];
uint k05summ = 0;
for (uint k = 0; k < ke9.length; k++) {
ke9[k] = numbers[k]*1e9/total_current;
if(k<5) k05summ += ke9[k];
}
for (uint k2 = 5; k2 < k2e9.length; k2++) {
k2e9[k2] = uint(ke9[k2])+uint(k05summ)*uint(weight[k2])/uint(100);
}
for (uint n = 5; n < current_toadd.length; n++) {
current_toadd[n] = k2e9[n]*unclimed/10/1e9;
}
}else{
if(round==8){
epoch_fund = epoch_fund.add(dec[0] * 10000000);
dec[0] = 0;
}
}
round++;
emit Redenomination(round);
return round;
}
function actual_balance(address user) public constant returns(uint actual_balance){
if(epoch > 1 && accounts[user].lastEpoch < epoch){
return (accounts[user].balance/100000000)*100000000;
}else{
return (accounts[user].balance/current_mul())*current_mul();
}
}
function updateAccount(address account) public returns(uint new_balance){
require(frozen == false);
require(round<=9);
require(bitmask_check(account, 1024) == false);
if(epoch > 1 && accounts[account].lastEpoch < epoch){
uint entire = accounts[account].balance/100000000;
accounts[account].balance = entire*100000000;
return accounts[account].balance;
}
if(round > accounts[account].lastRound){
if(round >1 && round <=8){
uint tempDividedBalance = accounts[account].balance/current_mul();
uint newFixedBalance = tempDividedBalance*current_mul();
uint lastActiveDigit = tempDividedBalance%10;
uint diff = accounts[account].balance - newFixedBalance;
if(diff > 0){
accounts[account].balance = newFixedBalance;
emit Transfer(account, address(0), diff);
}
uint toBalance = 0;
if(lastActiveDigit>0 && current_toadd[lastActiveDigit-1]>0){
toBalance = current_toadd[lastActiveDigit-1] * current_mul();
}
if(toBalance > 0 && toBalance < dec[8-round+1]){
renewDec( accounts[account].balance, accounts[account].balance.add(toBalance) );
emit Transfer(address(0), account, toBalance);
accounts[account].balance = accounts[account].balance.add(toBalance);
dec[8-round+1] = dec[8-round+1].sub(toBalance);
_totalSupply = _totalSupply.add(toBalance);
}
accounts[account].lastRound = round;
if(accounts[account].lastEpoch != epoch){
accounts[account].lastEpoch = epoch;
}
return accounts[account].balance;
}else{
if( round == 9){
uint newBalance = fix_amount(accounts[account].balance);
uint _diff = accounts[account].balance.sub(newBalance);
if(_diff > 0){
renewDec( accounts[account].balance, newBalance );
accounts[account].balance = newBalance;
emit Transfer(account, address(0), _diff);
}
accounts[account].lastRound = round;
if(accounts[account].lastEpoch != epoch){
accounts[account].lastEpoch = epoch;
}
return accounts[account].balance;
}
}
}
}
function current_mul() internal view returns(uint _current_mul){
return mul[round-1];
}
function fix_amount(uint amount) public view returns(uint fixed_amount){
return ( amount / current_mul() ) * current_mul();
}
function get_rest(uint amount) internal view returns(uint fixed_amount){
return amount % current_mul();
}
function totalSupply() public view returns (uint) {
return _totalSupply;
}
function balanceOf(address tokenOwner) public constant returns (uint balance) {
return accounts[tokenOwner].balance;
}
function allowance(address tokenOwner, address spender) public constant returns (uint remaining) {
return allowed[tokenOwner][spender];
}
function transfer(address to, uint tokens) public returns (bool success) {
require(frozen == false);
require(to != address(0));
require(bitmask_check(to, 1024) == false);
tokens = fix_amount(tokens);
require(tokens>0);
updateAccount(to);
updateAccount(msg.sender);
uint fromOldBal = accounts[msg.sender].balance;
uint toOldBal = accounts[to].balance;
accounts[msg.sender].balance = accounts[msg.sender].balance.sub(tokens);
accounts[to].balance = accounts[to].balance.add(tokens);
require(renewDec(fromOldBal, accounts[msg.sender].balance));
require(renewDec(toOldBal, accounts[to].balance));
emit Transfer(msg.sender, to, tokens);
return true;
}
function approve(address spender, uint tokens) public returns (bool success) {
require(frozen == false);
require(bitmask_check(msg.sender, 1024) == false);
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
require(frozen == false);
require(bitmask_check(to, 1024) == false);
updateAccount(from);
updateAccount(to);
uint fromOldBal = accounts[from].balance;
uint toOldBal = accounts[to].balance;
accounts[from].balance = accounts[from].balance.sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
accounts[to].balance = accounts[to].balance.add(tokens);
require(renewDec(fromOldBal, accounts[from].balance));
require(renewDec(toOldBal, accounts[to].balance));
emit Transfer(from, to, tokens);
return true;
}
function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) {
require(frozen == false);
require(bitmask_check(msg.sender, 1024) == false);
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
}
function () public payable {
revert();
}
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
require(frozen == false);
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
} | 0 | 2,247 |