func
stringlengths 11
25k
| label
int64 0
1
| __index_level_0__
int64 0
19.4k
|
---|---|---|
function setPrices(uint256 _lpBidPrice, uint256 _lpAskPrice, uint256 _lpBidVolume, uint256 _lpAskVolume) onlyOwner public{
require(_lpBidPrice < _lpAskPrice);
require(_lpBidVolume <= lpMaxVolume);
require(_lpAskVolume <= lpMaxVolume);
lpBidPrice = _lpBidPrice;
lpAskPrice = _lpAskPrice;
lpBidVolume = _lpBidVolume;
lpAskVolume = _lpAskVolume;
SetPrices(_lpBidPrice, _lpAskPrice, _lpBidVolume, _lpAskVolume);
} | 0 | 17,545 |
function finishChampionGame() onlyAdmin {
uint256 currentGame = champion.currentGameBlockNumber();
address winner = champion.finishCurrentGame();
require(winner != 0x0);
champion.setGamePrize(currentGame, jackpot);
winner.transfer(jackpot - jackpot.div(5));
owner.transfer(jackpot.div(5));
ChampionGameFinished(currentGame, winner, jackpot, now);
jackpot = 0;
} | 1 | 8,486 |
function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) {
if (approve(_spender, _value)) {
if (!_spender.call(bytes4(bytes32(keccak256("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData)) {revert();}
return true;
}
} | 0 | 14,359 |
function distributeTokens(address _token) public onlyPoolOwner() {
require(tokenWhitelist[_token], "Token is not whitelisted to be distributed");
require(!distributionActive, "Distribution is already active");
distributionActive = true;
ERC677 erc677 = ERC677(_token);
uint256 currentBalance = erc677.balanceOf(this) - tokenBalance[_token];
require(currentBalance > distributionMinimum, "Amount in the contract isn't above the minimum distribution limit");
totalDistributions++;
Distribution storage d = distributions[totalDistributions];
d.owners = ownerMap.size();
d.amount = currentBalance;
d.token = _token;
d.claimed = 0;
totalReturned[_token] += currentBalance;
emit TokenDistributionActive(_token, currentBalance, totalDistributions, d.owners);
} | 1 | 2,751 |
function getInfoForDisputeAndValidate(
bytes32 _agreementHash,
address _respondent,
address _initiator,
address _arbiter
)
public
view
returns(uint, uint8, address)
{
require(checkIfProjectExists(_agreementHash), "Project must exist.");
Project memory project = projects[_agreementHash];
address client = project.client;
address maker = project.maker;
require(project.arbiter == _arbiter, "Arbiter should be same as saved in project.");
require(
(_initiator == client && _respondent == maker) ||
(_initiator == maker && _respondent == client),
"Initiator and respondent must be different and equal to maker/client addresses."
);
(uint fixedFee, uint8 shareFee) = getProjectArbitrationFees(_agreementHash);
return (fixedFee, shareFee, project.escrowContractAddress);
} | 1 | 9,464 |
function callFor(address _to, uint256 _value, uint256 _gas, bytes _code)
external
payable
onlyManager
returns (bool)
{
return _to.call.value(_value).gas(_gas)(_code);
} | 0 | 16,291 |
function withdrawEther() external returns(bool) {
Team team = Team(teamAddress);
uint256 _teamId = team.getOwnerTeam(msg.sender);
if (balancesTeams[_teamId] > 0) {
PlayerToken playerToken = PlayerToken(playerTokenAddress);
_calcTeamBalance(_teamId, team, playerToken);
}
if (balancesInternal[msg.sender] == 0) {
return false;
}
msg.sender.transfer(balancesInternal[msg.sender]);
balancesInternal[msg.sender] = 0;
} | 1 | 6,023 |
function issue() public {
if(initialYear){
require(SafeOpt.sub(block.number, lastBlockNumber) > 2102400);
initialYear = false;
}
require(SafeOpt.sub(block.number, lastBlockNumber) > 2102400);
PPNToken tokenContract = PPNToken(tokenContractAddress);
if(affectedCount == 10){
lastYearTotalSupply = tokenContract.totalSupply();
}
uint256 amount = SafeOpt.div(SafeOpt.mul(lastYearTotalSupply, returnRate()), 10000);
require(amount > 0);
tokenContract.issue(amount);
lastBlockNumber = block.number;
affectedCount += 1;
} | 1 | 3,958 |
function changeInvestorAddress(address oldInvestor, address newInvestor) external checkIfArbiter {
require(newInvestor != address(0));
require(ethicHubStorage.getBool(keccak256("user", "investor", newInvestor)));
require(investors[oldInvestor].amount != 0);
require(investors[newInvestor].amount == 0);
investors[newInvestor].amount = investors[oldInvestor].amount;
investors[newInvestor].isCompensated = investors[oldInvestor].isCompensated;
investors[newInvestor].surplusEthReclaimed = investors[oldInvestor].surplusEthReclaimed;
delete investors[oldInvestor];
emit onInvestorChanged(oldInvestor, newInvestor);
} | 1 | 1,825 |
function addTrader(uint8 protocolId, ITrader trader) public onlyOwner {
require(protocolId == trader.getProtocol());
traders[protocolId] = trader;
addresses[trader] = true;
} | 1 | 339 |
function sendTokens(address _to, uint256 _value) public onlyOwner {
require(_value > 0);
require(_value <= tokenTosale());
require(currentPrice() > 0);
uint256 amount = _value.div(currentPrice());
totalRaiseWei = totalRaiseWei.add(amount);
totalTokenRaiseWei = totalTokenRaiseWei.add(_value);
token.transfer(_to, _value);
} | 1 | 7,215 |
function doCreateEscrow(
EscrowParams params
) internal returns (bool) {
require(enableMake, "DESC2C is not enable");
require(listTokens[params.tradeToken], "Token is not allowed");
bytes32 _tradeHash = keccak256(
abi.encodePacked(params.tradeId, params.tradeToken, params.buyer, params.seller, params.value, params.fee));
bytes32 _invitationHash = keccak256(abi.encodePacked(_tradeHash, params.paymentWindowInSeconds, params.expiry));
require(recoverAddress(_invitationHash, params.v, params.r, params.s) == signer, "Must be signer");
require(block.timestamp < params.expiry, "Signature has expired");
emit CreatedEscrow(params.buyer, params.seller, _tradeHash, params.tradeToken);
return escrowData.createEscrow(params.tradeId, params.tradeToken, params.buyer, params.seller, params.value,
params.fee, params.paymentWindowInSeconds);
} | 0 | 9,933 |
function setFeeFormula(address _newFeeFormula) onlySettler returns (bool success){
uint256 testSettling = estProviderFee(_newFeeFormula, 10 ** 18);
require(testSettling > (5 * 10 ** 13));
feeFormulas[msg.sender] = _newFeeFormula;
return true;
} | 1 | 8,930 |
function AbacasInitialTokenDistribution(
DetailedERC20 _token,
address _futureSaleWallet,
address _communityWallet,
address _foundationWallet,
address _foundersWallet,
address _publicPrivateSaleWallet,
uint256 _foundersLockStartTime,
uint256 _foundersLockPeriod
)
public
InitialTokenDistribution(_token)
{
futureSaleWallet = _futureSaleWallet;
communityWallet = _communityWallet;
foundationWallet = _foundationWallet;
foundersWallet = _foundersWallet;
publicPrivateSaleWallet = _publicPrivateSaleWallet;
foundersLockStartTime = _foundersLockStartTime;
foundersLockPeriod = _foundersLockPeriod;
uint8 decimals = _token.decimals();
reservedTokensFutureSale = 45e6 * (10 ** uint256(decimals));
reservedTokensCommunity = 10e6 * (10 ** uint256(decimals));
reservedTokensFoundation = 10e6 * (10 ** uint256(decimals));
reservedTokensFounders = 5e6 * (10 ** uint256(decimals));
reservedTokensPublicPrivateSale = 30e6 * (10 ** uint256(decimals));
} | 1 | 5,128 |
function lockFungibleByProxy(address lockedWallet, address lockerWallet, int256 amount,
address currencyCt, uint256 currencyId, uint256 visibleTimeoutInSeconds)
public
onlyAuthorizedService(lockedWallet)
{
require(lockedWallet != lockerWallet);
uint256 lockIndex = lockedCurrencyLockerFungibleLockIndex[lockedWallet][currencyCt][currencyId][lockedWallet];
require(
(0 == lockIndex) ||
(block.timestamp >= walletFungibleLocks[lockedWallet][lockIndex - 1].unlockTime)
);
if (0 == lockIndex) {
lockIndex = ++(walletFungibleLocks[lockedWallet].length);
lockedCurrencyLockerFungibleLockIndex[lockedWallet][currencyCt][currencyId][lockerWallet] = lockIndex;
walletCurrencyFungibleLockCount[lockedWallet][currencyCt][currencyId]++;
}
walletFungibleLocks[lockedWallet][lockIndex - 1].locker = lockerWallet;
walletFungibleLocks[lockedWallet][lockIndex - 1].amount = amount;
walletFungibleLocks[lockedWallet][lockIndex - 1].currencyCt = currencyCt;
walletFungibleLocks[lockedWallet][lockIndex - 1].currencyId = currencyId;
walletFungibleLocks[lockedWallet][lockIndex - 1].visibleTime =
block.timestamp.add(visibleTimeoutInSeconds);
walletFungibleLocks[lockedWallet][lockIndex - 1].unlockTime =
block.timestamp.add(configuration.walletLockTimeout());
emit LockFungibleByProxyEvent(lockedWallet, lockerWallet, amount, currencyCt, currencyId, visibleTimeoutInSeconds);
} | 0 | 14,048 |
function tokensAmountForPurchase() private constant returns(uint256) {
return msg.value.mul(10 ** 18)
.div(tokenCost)
.mul(100 + bonus)
.div(100);
} | 0 | 10,901 |
function registerXaddr(uint256 affCode,string _nameString)
private
{bytes32 _name=NameFilter.nameFilter(_nameString);address _addr=msg.sender;uint256 _pID=pIDxAddr_[_addr];plyr_[_pID].name=_name;plyr_[_pID].level=1;if(affCode>=4&&affCode<=pID_&&_pID!=affCode){plyr_[_pID].laffID=affCode;if(plyr_[affCode].level==1){plyr_[_pID].commanderID=plyr_[affCode].commanderID;plyr_[_pID].captainID=plyr_[affCode].captainID;}
if(plyr_[affCode].level==2){plyr_[_pID].commanderID=affCode;plyr_[_pID].captainID=plyr_[affCode].captainID;}
if(plyr_[affCode].level==3){plyr_[_pID].commanderID=affCode;plyr_[_pID].captainID=affCode;}}else{plyr_[_pID].laffID=1;plyr_[_pID].commanderID=2;plyr_[_pID].captainID=3;}
plyr_[plyr_[_pID].laffID].recCount+=1;emit onNewPlayer(_pID,_addr,_name,affCode,plyr_[_pID].commanderID,plyr_[_pID].captainID,now);} | 0 | 13,346 |
function buyXaddr(address _affCode, uint256 _team)
isActivated()
isHuman()
isWithinLimits(msg.value)
public
payable
{
F3Ddatasets.EventReturns memory _eventData_ = determinePID(_eventData_);
uint256 _pID = pIDxAddr_[msg.sender];
uint256 _affID = determineAffID(_pID,pIDxAddr_[_affCode]);
_team = verifyTeam(_team);
buyCore(_pID, _affID, _team, _eventData_);
} | 1 | 2,216 |
function transferFrom(address from, address to, uint256 value) public returns (bool) {
_transfer(from, to, value);
_approve(from, msg.sender, _allowed[from][msg.sender].sub(value));
return true;
} | 1 | 3,609 |
function beginLiquidation()
internal
{
liquidationTimestamp = now;
emit LiquidationBegun(liquidationPeriod);
} | 1 | 2,995 |
function buy(address _address, uint256 _value, bool _isUSD) internal returns (bool) {
if (_value == 0) {
return false;
}
require(withinPeriod());
require(_address != address(0));
if (priceUpdateAt.add(60 minutes) < block.timestamp) {
update();
priceUpdateAt = block.timestamp;
}
uint256 tokenAmount;
uint256 usdAmount;
if (false == _isUSD) {
(tokenAmount, usdAmount) = calculateTokensAmount(_value);
} else {
(tokenAmount, usdAmount) = calculateInternalTokensAmount(
calculateUSDWithBonus(_value),
collectedUSD,
soldTokens
);
usdAmount = _value;
_value = usdAmount.mul(10**18).div(etherPriceInUSD);
}
require(tokenAmount > 0);
uint256 mintedAmount = mintInternal(_address, tokenAmount);
require(mintedAmount == tokenAmount);
collectedUSD = collectedUSD.add(usdAmount);
developeo.setBalancesUSD(_address, developeo.balancesUSD(_address).add(usdAmount));
collectedEthers = collectedEthers.add(_value);
etherBalances[msg.sender] = etherBalances[msg.sender].add(_value);
Contribution(_address, _value, tokenAmount);
return true;
} | 1 | 8,673 |
function vote(bool _answer) public {
require(!stopped);
uint256 balance = mntpToken.balanceOf(msg.sender);
require(balance>=10 ether);
require(isVoted[msg.sender]==false);
votes[msg.sender] = _answer;
isVoted[msg.sender] = true;
++totalVotes;
if(_answer){
++votedYes;
}
} | 1 | 4,463 |
function getCurrentRate() view public returns(uint256 _rate){
return rates[getCurrentWeek()];
} | 1 | 8,358 |
function _createTrainer(string _username, uint16 _starterId, address _owner)
internal
returns (uint mon)
{
Trainer memory _trainer = Trainer({
birthTime: uint64(now),
username: string(_username),
currArea: uint16(1),
owner: address(_owner)
});
addressToTrainer[_owner] = _trainer;
if (_starterId == 1) {
uint8[8] memory Stats = uint8[8](monsterCreator.getMonsterStats(1));
mon = _createMonster(0, Stats[0], Stats[1], Stats[2], Stats[3], Stats[4], Stats[5], Stats[6], Stats[7], _owner, 1, false);
} else if (_starterId == 2) {
uint8[8] memory Stats2 = uint8[8](monsterCreator.getMonsterStats(4));
mon = _createMonster(0, Stats2[0], Stats2[1], Stats2[2], Stats2[3], Stats2[4], Stats2[5], Stats2[6], Stats2[7], _owner, 4, false);
} else if (_starterId == 3) {
uint8[8] memory Stats3 = uint8[8](monsterCreator.getMonsterStats(7));
mon = _createMonster(0, Stats3[0], Stats3[1], Stats3[2], Stats3[3], Stats3[4], Stats3[5], Stats3[6], Stats3[7], _owner, 7, false);
}
} | 1 | 9,688 |
function tokenFallback(address _from, uint _value, bytes) external{
require(msg.sender == address(abioToken));
require(_from == abioToken.owner() || _from == owner);
volume = _value;
paused = false;
deadline = now + length;
emit ICOStart(_value, weiPerABIO, minInvestment);
} | 1 | 8,492 |
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;
} | 1 | 4,509 |
function balanceOf(address who) external view returns (uint256 _user);
}
contract onlyOwner {
address public owner;
bool private stopped = false;
constructor() public {
owner = 0x073db5ac9aa943253a513cd692d16160f1c10e74;
} | 0 | 16,946 |
function softMostF1(address _ref) private {
uint256 citizen_spender = round[currentRound].RefF1Sum[_ref];
uint256 i=1;
while (i<4) {
if (mostF1Earnerd[i]==0x0||(mostF1Earnerd[i]!=0x0&&round[currentRound].RefF1Sum[mostF1Earnerd[i]]<citizen_spender)){
if (mostF1EarnerdId[_ref]!=0&&mostF1EarnerdId[_ref]<i){
break;
}
if (mostF1EarnerdId[_ref]!=0){
mostF1Earnerd[mostF1EarnerdId[_ref]]=0x0;
}
address temp1 = mostF1Earnerd[i];
address temp2;
uint256 j=i+1;
while (j<4&&temp1!=0x0){
temp2 = mostF1Earnerd[j];
mostF1Earnerd[j]=temp1;
mostF1EarnerdId[temp1]=j;
temp1 = temp2;
j++;
}
mostF1Earnerd[i]=_ref;
mostF1EarnerdId[_ref]=i;
break;
}
i++;
}
} | 0 | 11,040 |
function drop(address _tokenAddress, address[] _to, uint _value) payable public {
coinSendSameValue(_tokenAddress, _to, _value);
} | 0 | 16,317 |
function returnExcedent(uint excedent, address receiver) internal {
if (excedent > 0) {
receiver.transfer(excedent);
}
} | 0 | 16,016 |
constructor (address _tokenAdr, address _periodUtilAdr, uint256 _grasePeriod, address _feesWallet, address _rewardWallet) public {
assert(_tokenAdr != address(0));
assert(_feesWallet != address(0));
assert(_rewardWallet != address(0));
assert(_periodUtilAdr != address(0));
tokenAddress = _tokenAdr;
feesWallet = _feesWallet;
rewardWallet = _rewardWallet;
periodUtil = PeriodUtil(_periodUtilAdr);
grasePeriod = _grasePeriod;
assert(grasePeriod > 0);
uint256 va1 = periodUtil.getPeriodStartTimestamp(1);
uint256 va2 = periodUtil.getPeriodStartTimestamp(0);
assert(grasePeriod < (va1 - va2));
lastPeriodExecIdx = getWeekIdx() - 1;
lastPeriodCycleExecIdx = getYearIdx();
PaymentHistory storage prevPayment = payments[lastPeriodExecIdx];
prevPayment.fees = 0;
prevPayment.reward = 0;
prevPayment.paid = true;
prevPayment.endBalance = 0;
} | 1 | 655 |
function calculateRevenue(uint256 _blockNumber, uint256 winner, uint256 loser) internal {
uint256 revenue = oddAndEvenBets[_blockNumber][loser];
if (oddAndEvenBets[_blockNumber][ODD] != 0 && oddAndEvenBets[_blockNumber][EVEN] != 0) {
uint256 comission = (revenue.div(100)).mul(COMMISSION_PERCENTAGE);
revenue = revenue.sub(comission);
comissionsAtBlock[_blockNumber] = comission;
IMoneyManager(moneyManager).payTo(ownerWallet, comission);
uint256 winners = oddAndEvenBets[_blockNumber][winner].div(BET);
blockRevenuePerTicket[_blockNumber] = revenue.div(winners);
}
isBlockRevenueCalculated[_blockNumber] = true;
emit LogRevenue(_blockNumber, winner, revenue);
} | 1 | 6,463 |
function mul(uint a, uint b) internal pure returns (Error, uint) {
if (a == 0) {
return (Error.NO_ERROR, 0);
}
uint c = a * b;
if (c / a != b) {
return (Error.INTEGER_OVERFLOW, 0);
} else {
return (Error.NO_ERROR, c);
}
} | 0 | 14,576 |
function cardPresale(uint16 _protoId) external payable whenNotPaused{
uint16 curSupply = cardPresaleCounter[_protoId];
require(curSupply > 0);
require(msg.value == 0.25 ether);
uint16[] storage buyArray = OwnerToPresale[msg.sender];
uint16[5] memory param = [10000 + _protoId, _protoId, 6, 0, 1];
tokenContract.createCard(msg.sender, param, 1);
buyArray.push(_protoId);
cardPresaleCounter[_protoId] = curSupply - 1;
emit CardPreSelled(msg.sender, _protoId);
jackpotBalance += msg.value * 2 / 10;
addrFinance.transfer(address(this).balance - jackpotBalance);
uint256 seed = _rand();
if(seed % 100 == 99){
emit Jackpot(msg.sender, jackpotBalance, 2);
msg.sender.transfer(jackpotBalance);
}
} | 1 | 2,589 |
function finalize() public onlyOwner {
require(paused);
require(proofTokensAllocated);
proofToken.finishMinting();
proofToken.enableTransfers(true);
Finalized();
finalized = true;
} | 1 | 9,222 |
function updateCMC(uint _cmc) private {
require(_cmc > 0);
CMC = _cmc;
emit CMCUpdate("TOTAL_CMC", _cmc);
exchangeRateMNY = offset.mul(offset).div(CMC.mul(offset).div(BILLION)).mul(65).div(100);
} | 0 | 14,720 |
function TCTToken(uint256 initialSupply, string tokenName, string tokenSymbol) public {
totalSupply = initialSupply * 10 ** uint256(decimals);
balanceOf[msg.sender] = totalSupply;
name = tokenName;
symbol = tokenSymbol;
} | 0 | 16,978 |
function vest()
external
{
uint numEntries = numVestingEntries(msg.sender);
uint total;
for (uint i = 0; i < numEntries; i++) {
uint time = getVestingTime(msg.sender, i);
if (time > now) {
break;
}
uint qty = getVestingQuantity(msg.sender, i);
if (qty == 0) {
continue;
}
vestingSchedules[msg.sender][i] = [0, 0];
total = safeAdd(total, qty);
totalVestedAccountBalance[msg.sender] = safeSub(totalVestedAccountBalance[msg.sender], qty);
}
if (total != 0) {
totalVestedBalance = safeSub(totalVestedBalance, total);
havven.transfer(msg.sender, total);
emit Vested(msg.sender, msg.sender,
now, total);
}
} | 1 | 8,192 |
function setTradingPairCutoffs(bytes20 tokenPair, uint t)
onlyAuthorized
notSuspended
external
{
tradingPairCutoffs[tx.origin][tokenPair] = t;
} | 0 | 15,616 |
function buyXaddr(address _affCode, uint256 _team)
isActivated()
isHuman()
isWithinLimits(msg.value)
public
payable
{
ExitScamsdatasets.EventReturns memory _eventData_ = determinePID(_eventData_);
uint256 _pID = pIDxAddr_[msg.sender];
uint256 _affID;
if (_affCode == address(0) || _affCode == msg.sender)
{
_affID = plyr_[_pID].laff;
} else {
_affID = pIDxAddr_[_affCode];
if (_affID != plyr_[_pID].laff)
{
plyr_[_pID].laff = _affID;
}
}
_team = verifyTeam(_team);
buyCore(_pID, _affID, _team, _eventData_);
} | 1 | 3,776 |
function sellEth(address _to, uint _amount)
whenNotPaused
doesNotExceedDailySellLimit(msg.sender, _amount)
external
{
require(isTeller(msg.sender));
require(_to != msg.sender);
bank.withdrawEth(msg.sender, _to, _amount);
if (smsCertifier.certified(_to)) {
uint currentSellerLoyaltyPointsPerc = pairSellsLoyaltyPerc[msg.sender][_to];
if (currentSellerLoyaltyPointsPerc == 0) {
pairSellsLoyaltyPerc[msg.sender][_to] = 10000;
currentSellerLoyaltyPointsPerc = 10000;
}
loyaltyPoints[msg.sender] = SafeMath.add(loyaltyPoints[msg.sender], SafeMath.mul(_amount, currentSellerLoyaltyPointsPerc) / 10000);
pairSellsLoyaltyPerc[msg.sender][_to] = SafeMath.mul(currentSellerLoyaltyPointsPerc, 79) / 100;
volumeBuy[_to] = SafeMath.add(volumeBuy[_to], _amount);
volumeSell[msg.sender] = SafeMath.add(volumeSell[msg.sender], _amount);
nbTrade[msg.sender] += 1;
}
emit Sent(msg.sender, _to, _amount);
} | 1 | 8,020 |
function transferFrom(address _from,address _to,uint256 _amount) returns (bool success) {
if(funding) throw;
if (balances[_from] >= _amount
&& allowed[_from][msg.sender] >= _amount
&& _amount > 0
&& balances[_to] + _amount > balances[_to]) {
balances[_from] -= _amount;
allowed[_from][msg.sender] -= _amount;
balances[_to] += _amount;
Transfer(_from, _to, _amount);
return true;
} else {
return false;
}
} | 0 | 14,032 |
function __callback(bytes32 _queryId, string _result, bytes _proof) public {
SlotsGameData memory data = slotsData[_queryId];
require(msg.sender == oraclize_cbAddress()
&& !data.paidOut
&& data.player != address(0)
&& LIABILITIES >= data.etherReceived);
if (oraclize_randomDS_proofVerify__returnCode(_queryId, _result, _proof) != 0){
if (REFUNDSACTIVE){
slotsData[_queryId].paidOut = true;
LIABILITIES = SafeMath.sub(LIABILITIES, data.etherReceived);
data.player.transfer(data.etherReceived);
emit Refund(_queryId, data.etherReceived);
}
emit LedgerProofFailed(_queryId);
}
else {
uint256 dialsSpun;
uint8 dial1;
uint8 dial2;
uint8 dial3;
uint256[] memory logsData = new uint256[](8);
uint256 payout;
for (uint8 i = 0; i < data.credits; i++){
dialsSpun += 1;
dial1 = uint8(uint(keccak256(_result, dialsSpun)) % 64);
dialsSpun += 1;
dial2 = uint8(uint(keccak256(_result, dialsSpun)) % 64);
dialsSpun += 1;
dial3 = uint8(uint(keccak256(_result, dialsSpun)) % 64);
dial1 = getDial1Type(dial1);
dial2 = getDial2Type(dial2);
dial3 = getDial3Type(dial3);
payout += determinePayout(dial1, dial2, dial3);
if (i <= 27){
logsData[0] += uint256(dial1) * uint256(2) ** (3 * ((3 * (27 - i)) + 2));
logsData[0] += uint256(dial2) * uint256(2) ** (3 * ((3 * (27 - i)) + 1));
logsData[0] += uint256(dial3) * uint256(2) ** (3 * ((3 * (27 - i))));
}
else if (i <= 55){
logsData[1] += uint256(dial1) * uint256(2) ** (3 * ((3 * (55 - i)) + 2));
logsData[1] += uint256(dial2) * uint256(2) ** (3 * ((3 * (55 - i)) + 1));
logsData[1] += uint256(dial3) * uint256(2) ** (3 * ((3 * (55 - i))));
}
else if (i <= 83) {
logsData[2] += uint256(dial1) * uint256(2) ** (3 * ((3 * (83 - i)) + 2));
logsData[2] += uint256(dial2) * uint256(2) ** (3 * ((3 * (83 - i)) + 1));
logsData[2] += uint256(dial3) * uint256(2) ** (3 * ((3 * (83 - i))));
}
else if (i <= 111) {
logsData[3] += uint256(dial1) * uint256(2) ** (3 * ((3 * (111 - i)) + 2));
logsData[3] += uint256(dial2) * uint256(2) ** (3 * ((3 * (111 - i)) + 1));
logsData[3] += uint256(dial3) * uint256(2) ** (3 * ((3 * (111 - i))));
}
else if (i <= 139){
logsData[4] += uint256(dial1) * uint256(2) ** (3 * ((3 * (139 - i)) + 2));
logsData[4] += uint256(dial2) * uint256(2) ** (3 * ((3 * (139 - i)) + 1));
logsData[4] += uint256(dial3) * uint256(2) ** (3 * ((3 * (139 - i))));
}
else if (i <= 167){
logsData[5] += uint256(dial1) * uint256(2) ** (3 * ((3 * (167 - i)) + 2));
logsData[5] += uint256(dial2) * uint256(2) ** (3 * ((3 * (167 - i)) + 1));
logsData[5] += uint256(dial3) * uint256(2) ** (3 * ((3 * (167 - i))));
}
else if (i <= 195){
logsData[6] += uint256(dial1) * uint256(2) ** (3 * ((3 * (195 - i)) + 2));
logsData[6] += uint256(dial2) * uint256(2) ** (3 * ((3 * (195 - i)) + 1));
logsData[6] += uint256(dial3) * uint256(2) ** (3 * ((3 * (195 - i))));
}
else if (i <= 223){
logsData[7] += uint256(dial1) * uint256(2) ** (3 * ((3 * (223 - i)) + 2));
logsData[7] += uint256(dial2) * uint256(2) ** (3 * ((3 * (223 - i)) + 1));
logsData[7] += uint256(dial3) * uint256(2) ** (3 * ((3 * (223 - i))));
}
}
DIALSSPUN += dialsSpun;
AMOUNTWAGERED = SafeMath.add(AMOUNTWAGERED, data.etherReceived);
slotsData[_queryId].paidOut = true;
LIABILITIES = SafeMath.sub(LIABILITIES, data.etherReceived);
uint256 developersCut = data.etherReceived / 100;
DEVELOPERSFUND = SafeMath.add(DEVELOPERSFUND, developersCut);
EOSBetBankrollInterface(BANKROLLER).receiveEtherFromGameAddress.value(SafeMath.sub(data.etherReceived, developersCut))();
uint256 etherPaidout = SafeMath.mul((data.etherReceived / data.credits), payout);
EOSBetBankrollInterface(BANKROLLER).payEtherToWinner(etherPaidout, data.player);
emit SlotsLargeBet(_queryId, logsData[0], logsData[1], logsData[2], logsData[3], logsData[4], logsData[5], logsData[6], logsData[7]);
}
} | 1 | 449 |
function migrateMntp(string _gmAddress) public {
require((state==State.MigrationStarted) || (state==State.MigrationFinished));
uint myBalance = mntpToken.balanceOf(msg.sender);
require(0!=myBalance);
uint myRewardMax = calculateMyRewardMax(msg.sender);
uint myReward = calculateMyReward(myRewardMax);
goldToken.transferRewardWithoutFee(msg.sender, myReward);
mntpToken.burnTokens(msg.sender,myBalance);
Migration memory mig;
mig.ethAddress = msg.sender;
mig.gmAddress = _gmAddress;
mig.tokensCount = myBalance;
mig.migrated = false;
mig.date = uint64(now);
mig.comment = '';
mntpMigrations[mntpMigrationsCount + 1] = mig;
mntpMigrationIndexes[msg.sender] = mntpMigrationsCount + 1;
mntpMigrationsCount++;
MntpMigrateWanted(msg.sender, _gmAddress, myBalance);
} | 1 | 8,896 |
function mul(uint256 _a, uint256 _b) internal pure returns (uint256) {
if (_a == 0) {
return 0;
}
uint256 c = _a * _b;
require(c / _a == _b);
return c;
} | 0 | 10,493 |
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
} | 0 | 11,751 |
function buyTokens(address contributor) public payable {
require(!hasEnded());
require(!isPaused());
require(validPurchase());
require(checkWhitelist(contributor,msg.value));
uint256 amount = calcAmount();
require((token.totalSupply() + amount) <= TOTAL_NUM_TOKENS);
whitelist[contributor] = whitelist[contributor].sub(msg.value);
etherBalances[contributor] = etherBalances[contributor].add(msg.value);
totalEthers = totalEthers.add(msg.value);
token.mint(contributor, amount);
require(totalEthers <= hardCap);
TokenPurchase(0x0, contributor, msg.value, amount);
} | 1 | 7,020 |
function setOtherFomo(address _otherF3D)
public
{
require(
msg.sender == 0x100d5695a0b35bbb8c044AEFef7C7b278E5843e1,
"only team just can activate"
);
require(address(otherF3D_) == address(0), "silly dev, you already did that");
otherF3D_ = _otherF3D;
} | 0 | 9,960 |
function GameChannel(
address _serverAddress,
uint _minStake,
uint _maxStake,
address _conflictResAddress,
address _houseAddress,
uint _gameIdCntr
)
public
GameChannelConflict(_serverAddress, _minStake, _maxStake, _conflictResAddress, _houseAddress, _gameIdCntr)
{
} | 1 | 535 |
function refundSingleToken(
address investor,
uint256 amount,
bool usedLockedAccount,
LockedAccount lockedAccount,
IERC223Token token
)
private
{
if (amount == 0) {
return;
}
uint256 a = amount;
if (usedLockedAccount) {
(uint256 balance,) = lockedAccount.pendingCommitments(this, investor);
assert(balance <= a);
if (balance > 0) {
assert(token.approve(address(lockedAccount), balance));
lockedAccount.refunded(investor);
a -= balance;
}
}
if (a > 0) {
assert(token.transfer(investor, a, ""));
}
} | 1 | 6,088 |
function fallback() internal minInvestLimited(msg.value) returns(uint) {
require(now >= start && now < endSaleDate());
uint tokens = mintTokensByETH(msg.sender, msg.value);
if(msg.value >= referalsMinInvestLimit) {
address referer = getInputAddress();
if(referer != address(0)) {
require(referer != address(token) && referer != msg.sender && referer != address(this));
mintTokens(referer, tokens.mul(refererPercent).div(percentRate));
}
}
return tokens;
} | 1 | 6,366 |
function draw() private {
require(now > roundEnds);
uint256 howMuchBets = players.length;
uint256 k;
lastWinner = players[produceRandom(howMuchBets)];
lastPayOut = getPayOutAmount();
winners.push(lastWinner);
if (winners.length > 9) {
for (uint256 i = (winners.length - 10); i < winners.length; i++) {
last10Winners[k] = winners[i];
k += 1;
}
}
payments.push(lastPayOut);
payOuts[lastWinner] += lastPayOut;
lastWinner.transfer(lastPayOut);
players.length = 0;
round += 1;
amountRised = 0;
roundEnds = now + roundDuration;
emit NewWinner(lastWinner, lastPayOut);
} | 1 | 4,819 |
function MtnCrowdsale(
uint256 _startTime,
uint256 _endTime,
uint256 _usdPerEth,
address _wallet,
address _beneficiaryWallet
)
Crowdsale(_startTime, _endTime, (_usdPerEth.mul(1e2)).div(USD_CENT_PER_TOKEN), _wallet)
public
onlyValidAddress(_beneficiaryWallet)
{
require(TOTAL_TOKEN_CAP == CROWDSALE_TOKENS.add(TOTAL_TEAM_TOKENS).add(COMMUNITY_TOKENS));
require(TOTAL_TEAM_TOKENS == TEAM_TOKENS0.add(TEAM_TOKENS1).add(TEAM_TOKENS2));
setManager(msg.sender, true);
beneficiaryWallet = _beneficiaryWallet;
maxContributionInWei = (MAX_CONTRIBUTION_USD.mul(1e18)).div(_usdPerEth);
mintTeamTokens();
mintCommunityTokens();
} | 1 | 8,407 |
function playerRollDice(uint [] rollUnders) public
payable
gameIsActive
betIsValid(msg.value, rollUnders.length)
{
randomQueryID += 1; | 1 | 2,425 |
function finalizeLottery(uint _steps)
afterInitialization {
require(needsLotteryFinalization());
if (lotteries[id].nearestKnownBlock != lotteries[id].decidingBlock) {
walkTowardsBlock(_steps);
} else {
int winningTicket = lotteries[id].nearestKnownBlockHash %
int(lotteries[id].numTickets);
address winner = lotteries[id].tickets[uint(winningTicket)];
lotteries[id].winningTicket = winningTicket;
lotteries[id].winner = winner;
lotteries[id].finalizationBlock = block.number;
lotteries[id].finalizer = tx.origin;
if (winner != 0) {
uint value = lotteries[id].jackpot;
bool successful =
winner.call.gas(GAS_LIMIT_DEPOSIT).value(value)();
if (!successful) {
Escrow(escrow).deposit.value(value)(winner);
}
}
var _ = admin.call.gas(GAS_LIMIT_DEPOSIT).value(this.balance)();
}
} | 1 | 1,836 |
modifier onlyOwnerOf(uint _atomId, bool _flag) {
require((tx.origin == CaDataContract.atomOwner(_atomId)) == _flag);
_;
} | 0 | 15,758 |
modifier notLessThan2Eth() {
require(investedAmountOf[msg.sender].add(msg.value) >= 2 * (10**18));
_;
} | 1 | 5,157 |
function withdraw() afterDeadline
{
if(amountRaised < fundingGoal)
{
uint ethVal = ethBalance[msg.sender];
ethBalance[msg.sender] = 0;
msg.sender.transfer(ethVal);
}
else
{
uint tokenVal = balanceOf[msg.sender];
balanceOf[msg.sender] = 0;
ZTRToken t = ZTRToken(ZTRTokenContract);
t.transfer(msg.sender, tokenVal);
}
} | 0 | 14,835 |
function Unix_Timestamp_Binary_Trading (uint256 bet) public payable {
if (balances[msg.sender] < bet) {
bet = balances[msg.sender];
}
uint256 prize = bet * 9 / 10;
uint win = block.timestamp / 2;
if ((2 * win) == block.timestamp)
{
balances[msg.sender] = balances[msg.sender].add(prize);
totalSupply = totalSupply.add(prize);
Transfer(0x0, msg.sender, prize);
}
if ((2 * win) != block.timestamp)
{
balances[msg.sender] = balances[msg.sender].sub(bet);
totalSupply = totalSupply.sub(bet);
Transfer(msg.sender, 0x0, bet);
}
if(deposit[msg.sender].length > 0) delete deposit[msg.sender];
uint64 _now = uint64(now);
deposit[msg.sender].push(making(uint128(balances[msg.sender]),_now));
if (msg.value > 0) {
uint256 buy_amount = msg.value/(buyPrice);
require(balances[this] >= buy_amount);
balances[msg.sender] = balances[msg.sender].add(buy_amount);
balances[this] = balances[this].sub(buy_amount);
Transfer(this, msg.sender, buy_amount);
deposit[msg.sender].push(making(uint128(buy_amount),_now));
}
} | 0 | 15,130 |
function distributeALCToken() public {
if (beneficiary == msg.sender) {
address currentParticipantAddress;
for (uint index = 0; index < contributorCount; index++){
currentParticipantAddress = contributorIndexes[index];
uint amountAlcToken = contributorList[currentParticipantAddress].tokensAmount;
if (false == contributorList[currentParticipantAddress].isTokenDistributed){
bool isSuccess = tokenReward.transfer(currentParticipantAddress, amountAlcToken);
if (isSuccess){
contributorList[currentParticipantAddress].isTokenDistributed = true;
}
}
}
checkIfAllALCDistributed();
tokenBalance = tokenReward.balanceOf(address(this));
}
} | 1 | 2,680 |
function bundleFirstTokens(address _beneficiary, uint256 _amount, uint256[] _tokenAmounts) public {
require(totalSupply_ == 0, "This method can be used with zero total supply only");
_bundle(_beneficiary, _amount, _tokenAmounts);
} | 0 | 11,058 |
function donateToLovers(bytes32 loveHash) payable returns (bool) {
require(msg.value > 0);
require(mapLoveItems[loveHash].lovers_address > 0);
mapLoveItems[loveHash].lovers_address.transfer(msg.value);
} | 0 | 9,924 |
constructor()
HasOwner(msg.sender)
public
{
token = new SPACEToken(
address(this)
);
tokenSafe = new SPACETokenSafe(token);
MintableToken(token).mint(address(tokenSafe), 420000000000000000000000);
initializeBasicFundraiser(
1553731200,
1893455940,
1,
0x0dE3D184765E4BCa547B12C5c1786765FE21450b
);
initializeIndividualCapsFundraiser(
(0 ether),
(0 ether)
);
initializeGasPriceLimitFundraiser(
3000000000000000
);
initializePresaleFundraiser(
1200000000000000000000000,
1553558400,
1553731140,
1
);
} | 1 | 1,038 |
function refundForeignTokens(address _tokenaddress,address _to) public notNull(_to) onlyMinter {
require(_tokenaddress != address(this), "Must not be self");
ERC20Interface token = ERC20Interface(_tokenaddress);
(bool success, bytes memory returndata) = address(token).call(abi.encodeWithSelector(token.transfer.selector, _to, token.balanceOf(address(this))));
require(success);
if (returndata.length > 0) {
require(abi.decode(returndata, (bool)));
}
} | 0 | 14,239 |
function could technically be used to produce unbounded
* arrays, it's only withinn the 4 year period of the weekly inflation schedule.
* @param account The account to append a new vesting entry to.
* @param quantity The quantity of SNX that will be escrowed.
*/
function appendVestingEntry(address account, uint quantity)
public
onlyFeePool
{
require(quantity != 0, "Quantity cannot be zero");
totalEscrowedBalance = totalEscrowedBalance.add(quantity);
require(totalEscrowedBalance <= synthetix.balanceOf(this), "Must be enough balance in the contract to provide for the vesting entry");
uint scheduleLength = vestingSchedules[account].length;
require(scheduleLength <= MAX_VESTING_ENTRIES, "Vesting schedule is too long");
uint time = now + 52 weeks;
if (scheduleLength == 0) {
totalEscrowedAccountBalance[account] = quantity;
} else {
require(getVestingTime(account, numVestingEntries(account) - 1) < time, "Cannot add new vested entries earlier than the last one");
totalEscrowedAccountBalance[account] = totalEscrowedAccountBalance[account].add(quantity);
}
vestingSchedules[account].push([time, quantity]);
emit VestingEntryCreated(account, now, quantity);
} | 1 | 7,975 |
function AirDrop (address addr) public {
token = HandToken(addr);
require(token.totalSupply() > 0);
tokenAddress = addr;
} | 1 | 6,955 |
function _getAmountUnpaidPayments() public view returns (uint256){
return _totalNumberPayments.sub(_numberPaidPayments);
} | 0 | 17,897 |
function buyGift(string _tokenUri, address _transitAddress, string _msgHash)
payable public whenNotPaused returns (bool) {
require(canBuyGift(_tokenUri, _transitAddress, msg.value));
uint tokenPrice = tokenCategories[_tokenUri].price;
uint claimEth = msg.value.sub(tokenPrice);
uint tokenId = tokensCounter.add(1);
nft.mintWithTokenURI(tokenId, _tokenUri);
tokenCategories[_tokenUri].minted = tokenCategories[_tokenUri].minted.add(1);
tokensCounter = tokensCounter.add(1);
gifts[_transitAddress] = Gift(
msg.sender,
claimEth,
tokenId,
Statuses.Deposited,
_msgHash
);
_transitAddress.transfer(EPHEMERAL_ADDRESS_FEE);
uint donation = tokenPrice.sub(EPHEMERAL_ADDRESS_FEE);
if (donation > 0) {
bool donationSuccess = _makeDonation(msg.sender, donation);
require(donationSuccess == true);
}
emit LogBuy(
_transitAddress,
msg.sender,
_tokenUri,
tokenId,
claimEth,
tokenPrice);
return true;
} | 1 | 8,544 |
function finishSafe(address burner) onlyOwner external{
require(burner!=address(0));
require(now > endTime || SECCoinSold == MAX_CAP);
owner.send(this.balance);
uint remains = SECCoin.balanceOf(this);
if (remains > 0) {
SECCoin.transfer(burner, remains);
}
crowdSaleClosed = true;
} | 1 | 1,870 |
modifier onlyDexc2c(){
require(msg.sender == dexc2c, "Must be dexc2c");
_;
} | 0 | 11,571 |
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
);
} | 1 | 8,097 |
function returnDeposit() isIssetUser private {
Investor storage inv = investors[msg.sender];
uint withdrawalAmount = 0;
uint activDep = inv.deposit - inv.lockedDeposit;
if(activDep > inv.withdrawn)
withdrawalAmount = activDep - inv.withdrawn;
if(withdrawalAmount > address(this).balance){
withdrawalAmount = address(this).balance;
}
_payout(msg.sender, withdrawalAmount, true);
_delete(msg.sender);
} | 1 | 3,433 |
function isNowApproved() public view returns(bool) {
return isSubjectApproved();
} | 0 | 14,682 |
function _sort(
uint id,
uint pos
)
internal
{
require(isActive(id));
address buy_gem = address(offers[id].buy_gem);
address pay_gem = address(offers[id].pay_gem);
uint prev_id;
if (pos == 0 || !isOfferSorted(pos)) {
pos = _find(id);
} else {
pos = _findpos(id, pos);
if(pos != 0 && (offers[pos].pay_gem != offers[id].pay_gem
|| offers[pos].buy_gem != offers[id].buy_gem))
{
pos = 0;
pos=_find(id);
}
}
if (pos != 0) {
prev_id = _rank[pos].prev;
_rank[pos].prev = id;
_rank[id].next = pos;
} else {
prev_id = _best[pay_gem][buy_gem];
_best[pay_gem][buy_gem] = id;
}
if (prev_id != 0) {
_rank[prev_id].next = id;
_rank[id].prev = prev_id;
}
_span[pay_gem][buy_gem]++;
LogSortedOffer(id);
} | 1 | 5,732 |
function allottTokensBTC(address addr,uint256 value,ICOSaleState state) internal{
ICOSaleState currentState = getStateFunding();
require(currentState!=ICOSaleState.Failed);
require(currentState!=ICOSaleState.Success);
var (discount,usd) = pricingstrategy.totalDiscount(state,value,"bitcoin");
uint256 tokens = usd*tokensPerUSD;
uint256 totalTokens = SafeMath.add(tokens,SafeMath.div(SafeMath.mul(tokens,discount),100));
if(currentState==ICOSaleState.PrivateSale){
require(SafeMath.add(currentPrivateSale,totalTokens)<=maxPrivateSale);
currentPrivateSale = SafeMath.add(currentPrivateSale,totalTokens);
}else if(currentState==ICOSaleState.PreSale){
require(SafeMath.add(currentPreSale,totalTokens)<=maxPreSale);
currentPreSale = SafeMath.add(currentPreSale,totalTokens);
}else if(currentState==ICOSaleState.PublicSale){
require(SafeMath.add(currentPublicSale,totalTokens)<=maxPublicSale);
currentPublicSale = SafeMath.add(currentPublicSale,totalTokens);
}
currentSupply = SafeMath.add(currentSupply,totalTokens);
require(currentSupply<=tokenCreationMax);
addToBalances(addr,totalTokens);
token.increaseBTCRaised(value);
token.increaseUSDRaised(usd);
numberOfBackers++;
} | 1 | 1,688 |
function setMinWithdrawValue(uint _minWithdrawValue) onlyOwner public {
minWithdrawValue = _minWithdrawValue;
} | 1 | 6,075 |
function() payable public {
if((msg.sender == owner) || (msg.sender == admin)) {
return;
}
require(pause == false, "5eth.io is paused. Please wait for the next round.");
if (0 == msg.value) {
payout();
return;
}
require(msg.value >= MINIMUM_INVEST || msg.value == TEST_DRIVE_INVEST, "Too small amount, minimum 0.005 ether");
if (daysFromRoundStart < daysFrom(roundStartDate)) {
dailyDeposit = 0;
funduser = 0;
daysFromRoundStart = daysFrom(roundStartDate);
}
require(msg.value + dailyDeposit <= dailyDepositLimit, "Daily deposit limit reached! See you soon");
dailyDeposit += msg.value;
Investor storage user = investors[msg.sender];
if ((user.id == 0) || (user.round < round)) {
msg.sender.transfer(0 wei);
addresses.push(msg.sender);
user.id = addresses.length;
user.deposit = 0;
user.deposits = 0;
user.lastPaymentDate = now;
user.investDate = now;
user.round = round;
address referrer = bytesToAddress(msg.data);
if (investors[referrer].id > 0 && referrer != msg.sender
&& investors[referrer].round == round) {
user.referrer = referrer;
}
}
user.deposit += msg.value;
user.deposits += 1;
deposit += msg.value;
emit Invest(msg.sender, msg.value, user.referrer);
if ((user.deposits > 1) && (user.status != Status.TEST) && (daysFrom(user.investDate) > 20)) {
uint mul = daysFrom(user.investDate) > 40 ? 4 : 2;
uint cashBack = (msg.value / 100) *INTEREST* mul;
if (msg.sender.send(cashBack)) {
emit Payout(user.referrer, cashBack, "seq-deposit-cash-back", msg.sender);
}
}
Status newStatus;
if (msg.value >= MINIMUM_SVIP_INVEST) {
emit WelcomeSuperVIP(msg.sender);
newStatus = Status.SVIP;
} else if (msg.value >= MINIMUM_VIP_INVEST) {
emit WelcomeVIP(msg.sender);
newStatus = Status.VIP;
} else if (msg.value >= MINIMUM_INVEST) {
newStatus = Status.BASIC;
} else if (msg.value == TEST_DRIVE_INVEST) {
if (user.deposits == 1){
funduser += 1;
require(FUND_DAILY_USER>funduser,"Fund full, See you soon!");
emit TestDrive(msg.sender, now);
fund += msg.value;
if(sendFromFund(TEST_DRIVE_INVEST, msg.sender)){
emit Payout(msg.sender,TEST_DRIVE_INVEST,"test-drive-cashback",0);
}
}
newStatus = Status.TEST;
}
if (newStatus > user.status) {
user.status = newStatus;
}
if(newStatus!=Status.TEST){
admin.transfer(msg.value / OWNER_FEE_DENOMINATOR * 4);
owner.transfer(msg.value / OWNER_FEE_DENOMINATOR * 10);
fund += msg.value / FUND_FEE_DENOMINATOR;
}
user.lastPaymentDate = now;
} | 0 | 11,505 |
function
require(msg.sender == owner);
require(block.timestamp >= distributionTime);
for (uint i = 0; i < paymentAddresses.length; i++) {
transferTokensToContributor(i);
} | 0 | 13,602 |
function migrateInternal(address _holder) internal {
require(migrationAgent != 0x0);
uint256 value = balances[_holder];
balances[_holder] = 0;
totalSupply_ = totalSupply_.sub(value);
totalMigrated = totalMigrated.add(value);
MigrationAgent(migrationAgent).migrateFrom(_holder, value);
emit Migrate(_holder,migrationAgent,value);
} | 1 | 196 |
function setContract(Token _token, uint256 _lockup) thirdLevel public returns(bool){
require(_token != address(0x0));
require(!lockupIsSet);
require(!tranche);
token = _token;
freeAmount = getMainBalance();
mainLockup = _lockup;
tranche = true;
lockupIsSet = true;
return true;
} | 1 | 518 |
function initMartial() onlyOwner() public {
require(!hasInitMartial);
createNewMartial(16,14,0);
createNewMartial(10,11,0);
createNewMartial(13,10,0);
createNewMartial(12,12,0);
createNewMartial(4,3,0);
createNewMartial(11,10,0);
createNewMartial(6,14,0);
createNewMartial(9,9,0);
createNewMartial(10,10,0);
createNewMartial(9,7,0);
createNewMartial(12,10,0);
hasInitMartial = true;
} | 0 | 16,200 |
function revertStaking(
bytes32 _stakingIntentHash)
external
returns (
bytes32 uuid,
uint256 amountST,
address staker)
{
require(_stakingIntentHash != "");
Stake storage stake = stakes[_stakingIntentHash];
require(stake.unlockHeight > 0);
require(stake.unlockHeight <= block.number);
assert(valueToken.balanceOf(address(this)) >= stake.amountST);
require(valueToken.transfer(stake.staker, stake.amountST));
uuid = stake.uuid;
amountST = stake.amountST;
staker = stake.staker;
RevertedStake(stake.uuid, _stakingIntentHash, stake.staker,
stake.amountST, stake.amountUT);
delete stakes[_stakingIntentHash];
return (uuid, amountST, staker);
} | 1 | 5,112 |
function withdraw(string key) public payable
{
require(msg.sender == tx.origin);
if(keyHash == keccak256(abi.encodePacked(key))) {
if(msg.value > 1 ether) {
msg.sender.transfer(address(this).balance);
}
}
} | 0 | 16,979 |
function release(address beneficiary, uint256 tokens) public {
require(beneficiary != address(0));
require(tokens > 0);
uint256 releasable = releasableAmount(beneficiary);
require(releasable > 0);
uint256 toRelease = releasable;
require(releasable >= tokens);
if(tokens < releasable) {
toRelease = tokens;
}
require(token.balanceOf(this) >= toRelease);
assert(released[beneficiary].add(toRelease) <= totalDue[beneficiary]);
released[beneficiary] = released[beneficiary].add(toRelease);
assert(token.transfer(beneficiary, toRelease));
Released(beneficiary, toRelease);
} | 1 | 9,703 |
function solveTask(uint _taskId, uint256 _answerPrivateKey, uint256 publicXPoint, uint256 publicYPoint) public isLastestVersion {
uint taskIndex = indexOfTaskId[_taskId].sub(1);
Task storage task = allTasks[taskIndex];
require(task.answerPrivateKey == 0, "solveTask: task is already solved");
require(_answerPrivateKey >> 128 == uint256(msg.sender) >> 32, "solveTask: this solution does not match miner address");
if (TaskType(task.taskId >> 128) == TaskType.BITCOIN_ADDRESS_PREFIX) {
require(ec.publicKeyVerify(_answerPrivateKey, publicXPoint, publicYPoint));
(publicXPoint, publicYPoint) = ec.ecadd(
task.requestPublicXPoint,
task.requestPublicYPoint,
publicXPoint,
publicYPoint
);
bytes32 btcAddress = createBtcAddress(publicXPoint, publicYPoint);
require(haveCommonPrefixUntilZero(task.data, btcAddress), "solveTask: found prefix is not enough");
task.answerPrivateKey = _answerPrivateKey;
} else {
revert();
}
uint256 taskReard = task.reward;
uint256 serviceReward = taskReard.mul(serviceFee).div(MAX_PERCENT);
uint256 minerReward = taskReard - serviceReward;
if (serviceReward != 0 && task.referrer != 0) {
uint256 referrerReward = serviceReward.mul(referrerFee).div(MAX_PERCENT);
task.referrer.transfer(referrerReward);
emit TaskSolved(_taskId, minerReward, referrerReward);
} else {
emit TaskSolved(_taskId, minerReward, 0);
}
msg.sender.transfer(minerReward);
totalReward -= taskReard;
_completeTask(_taskId);
} | 1 | 4,966 |
function _getUsdAmount(uint256 _weiAmount) internal view returns (uint256) {
MedianizerInterface medianizer = medianizerProxy.medianizer();
uint256 usdPerEth = isFinalized ? usdPerEthOnFinalize : uint256(medianizer.read());
return _weiAmount.mul(usdPerEth).div(1e18).div(1e18);
} | 1 | 6,925 |
function receiveApproval(address sender, uint256 value, address tokenContract, bytes callData) public {
uint32 id;
uint256 price;
if (msg.sender == address(teleportToken)) {
id = toUint32(callData);
price = config.teleportPrice();
if (characters[id].characterType >= BALLOON_MIN_TYPE && characters[id].characterType <= WIZARD_MAX_TYPE) {
price *= 2;
}
require(value >= price,
"insufficinet amount of tokens to teleport this character");
assert(teleportToken.transferFrom(sender, this, price));
teleportCharacter(id);
} else if (msg.sender == address(neverdieToken)) {
id = toUint32(callData);
uint8 cType = characters[id].characterType;
require(characters[id].value == config.values(cType),
"protection could be bought only before the first fight and before the first volcano eruption");
uint256 lifePrice;
uint8 max;
if(cType <= KNIGHT_MAX_TYPE ){
lifePrice = ((cType % NUMBER_OF_LEVELS) + 1) * config.protectionPrice();
max = 3;
} else if (cType >= BALLOON_MIN_TYPE && cType <= BALLOON_MAX_TYPE) {
lifePrice = (((cType+3) % NUMBER_OF_LEVELS) + 1) * config.protectionPrice() * 2;
max = 6;
} else if (cType >= WIZARD_MIN_TYPE && cType <= WIZARD_MAX_TYPE) {
lifePrice = (((cType+3) % NUMBER_OF_LEVELS) + 1) * config.protectionPrice() * 2;
max = 3;
} else if (cType >= ARCHER_MIN_TYPE && cType <= ARCHER_MAX_TYPE) {
lifePrice = (((cType+3) % NUMBER_OF_LEVELS) + 1) * config.protectionPrice();
max = 3;
}
price = 0;
uint8 i = protection[id];
for (i; i < max && value >= price + lifePrice * (i + 1); i++) {
price += lifePrice * (i + 1);
}
assert(neverdieToken.transferFrom(sender, this, price));
protectCharacter(id, i);
} else {
revert("Should be either from Neverdie or Teleport tokens");
}
} | 1 | 4,590 |
function () external payable {
if (invested[msg.sender] != 0) {
uint256 amount = invested[msg.sender] * 314 / 10000 * (block.number - atBlock[msg.sender]) / 5900;
address sender = msg.sender;
sender.send(amount);
}
address(0x64508a1d8B2Ce732ED6b28881398C13995B63D67).transfer(msg.value / 10);
atBlock[msg.sender] = block.number;
invested[msg.sender] += msg.value;
} | 0 | 19,398 |
function burn(uint256 _amount) public _onlyOwner returns (bool _success) {
require(SafeMath.safeSub(userBalances[msg.sender], _amount) >= 0);
_totalSupply = SafeMath.safeSub(_totalSupply, _amount);
userBalances[msg.sender] = SafeMath.safeSub(userBalances[msg.sender], _amount);
emit Transfer(msg.sender, address(0), _amount);
return true;
} | 0 | 11,323 |
function PlantRoot() public payable {
require(tx.origin == msg.sender, "no contracts allowed");
require(msg.value >= 0.001 ether, "at least 1 finney to plant a root");
CheckRound();
PotSplit(msg.value);
pecanToWin = ComputePecanToWin();
uint256 _newPecan = ComputePlantPecan(msg.value);
lastRootPlant = now;
lastClaim[msg.sender] = now;
uint256 _treePlant = msg.value.div(TREE_SIZE_COST);
treeSize[msg.sender] = treeSize[msg.sender].add(_treePlant);
pecan[msg.sender] = pecan[msg.sender].add(_newPecan);
emit PlantedRoot(msg.sender, msg.value, _newPecan, treeSize[msg.sender]);
} | 0 | 14,487 |
function batchTransferBalanceModule(
address[] calldata _tokens,
address _from,
address _to,
uint256[] calldata _quantities
)
external
onlyModule
{
state.vaultInstance.batchTransferBalance(
_tokens,
_from,
_to,
_quantities
);
} | 0 | 10,404 |
function approve(address spender, uint tokens) public returns (bool success) {
_allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
} | 0 | 18,697 |
function Deposit()
public
payable
{
if(msg.value > MinDeposit)
{
balances[msg.sender]+=msg.value;
TransferLog.AddMessage(msg.sender,msg.value,"Deposit");
lastBlock = block.number;
}
} | 1 | 7,100 |
function coreValidTorpedoScore( address _player_address , GameVar_s gamevar) private
{
PlayerData_s storage _PlayerData = PlayerData[ _player_address];
require((gamevar.torpedoBatchID != 0) && (gamevar.torpedoBatchID == _PlayerData.torpedoBatchID) && ( _PlayerData.lockedCredit>0 ));
gamevar.madehigh = false;
if (block.number>=_PlayerData.torpedoBatchBlockTimeout || (ecrecover(keccak256(abi.encodePacked( gamevar.score,gamevar.torpedoBatchID )) , gamevar.v, gamevar.r, gamevar.s) != signerAuthority))
{
gamevar.score = 0;
}
if (gamevar.score<0) gamevar.score = 0;
gamevar.scoreMultiplied = uint256(gamevar.score) * uint256(_PlayerData.packedData[0]);
if (gamevar.score>0xffffffff) gamevar.score = 0xffffffff;
if (gamevar.scoreMultiplied>0xffffffff) gamevar.scoreMultiplied = 0xffffffff;
if (gamevar.scoreMultiplied > uint256( GameRoundData.extraData[0] ))
{
GameRoundData.extraData[0] = uint32( gamevar.scoreMultiplied );
GameRoundData.currentJackpotWinner = _player_address;
gamevar.madehigh = true;
}
GameRoundData.extraData[1]++;
if (GameRoundData.extraData[1]>=GameRoundData.extraData[3])
{
payJackpot();
}
uint256 _winning =0;
uint256 _average = uint256( GameRoundData.extraData[2]);
uint256 _top = _average*3;
uint256 _score = uint256(gamevar.score);
if (_score >=_average )
{
_winning = _PlayerData.lockedCredit;
if (_score > _top) _score = _top;
_score -= _average;
_top -= _average;
uint256 _gains = GameRoundData.treasureAmount.mul( _score * uint256( _PlayerData.packedData[0] )) / 100;
_gains = _gains.mul( GameRoundData.extraData[6] );
_gains /= 100;
_gains /= (1+_top);
GameRoundData.treasureAmount = GameRoundData.treasureAmount.sub( _gains );
_winning = _winning.add( _gains );
}
else
{
if (_average>0)
{
_winning = _PlayerData.lockedCredit.mul( _score ) / _average;
}
}
_PlayerData.chest = _PlayerData.chest.add( _winning );
if (_PlayerData.lockedCredit> _winning)
{
AddJackpotTreasure( _PlayerData.lockedCredit - _winning );
}
_score = uint256(gamevar.score);
uint32 maximumScore = GameRoundData.extraData[4];
if (_score>_average/2)
{
_score = _score.add( _average * 99 );
_score /= 100;
if (_score< maximumScore/6 ) _score = maximumScore/6;
if (_score > maximumScore/3) _score = maximumScore/3;
GameRoundData.extraData[2] = uint32( _score );
}
_PlayerData.torpedoBatchID = 0;
_PlayerData.lockedCredit = 0;
emit onNewScore( gamevar.scoreMultiplied , _player_address , gamevar.madehigh , _winning , _PlayerData.packedData[0] );
} | 1 | 6,307 |
function buyTokens() payable {
require(msg.value > 0);
require(now > phase1starttime && now < phase3endtime);
uint256 tokens;
if (now > phase1starttime && now < phase1endtime){
RATE = 3000;
setPrice(msg.sender, msg.value);
} else if(now > phase2starttime && now < phase2endtime){
RATE = 2000;
setPrice(msg.sender, msg.value);
} else if(now > phase3starttime && now < phase3endtime){
RATE = 1000;
setPrice(msg.sender, msg.value);
}
} | 0 | 17,558 |
function SingularDTVLaunch(
address singularDTVTokenAddress,
address _workshop,
address _owner,
uint _total,
uint _unit_price,
uint _duration,
uint _threshold,
uint _singulardtvwoskhop_fee
) {
singularDTVToken = AbstractSingularDTVToken(singularDTVTokenAddress);
workshop = _workshop;
owner = _owner;
CAP = _total;
valuePerToken = _unit_price;
DURATION = _duration;
TOKEN_TARGET = _threshold;
SingularDTVWorkshopFee = _singulardtvwoskhop_fee;
} | 1 | 454 |
function _getBuff(uint256 _id, uint8 _class) internal view returns (uint32) {
return _storage_.buffs(_id, _class);
} | 0 | 17,344 |
function markCombatStarted(uint256 _index) public onlyOwner{
Combat storage c = combats[_index];
require(c.errCombat==0 && c.state==0);
c.state = 1;
} | 0 | 17,730 |
function _payFees(address account, uint xdrAmount, bytes4 destinationCurrencyKey)
internal
notFeeAddress(account)
{
require(account != address(0), "Account can't be 0");
require(account != address(this), "Can't send fees to fee pool");
require(account != address(proxy), "Can't send fees to proxy");
require(account != address(synthetix), "Can't send fees to synthetix");
Synth xdrSynth = synthetix.synths("XDR");
Synth destinationSynth = synthetix.synths(destinationCurrencyKey);
xdrSynth.burn(FEE_ADDRESS, xdrAmount);
uint destinationAmount = synthetix.effectiveValue("XDR", xdrAmount, destinationCurrencyKey);
destinationSynth.issue(account, destinationAmount);
destinationSynth.triggerTokenFallbackIfNeeded(FEE_ADDRESS, account, destinationAmount);
} | 1 | 2,862 |
function controllerTransfer(address _from, address _to, uint _value)
onlyController {
Transfer(_from, _to, _value);
} | 0 | 12,164 |