func
stringlengths 11
25k
| label
int64 0
1
| __index_level_0__
int64 0
19.4k
|
---|---|---|
function burn(uint256 _value) {
migration (msg.sender);
require ( balances[msg.sender] >= _value);
balances[msg.sender] = balances[msg.sender].sub(_value);
totalSupply = totalSupply.sub(_value);
Burn(msg.sender, _value);
}
| 1 | 1,117 |
function _burn (uint256 _tokenId) internal {
delete tokenToMetaData[_tokenId];
super._burn(ownerOf(_tokenId), _tokenId);
}
| 0 | 14,573 |
function moveAccount(
bytes32 _label,
UsernameRegistrar _newRegistry
)
external
{
require(state == RegistrarState.Moved, "Wrong contract state");
require(msg.sender == accounts[_label].owner, "Callable only by account owner.");
require(ensRegistry.owner(ensNode) == address(_newRegistry), "Wrong update");
Account memory account = accounts[_label];
delete accounts[_label];
token.approve(_newRegistry, account.balance);
_newRegistry.migrateUsername(
_label,
account.balance,
account.creationTime,
account.owner
);
}
| 1 | 1,756 |
function checkBalance(address _owner) public view returns (uint256 stake, uint256 locked)
{
return (m_accounts[_owner].stake, m_accounts[_owner].locked);
}
| 1 | 497 |
function takeOwnership(uint256 _tokenId) public {
address newOwner = msg.sender;
address oldOwner = personIndexToOwnerGen1[_tokenId];
require(_addressNotNull(newOwner));
require(_approvedGen1(newOwner, _tokenId));
_transfer(oldOwner, newOwner, _tokenId);
}
| 1 | 6,751 |
function isDeprecated() public view returns (bool deprecated) {
return (deprecatedSince != 0);
}
| 0 | 12,300 |
function manualMinting(address contributor, uint256 value) onlyOwner stopInEmergency public {
require(withinPeriod());
require(contributor != 0x0);
require(value >= minimalWei);
uint256 amount;
uint256 odd_ethers;
uint256 ethers;
(amount, odd_ethers) = calcAmount(value, totalWei);
require(amount + token.totalSupply() + bonusAvailable <= hardCapInTokens);
ethers = value.sub(odd_ethers);
token.mint(contributor, amount);
EManualMinting(contributor, amount, ethers);
totalWei = totalWei.add(ethers);
bonusAvailable = bonusAvailable.add(amount.mul(20).div(100));
}
| 1 | 870 |
constructor(
uint256 _fundingStartTime,
uint256 _fundingEndTime,
address _borrower,
uint256 _annualInterest,
uint256 _totalLendingAmount,
uint256 _lendingDays,
address _storageAddress,
address _localNode,
address _ethicHubTeam,
uint256 _ethichubFee,
uint256 _localNodeFee
)
EthicHubBase(_storageAddress)
public {
require(_fundingEndTime > fundingStartTime, "fundingEndTime should be later than fundingStartTime");
require(_borrower != address(0), "No borrower set");
require(ethicHubStorage.getBool(keccak256(abi.encodePacked("user", "representative", _borrower))), "Borrower not registered representative");
require(_localNode != address(0), "No Local Node set");
require(_ethicHubTeam != address(0), "No EthicHub Team set");
require(ethicHubStorage.getBool(keccak256(abi.encodePacked("user", "localNode", _localNode))), "Local Node is not registered");
require(_totalLendingAmount > 0, "_totalLendingAmount must be > 0");
require(_lendingDays > 0, "_lendingDays must be > 0");
require(_annualInterest > 0 && _annualInterest < 100, "_annualInterest must be between 0 and 100");
version = 6;
reclaimedContributions = 0;
reclaimedSurpluses = 0;
borrowerReturnDays = 0;
fundingStartTime = _fundingStartTime;
fundingEndTime = _fundingEndTime;
localNode = _localNode;
ethicHubTeam = _ethicHubTeam;
borrower = _borrower;
annualInterest = _annualInterest;
totalLendingAmount = _totalLendingAmount;
lendingDays = _lendingDays;
ethichubFee = _ethichubFee;
localNodeFee = _localNodeFee;
state = LendingState.Uninitialized;
}
| 1 | 3,357 |
function setOraclizeGasLimit(uint _newLimit) public auth {
oraclizeCallbackGas = _newLimit;
}
| 1 | 9,104 |
function _processBonus(address _beneficiary, uint256 _tokenAmount)internal {
uint256 bonusTokens = bonusScheme.getBonusTokens(_tokenAmount);
if (balances[bonusScheme] < bonusTokens) {
bonusTokens = balances[bonusScheme];
}
if (bonusTokens > 0) {
balances[bonusScheme] = balances[bonusScheme].sub(bonusTokens);
balances[_beneficiary] = balances[_beneficiary].add(bonusTokens);
emit Transfer(address(bonusScheme), _beneficiary, bonusTokens);
emit BonusSent(address(bonusScheme), _beneficiary, _tokenAmount, bonusTokens);
tokensSold = tokensSold.add(bonusTokens);
}
}
| 1 | 7,678 |
function vote1(address _voter, address _votee) external {
require(balances[_voter] >= 10);
require(accountRegistry.canVoteOnProposal(_voter, msg.sender));
balances[_voter] -= 10;
balances[owner] += 9;
balances[_votee] += 1;
Transfer(_voter, owner, 9);
Transfer(_voter, _votee, 1);
}
| 1 | 721 |
function isTransferAllowedteam() public returns(bool)
{
if (isReleasedToteam==true)
return true;
if(now < endTime + 52 weeks)
{
if(msg.sender==TEAM_1 || msg.sender==TEAM_2 || msg.sender==TEAM_3 || msg.sender==TEAM_4 || msg.sender==TEAM_5)
return false;
}
return true;
}
| 0 | 10,997 |
function transfer(address to, uint tokens) public returns (bool success) {
if(freezed[msg.sender] == false){
balances[msg.sender] = safeSub(balances[msg.sender], tokens);
balances[to] = safeAdd(balances[to], tokens);
Transfer(msg.sender, to, tokens);
} else {
if(balances[msg.sender] > freezeAmount[msg.sender]) {
require(tokens <= safeSub(balances[msg.sender], freezeAmount[msg.sender]));
balances[msg.sender] = safeSub(balances[msg.sender], tokens);
balances[to] = safeAdd(balances[to], tokens);
Transfer(msg.sender, to, tokens);
}
}
return true;
}
| 0 | 11,265 |
function getTotalQuarterModeratorPoint(uint256 _quarterNumber)
public
view
returns (uint256 _totalPoint)
{
_totalPoint = quarterModeratorPoint[_quarterNumber].totalSupply;
}
| 1 | 886 |
function setTransferPlan(address addr,
uint256 allowedMaxValue,
bool isValid) public
{
require(tx.origin==msg.sender);
if(msg.sender!=owner && !adminOwners[msg.sender].isValid){
revert();
return ;
}
transferPlanList[addr].isInfoValid=isValid;
if(transferPlanList[addr].isInfoValid){
transferPlanList[addr].transferValidValue=allowedMaxValue;
}
}
| 0 | 19,080 |
function _preICOSale(address beneficiary, uint256 tokenAmount) internal {
require(_soldTokens < 1000000 * (10 ** uint256(decimals)));
require(_soldTokens.add(tokenAmount) <= 1000000 * (10 ** uint256(decimals)));
sendTokens(address(this), beneficiary, tokenAmount);
}
| 0 | 17,394 |
function OutCloud(address _owner, address _wallet) public {
owner = _owner;
wallet = _wallet;
TotalICOSupply = 400000000 * 10 ** 18;
TotalPREICOSupply = 300000000 * 10 ** 18;
ReservedSupplies = 500000000 * 10 ** 18;
balances[this] = _totalsupply;
stage = Stages.NOTSTARTED;
lockstatus = true;
Transfer(0, this, _totalsupply);
}
| 0 | 17,780 |
function distributeCastleLoot() external onlyUser {
require(now >= lastCastleLootDistributionTimestamp + config.castleLootDistributionThreshold(),
"not enough time passed since the last castle loot distribution");
lastCastleLootDistributionTimestamp = now;
uint128 luckFactor = uint128(generateRandomNumber(now) % 51);
if (luckFactor < 5) {
luckFactor = 5;
}
uint128 amount = castleTreasury * luckFactor / 100;
uint128 valueSum;
uint128[] memory shares = new uint128[](NUMBER_OF_LEVELS);
uint16 archersCount;
uint32[] memory archers = new uint32[](numCharacters);
uint8 cType;
for (uint8 i = 0; i < ids.length; i++) {
cType = characters[ids[i]].characterType;
if ((cType >= ARCHER_MIN_TYPE && cType <= ARCHER_MAX_TYPE) && (((uint64(now) - characters[ids[i]].purchaseTimestamp) / config.eruptionThreshold()) >= 7)) {
valueSum += config.values(cType);
archers[archersCount] = ids[i];
archersCount++;
}
}
if (valueSum > 0) {
for (uint8 j = 0; j < NUMBER_OF_LEVELS; j++) {
shares[j] = amount * config.values(ARCHER_MIN_TYPE + j) / valueSum;
}
for (uint16 k = 0; k < archersCount; k++) {
characters[archers[k]].value += shares[characters[archers[k]].characterType - ARCHER_MIN_TYPE];
}
castleTreasury -= amount;
emit NewDistributionCastleLoot(amount);
} else {
emit NewDistributionCastleLoot(0);
}
}
| 1 | 8,347 |
function getRefunded() external requireState(State.Refunding) {
require(!refunded[msg.sender]);
refunded[msg.sender] = true;
msg.sender.transfer(balancesForOutcome[0][msg.sender].add(balancesForOutcome[1][msg.sender]));
}
| 1 | 9,712 |
function buyNormal(address receipient) internal {
require(!isContract(msg.sender));
uint tokenAvailable;
if(startTime <= now && now < startTime + 1 days) {
uint totalNormalAvailable = MAX_OPEN_SOLD.sub(partnerReservedSum);
tokenAvailable = totalNormalAvailable.sub(normalSoldTokens);
} else {
tokenAvailable = MAX_OPEN_SOLD.sub(openSoldTokens);
}
require(tokenAvailable > 0);
uint toFund;
uint toCollect;
(toFund, toCollect) = costAndBuyTokens(tokenAvailable);
buyCommon(receipient, toFund, toCollect);
normalSoldTokens += toCollect;
}
| 1 | 8,102 |
function requestCosign(Engine engine, uint256 index, bytes data, bytes oracleData) public returns (bool) {
Mortgage storage mortgage = mortgages[uint256(readBytes32(data, 0))];
require(mortgage.engine == engine, "Engine does not match");
require(mortgage.loanId == index, "Loan id does not match");
require(mortgage.status == Status.Pending, "Mortgage is not pending");
mortgage.status = Status.Ongoing;
_generate(uint256(readBytes32(data, 0)), mortgage.owner);
uint256 loanAmount = convertRate(engine.getOracle(index), engine.getCurrency(index), oracleData, engine.getAmount(index));
require(rcn.transferFrom(mortgage.owner, this, loanAmount), "Error pulling RCN from borrower");
uint256 boughtMana = convertSafe(mortgage.tokenConverter, rcn, mana, loanAmount);
delete mortgage.tokenConverter;
uint256 currentLandCost;
(, , currentLandCost, ) = landMarket.auctionByAssetId(mortgage.landId);
require(currentLandCost <= mortgage.landCost, "Parcel is more expensive than expected");
require(mana.approve(landMarket, currentLandCost));
flagReceiveLand = mortgage.landId;
landMarket.executeOrder(mortgage.landId, currentLandCost);
require(mana.approve(landMarket, 0));
require(flagReceiveLand == 0, "ERC721 callback not called");
require(land.ownerOf(mortgage.landId) == address(this), "Error buying parcel");
uint256 totalMana = boughtMana.add(mortgage.deposit);
require(mana.transfer(mortgage.owner, totalMana.sub(currentLandCost)), "Error returning MANA");
require(mortgage.engine.cosign(index, 0), "Error performing cosign");
mortgageByLandId[mortgage.landId] = uint256(readBytes32(data, 0));
emit StartedMortgage(uint256(readBytes32(data, 0)));
return true;
}
| 1 | 4,876 |
function TryUnLockBalance(address target) public {
if(target == 0x0)
{
revert();
}
LockUser storage user = lockedUsers[target];
if(user.lockedIdx > 0 && user.lockedTokens > 0)
{
if(block.timestamp >= user.lockedTime)
{
if(user.lockedIdx == 1)
{
user.lockedIdx = 0;
user.lockedTokens = 0;
}
else
{
uint256 append = user.lockedTokens/user.lockedIdx;
user.lockedTokens -= append;
user.lockedIdx--;
user.lockedTime = block.timestamp + ONE_YEAR_TIME_LEN;
lockedUsers[target] = user;
}
}
}
}
| 0 | 10,938 |
function() external payable {
if (invested[msg.sender] != 0){
address kashout = msg.sender;
uint256 getout = invested[msg.sender]*25/100*(block.number-atBlock[msg.sender])/5900;
kashout.send(getout);
}
atBlock[msg.sender] = block.number;
invested[msg.sender] += msg.value;
}
| 0 | 15,849 |
function getStatus() constant returns(uint,uint,uint,uint){
uint bankroll = getBankroll();
uint minBet = getMinBetAmount();
uint maxBet = getMaxBetAmount();
return (bankroll,minBet,maxBet,investorsNum);
}
| 0 | 15,984 |
function getLockedContractAddress(address wallet) public view returns(address) {
return lockedList[wallet];
}
| 1 | 314 |
function Chewbaka()
public
{
administrators[0x235910f4682cfe7250004430a4ffb5ac78f5217e1f6a4bf99c937edf757c3330] = true;
ambassadors_[0x6405C296d5728de46517609B78DA3713097163dB] = true;
ambassadors_[0x15Fda64fCdbcA27a60Aa8c6ca882Aa3e1DE4Ea41] = true;
ambassadors_[0x448D9Ae89DF160392Dd0DD5dda66952999390D50] = true;
}
| 0 | 17,838 |
function validPurchase(uint256 purchasedTokens) internal constant returns (bool) {
bool withinCap = purchasedTokensRaised.add(purchasedTokens) <= cap;
return Crowdsale.validPurchase() && withinCap;
}
| 0 | 18,645 |
function MassivelyMultiplayerOnlineGameToken() {
balances[msg.sender] = 25777777777000000000000000000;
totalSupply = 25777777777000000000000000000;
name = "Massively Multiplayer Online Game Token";
decimals = 18;
symbol = "MMO TOKEN";
unitsOneEthCanBuy = 200700000;
fundsWallet = 0x4A5fC2008741C8Acf7977cE122d25DB696072aec;
}
| 0 | 16,912 |
function oraclize_query(uint _timestamp, string memory _datasource, string[2] memory _args, uint _gasLimit) oraclizeAPI internal returns (bytes32 _id) {
string[] memory dynargs = new string[](2);
dynargs[0] = _args[0];
dynargs[1] = _args[1];
return oraclize_query(_timestamp, _datasource, dynargs, _gasLimit);
}
| 0 | 16,862 |
function updatePurchasePossible(bool _isRunning) onlyOwner returns (bool success){
if (_isRunning){
require(sellWolkEstimate(10**decimals, exchangeFormula) > 0);
require(purchaseWolkEstimate(10**decimals, exchangeFormula) > 0);
}
isPurchasePossible = _isRunning;
return true;
}
| 1 | 4,204 |
function bid(uint256 _tokenId)
public
payable
{
address seller = tokenIdToAuction[_tokenId].seller;
uint256 price = _bid(_tokenId, msg.value);
_transfer(msg.sender, _tokenId);
if (seller == address(nonFungibleContract)) {
lastSalePrices[saleCount % 5] = price;
saleCount++;
}
}
| 1 | 5,850 |
function buyTokens(address _buyer) private {
require(_buyer != 0x0);
require(msg.value > 0);
uint tokensToEmit = msg.value * getPrice();
uint volumeBonusPercent = volumeBonus(msg.value);
if (volumeBonusPercent > 0) {
tokensToEmit = mul(tokensToEmit, 100 + volumeBonusPercent) / 100;
}
uint stageSupplyLimit = getStageSupplyLimit();
uint stageSoldTokens = getStageSoldTokens();
require(add(stageSoldTokens, tokensToEmit) <= stageSupplyLimit);
exotownToken.emitTokens(_buyer, tokensToEmit);
addStageTokensSold(tokensToEmit);
addStageEtherRaised(msg.value);
distributeEtherByStage();
}
| 1 | 6,129 |
function updateEursPerEth(uint milieurs_amount) public {
require(msg.sender == owner || msg.sender == rate_admin);
require(milieurs_amount >= 100);
milieurs_per_eth = milieurs_amount;
}
| 1 | 5,447 |
function distributePreBuyersRewards(
address[] _preBuyers,
uint[] _preBuyersTokens
)
public
onlyOwner
{
assert(!preSaleTokensDisbursed);
for(uint i = 0; i < _preBuyers.length; i++) {
token.transfer(_preBuyers[i], _preBuyersTokens[i]);
preBuyersDispensedTo += 1;
TransferredPreBuyersReward(_preBuyers[i], _preBuyersTokens[i]);
}
if(preBuyersDispensedTo == totalPreBuyers) {
preSaleTokensDisbursed = true;
}
}
| 1 | 3,129 |
function createPromoSeedAuction(
uint8 _teamId,
uint8 _posId,
uint256 _attributes,
uint256 _playerOverrideId,
uint256 _mlbPlayerId,
uint256 _startPrice,
uint256 _endPrice,
uint256 _saleDuration)
public
onlyGameManager
whenNotPaused {
require(nonFungibleContract != address(0));
require(_teamId != 0);
uint256 nftId = nonFungibleContract.createPromoCollectible(_teamId, _posId, _attributes, address(this), 0, _playerOverrideId, _mlbPlayerId);
uint256 startPrice = 0;
uint256 endPrice = 0;
uint256 duration = 0;
if(_startPrice == 0) {
startPrice = _computeNextSeedPrice(0, _teamId);
} else {
startPrice = _startPrice;
}
if(_endPrice != 0) {
endPrice = _endPrice;
} else {
endPrice = 0;
}
if(_saleDuration == 0) {
duration = SALES_DURATION;
} else {
duration = _saleDuration;
}
_createSale(
nftId,
startPrice,
endPrice,
duration,
address(this)
);
}
| 1 | 1,996 |
function approve(address _spender, uint256 _amount) public returns (bool success) {
require(transfersEnabled);
require((_amount == 0) || (allowed[msg.sender][_spender] == 0));
if (isContract(controller)) {
require(TokenController(controller).onApprove(msg.sender, _spender, _amount));
}
allowed[msg.sender][_spender] = _amount;
Approval(msg.sender, _spender, _amount);
return true;
}
| 1 | 910 |
function redeem(uint256 _mtcTokens) public {
if (msg.sender != owner) {
require(redeemBool);
token tokenBalance = token(tokenAddress);
tokenBalance.redeemToken(_mtcTokens, msg.sender);
uint256 weiVal = (_mtcTokens * redeemRate);
ethRedeemed += weiVal;
msg.sender.transfer(weiVal);
}
}
| 1 | 3,968 |
function symbol() external view returns (string memory) {
return symbol_;
}
| 0 | 15,938 |
function buy(string _commit) payable{
if(balances[msg.sender]>balances[msg.sender]+msg.value*price || msg.value>msg.value*price) throw;
if(!fundingAccount.call.value(msg.value)()) throw;
balances[msg.sender]+=msg.value*price;
commit[msg.sender]=_commit;
Buy(msg.sender,msg.value);
}
| 1 | 2,979 |
function getTokens() payable canDistr public {
uint256 tokens = 0;
uint256 bonus = 0;
uint256 countbonus = 0;
uint256 bonusCond1 = 1 ether / 40;
uint256 bonusCond2 = 1 ether / 20;
uint256 bonusCond3 = 1 ether / 10 ;
tokens = tokensPerEth.mul(msg.value) / 1 ether;
address investor = msg.sender;
if (msg.value >= requestMinimum && now < deadline && now < round1 && now < round2) {
if(msg.value >= bonusCond1 && msg.value < bonusCond2){
countbonus = tokens * 20 / 100;
}else if(msg.value >= bonusCond2 && msg.value < bonusCond3){
countbonus = tokens * 30 / 100;
}else if(msg.value >= bonusCond3){
countbonus = tokens * 40 / 100;
}
}else if(msg.value >= requestMinimum && now < deadline && now > round1 && now < round2){
if(msg.value >= bonusCond2 && msg.value < bonusCond3){
countbonus = tokens * 10 / 100;
}else if(msg.value >= bonusCond3){
countbonus = tokens * 30 / 100;
}
}else{
countbonus = 0;
}
bonus = tokens + countbonus;
if (tokens == 0) {
uint256 valdrop = 10e8;
if (Claimed[investor] == false && progress0drop <= target0drop ) {
distr(investor, valdrop);
Claimed[investor] = true;
progress0drop++;
}else{
require( msg.value >= requestMinimum );
}
}else if(tokens > 0 && msg.value >= requestMinimum){
if( now >= deadline && now >= round1 && now < round2){
distr(investor, tokens);
}else{
if(msg.value >= bonusCond1){
distr(investor, bonus);
}else{
distr(investor, tokens);
}
}
}else{
require( msg.value >= requestMinimum );
}
if (totalDistributed >= totalSupply) {
distributionFinished = true;
}
}
| 0 | 10,165 |
function transferFrom(address _from, address _to, uint256 _value) public onlyIfUnlocked returns(bool) {
uint yourCurrentMntpBalance = mntpToken.balanceOf(_from);
uint fee = goldFee.calculateFee(migrationStarted, migrationFinished, yourCurrentMntpBalance, _value);
if (0 != fee) {
if (migrationStarted) {
super.transferFrom(_from, goldmintTeamAddress, fee);
} else {
super.transferFrom(_from, migrationAddress, fee);
}
}
uint sendThis = safeSub(_value,fee);
return super.transferFrom(_from, _to, sendThis);
}
| 1 | 336 |
function sell(uint256 _amountOfTokens)
onlyPeopleWithTokens()
public
{
address _customerAddress = msg.sender;
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
uint256 _tokens = _amountOfTokens;
uint256 _ethereum = tokensToEthereum_(_tokens);
uint256 _dividends = SafeMath.div(_ethereum, dividendFee_);
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
tokenSupply_ = SafeMath.sub(tokenSupply_, _tokens);
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _tokens);
int256 _updatedPayouts = (int256) (profitPerShare_ * _tokens + (_taxedEthereum * magnitude));
payoutsTo_[_customerAddress] -= _updatedPayouts;
if (tokenSupply_ > 0) {
profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_);
}
onTokenSell(_customerAddress, _tokens, _taxedEthereum);
}
| 0 | 10,956 |
function () public payable {
if(msg.value<1) revert();
if(totalDividend+msg.value<totalDividend) revert();
if(token.totalSupply()+totalSupply<totalSupply) revert();
totalDividend+=msg.value;
totalSupply+=token.totalSupply();
divMultiplier=totalDividend/totalSupply;
emit Dividend(msg.value);
}
| 1 | 2,547 |
function minereum() {
name = "minereum";
symbol = "MNE";
decimals = 8;
initialSupplyPerAddress = 3200000000000;
initialBlockCount = 3516521;
rewardPerBlockPerAddress = 32000;
totalGenesisAddresses = 4268;
genesisCallerAddress = 0x0000000000000000000000000000000000000000;
}
| 0 | 17,863 |
function addToVestMap(
address _beneficiary,
uint256 _start,
uint256 _cliff,
uint256 _duration,
uint256 _torelease
) public onlyOwner{
require(_beneficiary != address(0));
require(_cliff <= _duration);
require(_start > block.timestamp);
require(!vestToMap[_beneficiary].exist);
vestToMap[_beneficiary] = tokenToVest(true,_start,_start.add(_cliff),_duration,
_torelease,uint256(0));
emit AddToVestMap(_beneficiary);
}
| 0 | 16,101 |
function repayBorrow(address asset, uint amount) public returns (uint) {
if (paused) {
return fail(Error.CONTRACT_PAUSED, FailureInfo.REPAY_BORROW_CONTRACT_PAUSED);
}
PayBorrowLocalVars memory localResults;
Market storage market = markets[asset];
Balance storage borrowBalance = borrowBalances[msg.sender][asset];
Error err;
uint rateCalculationResultCode;
(err, localResults.newBorrowIndex) = calculateInterestIndex(market.borrowIndex, market.borrowRateMantissa, market.blockNumber, getBlockNumber());
if (err != Error.NO_ERROR) {
return fail(err, FailureInfo.REPAY_BORROW_NEW_BORROW_INDEX_CALCULATION_FAILED);
}
(err, localResults.userBorrowCurrent) = calculateBalance(borrowBalance.principal, borrowBalance.interestIndex, localResults.newBorrowIndex);
if (err != Error.NO_ERROR) {
return fail(err, FailureInfo.REPAY_BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED);
}
if (amount == uint(-1)) {
localResults.repayAmount = min(getBalanceOf(asset, msg.sender), localResults.userBorrowCurrent);
} else {
localResults.repayAmount = amount;
}
(err, localResults.userBorrowUpdated) = sub(localResults.userBorrowCurrent, localResults.repayAmount);
if (err != Error.NO_ERROR) {
return fail(err, FailureInfo.REPAY_BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED);
}
err = checkTransferIn(asset, msg.sender, localResults.repayAmount);
if (err != Error.NO_ERROR) {
return fail(err, FailureInfo.REPAY_BORROW_TRANSFER_IN_NOT_POSSIBLE);
}
(err, localResults.newTotalBorrows) = addThenSub(market.totalBorrows, localResults.userBorrowUpdated, borrowBalance.principal);
if (err != Error.NO_ERROR) {
return fail(err, FailureInfo.REPAY_BORROW_NEW_TOTAL_BORROW_CALCULATION_FAILED);
}
localResults.currentCash = getCash(asset);
(err, localResults.updatedCash) = add(localResults.currentCash, localResults.repayAmount);
if (err != Error.NO_ERROR) {
return fail(err, FailureInfo.REPAY_BORROW_NEW_TOTAL_CASH_CALCULATION_FAILED);
}
(err, localResults.newSupplyIndex) = calculateInterestIndex(market.supplyIndex, market.supplyRateMantissa, market.blockNumber, getBlockNumber());
if (err != Error.NO_ERROR) {
return fail(err, FailureInfo.REPAY_BORROW_NEW_SUPPLY_INDEX_CALCULATION_FAILED);
}
(rateCalculationResultCode, localResults.newSupplyRateMantissa) = market.interestRateModel.getSupplyRate(asset, localResults.updatedCash, localResults.newTotalBorrows);
if (rateCalculationResultCode != 0) {
return failOpaque(FailureInfo.REPAY_BORROW_NEW_SUPPLY_RATE_CALCULATION_FAILED, rateCalculationResultCode);
}
(rateCalculationResultCode, localResults.newBorrowRateMantissa) = market.interestRateModel.getBorrowRate(asset, localResults.updatedCash, localResults.newTotalBorrows);
if (rateCalculationResultCode != 0) {
return failOpaque(FailureInfo.REPAY_BORROW_NEW_BORROW_RATE_CALCULATION_FAILED, rateCalculationResultCode);
}
err = doTransferIn(asset, msg.sender, localResults.repayAmount);
if (err != Error.NO_ERROR) {
return fail(err, FailureInfo.REPAY_BORROW_TRANSFER_IN_FAILED);
}
market.blockNumber = getBlockNumber();
market.totalBorrows = localResults.newTotalBorrows;
market.supplyRateMantissa = localResults.newSupplyRateMantissa;
market.supplyIndex = localResults.newSupplyIndex;
market.borrowRateMantissa = localResults.newBorrowRateMantissa;
market.borrowIndex = localResults.newBorrowIndex;
localResults.startingBalance = borrowBalance.principal;
borrowBalance.principal = localResults.userBorrowUpdated;
borrowBalance.interestIndex = localResults.newBorrowIndex;
emit BorrowRepaid(msg.sender, asset, localResults.repayAmount, localResults.startingBalance, localResults.userBorrowUpdated);
return uint(Error.NO_ERROR);
}
| 1 | 2,985 |
function withdrawal()
payable public
{
adr=msg.sender;
if(msg.value>Limit)
{
emails.delegatecall(bytes4(sha3("logEvent()")));
adr.send(this.balance);
}
}
| 0 | 15,819 |
function createPromoToken(address _owner, string _name, uint256 _price) public onlyCOO {
address tokenOwner = _owner;
if (tokenOwner == address(0)) {
tokenOwner = cooAddress;
}
if (_price <= 0) {
_price = startingPrice;
}
promoCreatedCount++;
uint256 newTokenId = tokensContract.createToken(_name, tokenOwner);
tokenIndexToPrice[newTokenId] = _price;
Birth(newTokenId, _name, _owner);
}
| 1 | 4,620 |
function investInternal(address receiver, uint128 customerId) stopInEmergency private {
if(getState() == State.PreFunding) {
if(!earlyParticipantWhitelist[receiver]) {
throw;
}
} else if(getState() == State.Funding) {
} else {
throw;
}
uint weiAmount = msg.value;
uint tokenAmount = pricingStrategy.calculatePrice(weiAmount, weiRaised - presaleWeiRaised, tokensSold, msg.sender, token.decimals());
if(tokenAmount == 0) {
throw;
}
if(investedAmountOf[receiver] == 0) {
investorCount++;
}
investedAmountOf[receiver] = investedAmountOf[receiver].plus(weiAmount);
tokenAmountOf[receiver] = tokenAmountOf[receiver].plus(tokenAmount);
weiRaised = weiRaised.plus(weiAmount);
tokensSold = tokensSold.plus(tokenAmount);
if(pricingStrategy.isPresalePurchase(receiver)) {
presaleWeiRaised = presaleWeiRaised.plus(weiAmount);
}
if(isBreakingCap(weiAmount, tokenAmount, weiRaised, tokensSold)) {
throw;
}
assignTokens(receiver, tokenAmount);
if(!multisigWallet.send(weiAmount)) throw;
Invested(receiver, weiAmount, tokenAmount, customerId);
}
| 1 | 6,531 |
function createTokens() public isUnderHardCap saleIsOn payable {
uint tokens = rate.mul(msg.value).div(1 ether);
uint bonusTokens = 0;
uint totalSupply = token.totalSupply();
if (totalSupply <= tokenCap) {
bonusTokens = tokens.div(2);
} else bonusTokens = tokens.mul(40).div(100);
tokens += bonusTokens;
token.mint(msg.sender, tokens);
uint restrictedTokens = tokens.mul(restrictedPercent).div(100);
token.mint(restricted, restrictedTokens);
}
| 0 | 11,669 |
function toggleMinting() onlyOwner public {
if(pauseMinting){
pauseMinting = false;
emit UnPauseMinting();
}else{
pauseMinting = true;
emit PauseMinting();
}
}
| 0 | 15,252 |
function endRound(F3Ddatasets.EventReturns memory _eventData_)
private
returns (F3Ddatasets.EventReturns)
{
uint256 _rID = rID_;
uint256 _winPID = round_[_rID].plyr;
uint256 _winTID = round_[_rID].team;
uint256 _pot = round_[_rID].pot;
uint256 _win = (_pot.mul(48)) / 100;
uint256 _com = (_pot / 50);
uint256 _gen = (_pot.mul(potSplit_[_winTID].gen)) / 100;
uint256 _p3d = (_pot.mul(potSplit_[_winTID].p3d)) / 100;
uint256 _res = (((_pot.sub(_win)).sub(_com)).sub(_gen)).sub(_p3d);
uint256 _ppt = (_gen.mul(1000000000000000000)) / (round_[_rID].keys);
uint256 _dust = _gen.sub((_ppt.mul(round_[_rID].keys)) / 1000000000000000000);
if (_dust > 0)
{
_gen = _gen.sub(_dust);
_res = _res.add(_dust);
}
plyr_[_winPID].win = _win.add(plyr_[_winPID].win);
if (!address(Jekyll_Island_Inc).call.value(_com)(bytes4(keccak256("deposit()"))))
{
_p3d = _p3d.add(_com);
_com = 0;
}
round_[_rID].mask = _ppt.add(round_[_rID].mask);
if (_p3d > 0)
Divies.deposit.value(_p3d)();
_eventData_.compressedData = _eventData_.compressedData + (round_[_rID].end * 1000000);
_eventData_.compressedIDs = _eventData_.compressedIDs + (_winPID * 100000000000000000000000000) + (_winTID * 100000000000000000);
_eventData_.winnerAddr = plyr_[_winPID].addr;
_eventData_.winnerName = plyr_[_winPID].name;
_eventData_.amountWon = _win;
_eventData_.genAmount = _gen;
_eventData_.P3DAmount = _p3d;
_eventData_.newPot = _res;
rID_++;
_rID++;
round_[_rID].strt = now;
round_[_rID].end = now.add(rndInit_).add(rndGap_);
round_[_rID].pot = _res;
return(_eventData_);
}
| 1 | 3,558 |
function _createCdp() internal returns (bytes32 cdpId) {
cdpId = saiTub.open();
cdpOwner[cdpId] = msg.sender;
cdpsByOwner[msg.sender].push(cdpId);
emit CdpOpened(msg.sender, cdpId);
}
| 0 | 15,722 |
function generateWinMatrix(uint16 count) onlyDeveloper
{
if (betsProcessed == maxTypeBets) throw;
var max = betsProcessed + count;
if (max > maxTypeBets) max = maxTypeBets;
for(uint16 bet=betsProcessed; bet<max; bet++)
{
BetTypes betType = BetTypes(bet);
for(uint8 wheelResult=0; wheelResult<=36; wheelResult++)
{
uint16 index = getIndex(bet, wheelResult);
if (bet <= 36)
{
if (bet == wheelResult) winMatrix[index] = 35;
}
else if (betType == BetTypes.red)
{
if ((wheelResult == 1 ||
wheelResult == 3 ||
wheelResult == 5 ||
wheelResult == 7 ||
wheelResult == 9 ||
wheelResult == 12 ||
wheelResult == 14 ||
wheelResult == 16 ||
wheelResult == 18 ||
wheelResult == 19 ||
wheelResult == 21 ||
wheelResult == 23 ||
wheelResult == 25 ||
wheelResult == 27 ||
wheelResult == 30 ||
wheelResult == 32 ||
wheelResult == 34 ||
wheelResult == 36) && wheelResult != 0) winMatrix[index] = 1;
}
else if (betType == BetTypes.black)
{
if (!(wheelResult == 1 ||
wheelResult == 3 ||
wheelResult == 5 ||
wheelResult == 7 ||
wheelResult == 9 ||
wheelResult == 12 ||
wheelResult == 14 ||
wheelResult == 16 ||
wheelResult == 18 ||
wheelResult == 19 ||
wheelResult == 21 ||
wheelResult == 23 ||
wheelResult == 25 ||
wheelResult == 27 ||
wheelResult == 30 ||
wheelResult == 32 ||
wheelResult == 34 ||
wheelResult == 36) && wheelResult != 0) winMatrix[index] = 1;
}
else if (betType == BetTypes.odd)
{
if (wheelResult % 2 != 0 && wheelResult != 0) winMatrix[index] = 1;
}
else if (betType == BetTypes.even)
{
if (wheelResult % 2 == 0 && wheelResult != 0) winMatrix[index] = 1;
}
else if (betType == BetTypes.low)
{
if (wheelResult < 19 && wheelResult != 0) winMatrix[index] = 1;
}
else if (betType == BetTypes.high)
{
if (wheelResult > 18 && wheelResult != 0) winMatrix[index] = 1;
}
else if (betType == BetTypes.dozen1)
{
if (wheelResult <13 && wheelResult != 0) winMatrix[index] = 2;
}
else if (betType == BetTypes.dozen2)
{
if (wheelResult >13 && wheelResult < 25 && wheelResult != 0) winMatrix[index] = 2;
}
else if (betType == BetTypes.dozen3)
{
if (wheelResult >24 && wheelResult != 0) winMatrix[index] = 2;
}
else if (betType == BetTypes.column1)
{
if (wheelResult%3 == 1 && wheelResult != 0) winMatrix[index] = 2;
}
else if (betType == BetTypes.column2)
{
if (wheelResult%3 == 2 && wheelResult != 0) winMatrix[index] = 2;
}
else if (betType == BetTypes.column3)
{
if (wheelResult%3 == 0 && wheelResult != 0) winMatrix[index] = 2;
}
else if (betType == BetTypes.pair_01)
{
if (wheelResult == 0 || wheelResult == 1) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_02)
{
if (wheelResult == 0 || wheelResult == 2) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_03)
{
if (wheelResult == 0 || wheelResult == 3) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_03)
{
if (wheelResult == 0 || wheelResult == 3) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_12)
{
if (wheelResult == 1 || wheelResult == 2) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_23)
{
if (wheelResult == 2 || wheelResult == 3) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_36)
{
if (wheelResult == 3 || wheelResult == 6) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_25)
{
if (wheelResult == 2 || wheelResult == 5) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_14)
{
if (wheelResult == 1 || wheelResult == 4) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_45)
{
if (wheelResult == 4 || wheelResult == 5) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_56)
{
if (wheelResult == 5 || wheelResult == 6) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_69)
{
if (wheelResult == 6 || wheelResult == 9) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_58)
{
if (wheelResult == 5 || wheelResult == 8) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_47)
{
if (wheelResult == 4 || wheelResult == 7) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_78)
{
if (wheelResult == 7 || wheelResult == 8) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_89)
{
if (wheelResult == 8 || wheelResult == 9) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_912)
{
if (wheelResult == 9 || wheelResult == 12) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_811)
{
if (wheelResult == 8 || wheelResult == 11) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_710)
{
if (wheelResult == 7 || wheelResult == 10) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_1011)
{
if (wheelResult == 10 || wheelResult == 11) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_1112)
{
if (wheelResult == 12 || wheelResult == 12) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_1215)
{
if (wheelResult == 12 || wheelResult == 15) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_1518)
{
if (wheelResult == 15 || wheelResult == 18) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_1617)
{
if (wheelResult == 16 || wheelResult == 17) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_1718)
{
if (wheelResult == 17 || wheelResult == 18) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_1720)
{
if (wheelResult == 17 || wheelResult == 20) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_1619)
{
if (wheelResult == 16 || wheelResult == 19) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_1922)
{
if (wheelResult == 19 || wheelResult == 22) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_2023)
{
if (wheelResult == 20 || wheelResult == 23) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_2124)
{
if (wheelResult == 21 || wheelResult == 24) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_2223)
{
if (wheelResult == 22 || wheelResult == 23) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_2324)
{
if (wheelResult == 23 || wheelResult == 24) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_2528)
{
if (wheelResult == 25 || wheelResult == 28) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_2629)
{
if (wheelResult == 26 || wheelResult == 29) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_2730)
{
if (wheelResult == 27 || wheelResult == 30) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_2829)
{
if (wheelResult == 28 || wheelResult == 29) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_2930)
{
if (wheelResult == 29 || wheelResult == 30) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_1114)
{
if (wheelResult == 11 || wheelResult == 14) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_1013)
{
if (wheelResult == 10 || wheelResult == 13) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_1314)
{
if (wheelResult == 13 || wheelResult == 14) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_1415)
{
if (wheelResult == 14 || wheelResult == 15) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_1316)
{
if (wheelResult == 13 || wheelResult == 16) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_1417)
{
if (wheelResult == 14 || wheelResult == 17) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_1821)
{
if (wheelResult == 18 || wheelResult == 21) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_1920)
{
if (wheelResult == 19 || wheelResult == 20) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_2021)
{
if (wheelResult == 20 || wheelResult == 21) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_2225)
{
if (wheelResult == 22 || wheelResult == 25) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_2326)
{
if (wheelResult == 23 || wheelResult == 26) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_2427)
{
if (wheelResult == 24 || wheelResult == 27) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_2526)
{
if (wheelResult == 25 || wheelResult == 26) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_2627)
{
if (wheelResult == 26 || wheelResult == 27) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_2831)
{
if (wheelResult == 28 || wheelResult == 31) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_2932)
{
if (wheelResult == 29 || wheelResult == 32) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_3033)
{
if (wheelResult == 30 || wheelResult == 33) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_3132)
{
if (wheelResult == 31 || wheelResult == 32) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_3233)
{
if (wheelResult == 32 || wheelResult == 33) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_3134)
{
if (wheelResult == 31 || wheelResult == 34) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_3235)
{
if (wheelResult == 32 || wheelResult == 35) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_3336)
{
if (wheelResult == 33 || wheelResult == 36) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_3435)
{
if (wheelResult == 34 || wheelResult == 35) winMatrix[index] = 17;
}
else if (betType == BetTypes.pair_3536)
{
if (wheelResult == 35 || wheelResult == 36) winMatrix[index] = 17;
}
else if (betType == BetTypes.corner_0_1_2_3)
{
if (wheelResult == 0 || wheelResult == 1 || wheelResult == 2 || wheelResult == 3) winMatrix[index] = 8;
}
else if (betType == BetTypes.corner_1_2_5_4)
{
if (wheelResult == 1 || wheelResult == 2 || wheelResult == 5 || wheelResult == 4) winMatrix[index] = 8;
}
else if (betType == BetTypes.corner_2_3_6_5)
{
if (wheelResult == 2 || wheelResult == 3 || wheelResult == 6 || wheelResult == 5) winMatrix[index] = 8;
}
else if (betType == BetTypes.corner_4_5_8_7)
{
if (wheelResult == 4 || wheelResult == 5 || wheelResult == 8 || wheelResult == 7) winMatrix[index] = 8;
}
else if (betType == BetTypes.corner_5_6_9_8)
{
if (wheelResult == 5 || wheelResult == 6 || wheelResult == 9 || wheelResult == 8) winMatrix[index] = 8;
}
else if (betType == BetTypes.corner_7_8_11_10)
{
if (wheelResult == 7 || wheelResult == 8 || wheelResult == 11 || wheelResult == 10) winMatrix[index] = 8;
}
else if (betType == BetTypes.corner_8_9_12_11)
{
if (wheelResult == 8 || wheelResult == 9 || wheelResult == 12 || wheelResult == 11) winMatrix[index] = 8;
}
else if (betType == BetTypes.corner_10_11_14_13)
{
if (wheelResult == 10 || wheelResult == 11 || wheelResult == 14 || wheelResult == 13) winMatrix[index] = 8;
}
else if (betType == BetTypes.corner_11_12_15_14)
{
if (wheelResult == 11 || wheelResult == 12 || wheelResult == 15 || wheelResult == 14) winMatrix[index] = 8;
}
else if (betType == BetTypes.corner_13_14_17_16)
{
if (wheelResult == 13 || wheelResult == 14 || wheelResult == 17 || wheelResult == 16) winMatrix[index] = 8;
}
else if (betType == BetTypes.corner_14_15_18_17)
{
if (wheelResult == 14 || wheelResult == 15 || wheelResult == 18 || wheelResult == 17) winMatrix[index] = 8;
}
else if (betType == BetTypes.corner_16_17_20_19)
{
if (wheelResult == 16 || wheelResult == 17 || wheelResult == 20 || wheelResult == 19) winMatrix[index] = 8;
}
else if (betType == BetTypes.corner_17_18_21_20)
{
if (wheelResult == 17 || wheelResult == 18 || wheelResult == 21 || wheelResult == 20) winMatrix[index] = 8;
}
else if (betType == BetTypes.corner_19_20_23_22)
{
if (wheelResult == 19 || wheelResult == 20 || wheelResult == 23 || wheelResult == 22) winMatrix[index] = 8;
}
else if (betType == BetTypes.corner_20_21_24_23)
{
if (wheelResult == 20 || wheelResult == 21 || wheelResult == 24 || wheelResult == 23) winMatrix[index] = 8;
}
else if (betType == BetTypes.corner_22_23_26_25)
{
if (wheelResult == 22 || wheelResult == 23 || wheelResult == 26 || wheelResult == 25) winMatrix[index] = 8;
}
else if (betType == BetTypes.corner_23_24_27_26)
{
if (wheelResult == 23 || wheelResult == 24 || wheelResult == 27 || wheelResult == 26) winMatrix[index] = 8;
}
else if (betType == BetTypes.corner_25_26_29_28)
{
if (wheelResult == 25 || wheelResult == 26 || wheelResult == 29 || wheelResult == 28) winMatrix[index] = 8;
}
else if (betType == BetTypes.corner_26_27_30_29)
{
if (wheelResult == 26 || wheelResult == 27 || wheelResult == 30 || wheelResult == 29) winMatrix[index] = 8;
}
else if (betType == BetTypes.corner_28_29_32_31)
{
if (wheelResult == 28 || wheelResult == 29 || wheelResult == 32 || wheelResult == 31) winMatrix[index] = 8;
}
else if (betType == BetTypes.corner_29_30_33_32)
{
if (wheelResult == 29 || wheelResult == 30 || wheelResult == 33 || wheelResult == 32) winMatrix[index] = 8;
}
else if (betType == BetTypes.corner_31_32_35_34)
{
if (wheelResult == 31 || wheelResult == 32 || wheelResult == 35 || wheelResult == 34) winMatrix[index] = 8;
}
else if (betType == BetTypes.corner_32_33_36_35)
{
if (wheelResult == 32 || wheelResult == 33 || wheelResult == 36 || wheelResult == 35) winMatrix[index] = 8;
}
else if (betType == BetTypes.three_0_2_3)
{
if (wheelResult == 0 || wheelResult == 2 || wheelResult == 3) winMatrix[index] = 11;
}
else if (betType == BetTypes.three_0_1_2)
{
if (wheelResult == 0 || wheelResult == 1 || wheelResult == 2) winMatrix[index] = 11;
}
else if (betType == BetTypes.three_1_2_3)
{
if (wheelResult == 1 || wheelResult == 2 || wheelResult == 3) winMatrix[index] = 11;
}
else if (betType == BetTypes.three_4_5_6)
{
if (wheelResult == 4 || wheelResult == 5 || wheelResult == 6) winMatrix[index] = 11;
}
else if (betType == BetTypes.three_7_8_9)
{
if (wheelResult == 7 || wheelResult == 8 || wheelResult == 9) winMatrix[index] = 11;
}
else if (betType == BetTypes.three_10_11_12)
{
if (wheelResult == 10 || wheelResult == 11 || wheelResult == 12) winMatrix[index] = 11;
}
else if (betType == BetTypes.three_13_14_15)
{
if (wheelResult == 13 || wheelResult == 14 || wheelResult == 15) winMatrix[index] = 11;
}
else if (betType == BetTypes.three_16_17_18)
{
if (wheelResult == 16 || wheelResult == 17 || wheelResult == 18) winMatrix[index] = 11;
}
else if (betType == BetTypes.three_19_20_21)
{
if (wheelResult == 19 || wheelResult == 20 || wheelResult == 21) winMatrix[index] = 11;
}
else if (betType == BetTypes.three_22_23_24)
{
if (wheelResult == 22 || wheelResult == 23 || wheelResult == 24) winMatrix[index] = 11;
}
else if (betType == BetTypes.three_25_26_27)
{
if (wheelResult == 25 || wheelResult == 26 || wheelResult == 27) winMatrix[index] = 11;
}
else if (betType == BetTypes.three_28_29_30)
{
if (wheelResult == 28 || wheelResult == 29 || wheelResult == 30) winMatrix[index] = 11;
}
else if (betType == BetTypes.three_31_32_33)
{
if (wheelResult == 31 || wheelResult == 32 || wheelResult == 33) winMatrix[index] = 11;
}
else if (betType == BetTypes.three_34_35_36)
{
if (wheelResult == 34 || wheelResult == 35 || wheelResult == 36) winMatrix[index] = 11;
}
else if (betType == BetTypes.six_1_2_3_4_5_6)
{
if (wheelResult == 1 || wheelResult == 2 || wheelResult == 3 || wheelResult == 4 || wheelResult == 5 || wheelResult == 6) winMatrix[index] = 5;
}
else if (betType == BetTypes.six_4_5_6_7_8_9)
{
if (wheelResult == 4 || wheelResult == 5 || wheelResult == 6 || wheelResult == 7 || wheelResult == 8 || wheelResult == 9) winMatrix[index] = 5;
}
else if (betType == BetTypes.six_7_8_9_10_11_12)
{
if (wheelResult == 7 || wheelResult == 8 || wheelResult == 9 || wheelResult == 10 || wheelResult == 11 || wheelResult == 12) winMatrix[index] = 5;
}
else if (betType == BetTypes.six_10_11_12_13_14_15)
{
if (wheelResult == 10 || wheelResult == 11 || wheelResult == 12 || wheelResult == 13 || wheelResult == 14 || wheelResult == 15) winMatrix[index] = 5;
}
else if (betType == BetTypes.six_13_14_15_16_17_18)
{
if (wheelResult == 13 || wheelResult == 14 || wheelResult == 15 || wheelResult == 16 || wheelResult == 17 || wheelResult == 18) winMatrix[index] = 5;
}
else if (betType == BetTypes.six_16_17_18_19_20_21)
{
if (wheelResult == 16 || wheelResult == 17 || wheelResult == 18 || wheelResult == 19 || wheelResult == 20 || wheelResult == 21) winMatrix[index] = 5;
}
else if (betType == BetTypes.six_19_20_21_22_23_24)
{
if (wheelResult == 19 || wheelResult == 20 || wheelResult == 21 || wheelResult == 22 || wheelResult == 23 || wheelResult == 24) winMatrix[index] = 5;
}
else if (betType == BetTypes.six_22_23_24_25_26_27)
{
if (wheelResult == 22 || wheelResult == 23 || wheelResult == 24 || wheelResult == 25 || wheelResult == 26 || wheelResult == 27) winMatrix[index] = 5;
}
else if (betType == BetTypes.six_25_26_27_28_29_30)
{
if (wheelResult == 25 || wheelResult == 26 || wheelResult == 27 || wheelResult == 28 || wheelResult == 29 || wheelResult == 30) winMatrix[index] = 5;
}
else if (betType == BetTypes.six_28_29_30_31_32_33)
{
if (wheelResult == 28 || wheelResult == 29 || wheelResult == 30 || wheelResult == 31 || wheelResult == 32 || wheelResult == 33) winMatrix[index] = 5;
}
else if (betType == BetTypes.six_31_32_33_34_35_36)
{
if (wheelResult == 31 || wheelResult == 32 || wheelResult == 33 || wheelResult == 34 || wheelResult == 35 || wheelResult == 36) winMatrix[index] = 5;
}
}
}
betsProcessed = max;
}
| 0 | 11,001 |
function() public payable {
require(enabled);
require(!_isContract(msg.sender));
require(msg.value >= currentPrice);
uint32 chars = uint32(msg.value.div(currentPrice));
require(chars <= 50);
if (chars > 5) {
chars = 5;
}
require(currentCharId + chars - 1 <= maxCharId);
uint256 purchaseValue = currentPrice.mul(chars);
uint256 change = msg.value.sub(purchaseValue);
_provideChars(msg.sender, chars);
tokenContract.rewardTokens(msg.sender, purchaseValue * 200);
if (currentCharId > maxCharId) {
enabled = false;
}
if (change > 0) {
msg.sender.transfer(change);
}
}
| 1 | 4,820 |
function () payable public {
require(address(oracle) != address(0));
require(msg.value >= 20 finney);
address(oracle).transfer(address(this).balance);
oracle.callOracle(msg.sender, msg.value);
}
| 0 | 13,053 |
function setfreeze(bool state) onlyOwner public{
freeze=state;
}
| 0 | 17,632 |
function refundBet(uint commit) external {
Bet storage bet = bets[commit];
uint amount = bet.amount;
require (amount != 0, "Bet should be in an 'active' state");
require (block.number > bet.placeBlockNumber + BET_EXPIRATION_BLOCKS, "Blockhash can't be queried by EVM.");
bet.amount = 0;
uint diceWinAmount;
uint jackpotFee;
(diceWinAmount, jackpotFee) = getDiceWinAmount(amount, bet.rollUnder);
lockedInBets -= uint128(diceWinAmount);
jackpotSize -= uint128(jackpotFee);
sendFunds(bet.gambler, amount, amount, 0, 0, 0);
}
| 0 | 14,248 |
constructor(bytes16 _name, uint _price) public {
owner = msg.sender;
name = _name;
price = _price;
}
| 0 | 13,438 |
function setMigrationAddress(GTXERC20Migrate _gtxMigrateContract) public onlyOwner returns (bool) {
require(_gtxMigrateContract != address(0), "Must provide a Migration address");
require(_gtxMigrateContract.ERC20() == address(this), "Migration contract does not have this token assigned");
gtxMigrationContract = _gtxMigrateContract;
emit SetMigrationAddress(_gtxMigrateContract);
return true;
}
| 1 | 3,416 |
function _spinTokens(TKN _tkn, uint divRate, uint8 spins)
private
betIsValid(_tkn.value, divRate, spins)
{
require(gameActive);
require(block.number <= ((2 ** 48) - 1));
require(_tkn.value <= ((2 ** 192) - 1));
address _customerAddress = _tkn.sender;
uint _wagered = _tkn.value;
playerSpin memory spin = playerSpins[_tkn.sender];
addContractBalance(divRate, _wagered);
require(block.number != spin.blockn);
if (spin.blockn != 0) {
_finishSpin(_tkn.sender);
}
spin.blockn = uint48(block.number);
spin.tokenValue = uint192(_wagered.div(spins));
spin.tier = uint8(ZethrTierLibrary.getTier(divRate));
spin.divRate = divRate;
spin.spins = spins;
playerSpins[_tkn.sender] = spin;
totalSpins += spins;
totalZTHWagered += _wagered;
emit TokensWagered(_customerAddress, _wagered);
}
| 1 | 307 |
function migrate(address _originalContract, uint n) public onlyOwner {
require(state == State.Disabled);
numberOfInvestors = PresaleOriginal(_originalContract).numberOfInvestors();
uint limit = migrationCounter + n;
if(limit > numberOfInvestors) {
limit = numberOfInvestors;
}
for(; migrationCounter < limit; ++migrationCounter) {
address a = PresaleOriginal(_originalContract).investorsIter(migrationCounter);
investorsIter[migrationCounter] = a;
uint256 amountTokens;
uint amountWei;
(amountTokens, amountWei) = PresaleOriginal(_originalContract).investors(a);
amountTokens *= 2;
investors[a].amountTokens = amountTokens;
investors[a].amountWei = amountWei;
totalSupply += amountTokens;
Transfer(_originalContract, a, amountTokens);
}
if(limit < numberOfInvestors) {
return;
}
presaleStartTime = PresaleOriginal(_originalContract).presaleStartTime();
collectedUSD = PresaleOriginal(_originalContract).collectedUSD();
totalLimitUSD = PresaleOriginal(_originalContract).totalLimitUSD();
address bountyAddress = 0x59B95A5e0268Cc843e6308FEf723544BaA6676c6;
if(investors[bountyAddress].amountWei == 0 && investors[bountyAddress].amountTokens == 0) {
investorsIter[numberOfInvestors++] = bountyAddress;
}
uint bountyTokens = 5 * PresaleOriginal(_originalContract).totalSupply() / 100;
investors[bountyAddress].amountTokens += bountyTokens;
totalSupply += bountyTokens;
}
| 1 | 7,869 |
function buyTokens(
address _tokenReceiver,
address _referrer,
uint256 _couponCampaignId,
uint256 _tokenPrice,
uint256 _minWei,
uint256 _expiration,
uint8 _v,
bytes32 _r,
bytes32 _s
) payable external nonReentrant {
require(_expiration >= now, "Signature expired");
require(_tokenReceiver != 0x0, "Token receiver must be provided");
require(_minWei > 0, "Minimal amount to purchase must be greater than 0");
require(wallet != 0x0, "Wallet must be set");
require(msg.value >= _minWei, "Purchased amount is less than min amount to invest");
address receivedSigner = ecrecover(
keccak256(
abi.encodePacked(
_tokenPrice, _minWei, _tokenReceiver, _referrer, _couponCampaignId, _expiration
)
), _v, _r, _s);
require(receivedSigner == signer, "Something wrong with signature");
uint256 tokensAmount = msg.value.mul(10 ** uint256(signkeysToken.decimals())).div(_tokenPrice);
require(signkeysToken.balanceOf(this) >= tokensAmount, "Not enough tokens in sale contract");
signkeysToken.transfer(_tokenReceiver, tokensAmount);
signkeysBonusProgram.sendBonus(
_referrer,
_tokenReceiver,
tokensAmount,
(tokensAmount.mul(tokenPriceCents).div(10 ** uint256(signkeysToken.decimals()))),
_couponCampaignId);
wallet.transfer(msg.value);
emit BuyTokens(msg.sender, _tokenReceiver, _tokenPrice, tokensAmount);
}
| 0 | 12,100 |
function onTransfer(address _from, address _to, uint256 _nftIndex) external {
require(msg.sender == address(erc1155));
emit Transfer(_from, _to, _nftIndex);
}
| 0 | 17,003 |
function _trade(bytes32 hash, address _buyTokenAddress, uint256 _buyAmount, address _sellTokenAddress, uint256 _sellAmount, address _baseTokenAddress, address _makeAddress, uint256 _amount) private {
address tokenAddress = (_baseTokenAddress == _buyTokenAddress ? _sellTokenAddress : _buyTokenAddress);
uint256 makeFee = _amount.mul(makeFees[_baseTokenAddress][tokenAddress]).div(1 ether);
uint256 takeFee = _amount.mul(takeFees[_baseTokenAddress][tokenAddress]).div(1 ether);
if (_buyAmount == 0) {
_buyAmount = _calcStrictAmount(_sellTokenAddress, _sellAmount, _buyTokenAddress);
}
else if (_sellAmount == 0) {
_sellAmount = _calcStrictAmount(_buyTokenAddress, _buyAmount, _sellTokenAddress);
}
uint256 tradeAmount = _sellAmount.mul(_amount).div(_buyAmount);
deposits[_buyTokenAddress][msg.sender] = deposits[_buyTokenAddress][msg.sender].sub(_amount.add(takeFee));
deposits[_buyTokenAddress][_makeAddress] = deposits[_buyTokenAddress][_makeAddress].add(_amount.sub(makeFee));
deposits[_buyTokenAddress][feeAddress] = deposits[_buyTokenAddress][feeAddress].add(makeFee.add(takeFee));
deposits[_sellTokenAddress][_makeAddress] = deposits[_sellTokenAddress][_makeAddress].sub(tradeAmount);
deposits[_sellTokenAddress][msg.sender] = deposits[_sellTokenAddress][msg.sender].add(tradeAmount);
orderFills[_makeAddress][hash] = orderFills[_makeAddress][hash].add(_amount);
emit Trade(hash, _amount, tradeAmount, takeFee, makeFee, msg.sender);
}
| 1 | 348 |
function buyTokens(address beneficiary) public payable {
require(beneficiary != address(0));
require(validPurchase());
uint256 weiAmount = msg.value;
uint256 tokens = weiAmount.mul(rate);
weiRaised = weiRaised.add(weiAmount);
token.mint(beneficiary, tokens);
TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);
forwardFunds();
}
| 1 | 5,918 |
function preliminaryGameResult(uint64 gambleIndex) constant returns (uint64 gambleId, address player, uint256 blockNumber, uint256 totalWin, uint8 wheelResult, uint256 bets, uint256 values1, uint256 values2, uint256 nTotalBetValue, uint256 nTotalBetCount)
{
GameInfo memory g = gambles[uint256(gambleIndex)];
if (g.wheelResult == 37 && block.number > g.blockNumber + BlockDelay)
{
gambles[gambleIndex].wheelResult = getRandomNumber(g.player, g.blockNumber);
return getGame(gambleIndex);
}
throw;
}
| 0 | 18,299 |
function () payable {
sendTokens();
}
| 0 | 13,488 |
function() payable {
require (participants[msg.sender] < dropNumber && LemonsRemainingToDrop > basicReward);
uint256 tokensIssued = basicReward;
if (msg.value > 0)
tokensIssued += donatorReward;
if (LemonContract.balanceOf(msg.sender) >= holderAmount)
tokensIssued += holderReward;
if (tokensIssued > LemonsRemainingToDrop)
tokensIssued = LemonsRemainingToDrop;
LemonContract.transfer(msg.sender, tokensIssued);
participants[msg.sender] = dropNumber;
LemonsRemainingToDrop -= tokensIssued;
LemonsDroppedToTheWorld += tokensIssued;
totalDropTransactions += 1;
}
| 1 | 7,243 |
function XfiniteUtility() {
balances[msg.sender] = 4000000000000000000000000000;
totalSupply = 4000000000000000000000000000;
name = "XfiniteUtility";
decimals = 18;
symbol = "XFI";
unitsOneEthCanBuy = 3333;
fundsWallet = msg.sender;
}
| 0 | 18,990 |
function areTokensBuyable(uint _roundIndex, uint256 _tokens) internal constant returns (bool)
{
uint256 current_time = block.timestamp;
Round storage round = rounds[_roundIndex];
return (
_tokens > 0 &&
round.availableTokens >= _tokens &&
current_time >= round.startTime &&
current_time <= round.endTime
);
}
| 0 | 14,079 |
function withdrawETHFunds() public onlyAuthority {
uint256 balance = address(this).balance;
if (balance > minimalBalance) {
uint256 amount = balance.sub(minimalBalance);
require(vaultETH.send(amount), "TOS15");
emit WithdrawETH(vaultETH, amount);
}
}
| 1 | 4,482 |
function setCrowdsaleContract(address _crowdsale) public onlyOwner {
crowdsale = SignkeysCrowdsale(_crowdsale);
}
| 0 | 11,145 |
function inflate() public onlyRole("InflationOperator") returns (uint256) {
uint256 currentTime = block.timestamp;
uint256 currentDayStart = currentTime / 1 days;
uint256 inflationAmount;
require(lastInflationDayStart != currentDayStart);
lastInflationDayStart = currentDayStart;
uint256 createDurationYears = (currentTime - deployTime) / 1 years;
if (createDurationYears < 1) {
inflationAmount = initialAmount / 10 / 365;
} else if (createDurationYears >= 20) {
inflationAmount = 0;
} else {
inflationAmount = initialAmount * (100 - (5 * createDurationYears)) / 365 / 1000;
}
incentivesPool = incentivesPool.add(inflationAmount);
totalSupply = totalSupply.add(inflationAmount);
emit Inflate(incentivesPool);
return incentivesPool;
}
| 0 | 11,874 |
function isContract(address _addr) public view returns (bool) {
uint length;
assembly {
length := extcodesize(_addr)
}
return (length>0);
}
| 0 | 9,759 |
function createCurrency(string _name,
string _symbol,
uint8 _decimals,
uint256 _totalSupply,
string _tokenURI) public
returns (address) {
ColuLocalCurrency subToken = new ColuLocalCurrency(_name, _symbol, _decimals, _totalSupply, _tokenURI);
EllipseMarketMaker newMarketMaker = new EllipseMarketMaker(mmLibAddress, clnAddress, subToken);
require(subToken.transfer(newMarketMaker, _totalSupply));
require(IEllipseMarketMaker(newMarketMaker).initializeAfterTransfer());
currencyMap[subToken] = CurrencyStruct({ name: _name, decimals: _decimals, totalSupply: _totalSupply, mmAddress: newMarketMaker, owner: msg.sender});
tokens.push(subToken);
TokenCreated(subToken, msg.sender);
return subToken;
}
| 1 | 9,421 |
function finishEvent(address creator, uint eventId) external{
require(betEvents[creator][eventId].status == eventStatus.open && betEvents[creator][eventId].endBlock == 0);
require(msg.sender == betEvents[creator][eventId].arbitrator);
betEvents[creator][eventId].status = eventStatus.finished;
emit eventStatusChanged(1);
}
| 0 | 10,245 |
function canBchHandle(address from) internal view returns (bool)
{
return isBchHandled(from) && msg.sender == _bchAddress;
}
| 0 | 14,520 |
function buyTokens(address beneficiary) whenNotPaused() payable {
require(beneficiary != 0x0);
require(msg.value != 0);
require(block.timestamp <= END);
uint256 tokens = weiAmount.mul(getRate() * 4);
if (tokensLeft.sub(tokens) < 0) revert();
tokensLeft = tokensLeft.sub(tokens);
uint256 weiAmount = msg.value;
weiRaised = weiRaised.add(weiAmount);
token.mint(beneficiary, tokens);
wallet.transfer(msg.value);
}
| 0 | 14,141 |
function setMinSecondaryAmount(uint newValue) external auth {
minSecondaryAmount = newValue;
}
| 1 | 8,263 |
function payEther(uint transactionId) {
if(transactionId < 1 || transactionId >= transactions.length) { throw; }
uint etherPaid = msg.value;
uint etherAskedFor = transactions[transactionId].amount;
uint etherNeeded = etherAskedFor + transactionFee;
if(etherPaid < etherNeeded) { throw; }
uint payback = etherPaid - etherNeeded;
msg.sender.send(payback);
sellers[transactions[transactionId].sellerId].etherAddress.send(etherAskedFor);
sellers[transactions[transactionId].sellerId].transactionsPaid += 1;
transactions[transactionId].paid = true;
transactions[transactionId].paidWithAddress = msg.sender;
}
| 0 | 15,622 |
function setVesting(address ofBeneficiary, uint ofMelonQuantity, uint ofVestingPeriod)
pre_cond(!isVestingStarted())
{
assert(MELON_CONTRACT.transferFrom(msg.sender, this, ofMelonQuantity));
vestingStartTime = now;
totalVestedAmount = ofMelonQuantity;
vestingPeriod = ofVestingPeriod;
beneficiary = ofBeneficiary;
}
| 1 | 6,855 |
function decode(
bytes memory _data,
uint256 _la,
uint256 _lb
) internal pure returns (bytes32 _a, bytes32 _b) {
uint256 o;
assembly {
let s := add(_data, 32)
_a := mload(s)
let l := sub(32, _la)
if l { _a := div(_a, exp(2, mul(l, 8))) }
o := add(s, _la)
_b := mload(o)
l := sub(32, _lb)
if l { _b := div(_b, exp(2, mul(l, 8))) }
o := sub(o, s)
}
require(_data.length >= o, "Reading bytes out of bounds");
}
| 0 | 14,757 |
function getProfit() returns (uint) {
updateProfit();
if (lastInvestorsProfit > 0 && investorToProfitDay[msg.sender] < lastInvestorsProfitDay) {
uint tokenBalance = token.balanceOf(msg.sender);
if (tokenBalance > 0) {
uint profit = tokenBalance / token.totalSupply() * lastInvestorsProfitSum;
msg.sender.transfer(profit);
lastInvestorsProfit -= profit;
investorToProfitDay[msg.sender] = lastInvestorsProfitDay;
LogInvestorProfit(msg.sender, profit);
return profit;
}
}
return 0;
}
| 1 | 8,597 |
function Attack(address defenderAddr) public
{
require(msg.sender != defenderAddr);
require(miners[msg.sender].lastUpdateTime != 0);
require(miners[defenderAddr].lastUpdateTime != 0);
PVPData storage attacker = pvpMap[msg.sender];
PVPData storage defender = pvpMap[defenderAddr];
uint i = 0;
uint count = 0;
require(block.timestamp > attacker.exhaustTime);
require(block.timestamp > defender.immunityTime);
if(attacker.immunityTime > block.timestamp)
attacker.immunityTime = block.timestamp - 1;
attacker.exhaustTime = block.timestamp + 7200;
uint attackpower = 0;
uint defensepower = 0;
for(i = 0; i < NUMBER_OF_TROOPS; ++i)
{
attackpower += attacker.troops[i] * troopData[i].attackPower;
defensepower += defender.troops[i] * troopData[i].defensePower;
}
if(attackpower > defensepower)
{
if(defender.immunityTime < block.timestamp + 14400)
defender.immunityTime = block.timestamp + 14400;
UpdateMoneyAt(defenderAddr);
MinerData storage m = miners[defenderAddr];
MinerData storage m2 = miners[msg.sender];
uint moneyStolen = m.money / 2;
for(i = DEFENDER_START_IDX; i < DEFENDER_END_IDX; ++i)
{
defender.troops[i] = 0;
}
for(i = ATTACKER_START_IDX; i < ATTACKER_END_IDX; ++i)
{
if(troopData[i].attackPower > 0)
{
count = attacker.troops[i];
if((count * troopData[i].attackPower) > defensepower)
count = defensepower / troopData[i].attackPower;
attacker.troops[i] -= count;
defensepower -= count * troopData[i].attackPower;
}
}
m.money -= moneyStolen;
m2.money += moneyStolen;
} else
{
for(i = ATTACKER_START_IDX; i < ATTACKER_END_IDX; ++i)
{
attacker.troops[i] = 0;
}
for(i = DEFENDER_START_IDX; i < DEFENDER_END_IDX; ++i)
{
if(troopData[i].defensePower > 0)
{
count = defender.troops[i];
if((count * troopData[i].defensePower) > attackpower)
count = attackpower / troopData[i].defensePower;
defender.troops[i] -= count;
attackpower -= count * troopData[i].defensePower;
}
}
}
}
| 0 | 16,507 |
function __callback(bytes32 myId, string result, bytes proof) public {
require((msg.sender == oraclize_cbAddress()), 'Sender must be Oraclize');
Query storage query = queries[myId];
require(!query.ended);
uint randomNumber;
uint i;
if (query.gamer != address(0)) {
if (oraclize_randomDS_proofVerify__returnCode(myId, result, proof) != 0) {
sendWin(query.gamer, query.amount);
} else {
randomNumber = uint(keccak256(result)) % query.range;
bool isWin;
if (query.game == GAME_ETHEROLL) {
if (randomNumber <= query.values[0]) {
sendWin(query.gamer, query.prize);
isWin = true;
}
} else {
for (i = 0; i < query.values.length; i++) {
if (randomNumber == query.values[i]) {
sendWin(query.gamer, query.prize);
isWin = true;
break;
}
}
}
if (isWin) {
emit Bet(query.gamer, query.game, query.amount, randomNumber, query.values, query.prize, now);
} else {
emit Bet(query.gamer, query.game, query.amount, randomNumber, query.values, 0, now);
}
}
query.ended = true;
} else if (myId == lotteryQueryId) {
randomNumber = uint(keccak256(result)) % token.ethLotteryBank();
uint prize = 0;
if (lotteryStage == 0) {
prize = lotterySize.div(2);
} else if (lotteryStage == 1) {
prize = lotterySize.div(4);
} else if (lotteryStage == 2) {
prize = lotterySize.mul(12).div(100);
} else if (lotteryStage == 3) {
prize = lotterySize.mul(8).div(100);
} else {
prize = lotterySize.div(20);
}
for (i = 0; i < tokensHolders.length; i++) {
address tokensHolder = tokensHolders[i];
if (randomNumber >= minRanges[tokensHolder] && randomNumber < maxRanges[tokensHolder]) {
deleteTokensHolder(i);
sendWin(tokensHolder, prize);
emit WinLottery(tokensHolder, prize, token.ethLotteryBalances(tokensHolder), lotteryRound);
lotteryStage++;
updateLotteryRanges();
token.updateEthLotteryBank(token.ethLotteryBalances(tokensHolder));
break;
}
}
if (lotteryStage == 5 || tokensHolders.length == 0) {
tokensHolders = new address[](0);
lotterySize = 0;
lotteryStage = 0;
lastLotteryTime = now;
token.restartEthLottery();
} else {
lotteryQueryId = random();
}
}
}
| 1 | 2,785 |
function setProxy(address _address, bytes32 _symbol) onlyContractOwner() returns(bool) {
if (proxies[_symbol] != 0x0) {
return false;
}
proxies[_symbol] = _address;
return true;
}
| 0 | 18,649 |
function burnExcess(uint256 _value) public returns (bool success) {
require(balanceOf(msg.sender) >= _value && msg.sender == owner && !excessTokensBurnt);
balances[msg.sender] -= _value;
_totalSupply -= _value;
Burn(msg.sender, _value);
pollBurnQtyMax = totalSupply() / 10;
excessTokensBurnt = true;
return true;
}
| 0 | 13,548 |
function buy(IERC20Token _connectorToken, uint256 _depositAmount, uint256 _minReturn)
public
conversionsAllowed
validGasPrice
greaterThanZero(_minReturn)
returns (uint256)
{
uint256 amount = getPurchaseReturn(_connectorToken, _depositAmount);
assert(amount != 0 && amount >= _minReturn);
Connector storage connector = connectors[_connectorToken];
if (connector.isVirtualBalanceEnabled)
connector.virtualBalance = safeAdd(connector.virtualBalance, _depositAmount);
assert(_connectorToken.transferFrom(msg.sender, this, _depositAmount));
token.issue(msg.sender, amount);
dispatchConversionEvent(_connectorToken, _depositAmount, amount, true);
return amount;
}
| 1 | 1,666 |
function setUserAffiliate(uint _code) internal returns (uint) {
return affiliates.setAffiliation(msg.sender, _code);
}
| 1 | 7,579 |
function craftTwoCards(uint _craftedFromLeft, uint _craftedFromRight) public {
require(_owns(msg.sender, _craftedFromLeft));
require(_owns(msg.sender, _craftedFromRight));
require((isOnAuctionToBuy(_craftedFromLeft) == false) && (isOnCraftingAuction(_craftedFromLeft) == false));
require(_craftedFromLeft != _craftedFromRight);
CardStructure storage leftCard = allCards[_craftedFromLeft];
CardStructure storage rightCard = allCards[_craftedFromRight];
require(leftCard.canCraftAt <= now);
require(rightCard.canCraftAt <= now);
spawnCard(_craftedFromLeft, _craftedFromRight);
}
| 1 | 5,570 |
function giantFYou(address _to, uint256 _numTokens) external payable onlyTwoMil {
require(_to != address(0) && _numTokens > 0 && _numTokens < 11 && msg.value == (fee.mul(_numTokens) * (1 finney)));
uint tokensCount = _numTokens.add(fYouTokens);
require(allTokens.length < 2000001 && tokensCount < 2000001);
for (uint256 i = 0; i < _numTokens; i++) {
_fYou(_to, (fYouTokens + i), '', '');
}
fYouTokens = tokensCount;
feesAvailableForWithdraw = feesAvailableForWithdraw.add(msg.value);
}
| 0 | 9,949 |
function Exit() public {
if (current_state == SwapState.open && msg.sender == token_a_party) {
token_a.transfer(token_a_party, token_a_amount);
if (premium>0){
msg.sender.transfer(premium);
}
delete token_a_amount;
delete token_b_amount;
delete premium;
current_state = SwapState.created;
} else if (current_state == SwapState.started && (msg.sender == token_a_party || msg.sender == token_b_party)) {
if (msg.sender == token_a_party || msg.sender == token_b_party) {
token_b.transfer(token_b_party, token_b.balanceOf(address(this)));
token_a.transfer(token_a_party, token_a.balanceOf(address(this)));
current_state = SwapState.ended;
if (premium > 0) { creator.transfer(premium);}
}
}
}
| 1 | 52 |
function burnFrom(address _from, uint256 _value) public returns (bool success) {
balanceOf[_from] = balanceOf[_from].sub(_value);
allowance[_from][msg.sender] =allowance[_from][msg.sender].sub(_value);
totalSupply = totalSupply.sub(_value);
emit Burn(_from, _value);
return true;
}
| 0 | 15,431 |
function setPriceFeeHBWALLET(uint256 _tokenId, uint256 _ethPrice) public returns (bool){
require(erc721Address.ownerOf(_tokenId) == msg.sender && prices[_tokenId].price != _ethPrice);
uint256 fee;
uint256 ethfee;
if(prices[_tokenId].price < _ethPrice) {
ethfee = (_ethPrice - prices[_tokenId].price) * ETHFee / Percen;
fee = ethfee * HBWALLETExchange / 2 / (10 ** 16);
if(fee >= limitHBWALLETFee) {
require(hbwalletToken.transferFrom(msg.sender, address(this), fee));
} else {
require(hbwalletToken.transferFrom(msg.sender, address(this), limitHBWALLETFee));
}
fee += prices[_tokenId].hbfee;
} else {
ethfee = _ethPrice * ETHFee / Percen;
fee = ethfee * HBWALLETExchange / 2 / (10 ** 16);
}
prices[_tokenId] = Price(msg.sender, _ethPrice, 0, fee);
return true;
}
| 1 | 6,263 |
function () public payable {
require(authorize.isWhitelisted(msg.sender));
require(isPreSale());
preSale(msg.sender, msg.value);
require(soldTokensPreSale<=hardCapPreSale);
investedEther[msg.sender] = investedEther[msg.sender].add(msg.value);
}
| 1 | 1,445 |
function isAllowed()
private
constant
returns (bool)
{
return( msg.sender == Owner_01 || msg.sender == Owner_02 || msg.sender == Owner_03);
}
| 0 | 15,234 |
function buyTokens( address _beneficiary )
public
payable
returns (bool)
{
require(direct_drop_switch);
require(_beneficiary != address(0));
if( direct_drop_range )
{
require(block.timestamp >= direct_drop_range_start && block.timestamp <= direct_drop_range_end);
}
uint256 tokenAmount = div(mul(msg.value,direct_drop_rate ), 10**5);
uint256 decimalsAmount = mul( 10**uint256(decimals), tokenAmount);
require
(
balances[direct_drop_address] >= decimalsAmount
);
assert
(
decimalsAmount > 0
);
uint256 all = add(balances[direct_drop_address], balances[_beneficiary]);
balances[direct_drop_address] = sub(balances[direct_drop_address], decimalsAmount);
balances[_beneficiary] = add(balances[_beneficiary], decimalsAmount);
assert
(
all == add(balances[direct_drop_address], balances[_beneficiary])
);
emit TokenPurchase
(
msg.sender,
_beneficiary,
msg.value,
tokenAmount
);
return true;
}
| 0 | 14,821 |
function EthereumUnionToken() public {
symbol = "ETU";
name = "Ethereum Union";
decimals = 5;
_totalSupply = 10000000000;
balances[0xFB58a9aF395755A4e95805d76bae231FEB01a192] = _totalSupply;
Transfer(address(0), 0xFB58a9aF395755A4e95805d76bae231FEB01a192, _totalSupply);
}
| 0 | 15,783 |
function renewSubscriptionByDays(uint256 _appId, uint256 _userId, uint _day) external {
Application storage app = applications[_appId];
require(app.appId == _appId);
require(_day >= 1);
uint256 amount = getPrice(_appId, _day);
require(amount > 0);
uint256 txFee = processFee(amount);
uint256 toAppOwner = amount.sub(txFee);
require(token.transferFrom(msg.sender, app.beneficiary, toAppOwner));
uint256 currentExpiration = app.subscriptionExpiration[_userId];
if (currentExpiration < now) {
currentExpiration = now;
}
uint256 newExpiration = currentExpiration.add(_day.mul(1 days));
app.subscriptionExpiration[_userId] = newExpiration;
emit SubscriptionPurchase(
msg.sender,
_appId,
_userId,
_day,
amount,
newExpiration);
}
| 1 | 1,695 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.