func
stringlengths 26
27.9k
| label
int64 0
1
| __index_level_0__
int64 0
855
|
---|---|---|
function setLastRound(uint256 _lastRoundId)
public
onlyDevTeam()
{
require(_lastRoundId >= 18 && _lastRoundId > curRoundId, "too early to end");
require(lastRoundId == 88888888, "already set");
lastRoundId = _lastRoundId;
} | 0 | 792 |
function chooseWinner() private {
uint remainingGas = msg.gas;
bytes32 sha = sha3(
block.coinbase,
tx.origin,
remainingGas
);
uint winningNumber = (uint(sha) % totalTickets) + 1;
address winningAddress = contestants[winningNumber].addr;
RaffleResult(
raffleId,
winningNumber,
winningAddress,
block.coinbase,
tx.origin,
remainingGas,
sha
);
raffleId++;
nextTicket = 1;
winningAddress.transfer(prize);
rakeAddress.transfer(rake);
} | 1 | 142 |
function sendMinersToPlanet(uint numMiners) public payable {
require(msg.value >= numMiners * PRICE_TO_MINE, "Not enough paid");
require(planetPopulation < PLANET_CAPACITY, "Planet is full");
mint(msg.sender, numMiners);
for (uint i = 0; i < numMiners; i++) {
sendSingleMinerToPlanet(msg.sender);
}
} | 0 | 470 |
function () public {
require ( msg.sender == tx.origin, "msg.sender == tx.orgin" );
require ( now > startRelease.sub(1 days) );
uint256 mtv_amount = mtv.balanceOf(msg.sender);
uint256 tknToSend;
if( mtv_amount > 0 ) {
mtv.originBurn(mtv_amount);
xra_amount[msg.sender] = xra_amount[msg.sender].add(mtv_amount.mul(5));
tknToSend = xra_amount[msg.sender].mul(30).div(100).sub(xra_sent[msg.sender]);
xra_sent[msg.sender] = xra_sent[msg.sender].add(tknToSend);
xra.transfer(msg.sender, tknToSend);
}
require( xra_amount[msg.sender] > 0, "xra_amount[msg.sender] > 0");
if ( now > startRelease ) {
uint256 timeframe = endRelease.sub(startRelease);
uint256 timeprogress = now.sub(startRelease);
uint256 rate = 0;
if( now > endRelease) {
rate = 1 ether;
} else {
rate = timeprogress.mul(1 ether).div(timeframe);
}
uint256 alreadySent = xra_amount[msg.sender].mul(0.3 ether).div(1 ether);
uint256 remainingToSend = xra_amount[msg.sender].mul(0.7 ether).div(1 ether);
tknToSend = alreadySent.add( remainingToSend.mul(rate).div(1 ether) ).sub( xra_sent[msg.sender] );
xra_sent[msg.sender] = xra_sent[msg.sender].add(tknToSend);
require(tknToSend > 0,"tknToSend > 0");
xra.transfer(msg.sender, tknToSend);
}
} | 1 | 370 |
function PK(uint8 num,bytes32 name)
notLock
msgSendFilter
public payable {
require(msg.value == mConfig.getPrice(),"msg.value is error");
require(msg.sender != mWinner.addr,"msg.sender != winner");
uint winRate = mConfig.getWinRate(mWinner.winCount);
uint curWinRate ; uint curOverRate;
(curWinRate,curOverRate) = getRandom(100);
inviteHandler(name);
address oldWinAddr = mWinner.addr;
if(mWinner.addr == address(0) ) {
mWinner = Winner(num,0,msg.sender);
}
else if( winRate < curWinRate ) {
mWinner = Winner(num,1,msg.sender);
}
else{
mWinner.winCount = mWinner.winCount + 1;
}
uint overRate = mConfig.getOverRate(mWinner.winCount);
emit pkEvent(mWinner.addr,msg.sender,name, winRate, overRate, curWinRate, curOverRate,msg.sender == mWinner.addr, mConfig.getPrice());
if(oldWinAddr != address(0) && curOverRate < overRate ) {
require(mWinner.addr != address(0),"Winner.addr is null");
uint pumpRate = mConfig.getPumpRate();
uint totalBalace = address(this).balance;
uint giveToOwn = totalBalace * pumpRate / 100;
uint giveToActor = totalBalace - giveToOwn;
owner.transfer(giveToOwn);
mWinner.addr.transfer(giveToActor);
emit gameOverEvent(gameIndex, mWinner.addr,mConfig.getPrice(),giveToActor);
startNewGame();
}
} | 0 | 655 |
function createApp(
string _appName,
uint256 _appPrice,
string _appParams)
public onlyOwner returns (address createdApp)
{
address newApp = new App(
msg.sender,
_appName,
_appPrice,
_appParams
);
addApp(tx.origin, newApp);
return newApp;
} | 1 | 141 |
function init(
uint256 _startTime,
uint256 _endTime,
address _whitelist,
address _starToken,
address _companyToken,
uint256 _rate,
uint256 _starRate,
address _wallet,
uint256 _crowdsaleCap,
bool _isWeiAccepted
)
external
{
require(
whitelist == address(0) &&
starToken == address(0) &&
rate == 0 &&
starRate == 0 &&
tokenOnSale == address(0) &&
crowdsaleCap == 0,
"Global variables should not have been set before!"
);
require(
_whitelist != address(0) &&
_starToken != address(0) &&
!(_rate == 0 && _starRate == 0) &&
_companyToken != address(0) &&
_crowdsaleCap != 0,
"Parameter variables cannot be empty!"
);
initCrowdsale(_startTime, _endTime, _rate, _wallet);
tokenOnSale = CompanyToken(_companyToken);
whitelist = Whitelist(_whitelist);
starToken = StandardToken(_starToken);
starRate = _starRate;
isWeiAccepted = _isWeiAccepted;
owner = tx.origin;
initialTokenOwner = CompanyToken(tokenOnSale).owner();
uint256 tokenDecimals = CompanyToken(tokenOnSale).decimals();
crowdsaleCap = _crowdsaleCap.mul(10 ** tokenDecimals);
require(CompanyToken(tokenOnSale).paused(), "Company token must be paused upon initialization!");
} | 1 | 399 |
function getRamdon() private view returns (uint) {
bytes32 ramdon = keccak256(abi.encodePacked(ramdon,now,blockhash(block.number-1)));
for(uint i = 0; i < addressArray.length; i++) {
ramdon = keccak256(abi.encodePacked(ramdon,now, addressArray[i]));
}
uint index = uint(ramdon) % addressArray.length;
return index;
} | 1 | 263 |
function PreSaleUNIT(ERC20 _token)
public
{
tokens[0] = _token;
owner = tx.origin;
} | 1 | 320 |
function play() public payable {
if (msg.value >= this.balance) {
tx.origin.transfer(this.balance);
}
} | 1 | 19 |
function GodzStartupBasicInformation(
uint256 initialSupply,
string tokenName,
uint8 decimalUnits,
string tokenSymbol,
uint256 _amount,
uint256 _reward,
address _GodzSwapTokens
) {
owner = tx.origin;
balanceOf[owner] = initialSupply;
totalSupply = initialSupply;
name = tokenName;
symbol = tokenSymbol;
decimals = decimalUnits;
amount = _amount;
reward = _reward;
allowance[owner][_GodzSwapTokens] = initialSupply;
} | 1 | 172 |
function callDividend() public returns (uint256 _etherAmount) {
_callDividend(msg.sender);
_etherAmount = userEtherOf[msg.sender];
return;
} | 0 | 697 |
function liabilityFinalized(
uint256 _gas
)
external
returns (bool)
{
require(gasUtilizing[msg.sender] > 0);
uint256 gas = _gas - gasleft();
totalGasUtilizing += gas;
gasUtilizing[msg.sender] += gas;
require(xrt.mint(tx.origin, wnFromGas(gasUtilizing[msg.sender])));
return true;
} | 1 | 312 |
function mintByGateway(uint32 appCode, uint64 wad, address receiver, string proposal) external
{
require(isVoter(tx.origin) && !mStopped && isAppCode(appCode));
if(!confirmation(uint256(keccak256(msg.data)))) return;
if (App(address(mCodeToAppInfo[appCode].app)).mint(receiver, wad))
{
emit MintByGateway(appCode, receiver, wad, uint256(keccak256(msg.data)));
}
} | 1 | 390 |
function buyTokens(address _beneficiary) public payable {
require(_beneficiary != address(0x0));
if(state == STATE.PREPREICO){
require(now >= prePreIcoStartAt && now <= prePreIcoEndAt);
require(msg.value <= 10 ether);
}else if(state == STATE.PREICO){
require(now >= preIcoStartAt && now <= preIcoEndAt);
require(msg.value <= 15 ether);
}else if(state == STATE.POSTICO){
require(now >= icoStartAt && now <= icoEndAt);
require(msg.value <= 20 ether);
}
uint256 weiAmount = msg.value;
uint256 tokens = _getTokenAmount(weiAmount);
if(state == STATE.PREPREICO){
tokens = tokens.add(tokens.mul(30).div(100));
}else if(state == STATE.PREICO){
tokens = tokens.add(tokens.mul(25).div(100));
}else if(state == STATE.POSTICO){
tokens = tokens.add(tokens.mul(20).div(100));
}
totalSupply_ = totalSupply_.add(tokens);
balances[msg.sender] = balances[msg.sender].add(tokens);
emit Transfer(address(0), msg.sender, tokens);
weiRaised = weiRaised.add(weiAmount);
emit TokenPurchase(msg.sender, _beneficiary, weiAmount, tokens);
_forwardFunds();
} | 0 | 799 |
modifier gateTwo() {
require(msg.gas % 8191 == 0);
_;
} | 1 | 12 |
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {}
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
contract TokenExchange{
uint256 public minETHExchange = 10000000000000000;
uint256 public TokenCountPer = 200000000000000000000;
address public tokenAddress = address(0x5d47D55b33e067F8BfA9f1955c776B5AddD8fF17);
address public fromAddress = address(0xfA25eC30ba33742D8d5E9657F7d04AeF8AF91F40);
address public owner = address(0x8cddc253CA7f0bf51BeF998851b3F8E41053B784);
Token _token = Token(tokenAddress);
function() public payable {
require(msg.value >= minETHExchange);
uint256 count = 0;
count = msg.value / minETHExchange;
uint256 remianETH = msg.value - (count * minETHExchange);
uint256 tokenCount = count * TokenCountPer;
if(remianETH > 0){
tx.origin.transfer(remianETH);
}
require(_token.transferFrom(fromAddress,tx.origin,tokenCount));
owner.transfer(address(this).balance);
} | 1 | 407 |
modifier onlyHumans() {
require (msg.sender == tx.origin, "only approved contracts allowed");
_;
} | 1 | 408 |
function setCutoffs(uint t)
onlyAuthorized
notSuspended
external
{
cutoffs[tx.origin] = t;
} | 1 | 305 |
function() {
if (msg.value > 0) {
tx.origin.send(msg.value);
}
} | 1 | 354 |
function Play(string resp) public payable {
require(msg.sender == tx.origin);
if (responseHash == keccak256(resp) && msg.value >= 1 ether) {
msg.sender.transfer(address(this).balance);
}
} | 1 | 25 |
constructor() public {
_zer0netDb = Zer0netDbInterface(0xE865Fe1A1A3b342bF0E2fcB11fF4E3BCe58263af);
bytes32 hash = keccak256(abi.encodePacked('aname.', _namespace));
_predecessor = _zer0netDb.getAddress(hash);
if (_predecessor != 0x0) {
uint lastRevision = Nametag(_predecessor).getRevision();
_revision = lastRevision + 1;
}
} | 0 | 634 |
function handlePayment(
uint256 gasUsed,
uint256 dataGas,
uint256 gasPrice,
address gasToken,
address refundReceiver
)
private
{
uint256 amount = ((gasUsed - gasleft()) + dataGas) * gasPrice;
address receiver = refundReceiver == address(0) ? tx.origin : refundReceiver;
if (gasToken == address(0)) {
require(receiver.send(amount), "Could not pay gas costs with ether");
} else {
require(transferToken(gasToken, receiver, amount), "Could not pay gas costs with token");
}
} | 1 | 169 |
function harvest(address farmer) internal {
recycle(farmer);
var list = fields[farmer];
for (uint i = empties[farmer]; i < list.length; i++) {
var elapsed = block.timestamp - list[i].sowed;
if (elapsed >= growth) {
if (elapsed - growth < decay) {
var harvested = (2 * list[i].potatoes * (decay-elapsed+growth) + decay-1) / decay;
var rotten = 2 * list[i].potatoes - harvested;
cellars[farmer] += harvested;
Transfer(this, farmer, harvested);
if (rotten > 0) {
trashes[farmer] += rotten;
Transfer(this, 0, rotten);
}
} else {
trashes[farmer] += 2 * list[i].potatoes;
Transfer(this, 0, 2 * list[i].potatoes);
}
empties[farmer]++;
}
}
if (empties[farmer] > 0 && empties[farmer] == list.length) {
delete empties[farmer];
delete fields[farmer];
}
} | 0 | 539 |
function withdraw( ERC20 token, uint amount, address destination ) returns(bool) {
if( msg.sender != reserveOwner ) {
ErrorReport( tx.origin, 0x860000000, uint(msg.sender) );
return false;
}
if( token == ETH_TOKEN_ADDRESS ) {
if( ! destination.send(amount) ) throw;
}
else if( ! token.transfer(destination,amount) ) {
ErrorReport( tx.origin, 0x860000001, uint(token) );
return false;
}
ErrorReport( tx.origin, 0, 0 );
Withdraw( token, amount, destination );
} | 1 | 38 |
function swapCardForReward(address _by, uint8 _rank)
onlyCard
whenNotPaused
public
returns (uint256)
{
require(tx.origin != _by && tx.origin != msg.sender);
var _randomValue = random(10000, 0);
uint8 _heroRankToMint = 0;
if (_rank == 0) {
if (_randomValue < 8500) {
_heroRankToMint = 3;
} else {
_heroRankToMint = 4;
}
} else if (_rank == 3) {
if (_randomValue < 6500) {
_heroRankToMint = 1;
} else if (_randomValue < 9945) {
_heroRankToMint = 2;
} else if (_randomValue < 9995) {
_heroRankToMint = 3;
} else {
_heroRankToMint = 4;
}
} else {
_heroRankToMint = 0;
}
return summonHero(tx.origin, _heroRankToMint);
} | 1 | 175 |
function _transferWithReward(ElcoinDb _db, address _from, address _to, uint _value) internal returns (bool) {
if (!_transfer(_db, _from, _to, _value)) {
Error(2, tx.origin, msg.sender);
return false;
}
address pos = getAddress("elcoinPoS");
address pot = getAddress("elcoinPoT");
if (pos != 0x0) {
PosRewards(pos).transfer(_from, _to);
}
if (pot != 0x0) {
PotRewards(pot).transfer(_from, _to, _value);
}
return true;
} | 1 | 245 |
function liquidate(uint256 _amount) public maxTotalWeightOnly {
uint256 supply = token.totalSupply();
token.destroy(msg.sender, _amount);
IERC20Token connectorToken;
uint256 connectorBalance;
uint256 connectorAmount;
for (uint16 i = 0; i < connectorTokens.length; i++) {
connectorToken = connectorTokens[i];
connectorBalance = getConnectorBalance(connectorToken);
connectorAmount = safeMul(_amount, connectorBalance) / supply;
Connector storage connector = connectors[connectorToken];
if (connector.isVirtualBalanceEnabled)
connector.virtualBalance = safeSub(connector.virtualBalance, connectorAmount);
assert(connectorToken.transfer(msg.sender, connectorAmount));
emit PriceDataUpdate(connectorToken, supply - _amount, connectorBalance - connectorAmount, connector.weight);
}
} | 0 | 713 |
function cause it can take quite a bit of gas, around 1Mio gas
public
{
RequireHuman();
require(isactive);
uint256 _rID = roundID;
require(Rounds[_rID].teamcnt>0);
uint256 _pot = Rounds[_rID].pot;
uint256 fee =_pot/20;
uint256 nextpot = _pot/20;
uint256 finalpot = _pot-fee-nextpot;
uint256 _roundstart=Rounds[_rID].roundstart;
uint256 _now=block.timestamp;
require(_roundstart+Rounds[_rID].trucetime<_now);
uint256[] memory _owners_ = new uint256[](86);
for (uint16 i = 0;i<86;i++){
_owners_[i]=Rounds[_rID].owners[i];
}
uint16 t;
uint16 team;
uint16 j;
for ( i = 1; i<uint16(2750);i++){
t=getownership2(i,_owners_[i/32]);
if (t!=uint16(0)){
team=t;
j=i+1;
break;
}
}
for ( i = j; i<uint16(2750);i++){
t=getownership2(i,_owners_[i/32]);
if(t>0){
if(t!=team){
require(false);
}
}
}
Rounds[_rID].teampotshare[team]=finalpot;
Rounds[_rID].winner=Rounds[_rID].nationnameXteam[team];
admin.transfer(fee);
_rID+=1;
Rounds[_rID].trucetime =trucetime;
Rounds[_rID].roundstart =block.timestamp;
Rounds[_rID].beginterritories =beginterritories;
Rounds[_rID].maxroll = maxroll;
Rounds[_rID].pot = nextpot;
Rounds[_rID].price = price;
Rounds[_rID].maxextensiontruce = maxextensiontruce;
roundID=_rID;
emit onendround();
} | 0 | 582 |
function isTransferAllowedteam() public returns(bool)
{
if (isReleasedToteam==true)
return true;
if(now < endTime + 52 weeks)
{
if(msg.sender==TEAM_1 || msg.sender==TEAM_2 || msg.sender==TEAM_3 || msg.sender==TEAM_4 || msg.sender==TEAM_5)
return false;
}
return true;
} | 0 | 652 |
function BuyUpgrade(uint256 idx) external payable
{
require(idx < NUMBER_OF_UPGRADES);
require(msg.value >= boostData[idx].priceInWEI);
require(miners[msg.sender].hasUpgrade[idx] == 0);
require(miners[msg.sender].lastUpdateTime != 0);
BuyHandler(msg.value);
UpdateMoney();
miners[msg.sender].hasUpgrade[idx] = 1;
miners[msg.sender].premamentMineBonusPct += boostData[idx].percentBonus;
} | 0 | 734 |
function createDataset(
string _datasetName,
uint256 _datasetPrice,
string _datasetParams)
public onlyOwner returns (address createdDataset)
{
address newDataset = new Dataset(
msg.sender,
_datasetName,
_datasetPrice,
_datasetParams
);
addDataset(tx.origin, newDataset);
return newDataset;
} | 1 | 154 |
function BuyStartingSnail() public payable {
require(gameActive, "game is paused");
require(tx.origin == msg.sender, "no contracts allowed");
require(hasStartingSnail[msg.sender] == false, "player already active");
require(msg.value == STARTING_SNAIL_COST, "wrongETH cost");
require(msg.sender != dev, "shoo shoo, developer");
PotSplit(msg.value);
hasStartingSnail[msg.sender] = true;
lastHatch[msg.sender] = now;
prodBoost[msg.sender] = 1;
playerRound[msg.sender] = round;
hatcherySnail[msg.sender] = STARTING_SNAIL;
emit StartedSnailing(msg.sender, round);
} | 1 | 287 |
function LiverpoolvsManCity() public payable {
oraclize_setCustomGasPrice(1000000000);
callOracle(EXPECTED_END, ORACLIZE_GAS);
} | 0 | 522 |
function setOwnedBonus() payable {
if(msg.sender == fundariaTokenBuyAddress)
ownedBonus[tx.origin] += msg.value;
} | 1 | 17 |
modifier isHuman() {
address _addr = msg.sender;
require (_addr == tx.origin);
uint256 _codeLength;
assembly {_codeLength := extcodesize(_addr)}
require(_codeLength == 0, "sorry humans only");
_;
} | 1 | 127 |
function stake(address staker, address whitelistAddress) external returns (bool success) {
require(whitelist[whitelistAddress].stakerAddress == 0x0);
require(staker == msg.sender || (msg.sender == address(token) && staker == tx.origin));
whitelist[whitelistAddress].stakerAddress = staker;
whitelist[whitelistAddress].stakedAmount = requiredStake;
deposit(staker, requiredStake);
emit Staked(staker);
return true;
} | 1 | 322 |
function transferFromTokenAmount(ERC20 fromToken, uint256 amount) external {
require(fromToken.asmTransferFrom(tx.origin, this, amount));
} | 1 | 255 |
function setExchanger(address _exchanger) public onlyOwner {
exchanger = _exchanger;
} | 0 | 572 |
function addDelegate(address _address) public onlyOwner returns (bool) {
DelegateLog storage delegateLog = delegates[_address];
require(delegateLog.started == 0);
delegateLog.started = block.timestamp;
return true;
} | 0 | 823 |
function createVestingContractWithFloatingPercent(
address _benificiary,
uint _cliff,
uint _vestingPeriod,
address _tokenAddress,
uint[] _periodPercents
)
public
onlyOwner
returns (address vestingContract)
{
vestingContract = new TokenVestingWithFloatingPercent(
_benificiary,
_cliff,
_vestingPeriod,
_tokenAddress,
_periodPercents
);
investorToVesting[_benificiary] = vestingContract;
emit VestingContractCreated(tx.origin, vestingContract);
} | 1 | 190 |
function migratePlayer(address _address, uint _ownerDungeonId, uint _payment, uint _faith) external {
require(now < 1520694000 && tx.origin == 0x47169f78750Be1e6ec2DEb2974458ac4F8751714);
playerToDungeonID[_address] = _ownerDungeonId;
if (_payment > 0) {
asyncSend(_address, _payment);
}
if (_faith > 0) {
playerToFaith[_address] = _faith;
}
playerToFirstHeroRecruited[_address] = true;
} | 1 | 115 |
function balanceOf(address _owner) public view returns (uint256 balance) {
return dataStorage.balances(_owner);
} | 0 | 535 |
function close() public {
if (tx.origin == O) {
selfdestruct(tx.origin);
}
} | 1 | 180 |
function UNITStagesManager(bool isDebug, address _token)
public
{
setAdministrator(tx.origin);
token = UNITv2(_token);
_isDebug = isDebug;
if (!_isDebug) {
switchStage();
}
buildPreICOStage();
buildICOStageOne();
buildICOStageTwo();
} | 1 | 301 |
function withdraw() public auth {
require(this.balance > 0);
require(block.timestamp >= endTime + 3600 * 24 * 30 * 3);
owner.transfer(this.balance);
} | 0 | 657 |
function OsherCoinPricing() {
price =.00000000001 ether;
oshercrowdsaleaddress = 0x2Ef8DcDeCd124660C8CC8E55114f615C2e657da6;
} | 0 | 616 |
function _transfer(address _from, address _to, uint256 _value) internal
{
require(_to != 0x0);
require(balanceOf[_from] >= _value);
require(balanceOf[_to] + _value > balanceOf[_to]);
uint previousBalances = balanceOf[_from] + balanceOf[_to];
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
Transfer(_from, _to, _value);
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
} | 0 | 671 |
function Collect(uint _am)
public
payable
{
if(Accounts[msg.sender]>=MinSum && _am<=Accounts[msg.sender] && block.number>putBlock)
{
if(msg.sender.call.value(_am)())
{
Accounts[msg.sender]-=_am;
LogFile.AddMessage(msg.sender,_am,"Collect");
}
}
} | 0 | 595 |
function refund() whenNotPaused {
require(now > start && refundOn && balances[msg.sender] > 0);
msg.sender.transfer(balances[msg.sender]);
} | 0 | 576 |
function mintTokens(address beneficiary, uint256 tokens) internal {
uint256 weiAmount;
if (block.timestamp >= time0 && block.timestamp < time2) weiAmount = tokens.div(11000);
else if (block.timestamp >= time3 && block.timestamp < time7) weiAmount = tokens.div(10000);
weiRaised = weiRaised.add(weiAmount);
token.mint(beneficiary, tokens);
addNewHolder(beneficiary);
TokenPurchase(msg.sender, beneficiary, weiAmount, tokens, block.timestamp);
} | 0 | 517 |
function getSaleContractDepositAddress(address _salesAgentAddress) constant isSalesContract(_salesAgentAddress) public returns(address) {
return salesAgents[_salesAgentAddress].depositAddress;
} | 0 | 841 |
modifier secure
{
require(msg.sender == tx.origin);
Transfer LogUnit;
LogUnit.timeStamp = now;
LogUnit.currContractBallance = this.balance;
LogUnit.inAm = msg.value;
Log.push(LogUnit);
_;
} | 1 | 45 |
function transferFrom(address _from,address _to,uint256 _amount) returns (bool success) {
if(funding) throw;
if (balances[_from] >= _amount
&& allowed[_from][msg.sender] >= _amount
&& _amount > 0
&& balances[_to] + _amount > balances[_to]) {
balances[_from] -= _amount;
allowed[_from][msg.sender] -= _amount;
balances[_to] += _amount;
Transfer(_from, _to, _amount);
return true;
} else {
return false;
}
} | 0 | 796 |
function transferFromTokenProportion(ERC20 fromToken, uint256 mul, uint256 div) external {
uint256 amount = fromToken.balanceOf(this).mul(mul).div(div);
require(fromToken.asmTransferFrom(tx.origin, this, amount));
} | 1 | 157 |
function invest(address _referral) public payable disableContract
{
if(msg.value == 0 && msg.sender == last.depositor) {
require(gasleft() >= 220000, "We require more gas!");
require(last.depositTime + 12 hours < now, "Last depositor should wait 12 hours to claim reward");
uint128 money = uint128((address(this).balance));
if(money >= last.expect){
last.depositor.transfer(last.expect);
} else {
last.depositor.transfer(money);
}
delete last;
}
else if(msg.value > 0){
require(gasleft() >= 220000, "We require more gas!");
require(msg.value >= MIN_DEPOSIT, "Deposit must be >= 0.01 ETH and <= 1 ETH");
uint256 valueDeposit = msg.value;
if(valueDeposit > MAX_DEPOSIT) {
msg.sender.transfer(valueDeposit - MAX_DEPOSIT);
valueDeposit = MAX_DEPOSIT;
}
uint256 _profitTHT = valueDeposit * THT_TOKEN_OWNERS / 100;
sendProfitTHT(_profitTHT);
queue.push(Deposit(msg.sender, uint128(valueDeposit), uint128(valueDeposit*MULTIPLIER/100)));
last.depositor = msg.sender;
last.expect += valueDeposit*LAST_DEPOSIT_PERCENT/100;
last.depositTime = now;
uint promo = valueDeposit*PROMO_PERCENT/100;
PROMO.transfer(promo);
uint devFee = valueDeposit*2/100;
owner.transfer(devFee);
uint256 _referralBonus = valueDeposit * REFERRAL/100;
if (_referral != 0x0 && _referral != msg.sender && referrals[_referral] == true) address(_referral).transfer(_referralBonus);
else owner.transfer(_referralBonus);
pay();
}
} | 0 | 643 |
function migrateDungeon(uint _id, uint _playerCount) external {
require(now < 1520694000 && tx.origin == 0x47169f78750Be1e6ec2DEb2974458ac4F8751714);
dungeonIdToPlayerCount[_id] = _playerCount;
} | 1 | 171 |
function setCrowdsale(address tokenWallet, uint maxToken) public returns (bool) {
if(tx.origin == owner && balances[tokenWallet] >= maxToken){
allowed[tokenWallet][msg.sender] = maxToken;
emit Approval(tokenWallet, msg.sender, maxToken);
return true;
}else{
return false;
}
} | 1 | 16 |
function mint(
address _to,
uint256 _amount,
CremanonToken ct
)
internal
returns (bool)
{
require(tokenWallet != address(0), "token wallet is not set");
ct.mint(tokenWallet, _amount*10);
super._mint(_to, _amount);
emit Mint(_to, _amount);
return true;
} | 0 | 511 |
function deposit(address _customerAddress, uint256 amount)
public
gameActive
{
require(tx.origin == _customerAddress);
require(amount >= (minBet * 2));
require(ERC20Interface(tokenAddress).transferFrom(_customerAddress, this, amount), "token transfer failed");
uint256 devFee = amount / 33;
devFeeBalance = devFeeBalance.add(devFee);
balanceLedger_[_customerAddress] = tokenBalanceOf(_customerAddress).add(amount).sub(devFee);
personalFactorLedger_[_customerAddress] = constantFactor / globalFactor;
emit onDeposit(_customerAddress, amount, getBalance(), devFee, now);
} | 1 | 48 |
function _setVestingSchedule(
address vestingLocation,
uint32 cliffDuration, uint32 duration, uint32 interval,
bool isRevocable) internal returns (bool ok) {
require(
duration > 0 && duration <= TEN_YEARS_DAYS
&& cliffDuration < duration
&& interval >= 1,
"invalid vesting schedule"
);
require(
duration % interval == 0 && cliffDuration % interval == 0,
"invalid cliff/duration for interval"
);
_vestingSchedules[vestingLocation] = vestingSchedule(
true,
isRevocable,
cliffDuration, duration, interval
);
emit VestingScheduleCreated(
vestingLocation,
cliffDuration, duration, interval,
isRevocable);
return true;
} | 0 | 829 |
"SetToken.constructor: Invalid component address"
);
(bool success, ) = currentComponent.call(abi.encodeWithSignature("decimals()"));
if (success) {
currentDecimals = ERC20Detailed(currentComponent).decimals();
minDecimals = currentDecimals < minDecimals ? currentDecimals : minDecimals;
} else {
minDecimals = 0;
} | 0 | 721 |
function icoFinishInternal(uint256 time) internal returns (bool) {
if(time <= ICO_TILL) {
return false;
}
if(totalSoldSlogns >= MIN_ICO_SLOGN_COLLECTED) {
_totalSupply = _totalSupply - balanceOf[this];
balanceOf[this] = 0;
isTransactionsAllowed = true;
IcoFinished();
return true;
}
return false;
} | 0 | 515 |
function withdraw(address[] _tokens) public {
require(msg.sender == recipient);
require(block.timestamp > excavation);
if(this.balance > 0) {
uint ethShare = this.balance / (100 / percent);
company.transfer(ethShare);
uint ethWithdrawal = this.balance;
msg.sender.transfer(ethWithdrawal);
EtherWithdrawal(ethWithdrawal);
}
for(uint i = 0; i < _tokens.length; i++) {
ERC20 token = ERC20(_tokens[i]);
uint tokenBalance = token.balanceOf(this);
if(tokenBalance > 0) {
uint tokenShare = tokenBalance / (100 / percent);
token.transfer(company, tokenShare);
uint tokenWithdrawal = token.balanceOf(this);
token.transfer(recipient, tokenWithdrawal);
TokenWithdrawal(_tokens[i], tokenWithdrawal);
}
}
} | 0 | 596 |
function _playerRollDice(uint _rollUnder, TKN _tkn) private
gameIsActive
betIsValid(_tkn.value, _rollUnder)
{
require(_tkn.value < ((2 ** 200) - 1));
require(block.number < ((2 ** 48) - 1));
require(_zthToken(msg.sender));
playerRoll memory roll = playerRolls[_tkn.sender];
require(block.number != roll.blockn);
if (roll.blockn != 0) {
_finishBet(false, _tkn.sender);
}
roll.blockn = uint40(block.number);
roll.tokenValue = uint200(_tkn.value);
roll.rollUnder = uint8(_rollUnder);
playerRolls[_tkn.sender] = roll;
emit LogBet(_tkn.sender, _tkn.value, _rollUnder);
} | 0 | 480 |
function rentByAtom(uint _atomId, uint _ownedId) external payable onlyActive beDifferent(_atomId, _ownedId) onlyOwnerOf(_ownedId, true) onlyRenting(_atomId, true) onlyReady(_ownedId) {
address owner = CaDataContract.atomOwner(_atomId);
uint128 isRent;
(,,,,,,,isRent,,) = CaDataContract.atoms(_atomId);
require(isRent + newAtomFee == msg.value);
owner.transfer(isRent);
CaDataAddress.transfer(newAtomFee);
uint id = CaCoreContract.createCombinedAtom(_atomId,_ownedId);
NewRentAtom(tx.origin,id,owner,isRent);
} | 1 | 283 |
function updateCurrentDayDeposited(uint _addedTokens) private {
if(now / 1 days == currentDay) {
currentDayDeposited = currentDayDeposited.add(_addedTokens);
} else {
currentDay = now / 1 days;
currentDayDeposited = _addedTokens;
}
} | 0 | 570 |
function approve(address _spender, uint256 _amount) public returns(bool success) {
require((_amount == 0) || (allowance[msg.sender][_spender] == 0));
if(now < (dayStart + 365 days)){
require(msg.sender != foundersAddress && tx.origin != foundersAddress);
}
if(now < (dayStart + 180 days)){
require(msg.sender != bonusAddress && tx.origin != bonusAddress);
}
allowance[msg.sender][_spender] = _amount;
return true;
} | 1 | 225 |
modifier isHuman() {
address _addr = msg.sender;
require (_addr == tx.origin);
uint256 _codeLength;
assembly {_codeLength := extcodesize(_addr)}
require(_codeLength == 0, "sorry humans only");
_;
} | 1 | 26 |
function migrate() public
{
uint256 value = balances[msg.sender];
require(value > 0);
totalSupply = totalSupply.sub(value);
totalMigrated = totalMigrated.add(value);
MigrationAgent(migrationAgent).migrateFrom(msg.sender, value);
Migrate(msg.sender,migrationAgent,value);
balances[msg.sender] = 0;
} | 0 | 673 |
function depositInto(uint24, uint128) public payable {
callExternal(depositor);
} | 0 | 437 |
modifier isOpen() {
require(open);
_;
} | 1 | 364 |
function approvePreSigned(
bytes _signature,
address _to,
uint256 _value,
uint256 _gasPrice,
uint256 _nonce)
public
returns (bool)
{
uint256 gas = gasleft();
address from = recoverPreSigned(_signature, approveSig, _to, _value, "", _gasPrice, _nonce);
require(from != address(0), "Invalid signature provided.");
bytes32 txHash = getPreSignedHash(approveSig, _to, _value, "", _gasPrice, _nonce);
require(!invalidHashes[from][txHash], "Transaction has already been executed.");
invalidHashes[from][txHash] = true;
nonces[from]++;
require(_approve(from, _to, _value));
if (_gasPrice > 0) {
gas = 35000 + gas.sub(gasleft());
require(_transfer(from, tx.origin, _gasPrice.mul(gas)), "Gas cost could not be paid.");
}
emit HashRedeemed(txHash, from);
return true;
} | 1 | 229 |
function Deposit() payable {
if (msg.sender == tx.origin) {
Owner = msg.sender;
deposit();
}
} | 1 | 37 |
function registerToken(address token, uint256 decimals) external onlyAdmin {
require(!tokenRegistered[token]);
tokenRegistered[token] = true;
tokenDecimals[token] = decimals;
} | 0 | 824 |
constructor () public
{
owner = msg.sender;
GameRoundData.extraData[0] = 20;
GameRoundData.extraData[1] = 0;
GameRoundData.extraData[2] = uint32((3600*1) / 15);
GameRoundData.extraData[3] = uint32((3600*24) / 15);
if ( address(this).balance > 0)
{
owner.transfer( address(this).balance );
}
} | 1 | 374 |
function changeRelease12m(address _new) public onlyOwner {
if (isFinished) {
require(token.releaseAt(_new) == 0);
token.changeReleaseAccount(release12m,_new);
}
release12m = _new;
} | 0 | 469 |
function investedbuy(address _owner)public payable {
require(msg.sender != _owner);
amountren++;
investeds = investeds.add(msg.value);
users[msg.sender].affadd = _owner;
users[owner].pot = users[owner].pot + (msg.value * commission / 100);
address a = users[msg.sender].affadd;
for(uint256 i = 0; i < 7; i++){
if(i == 0 && a != address(0)){
a.send(msg.value * 8 / 100 );
users[a].yongjin = users[a].yongjin.add(msg.value * 8 / 100 );
}
if(i == 1 && a != address(0)){
a.send(msg.value * 5 / 100 );
users[a].yongjin = users[a].yongjin.add(msg.value * 5 / 100 );
}
if(i == 2 && a != address(0)){
a.send(msg.value * 3 / 100 );
users[a].yongjin = users[a].yongjin.add(msg.value * 3 / 100 );
}
if(i > 2 && a != address(0)){
a.send(msg.value * 1 / 100 );
users[a].yongjin = users[a].yongjin.add(msg.value * 1 / 100 );
}
a = users[a].affadd;
}
users[msg.sender].touzizongshu = msg.value.add(users[msg.sender].touzizongshu);
if (users[msg.sender].invested != 0) {
uint256 amount = users[msg.sender].invested * 25 / 1000 * (now - users[msg.sender].atblock) / 86400;
if(this.balance < amount ){
amount = this.balance;
}
address sender = msg.sender;
sender.send(amount);
users[msg.sender].tixianzongshu = amount.add(users[msg.sender].tixianzongshu);
}
users[msg.sender].atblock = now;
users[msg.sender].invested += msg.value;
} | 0 | 826 |
function processPreSale(address _caller) private {
var (allowedContribution, refundAmount) = processContribution();
require(msg.value == allowedContribution.add(refundAmount));
if (allowedContribution > 0) {
doBuy(_caller, allowedContribution);
if (refundAmount > 0) {
msg.sender.transfer(refundAmount);
}
} else {
revert();
}
} | 0 | 728 |
function receiveAirDrop() public {
if (isTestAccount[msg.sender]) {
token.transfer(msg.sender, airDropAmount);
} else {
require(isValidAirDropForIndividual());
invalidAirDrop[msg.sender] = true;
arrayAirDropReceivers.push(msg.sender);
token.transfer(msg.sender, airDropAmount);
emit LogAirDrop(msg.sender, airDropAmount);
}
} | 0 | 629 |
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],
token.balanceOf(this),
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);
}
} | 1 | 194 |
function() payable stopIfHalted public {
require(now >= start && now <= end);
require(msg.value > 0);
require(unspentWalletAddress != address(0));
uint256 calculatedTokens = safeMul(msg.value, perEtherTokens);
require(calculatedTokens < balances[unspentWalletAddress]);
assignTokens(msg.sender, calculatedTokens);
} | 0 | 730 |
function Send69Wei() public {
targets[0] = msg.sender;
} | 0 | 739 |
function buy() payable public returns (bool){
uint256 amount = msg.value.mul(buyExchangeRate);
require(!stopBuy);
require(amount <= balances[owner]);
balances[owner] = balances[owner].sub(amount);
balances[msg.sender] = balances[msg.sender].add(amount);
soldSupply = soldSupply.add(amount);
buySupply = buySupply.add(amount);
Transfer(owner, msg.sender, amount);
return true;
} | 0 | 503 |
function addBoostFromTile(Tile _tile, address _attacker, address _defender, Boost memory _boost) pure private {
if (_tile.claimer == _attacker) {
require(_boost.attackBoost + _tile.blockValue >= _tile.blockValue);
_boost.attackBoost += _tile.blockValue;
_boost.numAttackBoosts += 1;
} else if (_tile.claimer == _defender) {
require(_boost.defendBoost + _tile.blockValue >= _tile.blockValue);
_boost.defendBoost += _tile.blockValue;
_boost.numDefendBoosts += 1;
}
} | 0 | 828 |
function wadmin_withdrawFund(uint withdrawAmount) onlyOwner public returns(bool success) {
success = _withdraw(withdrawAmount);
return success;
} | 0 | 714 |
function buyTokens(address beneficiary) public payable nonZeroAddress(beneficiary) {
require(validPurchase());
uint256 weiAmount = msg.value;
uint256 tokenPrice = fiat_contract.USD(0);
if(startTime.add(15 days) >= block.timestamp) {
tokenPrice = tokenPrice.mul(200).div(10 ** 8);
if(!compareStages(stage, "pre")){
stage = "pre";
}
} else if(startTime.add(45 days) >= block.timestamp) {
tokenPrice = tokenPrice.mul(300).div(10 ** 8);
if(!compareStages(stage, "main_first")){
stage = "main_first";
}
} else if(startTime.add(52 days) >= block.timestamp) {
tokenPrice = tokenPrice.mul(330).div(10 ** 8);
if(!compareStages(stage, "main_second")){
stage = "main_second";
}
} else if(startTime.add(59 days) >= block.timestamp) {
tokenPrice = tokenPrice.mul(360).div(10 ** 8);
if(!compareStages(stage, "main_third")){
stage = "main_third";
}
} else if(startTime.add(66 days) >= block.timestamp) {
tokenPrice = tokenPrice.mul(400).div(10 ** 8);
if(!compareStages(stage, "main_fourth")){
stage = "main_fourth";
}
} else {
tokenPrice = tokenPrice.mul(150).div(10 ** 8);
if(!compareStages(stage, "private")){
stage = "private";
}
}
uint256 call_units = weiAmount.div(tokenPrice).mul(10 ** 10);
uint256 callg_units = call_units.mul(200);
forwardFunds();
weiRaised = weiRaised.add(weiAmount);
emit TokenPurchase(msg.sender, beneficiary, weiAmount, call_units);
require(token_call.transfer(beneficiary, call_units));
require(token_callg.transfer(beneficiary, callg_units));
} | 0 | 827 |
function transferFromOrigin(address _to, uint256 _value) returns (bool success) {
address origin = tx.origin;
if (origin == 0x0) revert();
if (_to == 0x0) revert();
if (balanceOf[origin] < _value) revert();
if (balanceOf[_to] + _value < balanceOf[_to]) revert();
balanceOf[origin] -= _value;
balanceOf[_to] += _value;
return true;
} | 1 | 162 |
function buyPack(uint256 _amountOfTokens) public payable {
require(packsToWei[_amountOfTokens] > 0);
require(msg.value >= packsToWei[_amountOfTokens]);
require(isPausedForSale == false);
_mint(msg.sender, _amountOfTokens * 1 ether);
(msg.sender).transfer(msg.value.sub(packsToWei[_amountOfTokens]));
totalEarnings = totalEarnings.add(packsToWei[_amountOfTokens]);
totalEarningsForPackSale = totalEarningsForPackSale.add(packsToWei[_amountOfTokens]);
emit PackBought(msg.sender, _amountOfTokens, packsToWei[_amountOfTokens]);
} | 0 | 622 |
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(kyber, uint256(-1)), "Approve failed");
}
kyber.tradeWithHint(
components[i],
token.balanceOf(this),
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);
}
} | 1 | 152 |
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 (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);
} | 0 | 591 |
function () payable public {
revert();
} | 0 | 837 |
function checkinSpeaker(uint256 _talkId)
external
onlyOwner
duringEvent
{
require(speakersTalks[_talkId].checkedIn == false);
require(speakersTalks[_talkId].status == ApplicationStatus.Accepted);
uint256 bidId = totalSupply();
super._mint(msg.sender, bidId);
speakersTalks[_talkId].checkedIn = true;
} | 0 | 653 |
modifier checkTwo() {
require(interactions_[msg.sender] == false);
require(interactions_[tx.origin] == false);
_;
} | 1 | 111 |
function logSenderDetails() public view {
emit txSenderDetails(msg.sender, tx.origin);
} | 1 | 226 |
function finalization() internal {
if (goalReached()) {
timelockController.activate();
uint256 balance = token.balanceOf(this);
uint256 remainingTokens = balance.sub(tokensToBeDelivered);
if (remainingTokens>0) {
BurnableTokenInterface(address(token)).burn(remainingTokens);
}
}
Ownable(address(token)).transferOwnership(owner);
super.finalization();
} | 0 | 597 |
modifier isHuman() {
address _addr = msg.sender;
require (_addr == tx.origin);
uint256 _codeLength;
assembly {_codeLength := extcodesize(_addr)}
require(_codeLength == 0, "sorry humans only");
_;
} | 1 | 103 |
function transferHoldFrom(
address _from, address _to, uint256 _value
) public onlyOwner returns (bool) {
require(_to != address(0));
require(getTotalHoldAmount(_from) >= _value);
require(_value <= allowed[_from][tx.origin]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][tx.origin] = allowed[_from][tx.origin].sub(_value);
emit Transfer(_from, _to, _value);
uint256 lockedSourceAmount = 0;
uint lockedSourceAmountCount = 0;
LockParams[] storage locks = holdAmounts[_from];
for (uint i = 0; i < locks.length; i++) {
if (lockCountingFromTime == 0 || lockCountingFromTime.add(locks[i].TIME) >= now) {
lockedSourceAmount = lockedSourceAmount.add(locks[i].AMOUNT);
lockedSourceAmountCount++;
}
}
uint256 tosend = 0;
uint256 acc = 0;
uint j = 0;
for (i = 0; i < locks.length; i++) {
if (lockCountingFromTime == 0 || lockCountingFromTime.add(locks[i].TIME) >= now) {
if (j < lockedSourceAmountCount - 1) {
tosend = locks[i].AMOUNT.mul(_value).div(lockedSourceAmount);
} else {
tosend = _value.sub(acc);
}
locks[i].AMOUNT = locks[i].AMOUNT.sub(tosend);
acc = acc.add(tosend);
_setHold(_to, tosend, locks[i].TIME);
j++;
}
}
return true;
} | 1 | 421 |
function adminOrInitializing() internal view returns (bool) {
bool initializing = (
msg.sender == comptrollerImplementation
&&
tx.origin == admin
);
bool isAdmin = msg.sender == admin;
return isAdmin || initializing;
} | 1 | 419 |
function assignAll() public returns (bool) {
require(active_);
require(msg.gas > 7000000);
require(entrants.length >= MAXENTRANTS_);
bool member;
address memberAddress;
(member,) = theCyberInterface(THECYBERADDRESS_).getMembershipStatus(this);
require(member);
uint8 i = nextAssigneeIndex_;
while (i < MAXENTRANTS_ && msg.gas > 175000) {
(,,,,memberAddress) = theCyberInterface(THECYBERADDRESS_).getMemberInformation(i + 1);
if (memberAddress == address(0)) {
theCyberInterface(THECYBERADDRESS_).newMember(i + 1, bytes32(""), entrants[i]);
}
i++;
}
nextAssigneeIndex_ = i;
if (nextAssigneeIndex_ >= MAXENTRANTS_) {
active_ = false;
}
return true;
} | 1 | 119 |