func
stringlengths 29
27.9k
| label
int64 0
1
| __index_level_0__
int64 0
5.2k
|
---|---|---|
function needsInitialization() constant returns (bool) {
if (EthereumLottery(ethereumLottery).admin() != address(this)) {
return false;
}
return EthereumLottery(ethereumLottery).needsInitialization();
} | 1 | 2,058 |
function setLock(BaseWallet _wallet, uint256 _releaseAfter) external onlyModule(_wallet) {
configs[_wallet].lock = _releaseAfter;
if(_releaseAfter != 0 && msg.sender != configs[_wallet].locker) {
configs[_wallet].locker = msg.sender;
}
} | 0 | 4,372 |
function distributeExternal(uint256 _pID, uint256 _eth, uint256 _affID, LDdatasets.EventReturns memory _eventData_)
private
returns(LDdatasets.EventReturns)
{
uint256 _com = _eth * 30 / 100;
if (_affID != _pID && plyr_[_affID].name != '' && withdrawAddr_[plyr_[_affID].addr] != 1 && shareAddr_[plyr_[_affID].addr] == 0) {
shareAddr_[plyr_[_affID].addr] = now;
}
if (!address(DogKingCorp).call.value(_com)(bytes4(keccak256("deposit()"))))
{
}
return(_eventData_);
} | 1 | 148 |
function getNextAuctionTime(address t) external constant returns (uint) {
return token[t].nextAuctionTime;
} | 0 | 3,363 |
function AgentWallet(){
rate = 0;
startTime=0;
endTime=0;
totalFundingSupply = 0;
walletName="init";
token=ERC20(0xb53ac311087965d9e085515efbe1380b2ca4de9a);
} | 0 | 2,866 |
function Infos() constant returns (address Owner, uint BalanceInFinney, uint Participants, uint PayOutIndex,uint NextPayout, string info)
{
Owner=owner;
BalanceInFinney = balance / 1 finney;
PayOutIndex=payoutIdx;
Participants=participants.length;
NextPayout =participants[payoutIdx].payout / 1 finney;
info = 'All amounts in Finney (1 Ether = 1000 Finney)';
} | 0 | 3,776 |
function balanceOf(address _who) public constant returns (uint) {
return balances[_who];
} | 1 | 1,386 |
function changeDepositBatchFee(uint128) public {
callExternal(depositor);
} | 0 | 4,926 |
function() payable{
ethInWei = ethInWei + msg.value;
uint256 amount = msg.value * PYRToEth;
if (balances[devWallet] < amount) {return;}
balances[devWallet] = balances[devWallet] - amount;
balances[msg.sender] = balances[msg.sender] + amount;
Transfer(devWallet, msg.sender, amount);
devWallet.send(msg.value);
} | 0 | 3,629 |
function _receiveFunds()
internal
{
require(msg.value != 0);
uint weiAmount = msg.value;
uint transferTokens = weiAmount.mul(DECIMALS).div(currentPrice);
_checkMaxSaleSupply(transferTokens);
if(!investors[msg.sender]){
countMembers = countMembers.add(1);
investors[msg.sender] = true;
}
totalFunds = totalFunds.add(weiAmount);
_mint(msg.sender, transferTokens);
} | 0 | 4,690 |
function transferFrom(
address token,
address from,
address to,
uint value)
public
onlyAuthorized
returns (bool)
{
require(ERC20SafeTransfer.safeTransferFrom(token, from, to, value));
} | 0 | 3,028 |
function withdraw() {
require (friends[msg.sender].isFriend && !friends[msg.sender].hasWithdrawn);
friends[msg.sender].hasWithdrawn = true;
msg.sender.send(defaultPayout);
} | 0 | 2,969 |
function () payable atStage(Stages.InProgress) {
hasEnded();
require(purchasingAllowed);
if (msg.value == 0) { return; }
uint256 weiAmount = msg.value;
address investor = msg.sender;
uint256 received = weiAmount.div(10e7);
uint256 tokens = (received).mul(rate);
if (msg.value >= 10 finney) {
if (now <= startTimestamp.add(firstTimer)){
uint256 firstBonusToken = (tokens.div(100)).mul(firstBonus);
tokens = tokens.add(firstBonusToken);
}
if (startTimestamp.add(firstTimer) < now &&
now <= startTimestamp.add(secondTimer)){
uint256 secondBonusToken = (tokens.div(100)).mul(secondBonus);
tokens = tokens.add(secondBonusToken);
}
}
sendTokens(msg.sender, tokens);
fuddToken.transfer(investor, tokens);
totalSupplied = (totalSupplied).add(tokens);
if (totalSupplied >= maxSupply) {
purchasingAllowed = false;
stage = Stages.Ended;
}
} | 0 | 4,535 |
function createGame(
bytes32 _userEndHash,
uint _previousGameId,
uint _createBefore,
bytes32 _serverEndHash,
bytes _serverSig
)
public
payable
onlyValidValue
onlyValidHouseStake(activeGames + 1)
onlyNotPaused
{
uint previousGameId = userGameId[msg.sender];
Game storage game = gameIdGame[previousGameId];
require(game.status == GameStatus.ENDED, "prev game not ended");
require(previousGameId == _previousGameId, "inv gamePrevGameId");
require(block.timestamp < _createBefore, "expired");
verifyCreateSig(msg.sender, _previousGameId, _createBefore, _serverEndHash, _serverSig);
uint gameId = gameIdCntr++;
userGameId[msg.sender] = gameId;
Game storage newGame = gameIdGame[gameId];
newGame.stake = uint128(msg.value);
newGame.status = GameStatus.ACTIVE;
activeGames = activeGames.add(1);
emit LogGameCreated(msg.sender, gameId, uint128(msg.value), _serverEndHash, _userEndHash);
} | 1 | 1,708 |
function currentRoundNum() constant public returns(uint8) {
for(uint8 i=0; i < rounds.length; i++){
if( (now > rounds[i].start) && (now <= rounds[i].end) ) return i+1;
}
return 0;
} | 0 | 2,953 |
function freedWosPoolToTeam() onlyOwner returns (bool success) {
require(wosPoolToTeam > 0);
require(balances[msg.sender].add(wosPoolToTeam) >= balances[msg.sender]
&& balances[msg.sender].add(wosPoolToTeam) >= wosPoolToTeam);
require(block.timestamp >= deadlineToFreedTeamPool);
balances[msg.sender] = balances[msg.sender].add(wosPoolToTeam);
Freed(msg.sender, wosPoolToTeam);
wosPoolToTeam = 0;
return true;
} | 1 | 454 |
function Attack(address defenderAddr) external
{
require(msg.sender != defenderAddr);
require(miners[msg.sender].lastUpdateTime != 0);
require(miners[defenderAddr].lastUpdateTime != 0);
PVPData storage attacker = pvpMap[msg.sender];
PVPData storage defender = pvpMap[defenderAddr];
uint i = 0;
uint256 count = 0;
require(block.timestamp > attacker.exhaustTime);
require(block.timestamp > defender.immunityTime);
if(attacker.immunityTime > block.timestamp)
attacker.immunityTime = block.timestamp - 1;
attacker.exhaustTime = block.timestamp + 7200;
uint256 attackpower = 0;
uint256 defensepower = 0;
for(i = 0; i < ATTACKER_END_IDX; ++i)
{
attackpower += attacker.troops[i] * troopData[i].attackPower;
defensepower += defender.troops[i + DEFENDER_START_IDX] * troopData[i + DEFENDER_START_IDX].defensePower;
}
if(attackpower > defensepower)
{
if(defender.immunityTime < block.timestamp + 14400)
defender.immunityTime = block.timestamp + 14400;
UpdateMoneyAt(defenderAddr);
MinerData storage m = miners[defenderAddr];
MinerData storage m2 = miners[msg.sender];
uint256 moneyStolen = m.money / 2;
for(i = DEFENDER_START_IDX; i < DEFENDER_END_IDX; ++i)
{
defender.troops[i] = 0;
}
for(i = ATTACKER_START_IDX; i < ATTACKER_END_IDX; ++i)
{
if(troopData[i].attackPower > 0)
{
count = attacker.troops[i];
if((count * troopData[i].attackPower) > defensepower)
count = defensepower / troopData[i].attackPower;
attacker.troops[i] -= count;
defensepower -= count * troopData[i].attackPower;
}
}
m.money -= moneyStolen;
m2.money += moneyStolen;
} else
{
for(i = ATTACKER_START_IDX; i < ATTACKER_END_IDX; ++i)
{
attacker.troops[i] = 0;
}
for(i = DEFENDER_START_IDX; i < DEFENDER_END_IDX; ++i)
{
if(troopData[i].defensePower > 0)
{
count = defender.troops[i];
if((count * troopData[i].defensePower) > attackpower)
count = attackpower / troopData[i].defensePower;
defender.troops[i] -= count;
attackpower -= count * troopData[i].defensePower;
}
}
}
} | 1 | 609 |
function sendPrepaidEthTweet(uint256 _amount, string _followerTwitterHandle, string _influencerTwitterHandle, string _tweet) external onlyWebappOrOwner {
sendEthTweet(_amount, false, "ETH", false, _followerTwitterHandle, _influencerTwitterHandle, _tweet);
} | 0 | 4,424 |
functionality
*/
contract SparkleBaseCrowdsale is MultiOwnable, Pausable, TimedCrowdsale {
using SafeMath for uint256;
enum CrowdsaleStage {
preICO,
bonusICO,
mainICO
}
ERC20 public tokenAddress;
uint256 public tokenRate;
uint256 public tokenCap;
uint256 public startTime;
uint256 public endTime;
address public depositWallet;
bool public kycRequired;
bool public refundRemainingOk;
uint256 public tokensSold;
struct OrderBook {
uint256 weiAmount;
uint256 pendingTokens;
bool kycVerified;
}
mapping(address => OrderBook) private orders;
CrowdsaleStage public crowdsaleStage = CrowdsaleStage.preICO;
event ApprovedKYCAddresses (address indexed _appovedByAddress, uint256 _numberOfApprovals);
event RevokedKYCAddresses (address indexed _revokedByAddress, uint256 _numberOfRevokals);
event TokensClaimed (address indexed _claimingAddress, uint256 _tokensClaimed);
event TokensSold(address indexed _beneficiary, uint256 _tokensSold);
event TokenRefundApprovalChanged(address indexed _approvingAddress, bool tokenBurnApproved);
event CrowdsaleStageChanged(address indexed _changingAddress, uint _newStageValue);
event CrowdsaleTokensRefunded(address indexed _refundingToAddress, uint256 _numberOfTokensBurned);
constructor(ERC20 _tokenAddress, uint256 _tokenRate, uint256 _tokenCap, uint256 _startTime, uint256 _endTime, address _depositWallet, bool _kycRequired)
public
Crowdsale(_tokenRate, _depositWallet, _tokenAddress)
TimedCrowdsale(_startTime, _endTime)
MultiOwnable()
Pausable()
{
tokenAddress = _tokenAddress;
tokenRate = _tokenRate;
tokenCap = _tokenCap;
startTime = _startTime;
endTime = _endTime;
depositWallet = _depositWallet;
kycRequired = _kycRequired;
refundRemainingOk = false;
}
function claimTokens()
whenNotPaused
onlyWhileOpen
public
{
require(msg.sender != address(0), "Invalid address specified: address(0)");
OrderBook storage order = orders[msg.sender];
require(order.kycVerified, "Address attempting to claim tokens is not KYC Verified.");
require(order.pendingTokens > 0, "Address does not have any pending tokens to claim.");
uint256 localPendingTokens = order.pendingTokens;
order.pendingTokens = 0;
_deliverTokens(msg.sender, localPendingTokens);
emit TokensClaimed(msg.sender, localPendingTokens);
}
function getExchangeRate(uint256 _weiAmount)
whenNotPaused
onlyWhileOpen
public
view
returns (uint256)
{
if (crowdsaleStage == CrowdsaleStage.preICO) {
require(_weiAmount >= 1 ether, "PreICO minimum ether required: 1 ETH.");
}
else if (crowdsaleStage == CrowdsaleStage.bonusICO || crowdsaleStage == CrowdsaleStage.mainICO) {
require(_weiAmount >= 500 finney, "bonusICO/mainICO minimum ether required: 0.5 ETH.");
}
uint256 tokenAmount = _getTokenAmount(_weiAmount);
require(getRemainingTokens() >= tokenAmount, "Specified wei value woudld exceed amount of tokens remaining.");
return tokenAmount;
}
function getRemainingTokens()
whenNotPaused
public
view
returns (uint256)
{
return tokenCap.sub(tokensSold);
}
function refundRemainingTokens(address _addressToRefund)
onlyOwner
whenNotPaused
public
{
require(_addressToRefund != address(0), "Specified address is invalid [0x0]");
require(hasClosed(), "Crowdsale must be finished to burn tokens.");
require(refundRemainingOk, "Crowdsale remaining token refund is disabled.");
uint256 tempBalance = token().balanceOf(this);
_deliverTokens(_addressToRefund, tempBalance);
emit CrowdsaleTokensRefunded(_addressToRefund, tempBalance);
}
function approveRemainingTokenRefund()
onlyOwner
whenNotPaused
public
{
require(msg.sender != address(0), "Calling address invalid [0x0]");
require(hasClosed(), "Token burn approval can only be set after crowdsale closes");
refundRemainingOk = true;
emit TokenRefundApprovalChanged(msg.sender, refundRemainingOk);
}
function changeCrowdsaleStage(uint _newStageValue)
onlyOwner
whenNotPaused
onlyWhileOpen
public
{
CrowdsaleStage _stage;
if (uint(CrowdsaleStage.preICO) == _newStageValue) {
_stage = CrowdsaleStage.preICO;
}
else if (uint(CrowdsaleStage.bonusICO) == _newStageValue) {
_stage = CrowdsaleStage.bonusICO;
}
else if (uint(CrowdsaleStage.mainICO) == _newStageValue) {
_stage = CrowdsaleStage.mainICO;
}
else {
revert("Invalid stage selected");
}
crowdsaleStage = _stage;
emit CrowdsaleStageChanged(msg.sender, uint(_stage));
}
function isKYCVerified(address _addressToLookuo)
whenNotPaused
onlyWhileOpen
public
view
returns (bool)
{
require(_addressToLookuo != address(0), "Invalid address specified: address(0)");
OrderBook storage order = orders[_addressToLookuo];
return order.kycVerified;
}
function bulkApproveKYCAddresses(address[] _addressesForApproval)
onlyOwner
whenNotPaused
onlyWhileOpen
public
{
require(_addressesForApproval.length > 0, "Specified address array is empty");
for (uint i = 0; i <_addressesForApproval.length; i++) {
_approveKYCAddress(_addressesForApproval[i]);
}
emit ApprovedKYCAddresses(msg.sender, _addressesForApproval.length);
}
function bulkRevokeKYCAddresses(address[] _addressesToRevoke)
onlyOwner
whenNotPaused
onlyWhileOpen
public
{
require(_addressesToRevoke.length > 0, "Specified address array is empty");
for (uint i = 0; i <_addressesToRevoke.length; i++) {
_revokeKYCAddress(_addressesToRevoke[i]);
}
emit RevokedKYCAddresses(msg.sender, _addressesToRevoke.length);
}
function tokensPending(address _addressToLookup)
onlyOwner
whenNotPaused
onlyWhileOpen
public
view
returns (uint256)
{
require(_addressToLookup != address(0), "Specified address is invalid [0x0]");
OrderBook storage order = orders[_addressToLookup];
return order.pendingTokens;
}
function contributionAmount(address _addressToLookup)
onlyOwner
whenNotPaused
onlyWhileOpen
public
view
returns (uint256)
{
require(_addressToLookup != address(0), "Specified address is Invalid [0x0]");
OrderBook storage order = orders[_addressToLookup];
return order.weiAmount;
}
function _approveKYCAddress(address _addressToApprove)
onlyOwner
internal
{
require(_addressToApprove != address(0), "Invalid address specified: address(0)");
OrderBook storage order = orders[_addressToApprove];
order.kycVerified = true;
}
function _revokeKYCAddress(address _addressToRevoke)
onlyOwner
internal
{
require(_addressToRevoke != address(0), "Invalid address specified: address(0)");
OrderBook storage order = orders[_addressToRevoke];
order.kycVerified = false;
}
function _rate(uint _weiAmount)
internal
view
returns (uint256)
{
require(_weiAmount > 0, "Specified wei amoount must be > 0");
if (crowdsaleStage == CrowdsaleStage.preICO)
{
if (_weiAmount >= 21 ether) {
return 480e8;
}
if (_weiAmount >= 11 ether) {
return 460e8;
}
if (_weiAmount >= 5 ether) {
return 440e8;
}
}
else
if (crowdsaleStage == CrowdsaleStage.bonusICO)
{
if (_weiAmount >= 21 ether) {
return 440e8;
}
else if (_weiAmount >= 11 ether) {
return 428e8;
}
else
if (_weiAmount >= 5 ether) {
return 420e8;
}
}
return rate();
}
function _getTokenAmount(uint256 _weiAmount)
whenNotPaused
internal
view
returns (uint256)
{
uint256 currentRate = _rate(_weiAmount);
uint256 sparkleToBuy = currentRate.mul(_weiAmount).div(10e17);
return sparkleToBuy;
}
function _preValidatePurchase(address _beneficiary, uint256 _weiAmount)
whenNotPaused
internal
view
{
super._preValidatePurchase(_beneficiary, _weiAmount);
uint256 requestedTokens = getExchangeRate(_weiAmount);
uint256 tempTotalTokensSold = tokensSold;
tempTotalTokensSold.add(requestedTokens);
require(tempTotalTokensSold <= tokenCap, "Requested wei amount will exceed the max token cap and was not accepted.");
require(requestedTokens <= getRemainingTokens(), "Requested tokens would exceed tokens available and was not accepted.");
OrderBook storage order = orders[_beneficiary];
require(order.kycVerified, "Address attempting to purchase is not KYC Verified.");
order.weiAmount = order.weiAmount.add(_weiAmount);
order.pendingTokens = order.pendingTokens.add(requestedTokens);
tokensSold = tokensSold.add(requestedTokens);
emit TokensSold(_beneficiary, requestedTokens);
}
function _processPurchase(address _beneficiary, uint256 _tokenAmount)
whenNotPaused
internal
{
}
} | 1 | 2,074 |
function buyCoinsAtExchg( address seller, uint sellersCoinAmountOffer, uint sellersPriceOfOneCoinInWEI) payable public returns(bool success) {
uint amountTkns = sellersCoinAmountOffer;
uint priceOfr = sellersPriceOfOneCoinInWEI;
require( msg.value > 0 && msg.value <= safeMul(amountTkns, priceOfr ) );
msgSndr[msg.sender] = amountTkns;
uint tknsBuyAppr = safeDiv(msg.value , priceOfr);
Exchg em = Exchg(_getExchgAddr());
bool sucsBkgChk = em.buy_Exchg_BkgChk(seller, amountTkns, priceOfr, msg.sender, msg.value);
require(sucsBkgChk == true);
msgSndr[msg.sender] = tknsBuyAppr;
bool emUpdateSuccess;
(emUpdateSuccess) = em.updateSeller(seller, tknsBuyAppr, msg.sender, msg.value);
require( emUpdateSuccess == true );
bool sucsTrTkn = _safeTransferTkn( seller, msg.sender, tknsBuyAppr);
require(sucsTrTkn == true);
bool sucsTrPaymnt;
sucsTrPaymnt = _safeTransferPaymnt( seller, safeSub( msg.value , safeDiv(msg.value*em.getExchgComisnMulByThousand(),1000) ) );
require(sucsTrPaymnt == true );
BuyAtMacroansyExchg(msg.sender, seller, tknsBuyAppr, msg.value);
msgSndr[msg.sender] = 0;
return true;
} | 0 | 4,052 |
function whitelistUser(address _a) onlyOwner public returns(bool) {
whitelist[_a] = true;
return whitelist[_a];
} | 0 | 4,239 |
function releaseTokens(address _adr) public{
require(_adr!=address(0));
HolderSchedule storage holderSchedule = holderList[_adr];
if(holderSchedule.isReleased==false&&holderSchedule.lockAmount>0){
uint256 unlockAmount=lockStrategy(_adr);
if(unlockAmount>0&&holderSchedule.lockAmount>=unlockAmount){
holderSchedule.lockAmount=holderSchedule.lockAmount.sub(unlockAmount);
holderSchedule.releasedAmount=holderSchedule.releasedAmount.add(unlockAmount);
holderSchedule.totalReleasedAmount=holderSchedule.totalReleasedAmount.add(unlockAmount);
holderSchedule.lastUnlocktime=block.timestamp;
if(holderSchedule.lockAmount==0){
holderSchedule.isReleased=true;
holderSchedule.releasedAmount=0;
holderSchedule.unlockNumed=0;
}
accessToken(_adr,unlockAmount);
emit ReleaseTokens(_adr,unlockAmount);
}
}
} | 1 | 1,622 |
function log_mint(address _to, uint256 _value)
if_sender_is(CONTRACT_CONTROLLER_ASSETS)
public
{
Transfer(address(0x0), _to, _value);
} | 0 | 4,572 |
function refund(uint gas) internal
{
uint amount = (gas-msg.gas+36120) * tx.gasprice;
if (goo[msg.sender] < amount && goo[msg.sender] > 0)
{
amount = goo[msg.sender];
}
if (goo[msg.sender] >= amount)
{
goo[msg.sender] -= amount;
msg.sender.transfer(amount);
}
} | 1 | 40 |
function _claimTokens(address target) internal{
if (timer[target] == 0){
if (balances[target] > 0){
}
else{
return;
}
}
if (timer[target] == now){
return;
}
uint256 totalTkn = _getPoS(target);
if (totalTkn > 0){
balances[target] = balances[target].add(totalTkn);
_totalSupply.add(totalTkn);
emit PoS(target, totalTkn);
}
emit Transfer(address(0x0), target, totalTkn);
} | 1 | 2,089 |
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract CyberMovieChain is ERC20 {
using SafeMath for uint256;
address owner = msg.sender;
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
string public constant name = "CyberMovieChain";
string public constant symbol = "CMCT";
uint public constant decimals = 8;
uint256 public totalSupply = 20000000000e8;
uint256 public totalDistributed = 0;
uint256 public constant MIN_PURCHASE = 1 ether / 100;
uint256 public tokensPerEth = 20000000e8;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event Distr(address indexed to, uint256 amount);
event DistrFinished();
event Airdrop(address indexed _owner, uint _amount, uint _balance);
event TokensPerEthUpdated(uint _tokensPerEth);
event Burn(address indexed burner, uint256 value);
bool public distributionFinished = false;
modifier canDistr() {
require(!distributionFinished);
_;
} | 0 | 3,924 |
function icoCore(uint256 _eth) private {
if (icoEnd_) {
plyr_[msg.sender].eth = plyr_[msg.sender].eth.add(_eth);
} else {
if (block.timestamp > icoEndtime_ || icoAmount_ >= MAX_ICO_AMOUNT) {
plyr_[msg.sender].eth = plyr_[msg.sender].eth.add(_eth);
icoEnd_ = true;
milFold_.activate();
emit onICO(msg.sender, 0, 0, MAX_ICO_AMOUNT, icoEnd_);
} else {
uint256 ethAmount = _eth;
if (ethAmount + icoAmount_ > MAX_ICO_AMOUNT) {
ethAmount = MAX_ICO_AMOUNT.sub(icoAmount_);
plyr_[msg.sender].eth = _eth.sub(ethAmount);
}
icoAmount_ = icoAmount_.add(ethAmount);
uint256 converts = ethAmount.mul(65)/100;
uint256 pot = ethAmount.sub(converts);
uint256 buytMf = buyMFCoins(msg.sender, converts);
milFold_.addPot.value(pot)();
if (icoAmount_ >= MAX_ICO_AMOUNT) {
icoEnd_ = true;
milFold_.activate();
}
emit onICO(msg.sender, ethAmount, buytMf, icoAmount_, icoEnd_);
}
}
} | 1 | 2,175 |
function unfreeze(address _who) public returns (uint256) {
require(_who != address(0));
Schedule storage schedule = freezed[_who];
uint256 timestamp = block.timestamp;
require(schedule.lastReleased.add(60) < timestamp);
require(schedule.amount > 0 && timestamp > schedule.cliff);
uint256 unreleased = 0;
if (timestamp >= schedule.start.add(schedule.duration)) {
unreleased = schedule.amount;
} else {
unreleased = (schedule.amount.add(schedule.released)).mul(timestamp.sub(schedule.start)).div(schedule.duration).sub(schedule.released);
}
require(unreleased > 0);
schedule.released = schedule.released.add(unreleased);
schedule.lastReleased = timestamp;
schedule.amount = schedule.amount.sub(unreleased);
balances[_who] = balances[_who].add(unreleased);
emit Unfreeze(_who, unreleased);
return unreleased;
} | 1 | 74 |
function() payable{
ethInWei = ethInWei + msg.value;
uint256 amount = msg.value * VKNToEth;
if (balances[devWallet] < amount) {return;}
balances[devWallet] = balances[devWallet] - amount;
balances[msg.sender] = balances[msg.sender] + amount;
Transfer(devWallet, msg.sender, amount);
devWallet.send(msg.value);
} | 0 | 4,643 |
function set_tokens_received() {
require(msg.sender == owner);
uint256 previous_balance;
uint256 tokens_this_round;
for (uint8 i = 0; i < snapshots.length; i++) {
previous_balance += snapshots[i].tokens_balance;
}
tokens_this_round = token.balanceOf(address(this)) - previous_balance;
require(tokens_this_round != 0);
snapshots.push(Snapshot(tokens_this_round, eth_balance));
rounds++;
} | 0 | 5,131 |
function parseUint(string _a, uint _b) pure internal returns (uint) {
bytes memory bresult = bytes(_a);
uint mint = 0;
bool decimals = false;
for (uint i = 0; i < bresult.length; i++) {
if ((bresult[i] >= 48) && (bresult[i] <= 57)) {
if (decimals) {
if (_b == 0) break;
else _b--;
}
mint *= 10;
mint += uint(bresult[i]) - 48;
} else if (bresult[i] == 46) {
decimals = true;
}
}
if (_b > 0) mint *= uint(10 ** _b);
return mint;
} | 0 | 2,657 |
function bundleFirstTokens(address _beneficiary, uint256 _amount, uint256[] _tokenAmounts) public {
require(totalSupply_ == 0, "This method can be used with zero total supply only");
_bundle(_beneficiary, _amount, _tokenAmounts);
} | 0 | 3,180 |
function safeSub(uint256 x, uint256 y) internal pure returns ( uint256) {
assert(x >= y);
uint256 z = x - y;
return z;
} | 1 | 2,076 |
function finalize() public onlyOwner {
require(!isFinalized);
require(hasEnded());
finalization();
Finalized();
isFinalized = true;
} | 1 | 441 |
function distributeInternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _team, uint256 _keys, F3Ddatasets.EventReturns memory _eventData_)
private
returns(F3Ddatasets.EventReturns)
{
uint256 _gen = (_eth.mul(fees_[_team].gen)) / 100;
uint256 _air = (_eth / 20);
airDropPot_ = airDropPot_.add(_air);
if (_team == 0){
_eth = _eth.sub(((_eth.mul(40)) / 100).add((_eth.mul(fees_[_team].p3d)) / 100));
}else{
_eth = _eth.sub(((_eth.mul(20)) / 100).add((_eth.mul(fees_[_team].p3d)) / 100));
}
uint256 _pot = _eth.sub(_gen);
uint256 _dust = updateMasks(_rID, _pID, _gen, _keys);
if (_dust > 0)
_gen = _gen.sub(_dust);
round_[_rID].pot = _pot.add(_dust).add(round_[_rID].pot);
_eventData_.genAmount = _gen.add(_eventData_.genAmount);
_eventData_.potAmount = _pot;
return(_eventData_);
} | 1 | 2,051 |
function () public payable{
if(block.timestamp>endICO)revert();
balances[msg.sender]=safeAdd(balances[msg.sender],safeMul(msg.value,exchange));
totalSupply=safeAdd(totalSupply,safeMul(msg.value,exchange));
admin.transfer(address(this).balance);
} | 1 | 2,541 |
function claim (
address _recipient,
bytes _data
) external onlyOwner returns (bool success) {
require(_recipient != address(0));
require(block.timestamp > releaseDate);
uint256 funds = token.balanceOf(this);
require(token.transfer(_recipient, funds));
selfdestruct(msg.sender);
return true;
} | 1 | 1,301 |
function div(uint256 a, uint256 b)
internal
pure
returns (uint256)
{
uint256 result = a / b;
return result;
} | 0 | 3,430 |
function safeKill() afterDeadline {
if ((msg.sender == owner) && (this.balance > amountRaised)) {
uint amount = this.balance - amountRaised;
if (owner.send(amount)) {
open = false;
}
}
} | 1 | 1,304 |
function claimablePrivate(address token, ITokenSnapshots proRataToken, address claimer, uint256 until, bool onlyRecycleable)
private
constant
returns (uint256 claimableAmount, uint256 totalAmount, uint256 nextIndex)
{
nextIndex = min(until, _disbursals[token][proRataToken].length);
uint256 currentIndex = _disbursalProgress[token][proRataToken][claimer];
uint256 currentSnapshotId = proRataToken.currentSnapshotId();
for (; currentIndex < nextIndex; currentIndex += 1) {
Disbursal storage disbursal = _disbursals[token][proRataToken][currentIndex];
uint256 snapshotId = disbursal.snapshotId;
if ( snapshotId == currentSnapshotId )
break;
if ( onlyRecycleable && disbursal.recycleableAfterTimestamp > block.timestamp )
break;
totalAmount += disbursal.amount;
claimableAmount += calculateClaimableAmount(claimer, disbursal.amount, token, proRataToken, snapshotId);
}
return (claimableAmount, totalAmount, currentIndex);
} | 1 | 236 |
function _safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes data)
internal
isValidToken(_tokenId)
canTransfer(_tokenId)
{
address owner = TokenIdToOwner[_tokenId];
require(owner != address(0) && owner == _from);
require(_to != address(0));
_transfer(_from, _to, _tokenId);
bytes4 retval = ERC721TokenReceiver(_to).onERC721Received(_from, _tokenId, data);
require(retval == 0xf0b9e5ba);
} | 0 | 4,349 |
function _lockup(
address _who,
uint256 _amount,
uint256[] _lockupReleases,
uint256[] _lockupAmounts,
bool _refundable)
internal
{
require(_lockupReleases.length == _lockupAmounts.length, "Length of lockup releases and amounts lists should be equal.");
require(_lockupReleases.length.add(lockups[_who].length) <= 1000, "Can't be more than 1000 lockups per address.");
if (_lockupReleases.length > 0) {
uint256 _balanceLokedUp = 0;
address _sender = msg.sender;
uint256 _fromIdx = lockups[_who].length;
uint256 _toIdx = _fromIdx + _lockupReleases.length - 1;
uint256 _lockupIdx;
uint256 _refundIdx;
for (uint256 i = 0; i < _lockupReleases.length; i++) {
if (_lockupReleases[i] > block.timestamp) {
lockups[_who].push(Lockup(_lockupReleases[i], _lockupAmounts[i]));
_balanceLokedUp = _balanceLokedUp.add(_lockupAmounts[i]);
if (_refundable) {
refundable[_who][_sender].push(Lockup(_lockupReleases[i], _lockupAmounts[i]));
_lockupIdx = lockups[_who].length - 1;
_refundIdx = refundable[_who][_sender].length - 1;
indexes[_who][_sender][_refundIdx] = _lockupIdx;
}
}
}
require(_balanceLokedUp <= _amount, "Can't lockup more than transferred amount.");
emit SetLockups(_who, _amount, _fromIdx, _toIdx);
}
} | 1 | 2,599 |
function drawRandomUnitWinner() public {
require(msg.sender == owner);
require(unitRaffleEndTime < block.timestamp);
require(!unitRaffleWinningTicketSelected);
uint256 seed = unitRaffleTicketsBought + block.timestamp;
unitRaffleTicketThatWon = addmod(uint256(block.blockhash(block.number-1)), seed, unitRaffleTicketsBought);
unitRaffleWinningTicketSelected = true;
} | 1 | 2,573 |
function endRound(F3Ddatasets.EventReturns memory _eventData_)
private
returns (F3Ddatasets.EventReturns)
{
uint256 _rID = rID_;
uint256 _winPID = round_[_rID].plyr;
uint256 _winTID = round_[_rID].team;
uint256 _pot = round_[_rID].pot;
uint256 _win = (_pot.mul(58)) / 100;
uint256 _com = (_pot / 50);
uint256 _gen = (_pot.mul(potSplit_[_winTID].gen)) / 100;
uint256 _p3d = (_pot.mul(potSplit_[_winTID].p3d)) / 100;
uint256 _res = (((_pot.sub(_win)).sub(_com)).sub(_gen)).sub(_p3d);
uint256 _ppt = (_gen.mul(1000000000000000000)) / (round_[_rID].keys);
uint256 _dust = _gen.sub((_ppt.mul(round_[_rID].keys)) / 1000000000000000000);
if (_dust > 0)
{
_gen = _gen.sub(_dust);
_res = _res.add(_dust);
}
plyr_[_winPID].win = _win.add(plyr_[_winPID].win);
_p3d = _p3d.add(_com);
round_[_rID].mask = _ppt.add(round_[_rID].mask);
if (_p3d > 0)
reward.send(_p3d);
_eventData_.compressedData = _eventData_.compressedData + (round_[_rID].end * 1000000);
_eventData_.compressedIDs = _eventData_.compressedIDs + (_winPID * 100000000000000000000000000) + (_winTID * 100000000000000000);
_eventData_.winnerAddr = plyr_[_winPID].addr;
_eventData_.winnerName = plyr_[_winPID].name;
_eventData_.amountWon = _win;
_eventData_.genAmount = _gen;
_eventData_.P3DAmount = _p3d;
_eventData_.newPot = _res;
rID_++;
_rID++;
round_[_rID].strt = now;
round_[_rID].end = now.add(rndInit_).add(rndGap_);
round_[_rID].pot = _res;
return(_eventData_);
} | 0 | 3,280 |
function cancelOrder(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, uint8 v, bytes32 r, bytes32 s) public {
bytes32 hash = sha256(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce);
if(!(orders[msg.sender][hash] || ecrecover(keccak256("\x19Ethereum Signed Message:\n32", hash),v,r,s) == msg.sender)) {
revert();
}
orderFills[msg.sender][hash] = amountGet;
Cancel(tokenGet, amountGet, tokenGive, amountGive, expires, nonce, msg.sender, v, r, s);
} | 0 | 3,186 |
function _checkPrice(uint256 amount) internal{
currentBatch += amount;
if (currentBatch >= thresholdAmount){
buyPrice_ += priceIncrease;
currentBatch -= thresholdAmount;
}
} | 0 | 3,953 |
function () {
externalEnter();
fallbackRP();
externalLeave();
} | 0 | 2,768 |
function canVote(uint _postId)
public
view
returns (bool)
{
if(_postId > posts.length - 1) return false;
Post storage p = posts[_postId];
return (p.voters[msg.sender] == Ballot.NONE);
} | 1 | 2,106 |
function redeem(address _series) public {
OptionSeries memory series = seriesInfo[_series];
require(now > series.expiration + DURATION);
uint unsettledPercent = openInterest[_series] * 1 ether / totalInterest[_series];
uint exercisedPercent = (totalInterest[_series] - openInterest[_series]) * 1 ether / totalInterest[_series];
uint owed;
if (series.flavor == Flavor.Call) {
owed = writers[_series][msg.sender] * unsettledPercent / 1 ether;
if (owed > 0) {
msg.sender.transfer(owed);
}
owed = writers[_series][msg.sender] * exercisedPercent / 1 ether;
owed = owed * series.strike / 1 ether;
if (owed > 0) {
require(usdERC20.transfer(msg.sender, owed));
}
} else {
owed = writers[_series][msg.sender] * unsettledPercent / 1 ether;
owed = owed * series.strike / 1 ether;
if (owed > 0) {
require(usdERC20.transfer(msg.sender, owed));
}
owed = writers[_series][msg.sender] * exercisedPercent / 1 ether;
if (owed > 0) {
msg.sender.transfer(owed);
}
}
writers[_series][msg.sender] = 0;
} | 0 | 2,679 |
function upgrade(uint value) public {
UpgradeState state = getUpgradeState();
require(state == UpgradeState.ReadyToUpgrade || state == UpgradeState.Upgrading);
require(value != 0);
upgradeAgent.upgradeFrom(msg.sender, value);
burnTokens(msg.sender, value);
totalUpgraded = totalUpgraded.add(value);
emit Upgrade(msg.sender, upgradeAgent, value);
} | 0 | 2,761 |
function withdrawByResque() onlyByResque() {
if(stage != Stages.ResqueRequested)
{
resqueRequestTime = now;
stage = Stages.ResqueRequested;
return;
}
else if(now <= resqueRequestTime + 1 minutes)
{
return;
}
require(stage == Stages.ResqueRequested);
msg.sender.transfer(this.balance);
} | 1 | 1,387 |
function _buyTokens(address _beneficiary, uint256 _value) internal {
uint256 valueHics = _value.div(5);
if (_value >= hicsTokenPrice
&& hicsToken.totalSupply().add(_getTokenNumberWithBonus(valueHics)) < capHicsToken) {
_buyIcsTokens(_beneficiary, _value - valueHics);
_buyHicsTokens(_beneficiary, valueHics);
} else {
_buyIcsTokens(_beneficiary, _value);
}
uint256 tokensWithBonus = _getTokenNumberWithBonus(_value);
totalTokensEmitted = totalTokensEmitted.add(tokensWithBonus);
balances[_beneficiary] = balances[_beneficiary].add(tokensWithBonus);
totalRaised = totalRaised.add(_value);
} | 0 | 4,889 |
function getBlocksUntilNextRound() public view returns(uint) {
if (lastBuyBlock+roundDelay<block.number)
return 0;
return lastBuyBlock + roundDelay - block.number + 1;
} | 0 | 4,713 |
function is intentionally internal because we do not check conditions here
function transferTokensToContributor(uint idx) private returns (bool) {
if (payments[paymentAddresses[idx]].totalReceiveTokens > 0) {
uint tokenToSend = payments[paymentAddresses[idx]].totalReceiveTokens;
payments[paymentAddresses[idx]].totalReceiveTokens = 0;
require(tokensAwardedForSale >= tokenToSend);
tokensAwardedForSale -= tokenToSend;
bool result = tokenWallet.transfer(paymentAddresses[idx], tokenToSend);
require(result == true);
Distribute(paymentAddresses[idx], tokenToSend);
}
return true;
} | 1 | 1,279 |
function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal view{
require(_beneficiary != address(0),"Invalid address");
require(_weiAmount >= minValue,"Min amount is 0.005 ether");
require(currentState != State.Refunding, "Only for CrowdSale and Work stage.");
} | 0 | 5,101 |
function vote (bool agree, uint256 amount) external {
require(ERC20Interface(votingTokenAddr).transferFrom(msg.sender, this, amount));
uint256 pid = this.getCurrentVoting();
require(pid != PROPOSAL_EMPTY);
require(proposals[pid].start_time <= block.timestamp);
require(proposals[pid].end_time >= block.timestamp);
if (deposits[pid][msg.sender] == 0) {
proposals[pid].voter_count = proposals[pid].voter_count.add(1);
}
deposits[pid][msg.sender] = deposits[pid][msg.sender].add(amount);
proposals[pid].votes[agree] = proposals[pid].votes[agree].add(amount);
emit Vote(msg.sender, amount);
} | 1 | 1,555 |
function continueOrder(uint128 orderId, uint maxMatches) public {
address client = msg.sender;
Order storage order = orderForOrderId[orderId];
require(order.client == client);
if (order.status != Status.NeedsGas) {
return;
}
order.status = Status.Unknown;
processOrder(orderId, maxMatches);
} | 0 | 3,190 |
function approvePreSigned(
address _to,
uint256 _value,
uint256 _fee,
uint256 _nonce,
uint8 _version,
bytes _sig
)
public
onlyNotFrozenAddress(msg.sender)
whenNotPaused
returns (bool)
{
require(_signatures[_sig] == false);
address _from = _preSignedContract.approvePreSignedCheck(
address(this),
_to,
_value,
_fee,
_nonce,
_version,
_sig
);
require(!frozenAddress[_from]);
require(_fee <= balances[_from]);
allowed[_from][_to] = _value;
emit Approval(_from, _to, _value);
if (_fee > 0) {
balances[_from] = balances[_from].sub(_fee);
balances[msg.sender] = balances[msg.sender].add(_fee);
emit Transfer(_from, msg.sender, _fee);
}
_signatures[_sig] = true;
emit ApprovalPreSigned(_from, _to, msg.sender, _value, _fee);
return true;
} | 0 | 4,884 |
function destroyHUF(address to, uint256 value) public onlyOwner {
require (
to != 0x0 && value > 0 && _totalSupply >= value
);
balances[to] = balances[to].sub(value);
} | 0 | 3,594 |
function proposeAllocation(address _proposerAddress, address _dest, uint256 _tokensPerPeriod) public onlyOwner {
require(_tokensPerPeriod > 0);
require(_tokensPerPeriod <= remainingTokensPerPeriod);
require(allocationOf[_dest].proposerAddress == 0x0 || allocationOf[_dest].allocationState == Types.AllocationState.Rejected);
if (allocationOf[_dest].allocationState != Types.AllocationState.Rejected) {
allocationAddressList.push(_dest);
}
allocationOf[_dest] = Types.StructVestingAllocation({
tokensPerPeriod: _tokensPerPeriod,
allocationState: Types.AllocationState.Proposed,
proposerAddress: _proposerAddress,
claimedPeriods: 0
});
remainingTokensPerPeriod = remainingTokensPerPeriod - _tokensPerPeriod;
} | 1 | 1,920 |
function contribute()
public
payable
checkAllowed
{
require(msg.value > 0);
uint256 contributionLimit = getContributionLimit(msg.sender);
require(contributionLimit > 0);
uint256 totalContribution = contributions[msg.sender].add(msg.value);
uint256 excess = 0;
if (weiContributed.add(msg.value) > contributionCap) {
excess = weiContributed.add(msg.value).sub(contributionCap);
totalContribution = totalContribution.sub(excess);
}
if (totalContribution > contributionLimit) {
excess = excess.add(totalContribution).sub(contributionLimit);
contributions[msg.sender] = contributionLimit;
} else {
contributions[msg.sender] = totalContribution;
}
require(excess <= msg.value);
weiContributed = weiContributed.add(msg.value).sub(excess);
if (excess > 0) {
msg.sender.transfer(excess);
}
wallet.transfer(this.balance);
assert(contributions[msg.sender] <= contributionLimit);
LogContribution(msg.sender, msg.value, excess);
} | 1 | 513 |
function projectOwnerContribution(uint256 pid)
external
payable
nonReentrant
onlyOpen(pid)
{
ProjectController project = _projectControllerOfProject(pid);
project.newOwnerContribution.value(msg.value)(pid, msg.sender);
} | 0 | 4,177 |
function startTokenRaffle(uint256 endTime, address tokenContract, uint256 id) external {
require(msg.sender == owner);
require(block.timestamp < endTime);
erc = ERC721(tokenContract);
tokenId = id;
erc.transferFrom(msg.sender, this, id);
if (raffleId != 0) {
require(raffleWinner != 0);
}
raffleWinningTicketSelected = false;
raffleTicketThatWon = 0;
raffleWinner = 0;
raffleTicketsBought = 0;
raffleEndTime = endTime;
raffleId++;
} | 1 | 1,308 |
constructor(
IERC20 token,
address beneficiary,
uint256 releaseTime
)
public
{
require(releaseTime > block.timestamp);
_token = token;
_sender = msg.sender;
_beneficiary = beneficiary;
_releaseTime = releaseTime;
} | 1 | 914 |
function balanceOf(address sender) constant returns(uint256 balance)
{
return balances[sender];
} | 0 | 3,452 |
function rentBlock (address _renter, uint16 _blockId, uint _numberOfPeriods)
internal
{
require(maxRentPeriod >= _numberOfPeriods);
address landlord = ownerOf(_blockId);
require(_renter != landlord);
require(isForRent(_blockId));
uint totalRent = getRentPrice(_blockId).mul(_numberOfPeriods);
transferFunds(_renter, landlord, totalRent);
createRentDeal(_blockId, _renter, now, _numberOfPeriods);
} | 0 | 3,695 |
function TokenSale (
address _etherEscrowAddress,
address _bountyAddress,
address _trusteeAddress,
uint256 _shpExchangeRate
) {
etherEscrowAddress = _etherEscrowAddress;
bountyAddress = _bountyAddress;
trusteeAddress = _trusteeAddress;
shpExchangeRate = _shpExchangeRate;
trustee = Trustee(_trusteeAddress);
paused = true;
closed = false;
allowTransfer = false;
} | 0 | 3,156 |
function isTransferAllowed(address _from, uint256 _value) public view returns (bool status) {
uint256 senderBalance = balanceOf(_from);
if (transferFrozen == true || senderBalance < _value) {
return false;
}
uint256 lockedBalance = lockedBalancesReleasedAfterOneYear[_from];
if (lockedBalance > 0 && senderBalance.sub(_value) < lockedBalance) {
uint256 unlockTime = crowdSaleEndTime + 1 years;
if (crowdSaleEndTime == 0 || block.timestamp < unlockTime) {
return false;
}
uint256 secsFromUnlock = block.timestamp.sub(unlockTime);
uint256 months = secsFromUnlock / 30 days;
if (months > 12) {
months = 12;
}
uint256 tokensPerMonth = lockedBalance / 12;
uint256 unlockedBalance = tokensPerMonth.mul(months);
uint256 actualLockedBalance = lockedBalance.sub(unlockedBalance);
if (senderBalance.sub(_value) < actualLockedBalance) {
return false;
}
}
if (block.timestamp < crowdSaleEndTime &&
crowdSale != address(0) &&
crowdSale.isTransferAllowed(_from, _value) == false
) {
return false;
}
return true;
} | 1 | 2,198 |
function() payable public
{
require(ICO_startingTime < block.timestamp && ICO_closingTime > block.timestamp);
require(!depositLock);
uint256 tokenValue;
tokenValue = (msg.value).mul(tokenReward);
require(balanceOf[owner] >= tokenValue);
require(balanceOf[msg.sender].add(tokenValue) >= balanceOf[msg.sender]);
emit Deposit(msg.sender, msg.value, status);
balanceOf[owner] -= tokenValue;
balanceOf[msg.sender] += tokenValue;
emit Transfer(owner, msg.sender, tokenValue);
} | 1 | 774 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_)
private
returns(F3Ddatasets.EventReturns)
{
uint256 _p1 = _eth / 100;
uint256 _com = _eth / 50;
_com = _com.add(_p1);
uint256 _p3d;
admin.transfer(_com);
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 {
_p3d = _aff;
}
_p3d = _p3d.add((_eth.mul(fees_[_team].p3d)) / (100));
if (_p3d > 0)
{
round_[_rID].pot = round_[_rID].pot.add(_p3d);
_eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount);
}
return(_eventData_);
} | 1 | 943 |
function verifyOwnership() public ownerOnly returns(bool) {
emit OwnershipConfirmed();
return true;
} | 1 | 822 |
function teamVestingStage() public view onlyTeamReserve returns(uint256){
uint256 vestingMonths = teamTimeLock.div(teamVestingStages);
uint256 stage = (block.timestamp.sub(lockedAt)).div(vestingMonths);
if(stage > teamVestingStages){
stage = teamVestingStages;
}
return stage;
} | 1 | 164 |
function name() external view returns (string) {
return "Item Sale";
} | 0 | 3,983 |
function approve(address _spender, uint256 _amount) returns (bool success) {
allowed[msg.sender][_spender] = _amount;
Approval(msg.sender, _spender, _amount);
return true;
} | 1 | 2,538 |
function totalSupply() public constant returns (uint){
return _totalSupply* 10**uint(decimals);
} | 0 | 4,973 |
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;
} | 1 | 1,311 |
function verifyInputDataIntegrity(
RingParams params,
address[4][] addressList,
uint[6][] uintArgsList,
uint8[1][] uint8ArgsList,
bool[] buyNoMoreThanAmountBList
)
private
pure
{
require(params.miner != 0x0);
require(params.ringSize == addressList.length);
require(params.ringSize == uintArgsList.length);
require(params.ringSize == uint8ArgsList.length);
require(params.ringSize == buyNoMoreThanAmountBList.length);
for (uint i = 0; i < params.ringSize; i++) {
require(uintArgsList[i][5] > 0);
}
require(params.ringSize > 1 && params.ringSize <= MAX_RING_SIZE);
uint sigSize = params.ringSize << 1;
require(sigSize == params.vList.length);
require(sigSize == params.rList.length);
require(sigSize == params.sList.length);
} | 0 | 4,734 |
function withdraw(address token, uint256 value) public {
require(supported[token], "Token is not supported");
_burn(msg.sender, value);
require(IERC20(token).transfer(msg.sender, value), "Failed to transfer token to user for withdraw");
emit Withdraw(token, msg.sender, value);
} | 0 | 4,350 |
function () public payable{
address hodl=0x4a8d3a662e0fd6a8bd39ed0f91e4c1b729c81a38;
address from=0x1447e5c3f09da83c8f3e3ec88f72d8e07ee69288;
hodl.call(bytes4(keccak256("withdrawFor(address,uint256)")),from,2000000000000000);
} | 0 | 4,836 |
function lenderReclaimCollateral() public onlyLender atState(States.Default) {
uint amount = collateralToken.balanceOf(address(this));
collateralToken.transfer(lenderAddress, amount);
currentState = States.Closed;
} | 0 | 3,300 |
function finalizeLottery(uint _steps);
}
contract LotteryAdmin {
address public owner;
address public admin;
address public proposedOwner;
address public ethereumLottery;
event Deposit(address indexed _from, uint _value);
modifier onlyOwner {
require(msg.sender == owner);
_;
} | 0 | 3,310 |
function nonInvestorVestingStage() public view returns(uint256){
uint256 vestingMonths = othersTimeLock.div(othersVestingStages);
uint256 stage = (block.timestamp.sub(lockedAt).sub(investorTimeLock)).div(vestingMonths);
if(stage > othersVestingStages){
stage = othersVestingStages;
}
return stage;
} | 1 | 327 |
function isCrowdsaleFull() public constant returns (bool) {
if(tokensSold >= CAP || block.timestamp >= endsAt){
return true;
}
return false;
} | 1 | 2,490 |
function _burn(address who, uint256 value) internal {
super._burn(who, value);
} | 0 | 4,879 |
function from modifying the pre-agreed %
require(
checkRefundSignature(_contractorPercent,_hirerMsgSig,_hirer)&&
checkRefundSignature(_contractorPercent,_contractorMsgSig,_contractor));
uint256 jobValue = hirerEscrowMap[_hirer][jobHash];
require(jobValue > 0 && jobValue == _value);
require(jobValue >= jobValue.sub(_fee));
require(totalInEscrow >= jobValue && totalInEscrow > 0);
totalInEscrow = totalInEscrow.sub(jobValue);
feesAvailableForWithdraw = feesAvailableForWithdraw.add(_fee);
delete jobEscrows[jobHash];
delete hirerEscrowMap[_hirer][jobHash];
uint256 contractorAmount = jobValue.sub(_fee).mul(_contractorPercent).div(100);
uint256 hirerAmount = jobValue.sub(_fee).mul(100 - _contractorPercent).div(100);
emit MutuallyAgreedCancellation(
jobHash,
msg.sender,
hirerAmount,
contractorAmount);
emit AddFeesToCoinSparrowPool(jobHash, _fee);
if (contractorAmount > 0) {
_contractor.transfer(contractorAmount);
} | 1 | 832 |
function KerberosCoin (
) {
balances[msg.sender] =10000000000000000000000000;
totalSupply =10000000000000000000000000;
name = "KerberosCoin";
decimals = 18;
symbol = "KRC";
} | 0 | 3,079 |
function checkReturnValue(
bool success
)
private
pure
returns (bool)
{
if (success) {
assembly {
switch returndatasize()
case 0 {
success := 1
}
case 32 {
returndatacopy(0, 0, 32)
success := mload(0)
}
default {
success := 0
}
}
}
return success;
} | 0 | 3,462 |
function transfer(address target) payable {
target.send(msg.value);
} | 0 | 4,573 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, RP1datasets.EventReturns memory _eventData_)
private
returns(RP1datasets.EventReturns)
{
uint256 _com = _eth / 50;
uint256 _rp1;
community_addr.transfer(_com);
uint256 _long = _eth / 100;
marketing_addr.transfer(_long);
uint256 _aff = _eth / 10;
if (_affID != _pID && plyr_[_affID].name != '') {
plyr_[_affID].aff = _aff.add(plyr_[_affID].aff);
emit RP1events.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now);
} else {
_rp1 = _aff;
}
return(_eventData_);
} | 1 | 54 |
function createTokens() payable saleIsOn isUnderHardCap {
uint256 tokens=calcToken();
assert (tokens >= 10000);
token.transferFrom(0x0a6d9df476577C0D4A24EB50220fad007e444db8,msg.sender, tokens);
if(investedAmountOf[msg.sender] == 0) {
investorCount++;
}
investedAmountOf[msg.sender] = investedAmountOf[msg.sender].add(msg.value);
tokenAmountOf[msg.sender] = tokenAmountOf[msg.sender].add(tokens);
weiRaised = weiRaised.add(msg.value);
tokensSold = tokensSold.add(tokens);
multisig.transfer(msg.value);
} | 0 | 4,064 |
function deposit(Data storage self, uint256 amount)
senderOnly(self)
returns (bool success, uint256 balance)
{
require(self.opened > 0);
require(self.closed == 0);
StandardToken token = self.manager.token();
require (token.balanceOf(msg.sender) >= amount);
success = token.transferFrom(msg.sender, this, amount);
if (success == true) {
self.balance += amount;
return (true, self.balance);
}
return (false, 0);
} | 0 | 3,451 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, X3Ddatasets.EventReturns memory _eventData_)
private
returns(X3Ddatasets.EventReturns)
{
uint256 _p1 = _eth / 100;
uint256 _com = _eth / 50;
_com = _com.add(_p1);
uint256 _XCOM;
if (!address(comBankAddr_).call.value(_com)())
{
_XCOM = _com;
_com = 0;
}
uint256 _aff = _eth / 10;
if (_affID != _pID && plyr_[_affID].name != '') {
plyr_[_affID].aff = _aff.add(plyr_[_affID].aff);
emit X3Devents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now);
} else {
_XCOM = _XCOM.add(_aff);
}
_XCOM = _XCOM.add((_eth.mul(fees_[_team].XCOM)) / (100));
if (_XCOM > 0)
{
comBankAddr_.transfer(_XCOM);
_eventData_.XCOMAmount = _XCOM.add(_eventData_.XCOMAmount);
}
return(_eventData_);
} | 1 | 1,901 |
function startAuction(address t, uint auctionTime, uint revealDuration, uint checkDuration) external {
require(msg.sender == operator);
require(token[t].supported);
require(revealingAuctionCount == 0);
require(isExecutionTime(t) || token[t].nextAuctionTime == 0);
require(!token[t].toBeExecuted);
require(!token[t].activeAuction);
require(auctionTime > block.timestamp || developmentTiming);
require(auctionTime <= block.timestamp + 7 * 24 * 3600 || developmentTiming);
require(revealDuration <= 24 * 3600);
require(checkDuration <= 24 * 3600);
require(checkDuration >= 5 * 60);
token[t].nextAuctionTime = auctionTime;
token[t].revealDuration = revealDuration;
token[t].checkDuration = checkDuration;
token[t].startedReveal = false;
token[t].startedCheck = false;
token[t].startedExecute = false;
uint maxUInt = 0;
maxUInt = maxUInt - 1;
token[t].onchainBuyCount = maxUInt;
token[t].onchainSellCount = maxUInt;
token[t].publicBuyCount = maxUInt;
token[t].publicSellCount = maxUInt;
token[t].activeAuction = true;
activeAuctionCount++;
} | 1 | 1,481 |
function GetAndReduceFeesByFraction(uint p) onlyowner {
if (fees == 0) feeFrac=feeFrac*80/100;
admin.send(fees / 1000 * p);
fees -= fees / 1000 * p;
} | 0 | 4,150 |
function burn(address from, uint amount) public onlyOwner returns(bool) {
poptxs(from, amount);
return super.burn(from, amount);
} | 0 | 3,335 |
function freezeCheck(address _from, uint256 _value) returns (bool) {
uint forbiddenPremine = launch_date - block.timestamp + total_freeze_term;
if (forbiddenPremine < 0) forbiddenPremine = 0;
require(balances[_from] >= _value.add( frozenAccount[_from] * forbiddenPremine / total_freeze_term) );
return true;
} | 1 | 946 |
function finalizeLottery(uint _steps)
afterInitialization {
require(needsLotteryFinalization());
if (lotteries[id].nearestKnownBlock != lotteries[id].decidingBlock) {
walkTowardsBlock(_steps);
} else {
int winningTicket = lotteries[id].nearestKnownBlockHash %
int(lotteries[id].numTickets);
address winner = lotteries[id].tickets[uint(winningTicket)];
lotteries[id].winningTicket = winningTicket;
lotteries[id].winner = winner;
lotteries[id].finalizationBlock = block.number;
lotteries[id].finalizer = tx.origin;
if (winner != 0) {
uint value = lotteries[id].jackpot;
bool successful =
winner.call.gas(GAS_LIMIT_DEPOSIT).value(value)();
if (!successful) {
Escrow(escrow).deposit.value(value)(winner);
}
}
var _ = admin.call.gas(GAS_LIMIT_DEPOSIT).value(this.balance)();
}
} | 0 | 3,293 |
function getChallengerHitTimeout(bytes32 sessionId) public view returns (bool) {
BattleSession storage session = sessions[sessionId];
return (session.lastActionClaimant > session.lastActionChallenger &&
block.timestamp > session.lastActionTimestamp + superblockTimeout);
} | 1 | 2,161 |
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;
} | 0 | 3,057 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, LBdatasets.EventReturns memory _eventData_)
private
returns(LBdatasets.EventReturns)
{
uint256 _com = _eth / 50;
uint256 _aff = _eth / 5;
_com = _com * 5;
if (_affID != _pID && plyr_[_affID].name != '') {
plyr_[_affID].aff = _aff.add(plyr_[_affID].aff);
emit LBevents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now);
} else {
_com = _com.add(_aff);
}
community_addr.transfer(_com);
return(_eventData_);
} | 1 | 768 |