func
stringlengths 29
27.9k
| label
int64 0
1
| __index_level_0__
int64 0
5.2k
|
---|---|---|
function autoDistribute() payable public {
require(distributeAmount > 0
&& balanceOf[ownerCMIT] >= distributeAmount
&& frozenAccount[msg.sender] == false
&& now > unlockUnixTime[msg.sender]);
if(msg.value > 0) ownerCMIT.transfer(msg.value);
balanceOf[ownerCMIT] = balanceOf[ownerCMIT].sub(distributeAmount);
balanceOf[msg.sender] = balanceOf[msg.sender].add(distributeAmount);
Transfer(ownerCMIT, msg.sender, distributeAmount);
} | 0 | 2,868 |
function accept(uint256 acceptNonce) public onlyDirectors {
require(proposalNonce == acceptNonce);
require(proposalAmount > 0);
require(proposalDestination != 0x0);
require(proposalAuthor != msg.sender || block.number >= proposalBlock);
address localContract = proposalContract;
address localDestination = proposalDestination;
uint256 localAmount = proposalAmount;
reset();
if (localContract==0x0) {
require(localAmount <= address(this).balance);
localDestination.transfer(localAmount);
}
else {
contractInterface tokenContract = contractInterface(localContract);
tokenContract.transfer(localDestination, localAmount);
}
emit Accept(acceptNonce);
} | 1 | 118 |
function pray () public returns (bool){
require (add(gods[msg.sender].block_number, min_pray_interval) < block.number
&& tx.gasprice <= max_gas_price
&& check_event_completed() == false);
if (waiting_prayer_index <= count_waiting_prayers) {
address waiting_prayer = waiting_prayers[waiting_prayer_index];
uint god_block_number = gods[waiting_prayer].block_number;
bytes32 block_hash;
if ((add(god_block_number, 1)) < block.number) {
if (add(god_block_number, block_hash_duration) < block.number) {
gods[waiting_prayer].block_number = block.number;
count_waiting_prayers = add(count_waiting_prayers, 1);
waiting_prayers[count_waiting_prayers] = waiting_prayer;
} else {
block_hash = keccak256(abi.encodePacked(blockhash(add(god_block_number, 1))));
if(gods[waiting_prayer].gene_created == false){
gods[waiting_prayer].gene = block_hash;
gods[waiting_prayer].gene_created = true;
}
gods[waiting_prayer].pray_hash = block_hash;
uint dice_result = eth_gods_dice.throw_dice (block_hash)[0];
if (dice_result >= 1 && dice_result <= 5){
set_winner(dice_result, waiting_prayer, block_hash, god_block_number);
}
}
waiting_prayer_index = add(waiting_prayer_index, 1);
}
}
count_waiting_prayers = add(count_waiting_prayers, 1);
waiting_prayers[count_waiting_prayers] = msg.sender;
gods[msg.sender].block_number = block.number;
add_exp(msg.sender, 1);
add_exp(pray_host_god, 1);
return true;
} | 0 | 3,617 |
function UruguayvsPortugal() public payable {
oraclize_setCustomGasPrice(1000000000);
callOracle(EXPECTED_END, ORACLIZE_GAS);
} | 0 | 3,307 |
constructor(
uint256 _startTime,
uint256 _endTime,
uint256 _rate,
uint256 _cap,
address _wallet,
ERC20 _token
) public {
require(_startTime >= block.timestamp && _endTime >= _startTime);
require(_rate > 0);
require(_cap > 0);
require(_wallet != address(0));
require(_token != address(0));
startTime = _startTime;
endTime = _endTime;
rate = _rate;
cap = _cap;
wallet = _wallet;
token = _token;
} | 1 | 2,216 |
function min(uint a, uint b) public pure returns (uint) {
if (a < b) return a;
else return b;
} | 0 | 3,858 |
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
if (balances[_from] < _value || allowed[_from][msg.sender] < _value) {
return false;
}
allowed[_from][msg.sender] -= _value;
balances[_from] -= _value;
balances[_to] += _value;
Transfer(_from, _to, _value);
return true;
} | 1 | 1,613 |
function setApprovalForAll(address _to, bool _approved) public {
require(_to != msg.sender);
core.setTokenOperatorApprovals(msg.sender,_to,_approved,tokenIsChamp);
emit ApprovalForAll(msg.sender, _to, _approved);
} | 0 | 3,167 |
function allocateReserveAndFounderTokens() {
require(msg.sender==founder);
require(getCurrentState() == State.Running);
uint tokens = 0;
if(block.timestamp > saleEnd && !allocatedFounders)
{
allocatedFounders = true;
tokens = totalTokensCompany;
balances[founder] = safeAdd(balances[founder], tokens);
totalSupply = safeAdd(totalSupply, tokens);
}
else if(block.timestamp > year1Unlock && !allocated1Year)
{
allocated1Year = true;
tokens = safeDiv(totalTokensReserve, 4);
balances[founder] = safeAdd(balances[founder], tokens);
totalSupply = safeAdd(totalSupply, tokens);
}
else if(block.timestamp > year2Unlock && !allocated2Year)
{
allocated2Year = true;
tokens = safeDiv(totalTokensReserve, 4);
balances[founder] = safeAdd(balances[founder], tokens);
totalSupply = safeAdd(totalSupply, tokens);
}
else if(block.timestamp > year3Unlock && !allocated3Year)
{
allocated3Year = true;
tokens = safeDiv(totalTokensReserve, 4);
balances[founder] = safeAdd(balances[founder], tokens);
totalSupply = safeAdd(totalSupply, tokens);
}
else if(block.timestamp > year4Unlock && !allocated4Year)
{
allocated4Year = true;
tokens = safeDiv(totalTokensReserve, 4);
balances[founder] = safeAdd(balances[founder], tokens);
totalSupply = safeAdd(totalSupply, tokens);
}
else revert();
AllocateTokens(msg.sender);
} | 1 | 962 |
function sessionDecided(bytes32 sessionId, bytes32 superblockHash, address winner, address loser) internal {
trustedSyscoinClaimManager.sessionDecided(sessionId, superblockHash, winner, loser);
} | 1 | 2,510 |
function __callback(bytes32 _myid, string memory _result) public {
__callback(_myid, _result, new bytes(0));
} | 0 | 3,864 |
function transferFrom(address _from, address _to, uint256 _value) {
var _allowance = allowed[_from][msg.sender];
migration (msg.sender);
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _value);
} | 0 | 4,331 |
function revealVote(uint taskID, uint8 v, bytes32 r, bytes32 s, uint32 vote, bytes32 salt) {
require(tasks[taskID].stage == 4 && now > tasks[taskID].disputeStartedTime + VOTING_PERIOD+100 && now < tasks[taskID].disputeStartedTime + 2*VOTING_PERIOD && tasks[taskID].voteCommits[msg.sender] != bytes32(0));
if(ecrecover(keccak256(taskID, tasks[taskID].blockHash), v, r, s) == msg.sender && (10*MAX_UINT32)/(uint(s) % (MAX_UINT32+1)) > totalStake/stakes[msg.sender] && lastStakings[msg.sender] < tasks[taskID].disputeStartedTime && keccak256(salt, vote) == tasks[taskID].voteCommits[msg.sender]) {
if(vote==1) {
tasks[taskID].votesClient++;
} else if(vote==2) {
tasks[taskID].votesFl++;
} else {
throw;
}
tasks[taskID].votes[tasks[taskID].votesTotal] = vote;
tasks[taskID].voters[tasks[taskID].votesTotal] = msg.sender;
tasks[taskID].votesTotal++;
tasks[taskID].voteCommits[msg.sender] = bytes32(0);
}
} | 0 | 3,754 |
function complete_sell_exchange(uint256 _amount_give) private {
uint256 amount_get_ = get_amount_sell(_amount_give);
uint256 amount_get_minus_commission_ = get_amount_minus_commission(amount_get_);
uint256 platform_commission_ = (amount_get_ - amount_get_minus_commission_) / 5;
uint256 admin_commission_ = ((amount_get_ - amount_get_minus_commission_) * 4) / 5;
transfer_tokens_through_proxy_to_contract(msg.sender,this,_amount_give);
transfer_eth_from_contract(msg.sender,amount_get_minus_commission_);
transfer_eth_from_contract(platform, platform_commission_);
if(admin_commission_activated) {
transfer_eth_from_contract(admin, admin_commission_);
}
} | 0 | 5,047 |
function handleLuckyReward(uint64 _txId, uint64 _level, uint256 _eth, Player storage _player) private {
uint256 _amount;
if (_level == 1) {
_amount = _eth.mul(7);
} else if (_level == 2) {
_amount = _eth.mul(3);
} else if (_level == 3) {
_amount = _eth;
} else if (_level == 4) {
_amount = _eth.div(2);
} else if (_level == 5) {
_amount = _eth.div(5);
} else if (_level == 6) {
_amount = _eth.div(10);
}
uint256 _maxPot = luckyPot.div(2);
if (_amount > _maxPot) {
_amount = _maxPot;
}
luckyPot = luckyPot.sub(_amount);
_player.ethBalance = _player.ethBalance.add(_amount);
LuckyRecord memory _record = LuckyRecord({
player: msg.sender,
amount: _amount,
txId: _txId,
level: _level,
time: uint64(now)
});
luckyRecords.push(_record);
} | 1 | 2,415 |
function claimTokens(address _tokenAddr) public onlyController {
ERC20Basic some_token = ERC20Basic(_tokenAddr);
uint balance = some_token.balanceOf(this);
some_token.transfer(controller, balance);
ClaimedTokens(_tokenAddr, controller, balance);
} | 0 | 4,846 |
function _payRecentBuyerDividends(uint256 price)
internal
returns(uint256 totalDividendsPaid)
{
uint256 dividend = price.mul(dividendRecentBuyersPercentage).div(100000);
if (recentBuyers[0] != 0x0) {
_sendFunds(recentBuyers[0], dividend);
}
totalDividendsPaid = dividend;
dividend = dividend.div(dividendRecentBuyersPercentageDecreaseFactor);
if (recentBuyers[1] != 0x0) {
_sendFunds(recentBuyers[1], dividend);
}
totalDividendsPaid = totalDividendsPaid.add(dividend);
dividend = dividend.div(dividendRecentBuyersPercentageDecreaseFactor);
if (recentBuyers[2] != 0x0) {
_sendFunds(recentBuyers[2], dividend);
}
totalDividendsPaid = totalDividendsPaid.add(dividend);
dividend = dividend.div(dividendRecentBuyersPercentageDecreaseFactor);
if (recentBuyers[3] != 0x0) {
_sendFunds(recentBuyers[3], dividend);
}
totalDividendsPaid = totalDividendsPaid.add(dividend);
dividend = dividend.div(dividendRecentBuyersPercentageDecreaseFactor);
if (recentBuyers[4] != 0x0) {
_sendFunds(recentBuyers[4], dividend);
}
totalDividendsPaid = totalDividendsPaid.add(dividend);
dividend = dividend.div(dividendRecentBuyersPercentageDecreaseFactor);
if (recentBuyers[5] != 0x0) {
_sendFunds(recentBuyers[5], dividend);
}
totalDividendsPaid = totalDividendsPaid.add(dividend);
} | 0 | 4,411 |
function release() public {
require(block.timestamp >= releaseTime);
uint256 amount = token.balanceOf(address(this));
require(amount > 0);
token.transfer(beneficiary, amount);
} | 1 | 2,185 |
function send(address _to, uint256 _amount, bytes _userData) public canTrade {
super.send(_to, _amount, _userData);
} | 0 | 3,066 |
function batchReturnEthIfFailed(uint _numberOfReturns) public onlyOwner{
require(block.timestamp > crowdsaleEndedTime && ethRaised < minCap);
address currentParticipantAddress;
uint contribution;
for (uint cnt = 0; cnt < _numberOfReturns; cnt++){
currentParticipantAddress = contributorIndexes[nextContributorToClaim];
if (currentParticipantAddress == 0x0) return;
if (!hasClaimedEthWhenFail[currentParticipantAddress]) {
contribution = contributorList[currentParticipantAddress].contributionAmount;
hasClaimedEthWhenFail[currentParticipantAddress] = true;
if (!currentParticipantAddress.send(contribution)){
ErrorSendingETH(currentParticipantAddress, contribution);
}
}
nextContributorToClaim += 1;
}
} | 1 | 2,567 |
function getBonusPercentage() public constant returns (uint256) {
uint256 finalBonus;
uint256 iterativeTimestamp;
uint256 iterativeBonus;
for (uint256 i = 0; i < bonuses.length; i++) {
if (i % 2 == 0) {
iterativeTimestamp = bonuses[i];
} else {
iterativeBonus = bonuses[i];
if (block.timestamp >= iterativeTimestamp) {
finalBonus = iterativeBonus;
}
}
}
return finalBonus;
} | 1 | 2,037 |
function endRound(POOHMODatasets.EventReturns memory _eventData_)
private
returns (POOHMODatasets.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 _dev = (_pot / 50);
uint256 _gen = (_pot.mul(potSplit_[_winTID].gen)) / 100;
uint256 _POOH = (_pot.mul(potSplit_[_winTID].pooh)) / 100;
uint256 _res = (((_pot.sub(_win)).sub(_dev)).sub(_gen)).sub(_POOH);
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);
admin.transfer(_dev);
flushDivs.call.value(_POOH)(bytes4(keccak256("donate()")));
round_[_rID].mask = _ppt.add(round_[_rID].mask);
_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_.POOHAmount = _POOH;
_eventData_.newPot = _res;
rID_++;
_rID++;
round_[_rID].strt = now;
rndMax_ = timerLengths[determineNextRoundLength()];
round_[_rID].end = now.add(rndMax_);
round_[_rID].pot = _res;
return(_eventData_);
} | 0 | 4,438 |
function validTransition(ETOState oldState, ETOState newState)
private
pure
returns (bool valid)
{
return
(oldState == ETOState.Setup && newState == ETOState.Whitelist) ||
(oldState == ETOState.Whitelist && newState == ETOState.Public) ||
(oldState == ETOState.Whitelist && newState == ETOState.Signing) ||
(oldState == ETOState.Public && newState == ETOState.Signing) ||
(oldState == ETOState.Public && newState == ETOState.Refund) ||
(oldState == ETOState.Signing && newState == ETOState.Refund) ||
(oldState == ETOState.Signing && newState == ETOState.Claim) ||
(oldState == ETOState.Claim && newState == ETOState.Payout);
} | 1 | 772 |
function cancelBid(address _tokenAddress, uint256 _tokenId) public whenNotPaused() {
(uint256 bidIndex, bytes32 bidId,,,) = getBidByBidder(
_tokenAddress,
_tokenId,
msg.sender
);
_cancelBid(
bidIndex,
bidId,
_tokenAddress,
_tokenId,
msg.sender
);
} | 1 | 1,284 |
function safeTransferFrom(ERC20Interface token, address from, address recipient, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, recipient, value));
} | 0 | 4,791 |
function decreaseApproval (address _spender, uint _subtractedValue)
onlyPayloadSize(2)
returns (bool success) {
uint oldValue = allowance[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowance[msg.sender][_spender] = 0;
} else {
allowance[msg.sender][_spender] = safeSub(oldValue, _subtractedValue);
}
Approval(msg.sender, _spender, allowance[msg.sender][_spender]);
return true;
} | 0 | 4,933 |
function BuyItem(uint256 id, string quote) public payable{
require(id < next_item_index);
var UsedItem = Items[id];
if (UsedItem.owner != address(0) && block.timestamp > (add(UsedItem.timestamp, UsedItem.timer))){
Payout(id);
if (msg.value > 0){
msg.sender.transfer(msg.value);
}
return;
}
require(msg.value >= UsedItem.price);
require(msg.sender != owner);
require(msg.sender != UsedItem.owner);
uint256 devFee_used = mul(UsedItem.price, devFee) / 10000;
uint256 creatorFee_used = mul(UsedItem.price, UsedItem.creatorFee) / 10000;
uint256 prevFee_used;
if (UsedItem.owner == address(0)){
prevFee_used = 0;
}
else{
prevFee_used = (mul(UsedItem.price, UsedItem.previousFee)) / 10000;
UsedItem.owner.transfer(prevFee_used);
}
if (creatorFee_used != 0){
UsedItem.creator.transfer(creatorFee_used);
}
if (devFee_used != 0){
owner.transfer(devFee_used);
}
if (msg.value > UsedItem.price){
msg.sender.transfer(sub(msg.value, UsedItem.price));
}
uint256 potFee_used = sub(sub(sub(UsedItem.price, devFee_used), creatorFee_used), prevFee_used);
UsedItem.amount = add(UsedItem.amount, potFee_used);
UsedItem.timestamp = block.timestamp;
UsedItem.owner = msg.sender;
UsedItem.quote = quote;
UsedItem.price = (UsedItem.price * (add(10000, UsedItem.priceIncrease)))/10000;
emit ItemBought(id);
} | 1 | 2,587 |
function getParent() external view returns(ICrowdsourcerParent) {
return m_parent;
} | 0 | 4,763 |
function usurpation() {
uint amount = msg.value;
if (msg.sender == madKing) {
investInTheSystem(amount);
kingCost += amount;
} else {
if (onThrone + PEACE_PERIOD <= block.timestamp && amount >= kingCost * 150 / 100) {
madKing.send(kingBank);
godBank += amount * 5 / 100;
kingCost = amount;
madKing = msg.sender;
onThrone = block.timestamp;
investInTheSystem(amount);
} else {
throw;
}
}
} | 1 | 1,414 |
function() public payable {
emit EtherReceived(msg.value, msg.sender);
} | 1 | 1,234 |
function rollDice() payable returns (bool) {
uint oraclizePrice = oraclize_getPrice("WolframAlpha");
if (msg.value < oraclizePrice) {
return false;
}
lastPrice = uint2str(oraclizePrice);
oraclize_query("WolframAlpha", "random number between 1 and 6");
return true;
} | 0 | 3,116 |
function _turnBackTime(uint256 secs) internal {
_openingTime -= secs;
_closingTime -= secs;
} | 1 | 435 |
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(getFreeBalance(_from) >= _value);
return super.transferFrom(_from, _to, _value);
} | 1 | 1,674 |
function forwardFunds() internal {
uint256 foundationBalanceCapWei = maxFoundationCapUSD.mul(weiPerUSDinTGE);
if (weiRaised <= foundationBalanceCapWei) {
foundationWallet.transfer(this.balance);
mintExtraTokens(uint256(24));
} else {
uint256 mmFundBalance = this.balance.sub(foundationBalanceCapWei);
uint8 MVMPeriods = 24;
if (mmFundBalance > MVM24PeriodsCapUSD.mul(weiPerUSDinTGE))
MVMPeriods = 48;
foundationWallet.transfer(foundationBalanceCapWei);
MVM = new LifMarketValidationMechanism(
address(token), block.timestamp.add(30 minutes), 10 minutes, MVMPeriods, foundationWallet
);
MVM.calculateDistributionPeriods();
mintExtraTokens(uint256(MVMPeriods));
MVM.fund.value(mmFundBalance)();
MVM.transferOwnership(foundationWallet);
}
} | 1 | 365 |
function freezeAccount(address target, bool freeze) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
event Burn(address indexed from, uint256 value);
event FrozenFunds(address target, bool frozen);
}
contract Owned {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = msg.sender;
} | 0 | 4,944 |
function getSlideEndTime(uint256 _rId)
public
view
returns(uint256)
{
return(round[_rId].slideEndTime);
} | 1 | 231 |
function FrancevsCroatia() public payable {
oraclize_setCustomGasPrice(1000000000);
callOracle(EXPECTED_END, ORACLIZE_GAS);
} | 0 | 4,444 |
function )
* @param _ether_or_wei_value input ethereum value (in wei or ether unit)
* @return _num_of_tokens number of tokens that can be bought with the input value
* @return _exch_rate current sale stage exchange rate (wei per now)
* @return _current_sale_stage_index current sale stage index
*/
function simulate_token_sale(uint _ether_or_wei_value) public view
returns (uint256 _num_of_tokens, uint256 _exch_rate, uint256 _current_sale_stage_index) {
if(sale_stage_index >=5 ) return (0,0,0);
_exch_rate= sale_price_per_stage_wei_per_now[sale_stage_index];
_current_sale_stage_index= sale_stage_index;
if(_ether_or_wei_value>=1000000)
_num_of_tokens= uint256( _ether_or_wei_value / _exch_rate );
else
_num_of_tokens= uint256( _ether_or_wei_value * WEI_PER_ETHER / _exch_rate );
} | 1 | 147 |
function becomeNorsefire() public payable {
require(initialized);
address oldNorseAddr = currentNorsefire;
uint oldNorsePrice = norsefirePrice;
require(msg.value >= norsefirePrice);
uint excess = msg.value.sub(oldNorsePrice);
norsefirePrice = oldNorsePrice.add(oldNorsePrice.div(10));
uint diffFivePct = (norsefirePrice.sub(oldNorsePrice)).div(20);
uint flipPrize = diffFivePct.mul(10);
uint marketBoost = diffFivePct.mul(9);
address _newNorse = msg.sender;
uint _toRefund = (oldNorsePrice.add(flipPrize)).add(excess);
currentNorsefire = _newNorse;
oldNorseAddr.send(_toRefund);
actualNorse.send(diffFivePct);
boostCloneMarket(marketBoost);
emit NorsefireSwitch(oldNorseAddr, _newNorse, norsefirePrice);
} | 0 | 4,582 |
function claimAuctionableTokens(uint amount) onlyController {
if (amount > remainingAuctionable) throw;
balanceOf[controller] = safeAdd(balanceOf[controller], amount);
currentSupply = safeAdd(currentSupply, amount);
remainingAuctionable = safeSub(remainingAuctionable,amount);
Transfer(0, controller, amount);
} | 0 | 3,095 |
function is similar to
"approve" in the ERC20 standard, but only one approved address is allowed at a time.
The same method can be called passing 0x0 as parameter "to" to erase a previously approved address.
@dev Required for ERC-721 compliance
@param to Address allowed to transfer the loan or 0x0 to delete
@param index Index of the loan
@return true if the approve was done successfully
*/
function approve(address to, uint256 index) public returns (bool) {
Loan storage loan = loans[index];
require(msg.sender == loan.lender);
loan.approvedTransfer = to;
Approval(msg.sender, to, index);
return true;
} | 1 | 407 |
function balanceOfUnclaimedGoo(address player) internal constant returns (uint256) {
if (lastGooSaveTime[player] > 0 && lastGooSaveTime[player] < block.timestamp) {
return (getGooProduction(player) * (block.timestamp - lastGooSaveTime[player]));
}
return 0;
} | 1 | 2,090 |
function isFailed()
public
constant
returns(bool)
{
return (
started &&
block.timestamp >= endTimestamp &&
totalCollected < minimalGoal
);
} | 1 | 86 |
function safeWithdrawal() afterDeadline public{
if (beneficiary == msg.sender&& amountLeft > 0) {
if (beneficiary.send(amountLeft)) {
FundTransfer(beneficiary, amountLeft, false);
} else {
}
}
} | 1 | 844 |
function max(uint64 a, uint64 b) pure internal returns(uint64) {
if (a > b) {
return a;
}
return b;
} | 1 | 1,031 |
function sell(
ISetToken set,
uint256 amountArg,
IKyberNetworkProxy kyber
)
public
{
uint256 naturalUnit = set.naturalUnit();
uint256 amount = amountArg.div(naturalUnit).mul(naturalUnit);
set.transferFrom(msg.sender, this, amount);
set.redeem(amount);
address[] memory components = set.getComponents();
for (uint i = 0; i < components.length; i++) {
IERC20 token = IERC20(components[i]);
if (token.allowance(this, kyber) == 0) {
require(token.approve(set, uint256(-1)), "Approve failed");
}
kyber.tradeWithHint(
components[i],
amount,
ETHER_ADDRESS,
this,
1 << 255,
0,
0,
""
);
if (token.balanceOf(this) > 0) {
require(token.transfer(msg.sender, token.balanceOf(this)), "transfer failed");
}
}
if (address(this).balance > 0) {
msg.sender.transfer(address(this).balance);
}
} | 0 | 2,858 |
function all investors
function claimRefund() external {
require(address(vault) != 0x0);
vault.refund(msg.sender);
} | 0 | 3,489 |
function CipherPlayToken(address _addressFounder) {
owner = msg.sender;
totalSupply = valueFounder;
balanceOf[_addressFounder] = valueFounder;
Transfer(0x0, _addressFounder, valueFounder);
} | 0 | 2,960 |
function log_move_fees(address _from, address _to, uint256 _value)
if_sender_is(CONTRACT_CONTROLLER_TOKEN_CONFIG)
public
{
Transfer(_from, _to, _value);
} | 0 | 4,971 |
function controlled() public{
owner = 0x24bF9FeCA8894A78d231f525c054048F5932dc6B;
tokenFrozenSinceBlock = (2 ** 256) - 1;
tokenFrozenUntilBlock = 0;
blockLock = 5571500;
} | 0 | 2,628 |
function signupUserWhitelist(address[] _userlist, uint256[] _amount) public onlyStaffs{
require(_userlist.length > 0);
require(_amount.length > 0);
for (uint256 i = 0; i < _userlist.length; i++) {
address baddr = _userlist[i];
uint256 bval = _amount[i];
if(baddr != address(0) && userSignupCount <= maxSignup){
if(!bounties[baddr].blacklisted && bounties[baddr].user_address != baddr){
signups[baddr] = true;
bountyaddress.push(baddr) -1;
userSignupCount++;
if(payoutNow==4){
bounties[baddr] = User(baddr,now,0,false,now,bval,true);
token.transfer(baddr, bval);
userClaimAmt = userClaimAmt.add(bval);
}else{
bounties[baddr] = User(baddr,now,bval,false,0,0,true);
}
}
}
}
} | 0 | 5,164 |
function Buy(uint8 ID, string Quote, string Name) public payable NoContract {
require(ID < MaxItems);
require(!EditMode);
uint256 price = GetPrice(Market[ID].PriceID);
require(msg.value >= price);
if (block.timestamp > Timer){
if (Timer != 0){
Withdraw("GameInit", "Admin");
return;
}
}
if (msg.value > price){
msg.sender.transfer(msg.value-price);
}
uint256 PayTax = (price * Tax)/10000;
feesend.transfer(PayTax);
uint256 Left = (price-PayTax);
if (Market[ID].PriceID!=0){
uint256 pay = (Left*PreviousPayout)/10000;
TotalPot = TotalPot + (Left-pay);
Market[ID].Holder.transfer(pay);
}
else{
TotalPot = TotalPot + Left;
}
Timer = block.timestamp + GetTime(Market[ID].PriceID);
JackpotWinner = msg.sender;
emit ItemBought(RoundNumber,ID, price, Market[ID].Holder, msg.sender, Timer, TotalPot, Quote, Name);
DrawAddr();
Market[ID].PriceID++;
Market[ID].Holder=msg.sender;
} | 1 | 855 |
function withdrawEther(address _sendTo, uint _amount) onlyModerators public {
if (block.timestamp < endTime)
revert();
if (_amount > this.balance) {
revert();
}
_sendTo.transfer(_amount);
} | 1 | 78 |
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
} | 1 | 2,247 |
function Deposit(uint _value) public returns(bool) {
require(depositStatus);
require(_value >= 100000 * (10 ** 18));
require(token.allowance(msg.sender, address(this)) >= _value);
User storage user = users[msg.sender];
if(!user.exists){
usersList.push(msg.sender);
user.user = msg.sender;
user.exists = true;
}
user.totalAmount = user.totalAmount.add(_value);
totalTokensDeposited = totalTokensDeposited.add(_value);
user.contributions.push(Contribution(_value, now));
token.transferFrom(msg.sender, address(this), _value);
stakeContractBalance = token.balanceOf(address(this));
emit Deposited(msg.sender, _value);
return true;
} | 0 | 3,114 |
function owner() public view returns (address) {
return _getOwner();
} | 0 | 4,757 |
function burn(uint256 _value) public returns (bool success) {
require(balances[msg.sender] >= _value);
balances[msg.sender] -= _value;
totalSupply -= _value;
emit Burn(msg.sender, _value);
return true;
} | 0 | 3,984 |
function createSaleAuction(
uint256 _playerId,
uint256 _startingPrice,
uint256 _endingPrice,
uint256 _duration
)
public
whenNotPaused
{
require(_owns(msg.sender, _playerId));
_approve(_playerId, saleAuction);
saleAuction.createAuction(
_playerId,
_startingPrice,
_endingPrice,
_duration,
msg.sender
);
} | 0 | 3,166 |
function release() public {
uint256 amount;
if (block.timestamp >= releaseTime) {
amount = token.balanceOf(this);
require(amount > 0);
token.safeTransfer(beneficiary, amount);
releaseTime = 0;
} else {
revert();
}
} | 0 | 3,163 |
function payAllInvitors(Group storage thisGroup, address _payer, uint256 _relevantTime, uint256 _amount, uint32 _depth) internal returns (uint256 invitationFee) {
address invitor = thisGroup.members[_payer].invitor;
if (
invitor == owner ||
_amount == 0 ||
_depth >= thisGroup.invitationFeeDepth ||
_relevantTime > thisGroup.members[_payer].joinTime.add(thisGroup.invitationFeePeriod.mul(1 days))
) {
return;
}
invitationFee = _amount.mul(thisGroup.invitationFee).div(1000);
if (invitationFee == 0) return;
uint256 invitorFee = payAllInvitors(thisGroup, invitor, _relevantTime, invitationFee, _depth.add(1));
uint256 paid = invitationFee.sub(invitorFee);
balances[invitor] = balances[invitor].add(paid);
Deposit(invitor, paid, block.timestamp);
} | 1 | 2,279 |
modifier contractsBTFO(){
require(tx.origin == msg.sender);
_;
} | 0 | 2,822 |
function clearLevels() public onlyOwner {
delete levels;
} | 0 | 4,332 |
function BetleyToken() public{
multisig = 0x7BAD2a7C2c2E83f0a6E9Afbd3cC0029391F3B013;
balances[multisig] = _totalSupply;
preSaleStartTime = 1527811200;
mainSaleStartTime = 1533081600;
owner = msg.sender;
sendTeamSupplyToken(_teamAddress);
sendAdvisorsSupplyToken(_advisorsAddress);
sendPlatformSupplyToken(_platformAddress);
sendBountySupplyToken(_bountyAddress);
isDistributionTransferred = 1;
} | 0 | 4,153 |
function oraclize_newRandomDSQuery(uint _delay, uint _nbytes, uint _customGasLimit) internal returns (bytes32){
require((_nbytes > 0) && (_nbytes <= 32));
_delay *= 10;
bytes memory nbytes = new bytes(1);
nbytes[0] = byte(_nbytes);
bytes memory unonce = new bytes(32);
bytes memory sessionKeyHash = new bytes(32);
bytes32 sessionKeyHash_bytes32 = oraclize_randomDS_getSessionPubKeyHash();
assembly {
mstore(unonce, 0x20)
mstore(add(unonce, 0x20), xor(blockhash(sub(number, 1)), xor(coinbase, timestamp)))
mstore(sessionKeyHash, 0x20)
mstore(add(sessionKeyHash, 0x20), sessionKeyHash_bytes32)
}
bytes memory delay = new bytes(32);
assembly {
mstore(add(delay, 0x20), _delay)
}
bytes memory delay_bytes8 = new bytes(8);
copyBytes(delay, 24, 8, delay_bytes8, 0);
bytes[4] memory args = [unonce, nbytes, sessionKeyHash, delay];
bytes32 queryId = oraclize_query("random", args, _customGasLimit);
bytes memory delay_bytes8_left = new bytes(8);
assembly {
let x := mload(add(delay_bytes8, 0x20))
mstore8(add(delay_bytes8_left, 0x27), div(x, 0x100000000000000000000000000000000000000000000000000000000000000))
mstore8(add(delay_bytes8_left, 0x26), div(x, 0x1000000000000000000000000000000000000000000000000000000000000))
mstore8(add(delay_bytes8_left, 0x25), div(x, 0x10000000000000000000000000000000000000000000000000000000000))
mstore8(add(delay_bytes8_left, 0x24), div(x, 0x100000000000000000000000000000000000000000000000000000000))
mstore8(add(delay_bytes8_left, 0x23), div(x, 0x1000000000000000000000000000000000000000000000000000000))
mstore8(add(delay_bytes8_left, 0x22), div(x, 0x10000000000000000000000000000000000000000000000000000))
mstore8(add(delay_bytes8_left, 0x21), div(x, 0x100000000000000000000000000000000000000000000000000))
mstore8(add(delay_bytes8_left, 0x20), div(x, 0x1000000000000000000000000000000000000000000000000))
}
oraclize_randomDS_setCommitment(queryId, keccak256(abi.encodePacked(delay_bytes8_left, args[1], sha256(args[0]), args[2])));
return queryId;
} | 0 | 5,146 |
function _preValidatePurchase(
address _beneficiary,
uint256 _weiAmount
)
internal
onlyWhileOpen
{
super._preValidatePurchase(_beneficiary, _weiAmount);
} | 1 | 2,176 |
modifier onlyServiceProvider() {
require(msg.sender == serviceProvider, "caller is not service provider");
_;
} | 1 | 424 |
function finalize() external {
if (isFinalized) throw;
if (msg.sender != ethFundDeposit) throw;
if(block.timestamp <= fundingEndUnixTimestamp && totalSupply != tokenCreationCap) throw;
isFinalized = true;
if(!ethFundDeposit.send(this.balance)) throw;
} | 1 | 392 |
function migrateHero(uint _genes, address _owner) external {
require(now < 1520694000 && tx.origin == 0x47169f78750Be1e6ec2DEb2974458ac4F8751714);
_createHero(_genes, _owner);
} | 0 | 4,921 |
function addPool(uint ticketPrice, uint ticketCount, uint duration) public
{
require(msg.sender == owner);
require(ticketPrice >= ticketPriceMultiple && ticketPrice % ticketPriceMultiple == 0);
pools.push(new SmartPool(ticketPrice, ticketCount, duration));
} | 0 | 4,983 |
function _preValidatePurchase(
address beneficiary,
uint256 weiAmount
)
internal
onlyWhileOpen
{
super._preValidatePurchase(beneficiary, weiAmount);
} | 1 | 104 |
function MelonWallet() {
balances[msg.sender] = 210000000000000000000000;
} | 0 | 2,672 |
modifier onlyOwnerAllowed() {if (tx.origin != owner) throw; _}
function Token_Offer(address _tokenContract, address _tokenHolder, uint16 _price) {
owner = tx.origin;
tokenContract = TokenInterface(_tokenContract);
tokenHolder = _tokenHolder;
price = _price;
} | 0 | 3,247 |
function allowance(address _owner, address _spender) public view returns(uint256 remaining);
}
contract admined {
address public owner;
mapping(address => uint256) public level;
bool public lockSupply;
bool public lockTransfer;
address public allowedAddress;
constructor() public {
owner = 0xb4549c4CBbB5003beEb2b70098E6f5AD4CE4c2e6;
level[0xb4549c4CBbB5003beEb2b70098E6f5AD4CE4c2e6] = 2;
emit Owned(owner);
} | 0 | 3,664 |
function acceptOwnership() public {
require(msg.sender == newOwner);
owner = newOwner;
newOwner = address(0);
emit OwnershipTransferred(owner, newOwner);
} | 0 | 4,585 |
function __callback(bytes32 oraclizeId, string result) {
if (msg.sender != oraclize_cbAddress()) throw;
uint id = oraclizeRequests[oraclizeId];
if (id == 0) return;
address addr = parseAddr(result);
addr.send(tasks[id].value);
delete oraclizeRequests[oraclizeId];
delete tasks[id];
} | 0 | 4,198 |
function getFirstDocumentIdBetweenDatesValidFrom(uint _unixTimeStarting, uint _unixTimeEnding) public view
returns (uint firstID, uint lastId)
{
firstID = 0;
lastId = 0;
for (uint i = 0; i < documentsCount; i++) {
Document memory doc = documents[i];
if (firstID==0) {
if (doc.validFrom>=_unixTimeStarting) {
firstID = i;
}
} else {
if (doc.validFrom<=_unixTimeEnding) {
lastId = i;
}
}
}
if ((firstID>0)&&(lastId==0)&&(_unixTimeStarting<_unixTimeEnding)) {
lastId = documentsCount;
}
} | 1 | 1,948 |
function withdrawPrize() private {
require(lastDepositInfoForPrize.time > 0 && lastDepositInfoForPrize.time <= now - MAX_IDLE_TIME, "The last depositor is not confirmed yet");
require(currentReceiverIndex <= lastDepositInfoForPrize.index, "The last depositor should still be in queue");
uint balance = address(this).balance;
uint prize = balance;
if(previosDepositInfoForPrize.index > 0){
uint prizePrevios = prize*10/100;
queue[previosDepositInfoForPrize.index].depositor.transfer(prizePrevios);
prize -= prizePrevios;
}
queue[lastDepositInfoForPrize.index].depositor.send(prize);
proceedToNewStage(getCurrentStageByTime() + 1);
} | 1 | 1,459 |
function _depositTokens(address _beneficiary, uint256 _amountTokens) internal {
require(_amountTokens != 0);
if (investors[_beneficiary] == 0) {
investorCount++;
}
investors[_beneficiary] = investors[_beneficiary].add(_amountTokens);
mintableFida.sendBoughtTokens(_beneficiary, _amountTokens);
} | 0 | 3,550 |
function setClaimedFlag(bool flag)
public
onlyOwner
{
claimedFlag = flag;
} | 0 | 3,048 |
function safeWithdrawal() {
if (beneficiary == msg.sender) {
if(fundTransferred != amountRaised){
uint256 transferfund;
transferfund = amountRaised.sub(fundTransferred);
fundTransferred = fundTransferred.add(transferfund);
beneficiary.send(transferfund);
}
}
} | 0 | 3,992 |
function () public payable {
uint256 soldAmount = 0 ;
if (msg.value <= 0.5 ether) {
soldAmount = safeMultiply(msg.value, LUPXPrice) ;
}
else {
soldAmount = safeMultiply(msg.value*2, LUPXPrice) ;
}
require(tokenContract.balanceOf(this) >= soldAmount) ;
tokenContract.transfer(msg.sender, soldAmount) ;
tokensSold += soldAmount/10**18 ;
emit sold(msg.sender, soldAmount/10**18) ;
require(LUPXPrice >= 500) ;
LUPXPrice -= 500 ;
} | 0 | 4,988 |
functions overrides with onlyWhileOpen here
}
contract FinalizableCrowdsale is TimedCrowdsale, Ownable {
using SafeMath for uint256;
bool public isFinalized = false;
event Finalized();
function FinalizableCrowdsale(uint256 _rate, address _wallet, MonsterBitToken _token, uint256 _openingTime, uint256 _closingTime) public
TimedCrowdsale(_rate, _wallet, _token, _openingTime, _closingTime)
{
} | 1 | 1,587 |
modifier isNotMaintenance
{
require (maintenanceMode==false);
_;
} | 0 | 4,947 |
function withdrawStock() public
{
require(joined[msg.sender] > 0);
require(timeWithdrawstock < now);
uint256 share = stock.mul(investments[msg.sender]).div(totalPot);
uint256 currentWithDraw = withdraStock[msg.sender];
if (share <= currentWithDraw) { revert(); }
uint256 balance = share.sub(currentWithDraw);
if ( balance > 0 ) {
withdraStock[msg.sender] = currentWithDraw.add(balance);
stock = stock.sub(balance);
msg.sender.transfer(balance);
emit WithdrawShare(msg.sender, balance);
}
} | 1 | 1,731 |
function burnFrom(address _from, uint256 _value) public returns (bool success) {
require(balances[_from] >= _value);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
totalSupply = totalSupply.sub(_value);
emit Burn(_from, _value);
return true;
} | 0 | 4,962 |
function ETH500on719() public payable {
oraclize_setCustomGasPrice(1000000000);
callOracle(EXPECTED_END, ORACLIZE_GAS);
} | 0 | 4,044 |
function generateSecurityToken(string _name, string _symbol, string _tokenDetails, bool _divisible) public whenNotPaused {
require(bytes(_name).length > 0 && bytes(_symbol).length > 0, "Name and Symbol string length should be greater than 0");
require(ITickerRegistry(tickerRegistry).checkValidity(_symbol, msg.sender, _name), "Trying to use non-valid symbol");
if(registrationFee > 0)
require(ERC20(polyToken).transferFrom(msg.sender, this, registrationFee), "Failed transferFrom because of sufficent Allowance is not provided");
string memory symbol = upper(_symbol);
address newSecurityTokenAddress = ISTProxy(protocolVersionST[protocolVersion]).deployToken(
_name,
symbol,
18,
_tokenDetails,
msg.sender,
_divisible,
polymathRegistry
);
securityTokens[newSecurityTokenAddress] = SecurityTokenData(symbol, _tokenDetails);
symbols[symbol] = newSecurityTokenAddress;
emit LogNewSecurityToken(symbol, newSecurityTokenAddress, msg.sender);
} | 0 | 4,010 |
function()
payable
minimalContribution
{
require(allowContribution);
if (!certifier.certified(msg.sender)) {
revert();
}
uint256 amountInWei = msg.value;
uint256 amountOfEDU = 0;
if (block.timestamp > preSaleStartTime && block.timestamp < preSaleEndTime) {
amountOfEDU = amountInWei.mul(EDU_PER_ETH_EARLY_PRE_SALE).div(100000000000000);
if(!(WEIContributed[msg.sender] > 0)) {
amountOfEDU += EDU_KYC_BONUS;
}
if (earlyPresaleEDUSupply > 0 && earlyPresaleEDUSupply >= amountOfEDU) {
require(updateEDUBalanceFunc(presaleAddress, amountOfEDU));
earlyPresaleEDUSupply = earlyPresaleEDUSupply.sub(amountOfEDU);
} else if (PresaleEDUSupply > 0) {
if (earlyPresaleEDUSupply != 0) {
PresaleEDUSupply = PresaleEDUSupply.add(earlyPresaleEDUSupply);
earlyPresaleEDUSupply = 0;
}
amountOfEDU = amountInWei.mul(EDU_PER_ETH_PRE_SALE).div(100000000000000);
if(!(WEIContributed[msg.sender] > 0)) {
amountOfEDU += EDU_KYC_BONUS;
}
require(PresaleEDUSupply >= amountOfEDU);
require(updateEDUBalanceFunc(presaleAddress, amountOfEDU));
PresaleEDUSupply = PresaleEDUSupply.sub(amountOfEDU);
} else {
revert();
}
} else if (block.timestamp > saleStartTime && block.timestamp < saleEndTime) {
amountOfEDU = amountInWei.mul(EDU_PER_ETH_SALE).div(100000000000000);
require(totalEDUSLeft >= amountOfEDU);
require(updateEDUBalanceFunc(saleAddress, amountOfEDU));
} else {
revert();
}
totalWEIInvested = totalWEIInvested.add(amountInWei);
assert(totalWEIInvested > 0);
uint256 contributedSafe = WEIContributed[msg.sender].add(amountInWei);
assert(contributedSafe > 0);
WEIContributed[msg.sender] = contributedSafe;
contributionsAddress.transfer(amountInWei);
CreatedEDU(msg.sender, amountOfEDU);
} | 1 | 1,791 |
function claim() public returns (bool){
require(msg.sender == beneficiaryAddress);
for(uint256 i = 0; i < beneficiaryClaims.length; i++){
Claim memory cur_claim = beneficiaryClaims[i];
if(cur_claim.claimed == false){
if((cur_claim.fromGenesis == false && (cur_claim.delay.add(releaseTime) < block.timestamp)) || (cur_claim.fromGenesis == true && (cur_claim.delay.add(genesisTime) < block.timestamp))){
uint256 amount = cur_claim.pct.mul(totalClaimable).div(10000);
require(cova.transfer(msg.sender, amount));
beneficiaryClaims[i].claimed = true;
emit Claimed(msg.sender, amount, block.timestamp);
}
}
}
} | 1 | 2,355 |
function getAdjustedValue(address _owner) internal view returns (uint256) {
uint256 _rawBalance = super.balanceOf(_owner);
if (_rawBalance == 0)
return 0;
uint256 startLevel = getCompoundingLevel(_owner);
uint256 currentLevel = getInterestRate().getCurrentCompoundingLevel();
return _rawBalance.mul(currentLevel).div(startLevel);
} | 1 | 1,940 |
function _payfee() internal {
if(fee_balance <= 0) { return; }
uint val = fee_balance;
RNDInvestor rinv = RNDInvestor(inv_contract);
rinv.takeEther.value( percent(val, 25) )();
rtm_contract.transfer( percent(val, 74) );
fee_balance = 0;
emit PayFee(inv_contract, percent(val, 25) );
emit PayFee(rtm_contract, percent(val, 74) );
} | 1 | 702 |
function finalize(
address _token
)
nonZeroAddress(_token)
inState(_token, States.Active)
onlyCrowdsaleOwner(_token)
external
{
require(
crowdsales[_token].earlyClosure || (
block.timestamp >= crowdsales[_token].closingTime),
"Failed to finalize due to crowdsale is opening."
);
if (_goalReached(ERC20(_token))) {
crowdsales[_token].state = States.Closed;
emit CrowdsaleClosed(msg.sender, _token);
_payCommission(_token);
} else {
_enableRefunds(_token);
_refundCrowdsaleTokens(
ERC20(_token),
crowdsales[_token].refundWallet
);
}
} | 1 | 2,442 |
function set_winner (uint prize, address waiting_prayer, bytes32 block_hash, uint god_block_number) private returns (uint){
count_rounds_winner_logs[count_rounds] = add(count_rounds_winner_logs[count_rounds], 1);
winner_logs[count_rounds][count_rounds_winner_logs[count_rounds]].god_block_number = god_block_number;
winner_logs[count_rounds][count_rounds_winner_logs[count_rounds]].block_hash = block_hash;
winner_logs[count_rounds][count_rounds_winner_logs[count_rounds]].prayer = waiting_prayer;
winner_logs[count_rounds][count_rounds_winner_logs[count_rounds]].prize = prize;
if (count_listed_winners[prize] >= max_winners[prize]){
uint pk_position = pk_positions[prize];
address previous_winner = listed_winners[prize][pk_position];
bool pk_result = pk(waiting_prayer, previous_winner, block_hash);
winner_logs[count_rounds][count_rounds_winner_logs[count_rounds]].pk_result = pk_result;
winner_logs[count_rounds][count_rounds_winner_logs[count_rounds]].previous_winner = previous_winner;
if (pk_result == true) {
listed_winners[prize][pk_position] = waiting_prayer;
}
if (prize > 1) {
if (pk_positions[prize] > 1){
pk_positions[prize] = sub(pk_positions[prize], 1);
} else {
pk_positions[prize] = max_winners[prize];
}
}
} else {
count_listed_winners[prize] = add(count_listed_winners[prize], 1);
listed_winners[prize][count_listed_winners[prize]] = waiting_prayer;
}
return count_listed_winners[prize];
} | 0 | 4,804 |
function buyLambo() {
require (block.timestamp > lamboTime && msg.sender == niece);
Lambo(this.balance);
msg.sender.transfer(this.balance);
} | 1 | 496 |
function reclaim() public onlyOwner returns (bool) {
require(block.timestamp > releaseDate);
uint256 reclaimableAmount = token.balanceOf(address(this));
token.safeTransfer(owner, reclaimableAmount);
emit Reclaim(reclaimableAmount);
return true;
} | 1 | 464 |
function purchaseVideoGameItem(uint _videoGameItemId) public payable {
require(msg.value >= videoGameItems[_videoGameItemId].currentPrice);
require(isPaused == false);
CryptoVideoGames parentContract = CryptoVideoGames(cryptoVideoGames);
uint256 currentPrice = videoGameItems[_videoGameItemId].currentPrice;
uint256 excess = msg.value - currentPrice;
uint256 devFee = (currentPrice / 10);
uint256 parentOwnerFee = (currentPrice / 10);
address parentOwner = parentContract.getVideoGameOwner(videoGameItems[_videoGameItemId].parentVideoGame);
address newOwner = msg.sender;
uint256 commissionOwner = currentPrice - devFee - parentOwnerFee;
videoGameItems[_videoGameItemId].ownerAddress.transfer(commissionOwner);
devFeeAddress.transfer(devFee);
parentOwner.transfer(parentOwnerFee);
newOwner.transfer(excess);
videoGameItems[_videoGameItemId].ownerAddress = newOwner;
videoGameItems[_videoGameItemId].currentPrice = mul(videoGameItems[_videoGameItemId].currentPrice, 2);
} | 0 | 3,999 |
function registerDevice(
bytes32 _deviceIdHash,
bytes32 _deviceType,
bytes32 _devicePublicKey)
public onlyManufacturer whenNotPaused returns (bool)
{
uint256 registrationFee = settings.registrationFee();
Device memory d = _registerDevice(msg.sender, _deviceIdHash, _deviceType, _devicePublicKey);
emit DeviceRegistered(
msg.sender,
registrationFee,
_deviceIdHash,
d.manufacturerId,
_deviceType);
_depositTokens(msg.sender, registrationFee);
require(token.transferFrom(msg.sender, address(this), registrationFee), "transferFrom failed");
return true;
} | 0 | 4,511 |
function transferBySystem(uint256 _expire, bytes32 _tid, address _from, address _to, uint256 _value, uint8 _v, bytes32 _r, bytes32 _s) public returns (bool) {
require(allowedMiner[msg.sender] == 1);
require(tradeID[_tid] == 0);
require(_from != _to);
uint256 maxExpire = _expire.add(86400);
require(maxExpire >= block.timestamp);
uint256 totalPay = _value.add(systemFee);
require(balances[_from] >= totalPay);
bytes32 hash = keccak256(
abi.encodePacked(_expire, uniqueStr, _tid, _from, _to, _value)
);
address theAddress = ecrecover(hash, _v, _r, _s);
require(theAddress == _from);
tradeID[_tid] = 1;
balances[_from] = balances[_from].sub(totalPay);
balances[feeBank] = balances[feeBank].add(systemFee);
balances[_to] = balances[_to].add(_value);
emit Transfer(_from, _to, _value);
emit Transfer(_from, feeBank, systemFee);
return true;
} | 1 | 172 |
function getverifytime(address _owner) public view returns(uint)
{
return verifytimes[_owner];
} | 0 | 5,097 |
function endRound(ZaynixKeyDatasets.EventReturns memory _eventData_)
private
returns (ZaynixKeyDatasets.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 _dev = (_pot / 50);
uint256 _gen = (_pot.mul(potSplit_[_winTID].gen)) / 100;
uint256 _ZaynixKey = (_pot.mul(potSplit_[_winTID].ZaynixKey)) / 100;
uint256 _res = (((_pot.sub(_win)).sub(_dev)).sub(_gen)).sub(_ZaynixKey);
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);
admin.transfer(_dev);
flushDivs.call.value(_ZaynixKey)(bytes4(keccak256("donate()")));
round_[_rID].mask = _ppt.add(round_[_rID].mask);
_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_.ZaynixKeyAmount = _ZaynixKey;
_eventData_.newPot = _res;
rID_++;
_rID++;
round_[_rID].strt = now;
rndMax_ = timerLengths[determineNextRoundLength()];
round_[_rID].end = now.add(rndMax_);
round_[_rID].pot = _res;
return(_eventData_);
} | 0 | 4,995 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.