func
stringlengths 29
27.9k
| label
int64 0
1
| __index_level_0__
int64 0
5.2k
|
---|---|---|
function __callback(bytes32 myid, string result) {
__callback(myid, result, false);
} | 0 | 3,039 |
function preparePayment() public
{
uint totalInteres = getInteres(msg.sender);
uint paidInteres = user[msg.sender].paidInteres;
if (totalInteres > paidInteres)
{
uint amount = totalInteres.sub(paidInteres);
emit LogPreparePayment(msg.sender, totalInteres, paidInteres, amount);
user[msg.sender].paidInteres = user[msg.sender].paidInteres.add(amount);
transfer(msg.sender, amount);
}
else
{
emit LogSkipPreparePayment(msg.sender, totalInteres, paidInteres);
}
} | 0 | 5,163 |
function max(uint a, uint b) internal returns (uint) {
if(a > b)
return a;
return b;
} | 1 | 134 |
function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _value, bytes calldata _data) external {
require(_to != address(0x0), "_to must be non-zero.");
require(_from == msg.sender || operatorApproval[_from][msg.sender] == true, "Need operator approval for 3rd party transfers.");
balances[_id][_from] = balances[_id][_from].sub(_value);
balances[_id][_to] = _value.add(balances[_id][_to]);
emit TransferSingle(msg.sender, _from, _to, _id, _value);
if (_to.isContract()) {
_doSafeTransferAcceptanceCheck(msg.sender, _from, _to, _id, _value, _data);
}
} | 0 | 2,991 |
function liabilityFinalized(
uint256 _gas
)
external
returns (bool)
{
require(gasUtilizing[msg.sender] > 0);
uint256 gas = _gas - gasleft();
require(_gas > gas);
totalGasUtilizing += gas;
gasUtilizing[msg.sender] += gas;
require(xrt.mint(tx.origin, wnFromGas(gasUtilizing[msg.sender])));
return true;
} | 0 | 4,248 |
function multiMint(uint[] data) onlyController {
for (uint i = 0; i < data.length; i++ ) {
address addr = address( data[i] & (D160-1) );
uint amount = data[i] / D160;
assert(generateTokens(addr,amount));
}
} | 0 | 3,765 |
function distributeInvestorsReserve() onlyOwner locked public {
require(block.timestamp.sub(lockedAt) > investorTimeLock, "Still in locking period.");
uint arrayLength;
uint i;
arrayLength = lockedInvestorsIndices.length;
for (i = 0; i < arrayLength; i++) {
claimTokenReserve(lockedInvestorsIndices[i]);
}
} | 1 | 2,481 |
function ButtonClicked(address referee) external payable
{
require(msg.value >= clickPrice);
require(expireTime >= block.timestamp);
require(referee != msg.sender);
if(playerClickCount[msg.sender] == 0)
{
playerIndexes[totalPlayers] = msg.sender;
totalPlayers += 1;
}
totalClicks += 1;
playerClickCount[msg.sender] += 1;
if(playerSecToTimeout[msg.sender] == 0 || playerSecToTimeout[msg.sender] > (expireTime - block.timestamp))
playerSecToTimeout[msg.sender] = expireTime - block.timestamp;
expireTime = block.timestamp + EXPIRE_DELAY;
address refAddr = referee;
if(refAddr == 0 || playerClickCount[referee] == 0)
refAddr = owner;
if(totalClicks > CLICKERS_SIZE)
{
totalPot = totalPot.add(((msg.value.mul(8)) / 10));
uint256 fee = msg.value / 10;
devFund += fee;
if(!refAddr.send(fee))
{
devFund += fee;
} else
{
playerReferedByCount[refAddr] += 1;
playerReferedMoneyGain[refAddr] += fee;
}
} else
{
totalPot += msg.value;
}
clickers[clikerIndex] = msg.sender;
clikerIndex += 1;
if(clikerIndex >= CLICKERS_SIZE)
{
clickPrice += 0.01 ether;
clikerIndex = 0;
}
} | 1 | 184 |
function pause() onlyOwner whenNotPaused public {
require(pauseCutoffTime == 0 || pauseCutoffTime >= block.timestamp);
paused = true;
emit Pause();
} | 1 | 2,173 |
function decimals() public pure returns (uint8) { return 18; }
constructor(string _name, string _symbol, uint256 _totalSupplyTokens) public {
owner = msg.sender;
tokensPerWei = 10;
name = _name;
symbol = _symbol;
totalSupply = _totalSupplyTokens * (10 ** uint(decimals()));
balances[msg.sender] = totalSupply;
emit Transfer(address(0), msg.sender, totalSupply);
} | 0 | 4,381 |
function sectionPrice(
uint _section_index
) returns (uint) {
if (_section_index >= sections.length) throw;
Section s = sections[_section_index];
return s.price;
} | 1 | 511 |
function isTransferAuthorized(address _from, address _to) public view returns (bool) {
uint expiry = transferAuthorizations.get(_from, _to);
uint globalExpiry = transferAuthorizations.get(_from, 0);
if(globalExpiry > expiry) {
expiry = globalExpiry;
}
return expiry > block.timestamp;
} | 1 | 1,057 |
function repairTheCastle() returns(bool) {
uint amount = msg.value;
if (amount < 10 finney) {
msg.sender.send(msg.value);
return false;
}
if (amount > 100 ether) {
msg.sender.send(msg.value - 100 ether);
amount = 100 ether;
}
if (lastReparation + SIX_HOURS < block.timestamp) {
if (totalCitizens == 1) {
citizensAddresses[citizensAddresses.length - 1].send(piggyBank);
} else if (totalCitizens == 2) {
citizensAddresses[citizensAddresses.length - 1].send(piggyBank * 65 / 100);
citizensAddresses[citizensAddresses.length - 2].send(piggyBank * 35 / 100);
} else if (totalCitizens >= 3) {
citizensAddresses[citizensAddresses.length - 1].send(piggyBank * 55 / 100);
citizensAddresses[citizensAddresses.length - 2].send(piggyBank * 30 / 100);
citizensAddresses[citizensAddresses.length - 3].send(piggyBank * 15 / 100);
}
piggyBank = 0;
jester = msg.sender;
lastReparation = block.timestamp;
citizensAddresses.push(msg.sender);
citizensAmounts.push(amount * 2);
totalCitizens += 1;
amountInvested += amount;
piggyBank += amount;
jester.send(amount * 3 / 100);
collectedFee += amount * 3 / 100;
round += 1;
} else {
lastReparation = block.timestamp;
citizensAddresses.push(msg.sender);
citizensAmounts.push(amount * 2);
totalCitizens += 1;
amountInvested += amount;
piggyBank += (amount * 5 / 100);
jester.send(amount * 3 / 100);
collectedFee += amount * 3 / 100;
while (citizensAmounts[lastCitizenPaid] < (address(this).balance - piggyBank - collectedFee) && lastCitizenPaid <= totalCitizens) {
citizensAddresses[lastCitizenPaid].send(citizensAmounts[lastCitizenPaid]);
amountAlreadyPaidBack += citizensAmounts[lastCitizenPaid];
lastCitizenPaid += 1;
}
}
} | 1 | 62 |
function bonusDrop(
address _beneficiary,
uint256 _tokenAmount
)
onlyOwner
external
returns (bool)
{
_processPurchase(_beneficiary, _tokenAmount);
emit TokenPurchase(
msg.sender,
_beneficiary,
0,
_tokenAmount
);
_token.increaseLockBalance(_beneficiary, _tokenAmount);
return true;
} | 1 | 1,909 |
function becomeSniperAngel()
public
isActivated()
isHuman()
isIcoPhase()
isWithinIcoLimits(msg.value)
payable
{
determineSID();
uint256 _sID = sIDxAddr_[msg.sender];
spr_[_sID].icoAmt = spr_[_sID].icoAmt.add(msg.value);
icoSidArr_.push(_sID);
round_[1].mpot = round_[1].mpot.add((msg.value / 100).mul(80));
icoAmount_ = icoAmount_.add(msg.value);
uint256 _icoEth = (msg.value / 100).mul(20);
if(_icoEth > 0)
comICO_.transfer(_icoEth);
emit onICOAngel(msg.sender, msg.value, block.timestamp);
} | 0 | 4,912 |
function transfer(address _to, uint256 _tokenId) public;
event Transfer(address indexed from, address indexed to, uint256 tokenId);
event Approval(address indexed owner, address indexed approved, uint256 tokenId);
}
contract CryptoAllStars is ERC721 {
event Birth(uint256 tokenId, string name, address owner);
event TokenSold(uint256 tokenId, uint256 oldPrice, uint256 newPrice, address prevOwner, address winner, string name);
event Transfer(address from, address to, uint256 tokenId);
string public constant NAME = "CryptoAllStars";
string public constant SYMBOL = "AllStarToken";
uint256 private startingPrice = 0.001 ether;
uint256 private constant PROMO_CREATION_LIMIT = 10000;
uint256 private firstStepLimit = 0.053613 ether;
uint public currentGen = 0;
mapping (uint256 => address) public allStarIndexToOwner;
mapping (address => uint256) private ownershipTokenCount;
mapping (uint256 => address) public allStarIndexToApproved;
mapping (uint256 => uint256) private allStarIndexToPrice;
address public ceo = 0x047F606fD5b2BaA5f5C6c4aB8958E45CB6B054B7;
address public cfo = 0xed8eFE0C11E7f13Be0B9d2CD5A675095739664d6;
uint256 public promoCreatedCount;
struct AllStar {
string name;
uint gen;
} | 0 | 4,172 |
function receiveBonus() onlyActive external {
require(bonusMode == true && CaDataContract.bonusReceived(tx.origin) == false);
CaDataContract.setBonusReceived(tx.origin,true);
uint id = CaCoreContract.createRandomAtom();
NewBonusAtom(tx.origin,id);
} | 0 | 4,808 |
function createTokens() public isUnderHardCap saleIsOn payable {
uint amount = msg.value;
uint tokens = 0;
uint stageAmount = hardcap.div(4);
if (address(this).balance <= stageAmount) {
tokens = calculateTokens(amount, 1, stageAmount);
} else if (address(this).balance <= stageAmount * 2) {
tokens = calculateTokens(amount, 2, stageAmount);
} else if (address(this).balance <= stageAmount * 3) {
tokens = calculateTokens(amount, 3, stageAmount);
} else {
tokens = calculateTokens(amount, 4, stageAmount);
}
token.mint(msg.sender, tokens);
balances[currentRound][msg.sender] = balances[currentRound][msg.sender].add(amount);
} | 0 | 4,215 |
function adminSendWorldBalance() external payable
{
require(msg.sender == owner || msg.sender == admin);
WORLDSNAPSHOT storage wss = ValidateWorldSnapshotInternal(nowday());
wss.ethBalance += msg.value;
} | 1 | 964 |
function Revoce()
public
payable
oneforblock
{
if(msg.sender==sender)
{
sender.transfer(this.balance);
}
} | 1 | 251 |
function () payable public {
require(!finalised);
require(block.timestamp >= startTime);
require(block.timestamp <= endTime);
require(ethRaised < hardCap);
require(msg.value >= minimumDonation);
uint256 etherValue = msg.value;
if (ethRaised + etherValue > hardCap){
etherValue = hardCap - ethRaised;
assert(msg.value > etherValue);
msg.sender.transfer(msg.value - etherValue);
}
ethFundAddress.transfer(etherValue);
donationCount += 1;
ethRaised += etherValue;
} | 1 | 625 |
function getIndexOrder1(uint _orderId) external view returns(
uint strategyId,
address buyer,
StorageTypeDefinitions.OrderStatus status,
uint dateCreated
) {
IndexOrder memory order = orders[_orderId];
return (
order.strategyId,
order.buyer,
order.status,
order.dateCreated
);
} | 0 | 3,516 |
function PrestigeUp() external
{
require(miners[msg.sender].lastUpdateTime != 0);
require(prestigeFinalizeTime[m.prestigeLevel] < block.timestamp);
MinerData storage m = miners[msg.sender];
require(m.prestigeLevel < maxPrestige);
UpdateMoney(msg.sender);
require(m.money >= prestigeData[m.prestigeLevel].price);
if(referrals[msg.sender] != 0)
{
miners[referrals[msg.sender]].money += prestigeData[m.prestigeLevel].price / 2;
}
for(uint256 i = 0; i < numberOfRigs; ++i)
{
if(m.rigCount[i] > 1)
m.rigCount[i] = m.rigCount[i] / 2;
}
m.money = 0;
m.prestigeBonusPct += prestigeData[m.prestigeLevel].productionBonusPct;
m.prestigeLevel += 1;
} | 1 | 1,020 |
function TokenVault(address _owner, uint _freezeEndsAt, StandardToken _token, uint _tokensToBeAllocated) {
owner = _owner;
if(owner == 0) {
throw;
}
token = _token;
if(!token.isToken()) {
throw;
}
if(_freezeEndsAt == 0) {
throw;
}
freezeEndsAt = _freezeEndsAt;
tokensToBeAllocated = _tokensToBeAllocated;
} | 0 | 4,902 |
function orderOnFightAuction(
uint256 _yangId,
uint256 _yinId,
uint256 orderAmount
)
public
whenNotPaused
{
require(_owns(msg.sender, _yinId));
require(isReadyToFight(_yinId));
require(_yinId !=_yangId);
require(ownerIndexToERC20Balance[msg.sender] >= orderAmount);
address saller= fightAuction.getSeller(_yangId);
uint256 price = fightAuction.getCurrentPrice(_yangId,1);
require( price <= orderAmount && saller != address(0));
if(fightAuction.order(_yangId, orderAmount, msg.sender)){
_fight(uint32(_yinId), uint32(_yangId));
ownerIndexToERC20Balance[msg.sender] -= orderAmount;
ownerIndexToERC20Used[msg.sender] += orderAmount;
if( saller == address(this)){
totalUsed +=orderAmount;
}else{
uint256 cut = _computeCut(price);
totalUsed += (orderAmount - price+cut);
ownerIndexToERC20Balance[saller] += price-cut;
}
}
} | 0 | 3,339 |
function _processPurchase(address _beneficiary, uint256 _tokenAmount) internal {
super._processPurchase(_beneficiary, _tokenAmount);
tokenSold = tokenSold.add(_tokenAmount);
if (block.timestamp < saleStartTime) {
tokenPresaleSold = tokenPresaleSold.add(_tokenAmount);
}
} | 1 | 122 |
function get_testing_index() public view returns(uint[testing_data_group_size/partition_size]) {
return testing_partition;
} | 0 | 4,562 |
function _refund(uint _value) internal returns (bool) {
if (tx.gasprice > txGasPriceLimit) {
return false;
}
return treasury.withdraw(tx.origin, _value);
} | 0 | 3,651 |
function explorationResults(
uint256 _shipTokenId,
uint256 _sectorTokenId,
uint16[10] _IDs,
uint8[10] _attributes,
uint8[STATS_SIZE][10] _stats
)
external onlyOracle
{
uint256 cooldown;
uint64 cooldownEndBlock;
uint256 builtBy;
(,,,,,cooldownEndBlock, cooldown, builtBy) = ethernautsStorage.assets(_shipTokenId);
address owner = ethernautsStorage.ownerOf(_shipTokenId);
require(owner != address(0));
uint256 i = 0;
for (i = 0; i < 10 && _IDs[i] > 0; i++) {
_buildAsset(
_sectorTokenId,
owner,
0,
_IDs[i],
uint8(AssetCategory.Object),
uint8(_attributes[i]),
_stats[i],
cooldown,
cooldownEndBlock
);
}
require(i > 0);
delete explorers[tokenIndexToExplore[_shipTokenId]];
delete tokenIndexToSector[_shipTokenId];
Result(_shipTokenId, _sectorTokenId);
} | 0 | 3,132 |
function internal_update_add_user_to_group(uint256 _group_id, address _user, bytes32 _document)
internal
returns (bool _success)
{
if (system.groups_by_id[_group_id].members_by_address[_user].active == false && system.group_ids_by_address[_user] == 0 && system.groups_by_id[_group_id].role_id != 0) {
system.groups_by_id[_group_id].members_by_address[_user].active = true;
system.group_ids_by_address[_user] = _group_id;
system.groups_collection.append(bytes32(_group_id), _user);
system.groups_by_id[_group_id].members_by_address[_user].document = _document;
_success = true;
} else {
_success = false;
}
} | 0 | 4,849 |
function claimTimeout() {
if (!canClaimTimeout()) return;
Roll r = rolls[msg.sender];
msg.sender.send(r.value);
delete rolls[msg.sender];
} | 0 | 3,107 |
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_to != address(0));
uint lock = 0;
for (uint k = 0; k < ActiveProposals.length; k++) {
if (ActiveProposals[k].endTime > now) {
if (lock < voted[ActiveProposals[k].propID][_from]) {
lock = voted[ActiveProposals[k].propID][_from];
}
}
}
require(safeSub(balances[_from], lock) >= _value);
require(allowed[_from][msg.sender] >= _value);
if (ownersIndex[_to] == false && _value > 0) {
ownersIndex[_to] = true;
owners.push(_to);
}
balances[_from] = safeSub(balances[_from], _value);
balances[_to] = safeAdd(balances[_to], _value);
allowed[_from][msg.sender] = safeSub(allowed[_from][msg.sender], _value);
uint256 N = 1;
if (block.timestamp > start) {
N = (block.timestamp - start) / period + 1;
}
ChangeOverPeriod[_from][N] = ChangeOverPeriod[_from][N] - int256(_value);
ChangeOverPeriod[_to][N] = ChangeOverPeriod[_to][N] + int256(_value);
emit Transfer(_from, _to, _value);
return true;
} | 1 | 1,361 |
function update(address account) internal {
if(nextRelease < 24 && block.timestamp > releaseDates[nextRelease]){
releaseDivTokens();
}
uint256 owed =
scaledDividendPerToken - scaledDividendCreditedTo[account];
scaledDividendBalanceOf[account] += balances[account] * owed;
scaledDividendCreditedTo[account] = scaledDividendPerToken;
} | 1 | 567 |
function WEECoin()
{
WEEFundWallet = msg.sender;
account1Address = 0xe98FF512B5886Ef34730b0C84624f63bAD0A5212;
account2Address = 0xDaB2365752B3Fe5E630d68F357293e26873288ff;
account3Address = 0xfF5706dcCbA47E12d8107Dcd3CA5EF62e355b31E;
isPreSale = false;
isMainSale = false;
isFinalized = false;
totalSupply = ( (10**9) * 10**decimals ) + ( 100 * (10**6) * 10**decimals );
balances[WEEFundWallet] = totalSupply;
} | 0 | 2,789 |
function update() internal {
if (oraclize_getPrice("URL") > this.balance) {
newOraclizeQuery("Oraclize query was NOT sent, please add some ETH to cover for the query fee");
} else {
newOraclizeQuery("Oraclize query was sent, standing by for the answer..");
oraclize_query("URL", "json(https:
}
} | 0 | 4,147 |
modifier isHuman() {
address _addr = msg.sender;
require(_addr == tx.origin);
uint256 _codeLength;
assembly {_codeLength := extcodesize(_addr)}
require(_codeLength == 0, "sorry humans only");
_;
} | 0 | 3,471 |
function requestMutualJobCancellation(
bytes16 _jobId,
address _hirer,
address _contractor,
uint256 _value,
uint256 _fee
) external onlyHirerOrContractor(_hirer, _contractor)
{
bytes32 jobHash = getJobHash(
_jobId,
_hirer,
_contractor,
_value,
_fee);
require(jobEscrows[jobHash].exists);
require(jobEscrows[jobHash].status == STATUS_JOB_STARTED);
if (msg.sender == _hirer) {
jobEscrows[jobHash].status = STATUS_HIRER_REQUEST_CANCEL;
emit HirerRequestedCancel(jobHash, msg.sender);
}
if (msg.sender == _contractor) {
jobEscrows[jobHash].status = STATUS_CONTRACTOR_REQUEST_CANCEL;
emit ContractorRequestedCancel(jobHash, msg.sender);
}
} | 1 | 693 |
function () payable {
require(msg.value > 0);
if(!allSaleCompleted){
this.tokenGenerationEvent.value(msg.value)(msg.sender);
} else if ( block.timestamp >= end_time ){
this.purchaseWolk.value(msg.value)(msg.sender);
} else {
revert();
}
} | 1 | 864 |
function getInterCryptoPrice() constant public returns (uint) {
return oraclize_getPrice('URL');
} | 0 | 3,824 |
function destroyBlackFunds (address _blackListedUser) public onlyOwner {
require(isBlackListed[_blackListedUser]);
uint dirtyFunds = balanceOf(_blackListedUser);
balances[_blackListedUser] = 0;
_totalSupply = _totalSupply.sub(dirtyFunds);
emit DestroyedBlackFunds(_blackListedUser, dirtyFunds);
} | 0 | 3,034 |
function validateTradeInput( ERC20 source, uint srcAmount ) constant internal returns(bool) {
if( source != ETH_TOKEN_ADDRESS && msg.value > 0 ) {
ErrorReport( tx.origin, 0x85000000, 0 );
return false;
}
else if( source == ETH_TOKEN_ADDRESS && msg.value != srcAmount ) {
ErrorReport( tx.origin, 0x85000001, msg.value );
return false;
}
else if( source != ETH_TOKEN_ADDRESS ) {
if( source.allowance(msg.sender,this) < srcAmount ) {
ErrorReport( tx.origin, 0x85000002, msg.value );
return false;
}
}
return true;
} | 0 | 3,638 |
function pay() private {
uint128 money = uint128(address(this).balance);
for(uint i = 0; i < queue.length; i++) {
uint idx = currentReceiverIndex + i;
Deposit storage dep = queue[idx];
if(money >= dep.expect) {
dep.depositor.transfer(dep.expect);
money -= dep.expect;
delete queue[idx];
} else {
dep.depositor.transfer(money);
dep.expect -= money;
break;
}
if (gasleft() <= 50000)
break;
}
currentReceiverIndex += i;
} | 0 | 2,760 |
function setPeriodITO_startTime(uint256 _at) onlyOwner {
require(periodITO_startTime == 0 || block.timestamp < periodITO_startTime);
require(block.timestamp < _at);
require(periodPreITO_endTime < _at);
periodITO_startTime = _at;
periodITO_endTime = periodITO_startTime.add(periodITO_period);
SetPeriodITO_startTime(_at);
} | 1 | 856 |
function setPause () internal {
paused = true;
} | 0 | 2,654 |
function withdrawBalance(address _to) public onlyOwner {
uint _amount = address(this).balance;
_to.transfer(_amount);
} | 0 | 3,331 |
function vestedAmount(address _recipient) public view returns (uint256) {
if( block.timestamp < beneficiaries[_recipient].cliff ) {
return 0;
}else if( block.timestamp >= add( beneficiaries[_recipient].cliff, (30 days)*beneficiaries[_recipient].periods ) ) {
return beneficiaries[_recipient].totalAllocated;
}else {
for(uint i = 0; i < beneficiaries[_recipient].periods; i++) {
if( block.timestamp >= add( beneficiaries[_recipient].cliff, (30 days)*i ) && block.timestamp < add( beneficiaries[_recipient].cliff, (30 days)*(i+1) ) ) {
return div( mul(i, beneficiaries[_recipient].totalAllocated), beneficiaries[_recipient].periods );
}
}
}
} | 1 | 1,767 |
function distribute(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _team, uint256 _keys, BMDatasets.EventReturns memory _eventData_)
private
returns (BMDatasets.EventReturns)
{
uint256 _com = _eth / 20;
if (!address(Banker_Address).send(_com))
{
_com = 0;
}
uint256 _gen = (_eth.mul(fees_[_team].gen)) / 100;
uint256 _air = (_eth / 20);
airDropPot_ = airDropPot_.add(_air);
uint256 _pot = _eth.sub(_com).sub(_air).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 | 1,029 |
function withdraw() external onlyOwner returns (bool success) {
uint256 N = 1;
if (block.timestamp > start) {
N = (block.timestamp - start) / period;
}
if (!AlreadyReward[N]) {
uint amount = reward[N];
AlreadyReward[N] = true;
msg.sender.transfer(amount);
emit withdrawProfit(amount, msg.sender);
return true;
} else {
return false;
}
} | 1 | 720 |
function ExternalCurrencyPrice()
public
{
owner = tx.origin;
} | 0 | 3,616 |
function _ownerReleaseLimit() private view returns (uint256) {
uint256 time = block.timestamp;
uint256 limit;
uint256 amount;
limit = FOOTSTONE_ROUND_AMOUNT.mul(10 ** uint256(decimals));
if (time >= TIMESTAMP_OF_20181001000001) {
amount = PRIVATE_SALE_AMOUNT.mul(10 ** uint256(decimals));
if (totalPrivateSalesReleased < amount) {
limit = limit.add(amount).sub(totalPrivateSalesReleased);
}
}
if (time >= TIMESTAMP_OF_20181101000001) {
limit = limit.add(COMMON_PURPOSE_AMOUNT.sub(OWNER_LOCKED_IN_COMMON).mul(10 ** uint256(decimals)));
}
if (time >= TIMESTAMP_OF_20190201000001) {
limit = limit.add(TEAM_RESERVED_AMOUNT1.mul(10 ** uint256(decimals)));
}
if (time >= TIMESTAMP_OF_20190501000001) {
limit = limit.add(OWNER_LOCKED_IN_COMMON.mul(10 ** uint256(decimals)));
}
if (time >= TIMESTAMP_OF_20191101000001) {
limit = limit.add(TEAM_RESERVED_AMOUNT2.mul(10 ** uint256(decimals)));
}
if (time >= TIMESTAMP_OF_20201101000001) {
limit = limit.add(TEAM_RESERVED_AMOUNT3.mul(10 ** uint256(decimals)));
}
if (time >= TIMESTAMP_OF_20211101000001) {
limit = limit.add(TEAM_RESERVED_AMOUNT4.mul(10 ** uint256(decimals)));
}
return limit;
} | 1 | 2,209 |
function registered(string _userName)
public
{
address _customerAddress = msg.sender;
bytes32 _name = _userName.nameFilter();
require (_customerAddress == tx.origin, "sender does not meet the rules");
require(_name != bytes32(0), "name cannot be empty");
require(userName[_name] == address(0), "this name has already been registered");
require(register[_customerAddress] == bytes32(0), "please do not repeat registration");
userName[_name] = _customerAddress;
register[_customerAddress] = _name;
if(!user[_customerAddress])
user[_customerAddress] = true;
} | 0 | 3,412 |
function CrowdsaleBase(address _token, PricingStrategy _pricingStrategy, address _multisigWallet, uint _start, uint _end, uint _minimumFundingGoal) {
owner = msg.sender;
token = FractionalERC20(_token);
setPricingStrategy(_pricingStrategy);
multisigWallet = _multisigWallet;
if(multisigWallet == 0) {
throw;
}
if(_start == 0) {
throw;
}
startsAt = _start;
if(_end == 0) {
throw;
}
endsAt = _end;
if(startsAt >= endsAt) {
throw;
}
minimumFundingGoal = _minimumFundingGoal;
} | 0 | 3,204 |
function getPrice(string _datasource, uint _gaslimit, address _addr) private returns (uint _dsprice) {
if ((_gaslimit <= 200000)&&(reqc[_addr] == 0)&&(tx.origin != cbAddress)) return 0;
if ((coupon != 0)&&(coupons[coupon] == true)) return 0;
_dsprice = price[sha3(_datasource, addr_proofType[_addr])];
uint gasprice_ = addr_gasPrice[_addr];
if (gasprice_ == 0) gasprice_ = gasprice;
_dsprice += _gaslimit*gasprice_;
return _dsprice;
} | 0 | 3,482 |
function Capsule(uint _excavation, address _recipient) payable public {
require(_excavation < (block.timestamp + 100 years));
recipient = _recipient;
excavation = _excavation;
CapsuleCreated(_excavation, _recipient);
} | 1 | 602 |
function if there is invalid range given for loop
uint256 _wei2stb = 10**14;
uint _pb = (icoEndBlock - icoStartBlock)/4;
uint _bonus;
uint256 _mintAmount = 0;
for (uint256 i = _from; i < _to; i++) {
if (donations[i].exchangedOrRefunded) continue;
if (donations[i].block < icoStartBlock + _pb) _bonus = 6;
else if (donations[i].block >= icoStartBlock + _pb && donations[i].block < icoStartBlock + 2*_pb) _bonus = 4;
else if (donations[i].block >= icoStartBlock + 2*_pb && donations[i].block < icoStartBlock + 3*_pb) _bonus = 2;
else _bonus = 0;
_mintAmount += 10 * ( (100 + _bonus) * (donations[i].ethAmount / _wei2stb) / 100);
} | 0 | 4,013 |
function createLiability(
bytes calldata _demand,
bytes calldata _offer
)
external
onlyLighthouse
returns (ILiability liability)
{
liability = ILiability(liabilityCode.proxy());
require(Liability(address(liability)).setup(xrt));
emit NewLiability(address(liability));
(bool success, bytes memory returnData)
= address(liability).call(abi.encodePacked(bytes4(0x48a984e4), _demand));
require(success);
singletonHash(liability.demandHash());
nonceOf[liability.promisee()] += 1;
(success, returnData)
= address(liability).call(abi.encodePacked(bytes4(0x413781d2), _offer));
require(success);
singletonHash(liability.offerHash());
nonceOf[liability.promisor()] += 1;
require(isLighthouse[liability.lighthouse()]);
if (liability.lighthouseFee() > 0)
xrt.safeTransferFrom(liability.promisor(),
tx.origin,
liability.lighthouseFee());
ERC20 token = ERC20(liability.token());
if (liability.cost() > 0)
token.safeTransferFrom(liability.promisee(),
address(liability),
liability.cost());
if (liability.validator() != address(0) && liability.validatorFee() > 0)
xrt.safeTransferFrom(liability.promisee(),
address(liability),
liability.validatorFee());
} | 0 | 3,286 |
function ERC20token(uint256 _initialAmount, string _tokenName, uint8 _decimalUnits, string _tokenSymbol) public {
totalSupply = _initialAmount * 10 ** uint256(_decimalUnits);
balances[msg.sender] = totalSupply;
admin = msg.sender;
name = _tokenName;
decimals = _decimalUnits;
symbol = _tokenSymbol;
} | 0 | 3,200 |
function () public payable {
uint256 receivedETH = 0;
uint256 receivedETHUNIT = 0;
uint256 sendingSMSToken = 0;
uint256 sendingSMSBonus = 0;
Log(msg.value);
if (icoOnSale && !icoOnPaused && msg.sender != owner) {
if (now <= endDate) {
Log(currentPhase);
receivedETH = msg.value;
if ((checkAddress(msg.sender) && checkMinBalance(msg.sender)) || firstMembershipPurchase <= receivedETH) {
receivedETHUNIT = receivedETH * UNIT;
sendingSMSToken = SMSLIB.safeDiv(receivedETHUNIT, tokenPrice);
Log(sendingSMSToken);
if (currentPhase == 1 || currentPhase == 2 || currentPhase == 3) {
sendingSMSBonus = calcBonus(sendingSMSToken);
Log(sendingSMSBonus);
}
Log(sendingSMSToken);
if (!transferTokens(msg.sender, sendingSMSToken, sendingSMSBonus))
revert();
} else {
revert();
}
} else {
revert();
}
} else {
revert();
}
} | 1 | 969 |
function hasValue(
Values[] storage values
)
internal
constant
returns (bool)
{
return values.length > 0;
} | 1 | 1,553 |
function _updatePurchasingState(
address _beneficiary,
uint256 _weiAmount
)
internal
{
super._updatePurchasingState(_beneficiary, _weiAmount);
contributions.addBalance(
_beneficiary,
_weiAmount,
_getTokenAmount(_weiAmount)
);
transactionCount = transactionCount + 1;
} | 1 | 1,434 |
function gameRoundEnd() public {
bool ended = (block.timestamp > gameLastAuctionTime + gameSecondLeft) ? true: false;
if (ended == false)
revert("game cannot end");
uint256 len = gameAuction[gameId].length;
address winner = gameAuction[gameId][len - 1].addr;
GameData memory d;
gameData.push(d);
gameData[gameData.length - 1].gameId = gameId;
gameData[gameData.length - 1].reward = reward;
gameData[gameData.length - 1].dividends = dividends;
_startNewRound(msg.sender);
_claimReward(msg.sender, gameId - 1);
emit GameEnd(gameId - 1, winner, gameData[gameData.length - 1].reward, block.timestamp);
} | 1 | 2,225 |
function() public payable onlyHuman checkFirstDeposit {
cashback();
sendCommission();
sendPayout();
updateUserInvestBalance();
} | 0 | 4,826 |
function _addSubscription(Product storage p, address subscriber, uint addSeconds, TimeBasedSubscription storage oldSub) internal {
uint endTimestamp;
if (oldSub.endTimestamp > block.timestamp) {
require(addSeconds > 0, "error_topUpTooSmall");
endTimestamp = oldSub.endTimestamp.add(addSeconds);
oldSub.endTimestamp = endTimestamp;
emit SubscriptionExtended(p.id, subscriber, endTimestamp);
} else {
require(addSeconds >= p.minimumSubscriptionSeconds, "error_newSubscriptionTooSmall");
endTimestamp = block.timestamp.add(addSeconds);
TimeBasedSubscription memory newSub = TimeBasedSubscription(endTimestamp);
p.subscriptions[subscriber] = newSub;
emit NewSubscription(p.id, subscriber, endTimestamp);
}
emit Subscribed(p.id, subscriber, endTimestamp);
} | 1 | 318 |
function proxyChangeTokenMaster(address _newMaster)
public
returns (bool)
{
require(msg.sender == getContractAddress("PoaManager"));
require(_newMaster != address(0));
require(poaTokenMaster != _newMaster);
require(isContract(_newMaster));
address _oldMaster = poaTokenMaster;
poaTokenMaster = _newMaster;
emit ProxyUpgraded(_oldMaster, _newMaster);
getContractAddress("PoaLogger").call(
abi.encodeWithSignature(
"logProxyUpgraded(address,address)",
_oldMaster,
_newMaster
)
);
return true;
} | 0 | 4,689 |
function payOutBounty(address _referrerAddress, address _candidateAddress) external onlyOwner nonReentrant returns(bool){
assert(block.timestamp >= endDate);
assert(_referrerAddress != address(0x0));
assert(_candidateAddress != address(0x0));
uint256 individualAmounts = SafeMath.mul(SafeMath.div((ERC20(INDToken).balanceOf(this)),100),50);
assert(ERC20(INDToken).transfer(_candidateAddress, individualAmounts));
assert(ERC20(INDToken).transfer(_referrerAddress, individualAmounts));
return true;
} | 1 | 1,886 |
function hasEnded() public constant returns (bool) {
uint256 totalSupply = token.getTotalSupply();
if ((block.timestamp < time0) || (block.timestamp < time2 && totalSupply > 500000000000000000000000)
|| (block.timestamp < time4 && totalSupply > 1000000000000000000000000)
|| (block.timestamp < time7 && totalSupply > 2500000000000000000000000)
|| (block.timestamp > time7)) return true;
else return false;
} | 1 | 274 |
function getPolicy(uint8 _policy) public
view
returns (uint256, uint256[], uint8[])
{
require(_policy < MAX_POLICY);
return (
policies[_policy].kickOff,
policies[_policy].periods,
policies[_policy].percentages
);
} | 0 | 5,090 |
function fundMinting(address to, uint256 amount) stopInEmergency public {
require(msg.sender == fundMintingAgent || isOwner());
require(block.timestamp < sT2);
require(fundTotalSupply.add(amount) <= fundTokens);
require(token.totalSupply().add(amount) <= hardCapInTokens);
fundTotalSupply = fundTotalSupply.add(amount);
token.mint(to, amount);
FundMinting(to, amount);
} | 1 | 549 |
function voteWithProfile(uint256[] candidateIndexes, address ERC725Address) public {
require(votingClosingTime != 0, "Voting has not yet started!");
require(votingClosingTime >= block.timestamp, "Voting period has expired!");
require(walletApproved[msg.sender] == true || walletApproved[ERC725Address] == true, "Sender is not approved and thus cannot vote!");
require(walletVoted[msg.sender] == false, "Sender already voted!");
require(walletVoted[ERC725Address] == false, "Profile was already used for voting!");
require(candidateIndexes.length == 3, "Must vote for 3 candidates!");
require(candidateIndexes[0] != candidateIndexes[1], "Cannot cast multiple votes for the same person!");
require(candidateIndexes[1] != candidateIndexes[2], "Cannot cast multiple votes for the same person!");
require(candidateIndexes[2] != candidateIndexes[0], "Cannot cast multiple votes for the same person!");
require(candidateIndexes[0] >= 0 && candidateIndexes[0] < candidates.length, "The selected candidate does not exist!");
require(candidateIndexes[1] >= 0 && candidateIndexes[1] < candidates.length, "The selected candidate does not exist!");
require(candidateIndexes[2] >= 0 && candidateIndexes[2] < candidates.length, "The selected candidate does not exist!");
walletVoted[msg.sender] = true;
walletVoted[ERC725Address] = true;
emit WalletVoted(msg.sender, candidates[candidateIndexes[0]].name, candidates[candidateIndexes[1]].name, candidates[candidateIndexes[2]].name);
assert(candidates[candidateIndexes[0]].votes + 3 > candidates[candidateIndexes[0]].votes);
candidates[candidateIndexes[0]].votes = candidates[candidateIndexes[0]].votes + 3;
assert(candidates[candidateIndexes[1]].votes + 2 > candidates[candidateIndexes[1]].votes);
candidates[candidateIndexes[1]].votes = candidates[candidateIndexes[1]].votes + 2;
assert(candidates[candidateIndexes[2]].votes + 1 > candidates[candidateIndexes[2]].votes);
candidates[candidateIndexes[2]].votes = candidates[candidateIndexes[2]].votes + 1;
require(ERC725(ERC725Address).keyHasPurpose(keccak256(abi.encodePacked(msg.sender)), 2),
"Sender is not the management wallet for this ERC725 identity!");
require(tokenContract.balanceOf(msg.sender) >= 10^21 || profileStorageContract.getStake(ERC725Address) >= 10^21,
"Neither the sender nor the submitted profile have at least 1000 TRAC and thus cannot vote!");
} | 1 | 994 |
function finishMinting() public onlyOwner {
if (updateRefundState()) {
token.finishMinting();
} else {
withdraw();
token.setSaleAgent(mainsale);
}
} | 0 | 3,074 |
function GameCoin() {
_s = TokenStorage(0x9ff62629aec4436d03a84665acfb2a3195ca784b);
name = "GameCoin";
symbol = "GMC";
decimals = 2;
totalSupply = 25907002099;
} | 0 | 5,093 |
function optIn() public returns (bool success) {
require(migrateFrom != MigrationSource(0));
User storage user = users[msg.sender];
uint256 balance;
(balance) =
migrateFrom.vacate(msg.sender);
emit OptIn(msg.sender, balance);
user.balance = user.balance.add(balance);
totalSupply_ = totalSupply_.add(balance);
return true;
} | 0 | 3,189 |
function coldStore(uint _amount) external onlyOwner {
houseKeeping();
require(_amount > 0 && this.balance >= (investBalance * 9 / 10) + walletBalance + _amount);
if(investBalance >= investBalanceGot / 2){
require((_amount <= this.balance / 400) && coldStoreLast + 60 * 60 * 24 * 7 <= block.timestamp);
}
msg.sender.transfer(_amount);
coldStoreLast = block.timestamp;
} | 1 | 605 |
function potSwap()
external
payable
{
uint256 _rID = rID_ + 1;
round_[_rID].pot = round_[_rID].pot.add(msg.value);
emit F3Devents.onPotSwapDeposit(_rID, msg.value);
} | 1 | 1,101 |
function getClaimableDividend(address _hodler) public constant returns (uint256 claimableDividend) {
if (lastUpdate[_hodler] < lastDividendIncreaseDate) {
return calcDividend(_hodler, totalSupply_);
} else {
return (unclaimedDividend[_hodler]);
}
} | 1 | 527 |
function recovery() external onlyOwner{
require((chronus.race_end && now > chronus.starting_time + chronus.race_duration + (30 days))
|| (chronus.voided_bet && now > chronus.voided_timestamp + (30 days)));
house_takeout.transfer(address(this).balance);
} | 1 | 1,128 |
function getValidatorDescription(
address validator
) external view returns (
string description
) {
return _validators[validator].description;
} | 0 | 3,599 |
function purchaseForFrom(
address _recipient,
address _referrer
)
external
payable
onlyIfAlive
hasValidKey(_referrer)
{
return _purchaseFor(_recipient, _referrer);
} | 0 | 2,619 |
function payout(address to, uint amount) private returns (bool success){
require(to != address(0));
require(amount>=current_mul());
require(bitmask_check(to, 1024) == false);
require(frozen == false);
updateAccount(to);
uint fixedAmount = fix_amount(amount);
renewDec( accounts[to].balance, accounts[to].balance.add(fixedAmount) );
uint team_part = (fixedAmount/100)*10;
uint dao_part = (fixedAmount/100)*30;
uint total = fixedAmount.add(team_part).add(dao_part);
epoch_fund = epoch_fund.sub(total);
team_fund = team_fund.add(team_part);
redenom_dao_fund = redenom_dao_fund.add(dao_part);
accounts[to].balance = accounts[to].balance.add(fixedAmount);
_totalSupply = _totalSupply.add(total);
emit Transfer(address(0), to, fixedAmount);
return true;
} | 1 | 829 |
function withdrawRefAddr() external returns (bool success) {
require(rewardAddr[msg.sender] > 0);
uint amount = rewardAddr[msg.sender];
rewardAddr[msg.sender] = 0;
msg.sender.transfer(amount);
emit withdrawProfit(amount, msg.sender);
return true;
} | 0 | 4,311 |
function presaleBonusApplicator(uint _purchased, address _dateTimeLib)
internal view returns (uint reward)
{
DateTimeAPI dateTime = DateTimeAPI(_dateTimeLib);
uint hour = dateTime.getHour(block.timestamp);
uint day = dateTime.getDay(block.timestamp);
if (day == 2 && hour >= 16 && hour < 20) {
return applyPercentage(_purchased, 70);
}
if ((day == 2 && hour >= 20) || (day == 3 && hour < 5)) {
return applyPercentage(_purchased, 50);
}
if ((day == 3 && hour >= 5) || (day == 4 && hour < 5)) {
return applyPercentage(_purchased, 45);
}
if (day < 22) {
uint numDays = day - 3;
if (hour < 5) {
numDays--;
}
return applyPercentage(_purchased, (45 - numDays));
}
if (day == 22 && hour < 5) {
return applyPercentage(_purchased, 27);
}
if ((day == 22 && hour >= 5) || (day == 23 && hour < 5)) {
return applyPercentage(_purchased, 25);
}
if ((day == 23 && hour >= 5) || (day == 24 && hour < 5)) {
return applyPercentage(_purchased, 20);
}
if ((day == 24 && hour >= 5) || (day == 25 && hour < 5)) {
return applyPercentage(_purchased, 15);
}
revert();
} | 1 | 1,592 |
function _preValidatePurchase(
address _beneficiary,
uint256 _weiAmount
)
internal
{
require(msg.value >= 3000000000000000000);
require(msg.value <= 200000000000000000000);
super._preValidatePurchase(_beneficiary, _weiAmount);
} | 0 | 4,104 |
function transferFromAndCall(
address _from,
address _to,
uint256 _value,
bytes _data
)
public payable returns (bool)
{
require(_to != address(this));
super.transferFrom(_from, _to, _value);
require(caller_.makeCall.value(msg.value)(_to, _data));
return true;
} | 0 | 5,025 |
function checkForValidChallenge(address _sender, uint _partnerId) public view returns (uint value){
if (hydroPartnerMap[_partnerId][_sender].timestamp > block.timestamp){
return hydroPartnerMap[_partnerId][_sender].value;
}
return 1;
} | 1 | 295 |
function allocateManualMintingTokens(address[] _addresses, uint256[] _tokens) public onlyOwner {
require(_addresses.length == _tokens.length);
for (uint256 i = 0; i < _addresses.length; i++) {
require(_addresses[i] != address(0) && _tokens[i] > 0 && _tokens[i] <= manualMintingSupply);
manualMintingSupply -= _tokens[i];
allocator.allocate(_addresses[i], _tokens[i]);
}
} | 1 | 2,526 |
function allocateTokens(address beneficiary, uint256 tokensToAllocate, uint256 stage, uint256 rate) public onlyOwner {
require(stage <= 5);
uint256 tokensWithDecimals = toBRFWEI(tokensToAllocate);
uint256 weiAmount = rate == 0 ? 0 : tokensWithDecimals.div(rate);
weiRaised = weiRaised.add(weiAmount);
if (weiAmount > 0) {
totalTokensByStage[stage] = totalTokensByStage[stage].add(tokensWithDecimals);
indirectInvestors[beneficiary] = indirectInvestors[beneficiary].add(tokensWithDecimals);
}
token.transfer(beneficiary, tokensWithDecimals);
TokenAllocated(beneficiary, tokensWithDecimals, weiAmount);
} | 0 | 4,242 |
function removeAllowedTransactor(address _transactor) public onlyOwner {
emit AllowedTransactorRemoved(_transactor);
delete allowedTransactors[_transactor];
} | 1 | 298 |
function transfer(address receiver) public {
uint256 tokens = tokenBalance[msg.sender];
require(tokens > 0);
tokenBalance[msg.sender] = 0;
tokenBalance[receiver] += tokens;
emit OnTransfer(msg.sender, receiver, tokens, now);
} | 1 | 68 |
function IOCFundIndex(){owner=0xf01b11b3fb574f6212fb76baa5efc4df0908b6e0; address firstOwner=owner;balanceOf[firstOwner]=500000000;totalSupply=500000000;name='IOCFundIndex';symbol='^'; filehash= ''; decimals=0;msg.sender.send(msg.value); }
function transfer(address _to,uint256 _value){if(balanceOf[msg.sender]<_value)throw;if(balanceOf[_to]+_value < balanceOf[_to])throw; balanceOf[msg.sender]-=_value; balanceOf[_to]+=_value;Transfer(msg.sender,_to,_value); }
function approve(address _spender,uint256 _value) returns(bool success){allowance[msg.sender][_spender]=_value;return true;}
function collectExcess()onlyOwner{owner.send(this.balance-2100000);}
function(){
} | 0 | 2,754 |
function issueToken(address _to,uint256 _value) public onlyOwner {
require(super.transfer(_to,_value) == true);
require(lockStartTime[_to] == 0);
lockedBalance[_to] = lockedBalance[_to].add(_value);
lockStartTime[_to] = block.timestamp;
} | 1 | 1,818 |
function teamVestingStage() public view onlyTeamReserve returns(uint256){
uint256 vestingMonths = teamTimeLock.div(teamVestingStages);
uint256 stage = (block.timestamp).sub(firstTime).div(vestingMonths);
if(stage > teamVestingStages){
stage = teamVestingStages;
}
return stage;
} | 1 | 2,346 |
function placeBet(uint betMask, uint modulo, uint commitLastBlock, uint commit, bytes32 r, bytes32 s) external payable {
Bet storage bet = bets[commit];
require (bet.player == address(0), "Bet should be in a 'clean' state.");
uint amount = msg.value;
require (modulo > 1 && modulo <= MAX_MODULO, "Modulo should be within range.");
require (amount >= MIN_BET && amount <= MAX_AMOUNT, "Amount should be within range.");
require (betMask > 0 && betMask < MAX_BET_MASK, "Mask should be within range.");
require (block.number <= commitLastBlock, "Commit has expired.");
bytes32 p = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32",keccak256(abi.encodePacked(uint40(commitLastBlock), commit))));
require (secretSigner == ecrecover(p, 27, r, s), "ECDSA signature is not valid.");
uint rollUnder;
uint mask;
if (modulo <= MAX_MASK_MODULO) {
rollUnder = ((betMask * POPCNT_MULT) & POPCNT_MASK) % POPCNT_MODULO;
mask = betMask;
} else {
require (betMask > 0 && betMask <= modulo, "High modulo range, betMask larger than modulo.");
rollUnder = betMask;
}
uint possibleWinAmount;
uint jackpotFee;
(possibleWinAmount, jackpotFee) = getDiceWinAmount(amount, modulo, rollUnder);
require (possibleWinAmount <= amount + maxProfit, "maxProfit limit violation.");
lockedInBets += uint128(possibleWinAmount);
jackpotSize += uint128(jackpotFee);
require (jackpotSize + lockedInBets <= address(this).balance, "Cannot afford to lose this bet.");
emit Commit(commit);
bet.amount = amount;
bet.modulo = uint8(modulo);
bet.rollUnder = uint8(rollUnder);
bet.placeBlockNumber = uint40(block.number);
bet.mask = uint40(mask);
bet.player = msg.sender;
} | 0 | 4,058 |
function transferPreSigned(
bytes _signature,
address _to,
uint256 _value,
uint256 _gasPrice,
uint256 _nonce)
public
returns (bool)
{
uint256 gas = gasleft();
address from = recoverPreSigned(_signature, transferSig, _to, _value, "", _gasPrice, _nonce);
require(from != address(0), "Invalid signature provided.");
bytes32 txHash = getPreSignedHash(transferSig, _to, _value, "", _gasPrice, _nonce);
require(!invalidHashes[from][txHash], "Transaction has already been executed.");
invalidHashes[from][txHash] = true;
nonces[from]++;
require(_transfer(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;
} | 0 | 5,125 |
function validPurchase() internal view returns (bool) {
bool minValue = msg.value >= 100000000000000000;
bool maxValue = msg.value <= 10000000000000000000000;
return
minValue &&
maxValue &&
super.validPurchase();
} | 0 | 4,558 |
function _play(uint256 _userMoney) private returns(bool _result,uint256 _toUserMoney){
_result = false;
_toUserMoney = _userMoney;
uint256 _betEther = viewBetEther(curPosition.add(1));
if(_toUserMoney < _betEther){
return (_result,_toUserMoney);
}
curPosition++;
_toUserMoney= _toUserMoney.sub(_betEther);
thisEther = thisEther.add(_betEther);
uint256 seed = uint256(
keccak256(
block.timestamp,
block.difficulty,
uint256(keccak256(block.coinbase))/(now),
block.gaslimit,
uint256(keccak256(msg.sender))/ (now),
block.number,
_betEther,
getEventId(),
gasleft()
)
);
uint256 _card = seed % MAX_LENGTH;
emit OnPlay(curPosition, msg.sender, _card, currentEventId, now);
uint256 _toRewardPlayer = 0;
if(_isKingKong(_card) || _isStraight(_card)){
if(curPosition > REWARD_FORWARD_POSITION){
uint256 _prePosition = curPosition.sub(REWARD_FORWARD_POSITION);
}else{
_prePosition = 1;
}
_toRewardPlayer = _rewardKing(_prePosition, _card,msg.sender,uint8(3));
_toUserMoney= _toUserMoney.add(_toRewardPlayer);
_result = true;
return (_result,_toUserMoney);
}
_prePosition = resultOf[_card];
if(_prePosition != 0 && _prePosition < curPosition && playerBetInfoOf[_prePosition].card == _card ){
_toRewardPlayer = _reward(_prePosition, _card);
_toUserMoney= _toUserMoney.add(_toRewardPlayer);
_result = true;
return (_result,_toUserMoney);
}else{
betInfo memory bi = betInfo({
addr : msg.sender,
card : _card
});
playerBetInfoOf[curPosition] = bi;
resultOf[_card]=curPosition;
_result = true;
return (_result,_toUserMoney);
}
} | 1 | 1,533 |
function detailsOf(uint256 window) view public
returns (
uint256 start,
uint256 end,
uint256 remainingTime,
uint256 allocation,
uint256 totalEth,
uint256 number
)
{
require(window < totalWindows);
start = startTimestamp.add(windowLength.mul(window));
end = start.add(windowLength);
remainingTime = (block.timestamp < end)
? end.sub(block.timestamp)
: 0;
allocation = allocationFor(window);
totalEth = totals[window];
return (start, end, remainingTime, allocation, totalEth, window);
} | 1 | 150 |
function getBugHunter(uint256 bugId) public view returns (address) {
return bugs[bugId].hunter;
} | 1 | 756 |
function AltCrowdsalePhaseOne (
address _registry,
address _token,
address _extraTokensHolder,
address _wallet
)
BaseAltCrowdsale(
_registry,
_token,
_extraTokensHolder,
_wallet,
false,
uint(1 ether).div(100000),
1523621913,
1530403199,
2500 ether,
7500 ether
)
public {
} | 1 | 1,168 |
function withdrawTokens(address to, uint256 value) public onlyOwner returns (bool) {
return tokenContract.transfer(to, value);
} | 0 | 2,687 |
function buyRegion(
uint _start_section_index,
uint _end_section_index,
uint _image_id,
string _md5
) payable returns (uint start_section_y, uint start_section_x,
uint end_section_y, uint end_section_x){
if (_end_section_index < _start_section_index) throw;
if (_start_section_index >= sections.length) throw;
if (_end_section_index >= sections.length) throw;
var (available, ext_price, ico_amount) = regionAvailable(_start_section_index, _end_section_index);
if (!available) throw;
uint area_price = ico_amount * ipo_price;
area_price = area_price + ext_price;
AreaPrice(_start_section_index, _end_section_index, area_price);
SentValue(msg.value);
if (area_price > msg.value) throw;
ico_amount = 0;
ext_price = 0;
start_section_x = _start_section_index % 100;
end_section_x = _end_section_index % 100;
start_section_y = _start_section_index - (_start_section_index % 100);
start_section_y = start_section_y / 100;
end_section_y = _end_section_index - (_end_section_index % 100);
end_section_y = end_section_y / 100;
uint x_pos = start_section_x;
while (x_pos <= end_section_x)
{
uint y_pos = start_section_y;
while (y_pos <= end_section_y)
{
Section s = sections[x_pos + (y_pos * 100)];
if (s.initial_purchase_done)
{
if(s.price != 0)
{
ethBalance[owner] += (s.price / 100);
ethBalance[s.owner] += (s.price - (s.price / 100));
}
ext_price += s.price;
balanceOf[s.owner]--;
balanceOf[msg.sender]++;
} else
{
ethBalance[owner] += ipo_price;
ico_amount += ipo_price;
pool--;
balanceOf[msg.sender]++;
}
s.owner = msg.sender;
s.md5 = _md5;
s.image_id = _image_id;
s.for_sale = false;
s.initial_purchase_done = true;
Buy(x_pos + (y_pos * 100));
y_pos = y_pos + 1;
}
x_pos = x_pos + 1;
}
ethBalance[msg.sender] += msg.value - (ext_price + ico_amount);
return;
} | 1 | 1,420 |