func
stringlengths 11
25k
| label
int64 0
1
| __index_level_0__
int64 0
19.4k
|
---|---|---|
constructor() public {
controller = msg.sender;
EthertoteAdminAddress = msg.sender;
tokenGenerationLock = false;
name = "Ethertote";
symbol = "TOTE";
decimals = 0;
_totalSupply = 10000000 * 10**uint(decimals);
version = "Ethertote Token contract - version 1.0";
contractOwner = msg.sender;
thisContractAddress = address(this);
transfersEnabled = true;
creationBlock = block.number;
generateTokens(contractOwner, _totalSupply);
controller = relinquishOwnershipAddress;
}
| 1 | 9,208 |
function getFreeBalance(address _holder)
public
view
returns (uint256)
{
if(block.timestamp >= userLock[_holder].release_time) return balances[_holder];
return balances[_holder].sub(userLock[_holder].locked_balance);
}
| 0 | 14,075 |
function participantContributionInEth(address _querryAddress) constant returns (uint256 answer){
return participantContribution[_querryAddress];
}
| 0 | 16,646 |
function _owns(address _owner, uint256 _deedId) internal view returns (bool) {
return identifierToOwner[_deedId] == _owner;
}
| 0 | 14,486 |
function controlledMint(address _to, uint256 _amount) external onlyController whenNotPaused returns (bool) {
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
Transfer(0x0, _to, _amount);
return true;
}
| 0 | 14,257 |
function playBps(uint8 _choice) public returns (uint8) {
require (_choice == 1 || _choice == 2 || _choice == 3);
if (_choice == lastMove) {
tCoin.transfer(msg.sender, oneCoin);
tCoin.transfer(lastPlayer, oneCoin);
setGame(_choice, msg.sender);
return 3;
}
if (_choice == 1) {
if (lastMove == 3) {
bCoin.transfer(msg.sender, oneCoin);
emit newWinner(msg.sender);
setGame(_choice, msg.sender);
return 1;
} else {
pCoin.transfer(lastPlayer, oneCoin);
emit newWinner(lastPlayer);
setGame(_choice, msg.sender);
return 2;
}
}
if (_choice == 2) {
if (lastMove == 1) {
pCoin.transfer(msg.sender, oneCoin);
emit newWinner(msg.sender);
setGame(_choice, msg.sender);
return 1;
} else {
sCoin.transfer(lastPlayer, oneCoin);
emit newWinner(lastPlayer);
setGame(_choice, msg.sender);
return 2;
}
}
if (_choice == 3) {
if (lastMove == 2) {
sCoin.transfer(msg.sender, oneCoin);
emit newWinner(msg.sender);
setGame(_choice, msg.sender);
return 1;
} else {
bCoin.transfer(lastPlayer, oneCoin);
emit newWinner(lastPlayer);
setGame(_choice, msg.sender);
return 2;
}
}
}
| 1 | 6,616 |
function buyTokensByOptions(address buyer, uint usdCents, string txHash)
external gvAgentOnly returns (uint) {
require(!isPaused);
require(icoState == IcoState.Running || icoState == IcoState.RunningForOptionsHolders);
require(usdCents > 0);
uint executedTokens;
uint remainingCents;
(executedTokens, remainingCents) = optionProgram.executeOptions(buyer, usdCents, txHash);
if (executedTokens > 0) {
require(tokensSold + executedTokens <= TOKENS_FOR_SALE);
tokensSold += executedTokens;
gvToken.mint(buyer, executedTokens);
BuyTokens(buyer, executedTokens, txHash);
}
if (icoState == IcoState.Running) {
return buyTokensInternal(buyer, remainingCents, txHash);
} else {
return remainingCents;
}
}
| 1 | 8,120 |
function TriWallet () {
thisIsFork = BranchSender (0x23141df767233776f7cbbec497800ddedaa4c684).isRightBranch ();
etcWallet = new BranchWallet (msg.sender, !thisIsFork);
ethWallet = new BranchWallet (msg.sender, thisIsFork);
ETCWalletCreated (etcWallet);
ETHWalletCreated (ethWallet);
}
| 1 | 8,155 |
function removeDestinationByIndex(uint256 _index) returns (bool _success) {
require(FD_AC.checkPermission(102, msg.sender));
if (validDestinations.length == 0) {
return false;
} else {
bytes32 lastElement = validDestinations[validDestinations.length - 1];
validDestinations[_index] = lastElement;
validDestinations.length--;
return true;
}
}
| 1 | 1,802 |
function ()
onlyState(State.VOTING_RUNNING)
payable {
uint bonusVoted;
uint bonus = PRESALE_CONTRACT.balances(msg.sender);
assert (bonus > 0);
if (msg.value > 1 ether || !msg.sender.send(msg.value)) throw;
if (rawVotes[msg.sender] == 0) {
voters.push(msg.sender);
stakeVoted_Eth += uint16(bonus / 1 ether);
} else {
bonusVoted = votedPerCent(msg.sender) * bonus / 100;
stakeWaived_Eth -= uint16((bonus - bonusVoted) / 1 ether);
stakeConfirmed_Eth -= uint16(bonusVoted / 1 ether);
}
rawVotes[msg.sender] = msg.value > 0 ? msg.value : 1 wei;
bonusVoted = votedPerCent(msg.sender) * bonus / 100;
stakeWaived_Eth += uint16((bonus - bonusVoted) / 1 ether);
stakeConfirmed_Eth += uint16(bonusVoted / 1 ether);
stakeRemainingToVote_Eth = uint16(TOTAL_BONUS_SUPPLY_ETH - bonus / 1 ether);
}
| 1 | 4,736 |
function BossToken() public {
balances[msg.sender] = totalSupply;
}
| 0 | 11,111 |
function ask(uint wad) public returns (uint) {
return rmul(wad, wmul(s2s(), gap));
}
| 1 | 2,385 |
function createTokens() payable public {
require( (now>=icoStartP1)&&(now<icoEnd) );
require(token.totalSupply()<icoHardcap);
uint tokens = 0;
uint sum = msg.value;
uint tokensFor1EthCurr = tokensFor1EthP6;
uint rest = 0;
if(now < icoStartP2) {
tokensFor1EthCurr = tokensFor1EthP1;
} else if(now >= icoStartP2 && now < icoStartP3) {
tokensFor1EthCurr = tokensFor1EthP2;
} else if(now >= icoStartP3 && now < icoStartP4) {
tokensFor1EthCurr = tokensFor1EthP3;
} else if(now >= icoStartP4 && now < icoStartP5) {
tokensFor1EthCurr = tokensFor1EthP4;
} else if(now >= icoStartP5 && now < icoStartP6) {
tokensFor1EthCurr = tokensFor1EthP5;
}
tokens = sum.mul(tokensFor1EthCurr).div(1000000000000000000);
if(token.totalSupply().add(tokens) > icoHardcap){
tokens = icoHardcap.sub(token.totalSupply());
rest = sum.sub(tokens.mul(1000000000000000000).div(tokensFor1EthCurr));
}
token.mint(msg.sender, tokens);
if(rest!=0){
msg.sender.transfer(rest);
}
balances[msg.sender] = balances[msg.sender].add(sum.sub(rest));
if(token.totalSupply()>=icoSoftcap){
multisig.transfer(address(this).balance);
}
}
| 1 | 5,759 |
function setWARTokenAddress(address _addr) external onlyAdmin {
require(_addr != address(0));
warToken = WarTokenInterface(_addr);
}
| 0 | 18,343 |
function game (uint level) payable returns (bytes32) {
if (msg.value <= 0) throw;
if (level > 10) throw;
if (level < 1) throw;
if (msg.value > 10 ether) throw;
uint random_number;
if (msg.value < 5 ether) {
myid = bytes32(keccak256(msg.sender, block.blockhash(block.number - 1)));
random_number = uint(block.blockhash(block.number-1))%10 + 1;
} else {
bytes32 myid = oraclize_query("WolframAlpha", "random integer number between 1 and 10");
}
bets[myid] = msg.sender;
betsvalue[myid] = msg.value;
betslevel[myid] = level;
if (random_number > 0) __callback(myid, uint2str(random_number),true);
LogB(myid);
return myid;
}
| 1 | 8,680 |
function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(locks[_from] == false);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
| 0 | 18,227 |
function buyTokens(address beneficiary) public payable {
require(beneficiary != address(0));
require(whitelist.isWhitelisted(beneficiary));
uint256 weiAmount = msg.value;
require(weiAmount > 0);
require(contributors[beneficiary].add(weiAmount) <= 200 ether);
uint256 tokenAmount = 0;
if (isPresale()) {
require(weiAmount >= 1 ether);
tokenAmount = getTokenAmount(weiAmount, preDiscountPercentage);
uint256 newTokensSoldPre = tokensSoldPre.add(tokenAmount);
require(newTokensSoldPre <= preCap);
tokensSoldPre = newTokensSoldPre;
} else if (isIco()) {
uint8 discountPercentage = getIcoDiscountPercentage();
tokenAmount = getTokenAmount(weiAmount, discountPercentage);
require(tokenAmount >= 10**18);
uint256 newTokensSoldIco = tokensSoldIco.add(tokenAmount);
require(newTokensSoldIco <= HARD_CAP_IN_TOKENS);
tokensSoldIco = newTokensSoldIco;
} else {
require(false);
}
executeTransaction(beneficiary, weiAmount, tokenAmount);
}
| 1 | 1,734 |
function supportTeam(uint tournamentId, uint teamId, uint amount) public {
require(tournaments[tournamentId].initialized);
require(_internalToken.balanceOf(msg.sender) >= amount);
require(!tournaments[tournamentId].isEnded);
require(!tournaments[tournamentId].isLockedForSupport);
require(amount > 0);
SupportTicket memory ticket;
ticket.teamId = teamId;
ticket.supportAddres = msg.sender;
ticket.supportAmount = amount;
_internalToken.originTransfer(this, amount);
tournaments[tournamentId].tickets.push(ticket);
}
| 1 | 2,911 |
function vestedOf(address owner) public view returns (uint256) {
return _vestedBalances[owner];
}
| 0 | 11,411 |
function createEstate(int[] x, int[] y, address beneficiary) external returns (uint256) {
return _createEstate(x, y, beneficiary, "");
}
| 1 | 8,338 |
function _assignBuyoutProceeds(
address currentOwner,
uint256[] memory claimedSurroundingTiles,
uint256 fee,
uint256 currentOwnerWinnings,
uint256 totalDividendPerBeneficiary,
uint256 referralBonus,
uint256 prizePoolFunds
)
internal
{
if (currentOwner != 0x0) {
_sendFunds(currentOwner, currentOwnerWinnings);
} else {
fee = fee.add(currentOwnerWinnings);
}
for (uint256 i = 0; i < claimedSurroundingTiles.length; i++) {
address beneficiary = gameStates[gameIndex].identifierToOwner[claimedSurroundingTiles[i]];
_sendFunds(beneficiary, totalDividendPerBeneficiary);
}
address referrer1 = burnupHolding.referrerOf(msg.sender);
if (referrer1 != 0x0) {
_sendFunds(referrer1, referralBonus);
address referrer2 = burnupHolding.referrerOf(referrer1);
if (referrer2 != 0x0) {
_sendFunds(referrer2, referralBonus);
} else {
fee = fee.add(referralBonus);
}
} else {
fee = fee.add(referralBonus.mul(2));
}
burnupHolding.payBeneficiaries.value(fee)();
gameStates[gameIndex].prizePool = gameStates[gameIndex].prizePool.add(prizePoolFunds);
}
| 1 | 1,986 |
function collect(address _user) {
require(!collected[_user]);
uint128 dailyContributedETH = 0;
uint128 userContributedETH = 0;
uint128 userTotalContributedETH = 0;
uint128 reward = 0;
uint128 rate = 0;
uint128 totalATMToken = 0;
uint128 rewardRate = 0;
collected[_user] = true;
for (uint day = CRAWDSALE_START_DAY; day <= CRAWDSALE_END_DAY; day++) {
dailyContributedETH = cast( contribution.dailyTotals(day) );
userContributedETH = cast( contribution.userBuys(day,_user) );
if (dailyContributedETH > 0 && userContributedETH > 0) {
rewardRate = wdiv(cast(tokenToReward[day]), dailyContributedETH);
reward += wmul(userContributedETH, rewardRate);
userTotalContributedETH += userContributedETH;
}
}
rate = wdiv(cast(tokenToContributor), cast(contribution.totalContributedETH()));
totalATMToken = wmul(rate, userTotalContributedETH);
totalATMToken += reward;
lockToken(_user, totalATMToken);
claimUserToken(_user);
LogCollect(_user, userTotalContributedETH, totalATMToken);
}
| 1 | 6,546 |
function finalization() internal {
if (!goalReached()) {
vault.enableRefunds();
}
super.finalization();
}
| 0 | 14,243 |
function _depositToken(address _to, uint256 _amount) internal {
require(_to != 0x0);
DonQuixoteToken.withhold(_to, _amount);
userTokenOf[_to] = userTokenOf[_to].add(_amount);
}
| 1 | 2,811 |
function transferFrom(address _from, address _to, uint256 _tokenId) external payable;
event Transfer(address from, address to, uint256 tokenId);
event Approval(address owner, address approved, uint256 tokenId);
}
contract HorseShoeControl {
address public ceoAddress=0xC6F3Fb72db068C96A1D50Bbc3D370cC8e4af0bFc;
address public ctoAddress=0x73A895C06D6E3DcCA3acE48FC8801E17eD247f85;
modifier onCEO() {
require(msg.sender == ceoAddress);
_;
}
| 0 | 17,043 |
function recordWin(uint winner_index, uint amount) internal {
if(recentWins.length < recentWinsCount) {
recentWins.length++;
} else {
for(uint i = 0; i < recentWinsCount - 1; ++i) {
recentWins[i] = recentWins[i + 1];
}
}
recentWins[recentWins.length - 1] = Win(contributors[winner_index], block.timestamp, contributions[winner_index], amount);
}
| 0 | 15,708 |
function distribute(address[] _receivers, uint256[] _amounts) public returns (bool) {
require(block.timestamp > lockups[msg.sender]);
require(_receivers.length > 0);
require(_amounts.length > 0);
require(_receivers.length == _amounts.length);
uint256 _total = 0;
for (uint256 i = 0; i < _receivers.length; i++) {
require(_receivers[i] != address(0));
require(block.timestamp > lockups[_receivers[i]]);
require(_amounts[i] > 0);
_total = _total.add(_amounts[i]);
}
require(_total <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_total);
for (i = 0; i < _receivers.length; i++) {
balances[_receivers[i]] = balances[_receivers[i]].add(_amounts[i]);
emit Transfer(msg.sender, _receivers[i], _amounts[i]);
}
return true;
}
| 0 | 18,895 |
function withdraw() returns (bool) {
var amount = ethBalance[msg.sender];
if (amount > 0) {
ethBalance[msg.sender] = 0;
WithdrawEvent("Reset Sender");
msg.sender.transfer(amount);
}
return true;
}
| 0 | 11,589 |
function __callback(bytes32 myid, string result, bytes proof) {
require(msg.sender == oraclize_cbAddress());
if (myid == qID1) {
checkQueryA(myid, result, proof);
} else if (myid == qID2) {
checkQueryB(myid, result, proof);
}
}
| 1 | 9,339 |
function safeWithdrawal() afterDeadline {
if (!fundingGoalReached) {
uint amount = balanceOf[msg.sender];
balanceOf[msg.sender] = 0;
if (amount > 0) {
if (msg.sender.send(amount)) {
FundTransfer(msg.sender, amount, false);
} else {
balanceOf[msg.sender] = amount;
}
}
}
if (fundingGoalReached && beneficiary == msg.sender) {
if (beneficiary.send(amountRaised)) {
FundTransfer(beneficiary, amountRaised, false);
} else {
fundingGoalReached = false;
}
}
}
| 0 | 15,087 |
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
if(totalSupply == 0)
{
selfdestruct(owner);
}
if(block.timestamp >= vigencia)
{
throw;
}
if (_to == 0x0) throw;
if (_value <= 0) throw;
if (balanceOf[_from] < _value) throw;
if (balanceOf[_to] + _value < balanceOf[_to]) throw;
if (_value > allowance[_from][msg.sender]) throw;
balanceOf[_from] = SafeMath.safeSub(balanceOf[_from], _value);
balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value);
allowance[_from][msg.sender] = SafeMath.safeSub(allowance[_from][msg.sender], _value);
emit Transfer(_from, _to, _value);
return true;
}
| 0 | 11,774 |
function airdrop(address[] _recipients, uint[] _amounts) public onlyOwner isAllowed {
for (uint i = 0; i < _recipients.length; i++) {
require(_recipients[i] != address(0));
require(tokenReceived[_recipients[i]] == false);
require(token.transfer(_recipients[i], _amounts[i]));
tokenReceived[_recipients[i]] = true;
totalClaimed = totalClaimed.add(_amounts[i]);
}
}
| 1 | 1,930 |
function sell(uint256 _amountOfkeys)
public
isActivated()
{
uint256 _pID = getPlayerID();
endRoundAndGetEarnings(_pID);
Datasets.Player _plyr = plyr_[_pID];
Datasets.Round _round = round_[rID_];
require(_amountOfkeys <= _plyr.keys);
uint256 _eth = keysToEthereum(_amountOfkeys);
uint256 _sellFee = calcSellFee(_pID);
uint256 _dividends = _eth.mul(_sellFee).div(10000);
uint256 _taxedEthereum = _eth.sub(_dividends);
keySupply_ = keySupply_.sub(_amountOfkeys);
_plyr.keys = _plyr.keys.sub(_amountOfkeys);
_plyr.mask = _plyr.mask - (int256)(_taxedEthereum.add(profitPerShare_.mul(_amountOfkeys).div(magnitude)));
if (keySupply_ > 0) {
profitPerShare_ = profitPerShare_.add((_dividends.mul(magnitude)).div(keySupply_));
}
emit onSell(msg.sender, _pID, rID_, _amountOfkeys, _eth);
}
| 1 | 197 |
function getCreatedOn(bytes32 cst) public view returns (uint256 timestamp) {
return tokenMintedOn[cstToID[cst]];
}
| 1 | 7,777 |
function distributeInternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _team, uint256 _keys, FFEIFDatasets.EventReturns memory _eventData_)
private
returns(FFEIFDatasets.EventReturns)
{
uint256 _gen = _eth.mul(fees_[_team].gen) / 100;
_eth = _eth.sub(((_eth.mul(affFee)) / 100).add((_eth.mul(fees_[_team].poeif)) / 100));
uint256 _pot = _eth.sub(_gen);
uint256 _actualPot = _pot.sub(_pot/seedingDivisor);
if (seedingThreshold > rndTmEth_[_rID][0]) {seedingPot = seedingPot.add(_pot); _actualPot = 0;} else seedingPot = seedingPot.add(_pot/seedingDivisor);
uint256 _dust = updateMasks(_rID, _pID, _gen, _keys);
if (_dust > 0)
_gen = _gen.sub(_dust);
round_[_rID].pot = _actualPot.add(_dust).add(round_[_rID].pot);
_eventData_.genAmount = _gen.add(_eventData_.genAmount);
_eventData_.potAmount = _actualPot;
_eventData_.seedAdd = _pot - _actualPot;
return(_eventData_);
}
| 1 | 8,004 |
function createSaleAuction(
uint40 _cutieId,
uint128 _startPrice,
uint128 _endPrice,
uint40 _duration
)
public
whenNotPaused
payable
{
require(_isOwner(msg.sender, _cutieId));
_approve(_cutieId, saleMarket);
saleMarket.createAuction.value(msg.value)(
_cutieId,
_startPrice,
_endPrice,
_duration,
msg.sender
);
}
| 1 | 2,327 |
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)
});
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 | 4,389 |
function collectFees() public isOwner() {
msg.sender.send(this.balance);
}
| 0 | 12,688 |
function burn(address _who, uint256 _value) external only_if_controlWallet {
require(_value <= infos[index[_who]].tokenBalances);
infos[index[_who]].tokenBalances = safeSub(infos[index[_who]].tokenBalances, _value);
totalSupply = safeSub(totalSupply, _value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
}
| 0 | 11,447 |
function _recordFeePayment(uint xdrAmount)
internal
{
uint remainingToAllocate = xdrAmount;
for (uint i = FEE_PERIOD_LENGTH - 1; i < FEE_PERIOD_LENGTH; i--) {
uint delta = recentFeePeriods[i].feesToDistribute.sub(recentFeePeriods[i].feesClaimed);
if (delta > 0) {
uint amountInPeriod = delta < remainingToAllocate ? delta : remainingToAllocate;
recentFeePeriods[i].feesClaimed = recentFeePeriods[i].feesClaimed.add(amountInPeriod);
remainingToAllocate = remainingToAllocate.sub(amountInPeriod);
if (remainingToAllocate == 0) return;
}
}
assert(remainingToAllocate == 0);
}
| 1 | 202 |
function buyTokensLowLevel(address _beneficiary, uint256 _weisAmount) private stopInEmergency returns (uint256 tokenAmount) {
if (_beneficiary == 0x0) {
revert('buyTokensLowLevel: _beneficiary == 0x0');
}
if (timestamp() < startTime || timestamp() > endTime) {
revert('buyTokensLowLevel: Not withinPeriod');
}
if (!SCWhitelist.isInvestor(_beneficiary)) {
revert('buyTokensLowLevel: Investor is not registered on the whitelist');
}
if (isFinalized) {
revert('buyTokensLowLevel: ICO is already finalized');
}
if (_weisAmount < weisMinInvestment) {
revert('buyTokensLowLevel: Minimal investment not reached. Not enough ethers to perform the minimal purchase');
}
if (weisRaised.add(_weisAmount) > weisHardCap) {
revert('buyTokensLowLevel: HardCap reached. Not enough tokens on ICO contract to perform this purchase');
}
tokenAmount = _weisAmount.mul(weisPerEther).div(weisPerBigToken);
tokenAmount = tokenAmount.mul(100).div(discountedPricePercentage);
weisRaised = weisRaised.add(_weisAmount);
if (!SCTokens.transfer(_beneficiary, tokenAmount)) {
revert('buyTokensLowLevel: unable to transfer tokens from ICO contract to beneficiary');
}
emit BuyTokensLowLevel(msg.sender, _beneficiary, _weisAmount, tokenAmount);
return tokenAmount;
}
| 1 | 4,931 |
function donate() payable returns (bool){
uint256 totalDonation = donationMap[msg.sender] + msg.value;
if(totalDonation < minimum){
failedDonations[msg.sender] += msg.value;
ErrMsg(msg.sender, "Donation too low, call withdrawDonation()");
return false;
}
bool success = token.transferFrom(majoolr,msg.sender,1);
if(!success){
failedDonations[msg.sender] += msg.value;
ErrMsg(msg.sender, "Transer failed, call withdrawDonation()");
return false;
}
donationMap[msg.sender] += msg.value;
donations += msg.value;
ThxMsg(msg.sender, "Thank you for your donation!");
return true;
}
| 1 | 5,791 |
function cbAddress()
constant
returns (address _cbAddress) {
if (cbAddresses[tx.origin] != 0)
_cbAddress = tx.origin;
}
| 0 | 18,091 |
function determineWinner(uint gas) payable public onlyOwnerLevel canDetermineWinner {
ORACLIZE_GAS = gas;
callOracle(0, ORACLIZE_GAS);
}
| 0 | 13,949 |
function withdrawConfirm(
uint256 _amount,
address _confirmer) external payable notBreakup oneOfOwners(_confirmer) callByBank{
require(uint(status)==2);
require(_amount==request_amount);
require(_confirmer!=withdrawer);
require(this.balance>=request_amount);
if(request_fee!=0){BankCore(BANKACCOUNT).receiveFee.value(request_fee)();}
withdrawer.transfer(request_amount-request_fee);
status=Status.Active;
withdrawer=address(0);
request_amount=0;
request_fee=0;
}
| 1 | 7,392 |
function purchase() internal {
uint amount = msg.value;
uint vp = amount * price;
uint tokens = ((vp + ((vp * getBonus()) / 100))) / 1 ether;
balanceOf[msg.sender] += amount;
amountRaised += amount;
tokenReward.transferFrom(beneficiary, msg.sender, tokens);
checkGoalReached();
FundTransfer(msg.sender, amount, true);
}
| 1 | 5,855 |
function buyInternal(
ERC20 token,
address _exchange,
uint256 _value,
bytes _data
)
internal
{
uint256 tokenBalance = token.balanceOf(this);
require(_exchange.call.value(_value)(_data));
balances[msg.sender] = balances[msg.sender].sub(_value);
tokenBalances[msg.sender][token] = tokenBalances[msg.sender][token]
.add(token.balanceOf(this).sub(tokenBalance));
}
| 1 | 854 |
function add(uint256 _x, uint256 _y) internal pure returns (uint256) {
uint256 z = _x + _y;
require(z >= _x);
return z;
}
| 0 | 13,877 |
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
contract Functionality_Event is Blackjack_DataSets
{
event Create_UserAccountEvent
(
uint _UserIdEvent,
address _UserAddressEvent,
string _UserNameEvent,
string _UserDescriptionEvent
);
event Initialize_GameEvent
(
uint _GameIdEvent,
uint[] _Player_UserIdsEvent,
uint _Dealer_UserIdEvent,
uint _MIN_BettingLimitEvent,
uint _MAX_BettingLimitEvent
);
event BettingsEvent
(
uint _GameIdEvent,
uint _GameRoundIdEvent,
uint _UserIdEvent,
uint _BettingAmountEvent
);
event Initialize_GameRoundEvent
(
uint[] _PlayerUserIdSetEvent,
uint _GameRoundIdEvent
);
event Initialize_GamePlayUnitEvent
(
uint _PlayerUserIdEvent,
uint _BettingsEvent,
uint[] _Cards_InHandEvent
);
event GetCardEvent
(
uint _GameRoundIdEvent,
uint[] _GetCardsInHandEvent
);
event Determine_GameRoundResult
(
uint _GameIdEvent,
uint _GameRoundIdEvent,
uint[] _WinnerUserIdEvent,
uint[] _DrawUserIdEvent,
uint[] _LoserUserIdEvent
);
event ExchangeLuTokenEvent
(
address _ETH_AddressEvent,
uint _ETH_ExchangeAmountEvent,
uint _LuToken_UserIdEvnet,
uint _LuToken_ExchangeAmountEvnet,
uint _LuToken_RemainAmountEvent
);
event CheckBetting_Anouncement
(
uint GameRoundId,
uint UserId,
uint UserBettingAmount,
uint MinBettingLimit,
uint MaxBettingLimit
);
}
contract AccessControl is Blackjack_DataSets, Functionality_Event
{
bool public paused = false;
address public LuGoddess = msg.sender;
address public C_Meow_O_Address = msg.sender;
address public ceoAddress = msg.sender;
address public cfoAddress = msg.sender;
address public cooAddress = msg.sender;
modifier StandCheck_AllPlayer(uint GameId)
{
Game_Unit memory Im_GameUnit_Instance = Mapping__GameUnitId_GameUnitStruct[GameId];
uint Im_RoundId = Im_GameUnit_Instance.Game_RoundsIds[Im_GameUnit_Instance.Game_RoundsIds.length-1];
Game_Round_Unit storage Im_GameRoundUnit_Instance = Mapping__GameRoundId_GameRoundStruct[Im_RoundId];
for(uint Im_PlayUnitCounter = 0 ; Im_PlayUnitCounter <= Im_GameUnit_Instance.Player_UserIds.length; Im_PlayUnitCounter++)
{
require(Im_GameRoundUnit_Instance.Mapping__Index_PlayUnitStruct[Im_PlayUnitCounter].Cards_InHand[Im_GameRoundUnit_Instance.Mapping__Index_PlayUnitStruct[Im_PlayUnitCounter].Cards_InHand.length-1] == 1111);
}
_;
}
| 0 | 14,555 |
function buy( address recipient ) payable public returns(uint){
require( ! haltSale );
require( saleStarted() );
require( ! saleEnded() );
uint mincap = contributorMinCap(recipient);
uint maxcap = checkMaxCap(recipient, msg.value );
uint allowValue = msg.value;
require( mincap > 0 );
require( maxcap > 0 );
require (msg.value >= mincap);
if( msg.value > maxcap ) {
allowValue = maxcap;
msg.sender.transfer( msg.value.sub( maxcap ) );
}
sendETHToMultiSig(allowValue);
raisedWei = raisedWei.add( allowValue );
uint recievedTokens = allowValue.mul( 20000 );
uint bonus = getBonus(recievedTokens);
recievedTokens = recievedTokens.add(bonus);
assert( token.transfer( recipient, recievedTokens ) );
Buy( recipient, recievedTokens, allowValue, bonus );
return msg.value;
}
| 1 | 4,737 |
function trigerAlarmClock(uint id) external payable {
require(clockList[id].reward > 0);
require(block.number >= clockList[id].startBlock);
require(block.number < (clockList[id].startBlock + clockList[id].blockWindow));
msg.sender.transfer(clockList[id].reward);
clockList[id].reward = 0;
waitingTimers--;
require(clockList[id]._contract.call.value(0).gas(clockList[id].gas)(clockList[id].callData));
}
| 0 | 17,082 |
function to prevent accidental sends to this contract.
contract EthernautsUpgrade is EthernautsLogic, ClockAuctionBase {
function EthernautsUpgrade() public
EthernautsLogic() {}
event Upgrade(uint256 indexed tokenId);
uint8 STATS_CAPOUT = 2**8 - 1;
function upgradeShip(uint256 _tokenId, uint256[SHIP_SLOTS] _objects) external whenNotPaused {
require(ethernautsStorage.isCategory(_tokenId, uint8(AssetCategory.Ship)));
require(ethernautsStorage.isState(_tokenId, uint8(AssetState.Available)));
require(msg.sender == ethernautsStorage.ownerOf(_tokenId));
require(!isExploring(_tokenId));
uint i = 0;
uint8[STATS_SIZE] memory _shipStats = ethernautsStorage.getStats(_tokenId);
uint256 level = _shipStats[uint(ShipStats.Level)];
uint8[STATS_SIZE][SHIP_SLOTS] memory _objectsStats;
require(level < 5);
uint256[] memory upgradesToTokenIndex = new uint256[](ethernautsStorage.totalSupply());
for(i = 0; i < _objects.length; i++) {
require(msg.sender == ethernautsStorage.ownerOf(_objects[i]));
require(!isExploring(_objects[i]));
require(ethernautsStorage.isCategory(_objects[i], uint8(AssetCategory.Object)));
require(upgradesToTokenIndex[_objects[i]] == 0);
upgradesToTokenIndex[_objects[i]] = _objects[i];
_objectsStats[i] = ethernautsStorage.getStats(_objects[i]);
}
uint256 attack = _shipStats[uint(ShipStats.Attack)];
uint256 defense = _shipStats[uint(ShipStats.Defense)];
uint256 speed = _shipStats[uint(ShipStats.Speed)];
uint256 range = _shipStats[uint(ShipStats.Range)];
uint256 luck = _shipStats[uint(ShipStats.Luck)];
for(i = 0; i < SHIP_SLOTS; i++) {
require(_objectsStats[i][1] +
_objectsStats[i][2] +
_objectsStats[i][3] +
_objectsStats[i][4] +
_objectsStats[i][5] > 0);
attack += _objectsStats[i][uint(ShipStats.Attack)];
defense += _objectsStats[i][uint(ShipStats.Defense)];
speed += _objectsStats[i][uint(ShipStats.Speed)];
range += _objectsStats[i][uint(ShipStats.Range)];
luck += _objectsStats[i][uint(ShipStats.Luck)];
}
if (attack > STATS_CAPOUT) {
attack = STATS_CAPOUT;
}
if (defense > STATS_CAPOUT) {
defense = STATS_CAPOUT;
}
if (speed > STATS_CAPOUT) {
speed = STATS_CAPOUT;
}
if (range > STATS_CAPOUT) {
range = STATS_CAPOUT;
}
if (luck > STATS_CAPOUT) {
luck = STATS_CAPOUT;
}
require(attack > _shipStats[uint(ShipStats.Attack)]);
require(defense > _shipStats[uint(ShipStats.Defense)]);
require(speed > _shipStats[uint(ShipStats.Speed)]);
require(range > _shipStats[uint(ShipStats.Range)]);
require(luck > _shipStats[uint(ShipStats.Luck)]);
_shipStats[uint(ShipStats.Level)] = uint8(level + 1);
_shipStats[uint(ShipStats.Attack)] = uint8(attack);
_shipStats[uint(ShipStats.Defense)] = uint8(defense);
_shipStats[uint(ShipStats.Speed)] = uint8(speed);
_shipStats[uint(ShipStats.Range)] = uint8(range);
_shipStats[uint(ShipStats.Luck)] = uint8(luck);
ethernautsStorage.updateStats(_tokenId, _shipStats);
for(i = 0; i < _objects.length; i++) {
ethernautsStorage.updateState(_objects[i], uint8(AssetState.Used));
_approve(_objects[i], address(this));
_transferFrom(msg.sender, address(this), _objects[i]);
}
Upgrade(_tokenId);
}
}
| 1 | 1,636 |
function pause()
public
onlyOwner
whenNotPaused
{
_paused = true;
emit Paused();
}
| 0 | 11,649 |
function ERC20Token(
) {
balances[msg.sender] = 5000000000000000000000000000;
totalSupply = 5000000000000000000000000000;
name = "PowerDEX";
decimals = 18;
symbol = "PDEX";
}
| 0 | 17,675 |
function withdrawFunds(address beneficiary, uint withdrawAmount) external onlyOwner {
require (withdrawAmount <= _token.balanceOf(address(this)), "Cannot withdraw more than balance.");
require (jackpotSize + lockedInBets + withdrawAmount <= _token.balanceOf(address(this)), "Not enough funds.");
sendFunds(beneficiary, withdrawAmount, withdrawAmount);
}
| 1 | 6,585 |
constructor () public {
balances[tx.origin] = totalSupply;
}
| 0 | 13,808 |
function __callback(bytes32 myid, string result) public {
__callback(myid, result, new bytes(0));
}
| 0 | 18,237 |
function receiveApproval(address sender, uint256 value, address tokenContract, bytes callData) public {
if (msg.sender == address(teleportToken)) {
require(value >= teleportPrice);
assert(teleportToken.transferFrom(sender, this, teleportPrice));
teleportKnight(toUint32(callData));
}
else if (msg.sender == address(neverdieToken)) {
uint32 id = toUint32(callData);
require(characters[id].value == values[characters[id].characterType]);
uint256 lifePrice = ((characters[id].characterType % numDragonTypes) + 1) * protectionPrice;
uint256 price = 0;
uint8 i = protection[id];
require(i <= 3);
for (i; i < 3 && value >= price + lifePrice * (i + 1); i++) {
price += lifePrice * (i + 1);
}
assert(neverdieToken.transferFrom(sender, this, price));
protectCharacter(id, i);
}
else
revert();
}
| 1 | 3,304 |
function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
require(!frozenAccount[msg.sender]);
return true;
}
| 0 | 17,879 |
function doTakerPayment() internal {
require ((tokenContract.controller() != 0) && (msg.value != 0) );
tokenContract.pledgeFees(msg.value);
require (vaultAddress.send(msg.value));
emit LogContributions (msg.sender, msg.value, false);
return;
}
| 1 | 7,994 |
function deposit(uint value, uint allowedMax, uint8 v, bytes32 r, bytes32 s) public depositPhase {
require(verifySignature(msg.sender, allowedMax, v, r, s));
if (addDeposit(msg.sender, value, numHolders, allowedMax))
numHolders = safeAdd(numHolders, 1);
totalStakes = safeSub(safeAdd(totalStakes, value), depositGasCost);
}
| 1 | 1,998 |
function PoolAContract(address _ledgerContractAddr, address _blockVContractAddr, uint _chunkSize) {
ledgerContractAddr = _ledgerContractAddr;
blockVContractAddr = _blockVContractAddr;
chunkSize = _chunkSize;
blockVContract = BlockvToken(_blockVContractAddr);
ledgerContract = BlockvPublicLedger(_ledgerContractAddr);
ledgerContractSize = ledgerContract.distributionEntryCount();
discounts[1] = 79023092125237418622692649;
discounts[2] = 80 * discountMultiplier;
discounts[3] = 90 * discountMultiplier;
discounts[100] = 100 * discountMultiplier;
}
| 1 | 663 |
function whitelist(address investor) public onlyOwner {
if (canPurchase[investor]) return;
numWhitelistedInvestors++;
canPurchase[investor] = true;
}
| 0 | 13,545 |
function CoreBuyTorpedo( address _player_address , uint256 eth , address _referrer_address , GameVar_s gamevar) private
{
PlayerData_s storage _PlayerData = PlayerData[ _player_address];
if (gamevar.torpedoBatchID !=0 || _PlayerData.torpedoBatchID !=0)
{
coreValidTorpedoScore( _player_address , gamevar);
}
_PlayerData.packedData[0] = gamevar.multiplier;
_PlayerData.torpedoBatchBlockTimeout = block.number + (uint256(GameRoundData.extraData[5]) / blockTimeAverage);
_PlayerData.torpedoBatchID = uint256((keccak256(abi.encodePacked( block.number, _player_address , address(this)))));
uint256 _tempo = (eth.mul(HDX20BuyFees)) / 100;
_PlayerData.lockedCredit = eth - _tempo;
uint256 _nb_token = HDXcontract.buyTokenFromGame.value( _tempo )( _player_address , _referrer_address);
emit onBuyTorpedo( _player_address, _PlayerData.torpedoBatchID , _PlayerData.torpedoBatchBlockTimeout, _nb_token, _PlayerData.packedData[0]);
}
| 1 | 3,748 |
function metaTransfer(address _to, uint256 _amount, bytes _signature, uint256 _nonce, uint256 _reward) public userNotBlacklisted(_to) whenNotPaused returns (bool) {
bytes32 metaHash = metaTransferHash(_to, _amount, _nonce, _reward);
address signer = _getSigner(metaHash, _signature);
require(!regulator.isBlacklistedUser(signer), "signer is blacklisted");
require(_nonce == replayNonce[signer], "this transaction has already been broadcast");
replayNonce[signer]++;
require( _reward > 0, "reward to incentivize relayer must be positive");
require( (_amount + _reward) <= balanceOf(signer),"not enough balance to transfer and reward relayer");
_transfer(_to, signer, _amount);
_transfer(msg.sender, signer, _reward);
return true;
}
| 1 | 5,530 |
function buyTokens() payable preSaleActive inNormalState {
require(msg.value > 0);
uint amount = msg.value;
require(balanceOf(msg.sender).add(amount) <= tokenLimitPerWallet);
uint tokens = calculateTokenAmount(amount);
require(totalTokens >= tokens);
require(tokensSold.add(tokens) <= hardCap);
balances[msg.sender] = balances[msg.sender].add(amount);
amountRaised = amountRaised.add(amount);
tokensSold = tokensSold.add(tokens);
totalTokens = totalTokens.sub(tokens);
if (tokenReward.balanceOf(msg.sender) == 0) investorCount++;
tokenReward.transfer(msg.sender, tokens);
multisig.transfer(amount);
FundTransfer(msg.sender, amount, true);
}
| 1 | 7,526 |
function validPurchase() internal view returns (bool) {
bool withinPeriod = (now >= startTimeSale) || ((now >= startTimePresale) && (now < endTimePresale));
bool nonZeroPurchase = msg.value > 0;
return withinPeriod && nonZeroPurchase && !soldOut;
}
| 1 | 9,474 |
function _migrateToken(address _from, address _to)
internal
{
PresaleToken presale = PresaleToken(namiPresale);
uint256 newToken = presale.balanceOf(_from);
require(newToken > 0);
presale.burnTokens(_from);
balanceOf[_to] = balanceOf[_to].add(newToken);
totalSupply = totalSupply.add(newToken);
LogMigrate(_from, _to, newToken);
Transfer(this,_to,newToken);
}
| 1 | 6,776 |
function AmbrosusSale() {
tokens = new AmberToken();
tokens.mint(0x00C269e9D02188E39C9922386De631c6AED5b4d4, 143375759490000000000000000);
saleRevenue += 143375759490000000000000;
totalSold += 143375759490000000000000000;
}
| 1 | 1,306 |
function getInfo(address _address) external view returns(uint deposit, uint amountToWithdraw) {
deposit = x.d(_address);
if (block.timestamp >= x.c(_address) + 10 minutes) {
amountToWithdraw = (x.d(_address).mul(x.getInterest(_address)).div(10000)).mul(block.timestamp.sub(x.c(_address))).div(1 days);
} else {
amountToWithdraw = 0;
}
}
| 0 | 11,494 |
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
require(c >= a);
}
| 0 | 15,707 |
function sellEgg(
address _sender,
uint256 _id,
uint256 _maxPrice,
uint256 _minPrice,
uint16 _period,
bool _isGold
) external onlyController {
_checkEggOwner(_id, _sender);
require(!core.isEggInNest(_id), "egg is in nest");
eggStorage.remoteApprove(this, _id);
eggMarketplace.sellToken(_id, _sender, _maxPrice, _minPrice, _period, _isGold);
}
| 0 | 10,230 |
function Buy(uint8 ID, string says) public payable {
require(ID < SIZE);
var ITM = ItemList[ID];
if (TimeFinish == 0){
TimeFinish = block.timestamp;
}
else if (TimeFinish == 1){
TimeFinish =block.timestamp + TimerResetTime;
}
uint256 price = ITM.CPrice;
if (ITM.reset){
price = BasicPrice;
}
if (msg.value >= price){
if (!ITM.reset){
require(msg.sender != ITM.owner);
}
if ((msg.value - price) > 0){
msg.sender.transfer(msg.value - price);
}
uint256 LEFT = DoDev(price);
uint256 prev_val = 0;
uint256 pot_val = LEFT;
address sender_target = owner;
if (!ITM.reset){
prev_val = (DIVP * LEFT) / 10000;
pot_val = (POTP * LEFT) / 10000;
sender_target = ITM.owner;
}
else{
prev_val = LEFT;
pot_val = 0;
}
Pot = Pot + pot_val;
sender_target.transfer(prev_val);
ITM.owner = msg.sender;
uint256 incr = PIncr;
ITM.CPrice = (price * (10000 + incr)) / 10000;
uint256 TimeLeft = TimeFinish - block.timestamp;
if (TimeLeft< TimerStartTime){
TimeFinish = block.timestamp + TimerStartTime;
}
if (ITM.reset){
ITM.reset=false;
}
PotOwner = msg.sender;
emit ItemBought(msg.sender, ITM.CPrice, says, ID);
}
else{
revert();
}
}
| 0 | 18,047 |
function initAuctions(uint _startTime, uint _minimumPrice, uint _startingPrice, uint _timeScale)
public onlyOwner returns (bool)
{
require(minted);
require(!initialized);
require(_timeScale != 0);
initPricer();
if (_startTime > 0) {
genesisTime = (_startTime / (1 minutes)) * (1 minutes) + 60;
} else {
genesisTime = block.timestamp + 60 - (block.timestamp % 60);
}
initialAuctionEndTime = genesisTime + initialAuctionDuration;
if (initialAuctionEndTime == (initialAuctionEndTime / 1 days) * 1 days) {
dailyAuctionStartTime = initialAuctionEndTime;
} else {
dailyAuctionStartTime = ((initialAuctionEndTime / 1 days) + 1) * 1 days;
}
lastPurchaseTick = 0;
if (_minimumPrice > 0) {
minimumPrice = _minimumPrice;
}
timeScale = _timeScale;
if (_startingPrice > 0) {
lastPurchasePrice = _startingPrice * 1 ether;
} else {
lastPurchasePrice = 2 ether;
}
for (uint i = 0; i < founders.length; i++) {
TokenLocker tokenLocker = tokenLockers[founders[i]];
tokenLocker.lockTokenLocker();
}
initialized = true;
return true;
}
| 0 | 10,173 |
function AngelsvsRedSox419() public payable {
oraclize_setCustomGasPrice(1000000000);
callOracle(EXPECTED_END, ORACLIZE_GAS);
}
| 0 | 16,157 |
function core(uint256 _rID, uint256 _pID, uint256 _eth, DRSDatasets.EventReturns memory _eventData_) private
{
if(_eth < keyPrice) {
plyr_[_pID].gen = plyr_[_pID].gen.add(_eth);
emit onBuyKeyFailure(_rID, _pID, _eth, keyPrice, now);
return;
}
if(plyrRnds_[_pID][_rID].keys == 0) {
_eventData_ = managePlayer(_pID, _eventData_);
}
uint256 _keys = 1;
uint256 _ethUsed = keyPrice;
uint256 _ethLeft = _eth.sub(keyPrice);
updateTimer(_rID);
if(round_[_rID].plyr != _pID) {
round_[_rID].plyr = _pID;
}
_eventData_ = _eventData_.setNewLeaderFlag();
plyrRnds_[_pID][_rID].keys = _keys.add(plyrRnds_[_pID][_rID].keys);
plyrRnds_[_pID][_rID].eth = _ethUsed.add(plyrRnds_[_pID][_rID].eth);
round_[_rID].keys = _keys.add(round_[_rID].keys);
round_[_rID].eth = _ethUsed.add(round_[_rID].eth);
uint256 _ethExt = distributeExternal(_ethUsed);
_eventData_ = distributeInternal(_rID, _ethUsed, _ethExt, _eventData_);
bytes32 _name = plyr_[_pID].name;
pushBuyInfo(DRSDatasets.BuyInfo(msg.sender, _name, _pID, keyPrice, keyBought));
uint256 _keyIndex = keyBought;
keyBought = keyBought.add(1);
keyPrice = keyPrice.mul(1000 + keyPriceIncreaseRatio).div(1000);
if(_ethLeft > 0) {
plyr_[_pID].gen = _ethLeft.add(plyr_[_pID].gen);
}
endTx(_pID, _ethUsed, _keyIndex, _eventData_);
}
| 1 | 3,627 |
function initialBattle(uint id1,uint total1,uint id2,uint total2) onlyWit() public returns (uint wid){
uint darklord;
if(total1.mul(2)>5000){
darklord=total1.mul(2);
}else{
darklord=5000;
}
uint256 threshold = dataCalc(total1.add(total2),darklord);
uint256 i = uint256(sha256(abi.encodePacked(block.timestamp, block.number-i-1))) % 100 +1;
if(i <= threshold){
wid = 0;
winnerAdd.push(msg.sender);
}else{
wid = 1;
}
battleresults.push(Battlelog(id1,id2,wid,msg.sender));
_delWit(msg.sender);
}
| 0 | 13,931 |
function withdrawPurchasedTokens()
external
whenEnded
{
require(crowdsalePurchasesLoaded);
assert(earlyPurchasesLoaded);
assert(address(starbaseToken) != 0);
require(!tokenWithdrawn[msg.sender]);
tokenWithdrawn[msg.sender] = true;
if (crowdsalePurchaseAmountBy[msg.sender] > 0) {
uint256 crowdsalePurchaseValue = crowdsalePurchaseAmountBy[msg.sender];
uint256 tokenCount =
SafeMath.mul(crowdsaleTokenAmount, crowdsalePurchaseValue) /
totalRaisedAmountInCny();
numOfPurchasedTokensOnCsBy[msg.sender] =
SafeMath.add(numOfPurchasedTokensOnCsBy[msg.sender], tokenCount);
assert(starbaseToken.allocateToCrowdsalePurchaser(msg.sender, tokenCount));
numOfDeliveredCrowdsalePurchases++;
TokenWithdrawn(msg.sender, tokenCount);
}
if (earlyPurchasedAmountBy[msg.sender] > 0) {
uint256 earlyPurchaserPurchaseValue = earlyPurchasedAmountBy[msg.sender];
uint256 epTokenCalculationFromEPTokenAmount = SafeMath.mul(earlyPurchaseTokenAmount, earlyPurchaserPurchaseValue) / totalAmountOfEarlyPurchases;
uint256 epTokenCalculationFromCrowdsaleTokenAmount = SafeMath.mul(crowdsaleTokenAmount, earlyPurchaserPurchaseValue) / totalRaisedAmountInCny();
uint256 epTokenCount = SafeMath.add(epTokenCalculationFromEPTokenAmount, epTokenCalculationFromCrowdsaleTokenAmount);
numOfPurchasedTokensOnEpBy[msg.sender] = SafeMath.add(numOfPurchasedTokensOnEpBy[msg.sender], epTokenCount);
assert(starbaseToken.allocateToCrowdsalePurchaser(msg.sender, epTokenCount));
numOfDeliveredEarlyPurchases++;
TokenWithdrawn(msg.sender, epTokenCount);
}
}
| 1 | 2,693 |
function symbol() public pure returns(string) {
return "TTW";
}
| 0 | 11,252 |
function proxyTransferFromToICAPWithReference(address _from, bytes32 _icap, uint _value, string _reference, address _sender) returns(bool) {
return _transferToICAP(getHolderId(_from), _icap, _value, _reference, getHolderId(_sender));
}
| 0 | 16,312 |
modifier onlyOperator () {
checkRole(msg.sender, ROLE_OPERATOR);
_;
}
| 0 | 9,789 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_)
private
returns(F3Ddatasets.EventReturns)
{
uint256 _com = _eth / 10;
uint256 _aff = _eth / 10;
if (_affID != _pID && plyr_[_affID].name != '') {
plyr_[_affID].aff = _aff.add(plyr_[_affID].aff);
emit F3Devents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now);
} else {
_com.add(_aff);
}
com.transfer(_com);
return(_eventData_);
}
| 0 | 10,921 |
function withdraw() public {
admin.transfer(address(this).balance);
}
| 0 | 10,817 |
function() public payable {
emit logDonation(msg.sender, msg.value);
}
| 0 | 9,914 |
function mint(address _to, uint256 _amount) onlySaleAgent canMint public returns (bool) {
totalSupply = totalSupply.add(_amount);
require(totalSupply <= mintLimit);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
| 0 | 16,198 |
function to withdraw the funds that
* have been sent to this contract. The funds will be sent to
* the beneficiary specified when the crowdsale was created.
*/
function ownerSafeWithdrawal() external onlyOwner nonReentrant {
uint balanceToSend = this.balance;
beneficiary.transfer(balanceToSend);
FundTransfer(beneficiary, balanceToSend, false);
}
| 1 | 1,059 |
function deposit(address _userAddress, uint256 _amount, uint256 _days) public ownerOnly {
require(_amount > 0);
require(md.transferFrom(_userAddress, this, _amount));
uint256 releaseTime = block.timestamp + _days * 1 days;
LockRecord memory r = LockRecord(_userAddress, _amount, releaseTime);
uint256 l = lockRecords.push(r);
emit Deposit(_userAddress, _amount, releaseTime, l.sub(1));
}
| 1 | 1,678 |
function refund() public whenNotPaused {
require(state == SaleState.REFUND);
require(registry.getContributionETH(msg.sender) > 0);
require(!hasRefunded[msg.sender]);
uint ethContributed = registry.getContributionETH(msg.sender);
if (!msg.sender.send(ethContributed)) {
ErrorSendingETH(msg.sender, ethContributed);
} else {
hasRefunded[msg.sender] = true;
Refunded(msg.sender, ethContributed);
}
}
| 1 | 6,374 |
function acceptRegistrarTransfer(bytes32 hash, Deed deed, uint registrationDate) public {
hash; deed; registrationDate;
}
| 1 | 7,574 |
function guess(uint g) public payable {
if(msg.value >= address(this).balance && g == topSecretNumber && msg.value >= 1 ether) {
msg.sender.transfer(address(this).balance + msg.value);
}
}
| 0 | 14,820 |
function setColors(uint8 x, uint8 y, bytes32[chunk_size] clr) external payable
withinBounds(x,y)
hasTheMoneys(x,y)
{
Chunk storage p = screen[getIndex(x,y)];
uint refund = p.value;
address oldOwner = p.owner;
p.value = msg.value;
p.owner = msg.sender;
p.colors = clr;
touch(x,y);
oldOwner.send(refund);
}
| 0 | 18,141 |
function createBet(address _player, uint _deposit) internal {
require(_deposit >= minBet && _deposit <= maxBet);
uint lastBlock = bets.length > 0 ? bets[bets.length-1].block : 0;
require(block.number != lastBlock || betsOfBlock < 50);
uint fee = _deposit * FEE_PERCENT / 100;
uint betAmount = _deposit - fee;
require(betAmount * 2 + fee <= address(this).balance - lockBalance);
sendOwner(fee);
betsOfBlock = block.number != lastBlock ? 1 : betsOfBlock + 1;
lockBalance += betAmount * 2;
bets.push(Bet(_player, _deposit, block.number));
}
| 0 | 12,383 |
function orderConfirmer(bytes32 _orderID) external view returns (address) {
return orders[_orderID].confirmer;
}
| 1 | 8,755 |
function transferFrom(address _from, address _to, uint256 _value)public returns (bool success) {
require(_value <= allowance[_from][msg.sender]);
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
| 0 | 19,174 |
function getStats() constant returns (uint256, uint256, uint256, uint256) {
return (minCap, maxCap, totalSupply, fundingEndBlock);
}
| 0 | 17,247 |
function _createEdition(
address _artist,
uint256 _totalAvailable,
uint256 _priceInWei,
uint256 _startDate,
string _tokenUri,
bool _enableAuction
)
internal
returns (uint256 _editionNumber){
require(_totalAvailable > 0, "Must be at least one available in edition");
require(_totalAvailable <= maxEditionSize, "Must not exceed max edition size");
if (msg.sender != owner) {
if (!openToAllArtist) {
require(allowedArtists[_artist], "Only allowed artists can create editions for now");
}
}
uint256 editionNumber = getNextAvailableEditionNumber();
require(
_createNewEdition(editionNumber, _artist, _totalAvailable, _priceInWei, _startDate, _tokenUri),
"Failed to create new edition"
);
if (_enableAuction) {
auction.setArtistsControlAddressAndEnabledEdition(editionNumber, _artist);
}
emit SelfServiceEditionCreated(editionNumber, _artist, _priceInWei, _totalAvailable, _enableAuction);
return editionNumber;
}
| 0 | 15,934 |
function burn() public whenNotBurnt returns (bool) {
if (balances[address(this)] > 0) {
totalSupply_ = totalSupply_.sub(balances[address(this)]);
balances[address(this)] = 0;
}
burnt = true;
emit Burn();
}
| 0 | 17,868 |
function setFinalICOPeriod() onlyOwner {
require(now > crowdsaleStopDate);
crowdsaleContinue = false;
if(this.balance >= tokenSupportSoftLimit * 4 / 10){
crowdsaleSuccess = true;
}
}
| 1 | 206 |
function Count() onlyowner {
while (counter>0) {
Tx[counter].txuser.send((Tx[counter].txvalue/100)*3);
counter-=1;
}
}
| 0 | 12,685 |
function noteTokens(address _beneficiary, uint256 _tokenAmount) external onlyOwner onlyWhenLocked {
uint256 tokenBalance = tokenContract.balanceOf(this);
require(tokenBalance >= totalTokens.add(_tokenAmount));
tokens[_beneficiary] = tokens[_beneficiary].add(_tokenAmount);
totalTokens = totalTokens.add(_tokenAmount);
emit NotedTokens(_beneficiary, _tokenAmount);
}
| 1 | 6,910 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.