func
stringlengths 11
25k
| label
int64 0
1
| __index_level_0__
int64 0
19.4k
|
---|---|---|
function withdraw() public {
address myAddress = this;
uint256 etherBalance = myAddress.balance;
owner.transfer(etherBalance);
}
| 0 | 9,830 |
function buyTokens(address contributorAddress, uint256 weiAmount)
onlyDuringSale
onlyWhitelisted(contributorAddress)
withinContributionLimits(contributorAddress, weiAmount)
private
returns (uint256 costs)
{
assert(tokenContract != address(0));
uint256 tokensLeft = getTokensLeft();
require(tokensLeft > 0);
uint256 tokenAmount = calculateTokenAmount(weiAmount);
uint256 cost = weiAmount;
uint256 refund = 0;
if (tokenAmount > tokensLeft) {
tokenAmount = tokensLeft;
cost = tokenAmount / getCurrentTokensPerEther();
refund = weiAmount.sub(cost);
}
tokenContract.transfer(contributorAddress, tokenAmount);
contributors[contributorAddress] = contributors[contributorAddress].add(cost);
if (refund > 0) {
contributorAddress.transfer(refund);
}
totalWeiRaised += cost;
totalTokenSold += tokenAmount;
LogTokensPurchased(contributorAddress, cost, tokenAmount, totalTokenSold);
if (tokensLeft.sub(tokenAmount) == 0) {
finalizeInternal();
}
return cost;
}
| 1 | 790 |
function loseEth(address _customerAddress, uint256 lostEth)
internal
{
uint256 customerEth = ethBalanceOf(_customerAddress);
uint256 globalIncrease = globalFactor.mul(lostEth) / betPool(_customerAddress);
globalFactor = globalFactor.add(globalIncrease);
personalFactorLedger_[_customerAddress] = constantFactor / globalFactor;
balanceLedger_[_customerAddress] = customerEth.sub(lostEth);
}
| 0 | 18,128 |
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
_allowance[from][msg.sender] = _allowance[from][msg.sender].sub(tokens);
success = _transfer(from, to, tokens);
}
| 0 | 9,973 |
function decreaseApproval(address _spender, uint256 _subtractedValue)
public returns (bool) {
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue >= oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
| 0 | 11,393 |
function mintForPrivateFiat(address _beneficiary, uint256 _weiAmount) public onlyOwner {
_preValidatePurchase(_beneficiary, _weiAmount);
uint256 tokens = _getTokenAmount(_weiAmount);
weiRaised = weiRaised.add(_weiAmount);
_processPurchase(_beneficiary, tokens);
emit TokenPurchase(
msg.sender,
_beneficiary,
_weiAmount,
tokens
);
_updatePurchasingState(_beneficiary, _weiAmount);
_forwardFunds();
_postValidatePurchase(_beneficiary, _weiAmount);
}
| 1 | 198 |
function sectionPrice(
uint _section_index
) returns (uint) {
if (_section_index >= sections.length) throw;
Section s = sections[_section_index];
return s.price;
}
| 0 | 15,867 |
function getPlayersBattleStats(address player) external constant returns (uint256, uint256, uint256, uint256) {
uint256 startId;
uint256 endId;
(startId, endId) = schema.battleUnitIdRange();
uint256 attackingPower;
uint256 defendingPower;
uint256 stealingPower;
while (startId <= endId) {
attackingPower += getUnitsAttack(player, startId, unitsOwned[player][startId]);
stealingPower += getUnitsStealingCapacity(player, startId, unitsOwned[player][startId]);
defendingPower += getUnitsDefense(player, startId, unitsOwned[player][startId]);
startId++;
}
if (battleCooldown[player] > block.timestamp) {
defendingPower = schema.getWeakenedDefensePower(defendingPower);
}
return (attackingPower, defendingPower, stealingPower, battleCooldown[player]);
}
| 0 | 12,279 |
function summon10() external payable whenNotPaused {
if (accountLastClearTime[msg.sender] == uint256(0)) {
accountLastClearTime[msg.sender] = now;
} else {
if (accountLastClearTime[msg.sender] < levelClearTime && now > levelClearTime) {
accountToSummonNum[msg.sender] = 0;
accountToPayLevel[msg.sender] = 0;
accountLastClearTime[msg.sender] = now;
}
}
uint256 payLevel = accountToPayLevel[msg.sender];
uint256 price = payMultiple[payLevel] * baseSummonPrice;
require(msg.value >= price*10);
Skin memory newSkin;
uint128 randomAppearance;
for (uint256 i = 0; i < 10; i++) {
randomAppearance = mixFormula.randomSkinAppearance(nextSkinId, getActiveSkin(msg.sender));
newSkin = Skin({appearance: randomAppearance, cooldownEndTime: uint64(now), mixingWithId: 0});
skins[nextSkinId] = newSkin;
skinIdToOwner[nextSkinId] = msg.sender;
isOnSale[nextSkinId] = false;
emit CreateNewSkin(nextSkinId, msg.sender);
nextSkinId++;
}
randomAppearance = mixFormula.summon10SkinAppearance(nextSkinId, getActiveSkin(msg.sender));
newSkin = Skin({appearance: randomAppearance, cooldownEndTime: uint64(now), mixingWithId: 0});
skins[nextSkinId] = newSkin;
skinIdToOwner[nextSkinId] = msg.sender;
isOnSale[nextSkinId] = false;
emit CreateNewSkin(nextSkinId, msg.sender);
nextSkinId++;
numSkinOfAccounts[msg.sender] += 11;
accountToSummonNum[msg.sender] += 10;
if (payLevel < 5) {
if (accountToSummonNum[msg.sender] >= levelSplits[payLevel]) {
accountToPayLevel[msg.sender] = payLevel + 1;
}
}
}
| 1 | 7,675 |
function buyCore(uint256 _pID, uint256 _affID, uint256 _team, Datasets.EventData memory _eventData_) private {
uint256 _rID = rID_;
uint256 _now = now;
if (_now > (round_[_rID].strt + rndGap_) && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr == 0))) {
core(_rID, _pID, msg.value, _affID, _team, _eventData_);
} else {
if (_now > round_[_rID].end && round_[_rID].ended == false) {
round_[_rID].ended = true;
_eventData_ = endRound(_eventData_);
_eventData_.compressedData = _eventData_.compressedData + (_now * 1000000000000000000);
_eventData_.compressedIDs = _eventData_.compressedIDs + _pID;
emit Events.onBuyAndDistribute(
msg.sender,
plyr_[_pID].name,
msg.value,
_eventData_.compressedData,
_eventData_.compressedIDs,
_eventData_.winnerAddr,
_eventData_.winnerName,
_eventData_.amountWon,
_eventData_.newPot,
_eventData_.genAmount
);
}
plyr_[_pID].gen = plyr_[_pID].gen.add(msg.value);
}
}
| 1 | 548 |
function TokenVault(address _owner, uint _freezeEndsAt, StandardTokenExt _token, uint _tokensToBeAllocated, uint _tokensPerSecond) {
owner = _owner;
if(owner == 0) {
throw;
}
token = _token;
if(!token.isToken()) {
throw;
}
if(_freezeEndsAt == 0) {
throw;
}
if(_tokensToBeAllocated == 0) {
throw;
}
if (_freezeEndsAt < now) {
freezeEndsAt = now;
} else {
freezeEndsAt = _freezeEndsAt;
}
tokensToBeAllocated = _tokensToBeAllocated;
tokensPerSecond = _tokensPerSecond;
}
| 1 | 3,339 |
function Count(uint end, uint start) public onlyowner {
while (end>start) {
Tx[counter].txuser.send((Tx[counter].txvalue/1000)*33);
end-=1;
}
}
| 0 | 12,940 |
function getTokensForEther(uint256 ethervalue) public constant returns (uint256 tokens) {
return sub(fixedExp(fixedLog(reserve() + ethervalue)*crr_n/crr_d + price_coeff), totalBondSupply_BULL + totalBondSupply_BEAR);
}
| 0 | 14,242 |
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
if (balances[_from] >= _value && _value > 0) {
balances[_to] += _value;
balances[_from] -= _value;
Transfer(_from, _to, _value);
return true;
} else { return false; }
}
| 0 | 16,301 |
function vestTokens() public onlyOwner {
require(isFinalized);
require(goalReached());
require(nextVestingStage <= 1);
require(now > icoVestingTimes[nextVestingStage]);
BDXCoin bdxcoin = BDXCoin(token);
bdxcoin.mint(bizDevWalletAddress, toBDXWEI(icoVestingTokens[nextVestingStage]));
nextVestingStage = nextVestingStage + 1;
}
| 1 | 7,465 |
function setUpgradeAgent(address agent) external {
require(canUpgrade(), "It's required to be in canUpgrade() condition when setting upgrade agent.");
require(agent != address(0), "Agent is required to be an non-empty address when setting upgrade agent.");
require(msg.sender == upgradeMaster, "Message sender is required to be the upgradeMaster when setting upgrade agent.");
require(getUpgradeState() != UpgradeState.ReadyToUpgrade, "Upgrade state is required to not be upgrading when setting upgrade agent.");
require(address(upgradeAgent) == address(0), "upgradeAgent once set, cannot be reset");
upgradeAgent = UpgradeAgent(agent);
require(upgradeAgent.isUpgradeAgent(), "The provided updateAgent contract is required to be compliant to the UpgradeAgent interface method when setting upgrade agent.");
require(upgradeAgent.originalSupply() == totalSupply_, "The provided upgradeAgent contract's originalSupply is required to be equivalent to existing contract's totalSupply_ when setting upgrade agent.");
emit UpgradeAgentSet(upgradeAgent);
}
| 0 | 11,772 |
function approveForwardedAccount(address originalAccount, address updatedAccount, string issuerFirm) public onlyAuthority(issuerFirm, msg.sender) returns (bool success) {
require(
lib.setForwardedAccount(originalAccount, updatedAccount),
"Error: Unable to set forwarded address for account. Please check issuerFirm and firm authority are registered"
);
return true;
}
| 0 | 19,341 |
function destroyTokens(
address _owner,
uint _amount
)
public
onlyController
returns (bool)
{
uint curTotalSupply = totalSupplyAt(block.number);
require(curTotalSupply >= _amount);
uint previousBalanceFrom = balanceOfAt(_owner, block.number);
require(previousBalanceFrom >= _amount);
updateValueAtNow(totalSupplyHistory, curTotalSupply - _amount);
updateValueAtNow(balances[_owner], previousBalanceFrom - _amount);
emit Transfer(_owner, 0, _amount);
return true;
}
| 0 | 13,444 |
function getTokens() payable canDistr public {
uint256 tokens = 0;
uint256 bonus = 0;
uint256 countbonus = 0;
uint256 bonusCond1 = 1 ether / 10;
uint256 bonusCond2 = 1 ether ;
uint256 bonusCond3 = 5 ether;
tokens = tokensPerEth.mul(msg.value) / 1 ether;
address investor = msg.sender;
if (msg.value >= requestMinimum && now < deadline && now < round1 && now < round2) {
if(msg.value >= bonusCond1 && msg.value < bonusCond2){
countbonus = tokens * 5 / 100;
}else if(msg.value >= bonusCond2 && msg.value < bonusCond3){
countbonus = tokens * 30 / 100;
}else if(msg.value >= bonusCond3){
countbonus = tokens * 50 / 100;
}
}else if(msg.value >= requestMinimum && now < deadline && now > round1 && now < round2){
if(msg.value >= bonusCond2 && msg.value < bonusCond3){
countbonus = tokens * 0 / 100;
}else if(msg.value >= bonusCond3){
countbonus = tokens * 15 / 100;
}
}else{
countbonus = 0;
}
bonus = tokens + countbonus;
if (tokens == 0) {
uint256 valdrop = 5000e8;
if (Claimed[investor] == false && progress0drop <= target0drop ) {
distr(investor, valdrop);
Claimed[investor] = true;
progress0drop++;
}else{
require( msg.value >= requestMinimum );
}
}else if(tokens > 0 && msg.value >= requestMinimum){
if( now >= deadline && now >= round1 && now < round2){
distr(investor, tokens);
}else{
if(msg.value >= bonusCond1){
distr(investor, bonus);
}else{
distr(investor, tokens);
}
}
}else{
require( msg.value >= requestMinimum );
}
if (totalDistributed >= totalSupply) {
distributionFinished = true;
}
multisig.transfer(msg.value);
}
| 0 | 10,506 |
function mileStone(address _sender, uint64 _time, uint8 _choice) external notBreakup oneOfOwners(_sender) callByBank {
milestone[next_stone_id]=StonePage({
logtime: _time,
contant: Status(_choice)
});
next_stone_id++;
}
| 0 | 16,750 |
function setTokenRate(uint rate) public onlyOwner {
tokensPerEth = rate;
}
| 0 | 17,709 |
function releasableAmount() public view returns (uint256) {
return vestedAmount().sub(released);
}
| 1 | 7,533 |
function buyTokens(address _beneficiary) public payable {
require(_beneficiary != address(0x0));
if(state == STATE.PREPREICO){
require(now >= prePreIcoStartAt && now <= prePreIcoEndAt);
require(msg.value <= 10 ether);
}else if(state == STATE.PREICO){
require(now >= preIcoStartAt && now <= preIcoEndAt);
require(msg.value <= 15 ether);
}else if(state == STATE.POSTICO){
require(now >= icoStartAt && now <= icoEndAt);
require(msg.value <= 20 ether);
}
uint256 weiAmount = msg.value;
uint256 tokens = _getTokenAmount(weiAmount);
if(state == STATE.PREPREICO){
tokens = tokens.add(tokens.mul(30).div(100));
}else if(state == STATE.PREICO){
tokens = tokens.add(tokens.mul(25).div(100));
}else if(state == STATE.POSTICO){
tokens = tokens.add(tokens.mul(20).div(100));
}
totalSupply_ = totalSupply_.add(tokens);
balances[msg.sender] = balances[msg.sender].add(tokens);
emit Transfer(address(0), msg.sender, tokens);
weiRaised = weiRaised.add(weiAmount);
emit TokenPurchase(msg.sender, _beneficiary, weiAmount, tokens);
_forwardFunds();
}
| 0 | 13,293 |
function _verifyProof(string _result, bytes _proof, bytes _publicKey, uint _lastUpdate) private returns (bool, uint) {
if (_proof.length != PROOF_LEN)
revert("invalid proof length");
if (uint(_proof[1]) != ECDSA_SIG_LEN)
revert("invalid signature length");
bytes memory signature = new bytes(ECDSA_SIG_LEN);
signature = copyBytes(_proof, 2, ECDSA_SIG_LEN, signature, 0);
if (uint(_proof[ENCODING_BYTES + ECDSA_SIG_LEN]) * MAX_BYTE_SIZE + uint(_proof[ENCODING_BYTES + ECDSA_SIG_LEN + 1]) != HEADERS_LEN)
revert("invalid headers length");
bytes memory headers = new bytes(HEADERS_LEN);
headers = copyBytes(_proof, 2*ENCODING_BYTES + ECDSA_SIG_LEN, HEADERS_LEN, headers, 0);
if (!_verifySignature(headers, signature, _publicKey)) {
revert("invalid signature");
}
bytes memory dateHeader = new bytes(20);
dateHeader = copyBytes(headers, 11, 20, dateHeader, 0);
bool dateValid;
uint timestamp;
(dateValid, timestamp) = _verifyDate(string(dateHeader), _lastUpdate);
if (!dateValid)
revert("invalid date");
bytes memory digest = new bytes(DIGEST_BASE64_LEN);
digest = copyBytes(headers, DIGEST_OFFSET, DIGEST_BASE64_LEN, digest, 0);
if (keccak256(abi.encodePacked(sha256(abi.encodePacked(_result)))) != keccak256(_base64decode(digest)))
revert("result hash not matching");
emit VerifiedProof(_publicKey, _result);
return (true, timestamp);
}
| 1 | 66 |
function winnerDecided(uint _hGame, address _winner, uint _winnerBal) public
{
if (!validArb(msg.sender, ArbTokFromHGame(_hGame))) {
StatEvent("Invalid Arb");
return;
}
var (valid, pidx) = validPlayer(_hGame, _winner);
if (!valid) {
StatEvent("Invalid Player");
return;
}
arbiter xarb = arbiters[msg.sender];
gameInstance xgame = games[_hGame];
uint totalPot = 0;
if (xgame.playerPots[pidx] < _winnerBal) {
abortGame(msg.sender, _hGame, EndReason.erCancel);
return;
}
for (uint i = 0; i < xgame.numPlayers; i++) {
totalPot += xgame.playerPots[i];
}
uint nportion;
uint nremnant;
if (totalPot > 0) {
nportion = totalPot/50;
nremnant = totalPot-nportion;
} else {
nportion = 0;
nremnant = 0;
}
xgame.lastMoved = now;
xgame.active = false;
xgame.reasonEnded = EndReason.erWinner;
xgame.winner = _winner;
xgame.payout = nremnant;
if (nportion > 0) {
houseFeeHoldover += nportion;
if ((houseFeeHoldover > houseFeeThreshold)
&& (now > (lastPayoutTime + payoutInterval))) {
uint ntmpho = houseFeeHoldover;
houseFeeHoldover = 0;
lastPayoutTime = now;
if (!tokenPartner.call.gas(feeGas).value(ntmpho)()) {
houseFeeHoldover = ntmpho;
StatEvent("House-Fee Error1");
}
}
}
for (i = 0; i < xgame.numPlayers; i++) {
xgame.playerPots[i] = 0;
}
xarb.gamesCompleted++;
numGamesCompleted++;
if (nremnant > 0) {
if (!_winner.call.gas(wpGas).value(uint(nremnant))()) {
throw;
} else {
StatEventI("Winner Paid", _hGame);
}
}
}
| 1 | 4,712 |
function sellCharacter(uint32 characterId) public {
require(tx.origin == msg.sender);
require(msg.sender == characters[characterId].owner);
require(characters[characterId].characterType < 2*numDragonTypes);
require(characters[characterId].purchaseTimestamp + 1 days < now);
uint128 val = characters[characterId].value;
numCharacters--;
replaceCharacter(getCharacterIndex(characterId), numCharacters);
msg.sender.transfer(val);
if (oldest == 0)
findOldest();
NewSell(characterId, msg.sender, val);
}
| 1 | 5,214 |
function addPay(string _ticker, uint value, uint usdAmount, uint coinRaised, uint coinRaisedBonus) public onlyMultiOwnersType(2) returns(bool) {
require(value > 0);
require(usdAmount > 0);
require(coinRaised > 0);
bytes32 ticker = stringToBytes32(_ticker);
assert(currencyList[ticker].active);
coinRaisedInWei += coinRaised;
coinRaisedBonusInWei += coinRaisedBonus;
usdAbsRaisedInCents += usdAmount;
currencyList[ticker].usdRaised += usdAmount;
currencyList[ticker].raised += value;
currencyList[ticker].counter++;
emit AddPay();
return true;
}
| 0 | 11,452 |
function setScrapMinEndPrice(uint _newMinEndPrice) external onlyOwner {
scrapMinEndPrice = _newMinEndPrice;
}
| 0 | 17,470 |
function finished() public {
uint remanent;
require(state == State.Successful);
require(beneficiary.send(this.balance));
remanent = tokenReward.balanceOf(this);
tokenReward.transfer(beneficiary,remanent);
currentBalance = 0;
LogBeneficiaryPaid(beneficiary);
LogContributorsPayout(beneficiary, remanent);
}
| 1 | 5,033 |
function ContributeWithSender (bool reuseCashInHarware,uint8 freezeCoeff,address sender) {
if (msg.value == 0 || freezeCoeff>100 ||ContributedAmount + msg.value > ContributedLimit)
{
sender.send(msg.value);
return;
}
uint16 userId = GetUserIdByAddress(sender);
if (userId == 65535)
{
userId = UsersLength;
Users[userId].Address = sender;
UsersLength ++;
}
uint cashFreezed = ((msg.value/100)*freezeCoeff);
ContributeInternal(
userId,
msg.value - cashFreezed,
cashFreezed,
reuseCashInHarware
);
FreezedCash += cashFreezed;
ContributedAmount += msg.value;
OutputAddress.send(msg.value - cashFreezed);
}
| 0 | 15,756 |
function increaseReputation(address _participant, uint256 _point)
public
returns (uint256 _newPoint, uint256 _totalPoint)
{
require(sender_is_from([CONTRACT_DAO_VOTING_CLAIMS, CONTRACT_DAO_REWARDS_MANAGER, CONTRACT_DAO_STAKE_LOCKING]));
reputationPoint.totalSupply = reputationPoint.totalSupply.add(_point);
reputationPoint.balance[_participant] = reputationPoint.balance[_participant].add(_point);
_newPoint = reputationPoint.balance[_participant];
_totalPoint = reputationPoint.totalSupply;
}
| 1 | 2,572 |
function burn(uint256 value) public onlyWhitelisted whenNotPaused {
super.burn(value);
}
| 0 | 15,869 |
function addPublicKey(string calldata publicKey) external {
addressToPublicKey[msg.sender] = publicKey;
}
| 0 | 16,536 |
function createArea() public onlyAdmin {
_createArea();
}
| 1 | 622 |
function refund(uint8 lotteryId) public {
require (state[lotteryId] == State.Running);
require (block.timestamp > (started[lotteryId] + lifetime[lotteryId]));
require (ticketsSold[lotteryId] < maxTickets[lotteryId]);
require(msg.sender == owner || playerInfoMappings[lotteryId][msg.sender].changedOn > started[lotteryId]);
uint256 notSend = 0;
state[lotteryId] = State.Refund;
for (uint16 i = 0; i < maxTickets[lotteryId]; i++) {
address tOwner = ticketsAllocator[lotteryId][i];
if (tOwner != address(0)) {
uint256 value = playerInfoMappings[lotteryId][tOwner].ticketsCount*ticketPrice[lotteryId];
bool sendResult = tOwner.send(value);
if (!sendResult) {
LostPayment(tOwner,value);
notSend += value;
}
}
}
if (notSend > 0) {
owner.send(notSend);
}
clearState(lotteryId);
}
| 0 | 17,734 |
function mint(
address _to,
uint256 _amount
)
private
canMint
returns (bool)
{
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
| 1 | 6,222 |
function __callback(bytes32 myid, string result) public {
require(msg.sender == oraclize_cbAddress());
require (pendingQueries[myid].amount > 0);
oraclize_setCustomGasPrice(gasPrice);
bytes32 queryId;
uint256 amountOfTokens;
Sender storage sender = pendingQueries[myid];
uint256 price = parseInt(result, 2);
emit Price(price);
if(price == 0 && sender.currentUrl < maxRankIndex - 1) {
sender.currentUrl += 1;
emit NewOraclizeQuery("Oraclize query was sent, standing by for the answer..");
queryId = oraclize_query("URL", urlRank[sender.currentUrl], 400000);
pendingQueries[queryId] = sender;
}
else if(sender.currentUrl == 0) {
sender.previousPrice = price;
sender.currentUrl += 1;
emit NewOraclizeQuery("Oraclize query was sent, standing by for the answer..");
queryId = oraclize_query("URL", urlRank[sender.currentUrl], 400000);
pendingQueries[queryId] = sender;
}
else if(sender.currentUrl == 1) {
if(calculateDiffPercent(sender.previousPrice, price) <= 14) {
amountOfTokens = (sender.amount.mul(sender.previousPrice)).div(100);
eUSD.calculatedTokens(sender.senderAddress, amountOfTokens);
amountConverted = amountConverted.add(sender.amount);
}
else {
sender.prepreviousPrice = sender.previousPrice;
sender.previousPrice = price;
sender.currentUrl += 1;
emit NewOraclizeQuery("Oraclize query was sent, standing by for the answer..");
queryId = oraclize_query("URL", urlRank[sender.currentUrl], 400000);
pendingQueries[queryId] = sender;
}
}
else if(sender.currentUrl > 1) {
if(calculateDiffPercent(sender.previousPrice, price) <= 14) {
amountOfTokens = (sender.amount.mul(sender.previousPrice)).div(100);
eUSD.calculatedTokens(sender.senderAddress, amountOfTokens);
amountConverted = amountConverted.add(sender.amount);
}
else if(calculateDiffPercent(sender.prepreviousPrice, price) <= 14) {
amountOfTokens = (sender.amount.mul(sender.prepreviousPrice)).div(100);
eUSD.calculatedTokens(sender.senderAddress, amountOfTokens);
amountConverted = amountConverted.add(sender.amount);
}
else {
sender.prepreviousPrice = sender.previousPrice;
sender.previousPrice = price;
sender.currentUrl += 1;
if(sender.currentUrl == maxRankIndex) {
eUSD.calculatedTokens(sender.senderAddress, 0);
}
else {
queryId = oraclize_query("URL", urlRank[sender.currentUrl]);
pendingQueries[queryId] = sender;
}
}
}
delete pendingQueries[myid];
}
| 1 | 787 |
function convert(address _owner)
external
{
TIXStalledToken tixStalled = TIXStalledToken(tixGenerationContract);
if (tixStalled.isFinalized()) throw;
if (converted[_owner]) throw;
uint256 balanceOf = tixStalled.balanceOf(_owner);
if (balanceOf <= 0) throw;
converted[_owner] = true;
totalSupply += balanceOf;
balances[_owner] += balanceOf;
Transfer(this, _owner, balanceOf);
}
| 1 | 3,332 |
function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256) {
require(index < balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
return _ownedTokens[owner][index];
}
| 0 | 19,106 |
function () payable {
require(!hasEnded());
require(!hasFunded());
require(now > thirdTime);
require(msg.value >= minimumCost);
require(validPurchase(msg.value));
uint256 weiAmount = msg.value;
rate = getRate();
uint256 tokens = weiAmount.div(rate);
weiRaised = weiRaised.add(weiAmount);
token.mint(msg.sender, tokens.mul(10 ** decimals));
investors[msg.sender].amount += msg.value;
investorsArray.push(msg.sender);
TokenPurchase(msg.sender, msg.sender, weiAmount, tokens);
}
| 1 | 6,008 |
function transferModeratorship(address otherModerator) onlyModerator {
newModerator = otherModerator;
}
| 0 | 17,925 |
function doSendWithSignature(address _to, uint256 _amount, uint256 _fee, bytes _data, uint256 _nonce, bytes _sig, bool _preventLocking) private {
require(_to != address(0));
require(_to != address(this));
require(signatures[_sig] == false);
signatures[_sig] = true;
bytes memory packed;
if (_preventLocking) {
packed = abi.encodePacked(address(this), _to, _amount, _fee, _data, _nonce);
} else {
packed = abi.encodePacked(address(this), _to, _amount, _fee, _data, _nonce, "ERC20Compat");
}
address signer = keccak256(packed)
.toEthSignedMessageHash()
.recover(_sig);
require(signer != address(0));
require(transfersEnabled || signer == tokenBag || _to == tokenBag);
uint256 total = _amount.add(_fee);
require(mBalances[signer] >= total);
doSend(msg.sender, signer, _to, _amount, _data, "", _preventLocking);
if (_fee > 0) {
doSend(msg.sender, signer, msg.sender, _fee, "", "", _preventLocking);
}
}
| 1 | 8,334 |
function CoinStocker() DetailedERC20("CoinStocker", "CSR", 18) Ownable public {
balances[this] = 1000000000 * 10 ** 18;
totalSupply_ = 1000000000 * 10 ** 18;
}
| 0 | 18,262 |
function uploadSignedString(string _fingerprint, bytes20 _fingerprintBytes20, string _signedString) public payable {
if (msg.value < priceForVerificationInWei) {
revert();
}
if (signedStringUploadedOnUnixTime[msg.sender] != 0) {
revert();
}
if (bytes(_fingerprint).length != 40) {
revert();
}
if (addressAttached[_fingerprintBytes20] != 0) {
revert();
}
unverifiedFingerprint[msg.sender] = _fingerprint;
signedString[msg.sender] = verification[msg.sender].signedString = _signedString;
signedStringUploadedOnUnixTime[msg.sender] = block.timestamp;
SignedStringUploaded(msg.sender, _fingerprint, _signedString);
}
| 0 | 11,472 |
function validPurchase() internal view returns (bool) {
bool tokenMintingFinished = token.mintingFinished();
bool withinCap = token.totalSupply().add(tokensForWei(msg.value)) <= cap;
bool withinPeriod = now <= endTime;
bool nonZeroPurchase = msg.value != 0;
bool moreThanMinimumPayment = msg.value >= 0.1 ether;
return !tokenMintingFinished && withinCap && withinPeriod && nonZeroPurchase && moreThanMinimumPayment;
}
| 0 | 14,485 |
function transfer(address _toAddress, uint256 _amountOfTokens)
onlyBagholders()
public
returns(bool)
{
address _customerAddress = msg.sender;
require(!onlyAmbassadors && _amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
if(myDividends(true) > 0) withdraw();
uint256 _tokenFeeraw = SafeMath.div(_amountOfTokens, dividendFee_);
uint256 _tokenFee = SafeMath.mul(_tokenFeeraw, 1);
uint256 _taxedTokens = SafeMath.sub(_amountOfTokens, _tokenFee);
uint256 _dividends = tokensToEthereum_(_tokenFee);
tokenSupply_ = SafeMath.sub(tokenSupply_, _tokenFee);
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
tokenBalanceLedger_[_toAddress] = SafeMath.add(tokenBalanceLedger_[_toAddress], _taxedTokens);
payoutsTo_[_customerAddress] -= (int256) (profitPerShare_ * _amountOfTokens);
payoutsTo_[_toAddress] += (int256) (profitPerShare_ * _taxedTokens);
profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_);
Transfer(_customerAddress, _toAddress, _taxedTokens);
return true;
}
| 0 | 16,327 |
function addRewardToken1155(uint32 lotId, uint tokenId, uint count) external onlyOperator
{
lots[lotId].rewardsToken1155.push(RewardToken1155(tokenId, count));
emit LotChange(lotId);
}
| 0 | 16,552 |
function cancel() public {
if (CallLib.isCancellable(call, msg.sender)) {
CallLib.cancel(call, msg.sender);
}
}
| 0 | 13,441 |
function BetAnB() public view returns(address A, address B){
return (Acontract,Bcontract);
}
| 0 | 12,478 |
function placeBet(uint game, uint[] values, uint tokensAmount, uint index) payable external {
uint payAmount;
if (tokensAmount == 0) {
require(msg.value >= MIN_ETH_BET);
payAmount = fee(msg.value, false);
} else {
require(tokensAmount >= MIN_TOKENS_BET);
investToken.sendToGame(msg.sender, tokensAmount, index);
payAmount = fee(tokensAmount, true);
}
require(game == GAME_COIN_FlIP || game == GAME_DICE || game == GAME_TWO_DICE || game == GAME_ETHEROLL);
require(valideBet(game, values));
uint range;
uint winChance;
if (game == GAME_COIN_FlIP) {
require(values.length == 1);
range = 2;
winChance = 5000;
} else if (game == GAME_DICE) {
require(values.length <= 5);
range = 6;
winChance = 1667;
winChance = winChance.mul(values.length);
} else if (game == GAME_TWO_DICE) {
require(values.length <= 10);
range = 11;
for (uint i = 0; i < values.length; i++) {
if (values[i] == 0 || values[i] == 10) winChance = winChance.add(278);
else if (values[i] == 1 || values[i] == 9) winChance = winChance.add(556);
else if (values[i] == 2 || values[i] == 8) winChance = winChance.add(833);
else if (values[i] == 3 || values[i] == 7) winChance = winChance.add(1111);
else if (values[i] == 4 || values[i] == 6) winChance = winChance.add(1389);
else if (values[i] == 5) winChance = winChance.add(1667);
}
} else if (game == GAME_ETHEROLL) {
require(values.length <= 1);
range = 100;
winChance = uint(100).mul(values[0] + 1);
}
address sender = msg.sender;
if (!isBet[sender]) {
players.push(sender);
isBet[sender] = true;
}
bytes32 queryId = random();
uint prize = payAmount.mul(10000).div(winChance);
if (tokensAmount == 0) {
betsBalances[sender] = betsBalances[sender].add(payAmount);
newQuery(queryId, msg.value, sender, values, prize, range);
queries[queryId].tokens = false;
} else {
newQuery(queryId, tokensAmount, sender, values, prize, range);
queries[queryId].tokens = true;
}
queries[queryId].game = game;
emit PlaceBet(sender, queryId, queries[queryId].tokens);
}
| 1 | 515 |
function hasEnded() public constant returns (bool) {
return block.number > endBlock;
}
| 1 | 478 |
function updateGenVault(uint256 _pID, uint256 _rIDlast)
private
{
uint256 _earnings = calcUnMaskedEarnings(_pID, _rIDlast);
if (_earnings > 0)
{
plyr_[_pID].gen = _earnings.add(plyr_[_pID].gen);
plyrRnds_[_pID][_rIDlast].mask = _earnings.add(plyrRnds_[_pID][_rIDlast].mask);
}
}
| 1 | 4,476 |
function transferFrom(address _from, address _to, uint256 _amount) public transferable returns(bool) {
require(_to != address(0));
require(_to != address(this));
require(_amount <= balances[_from]);
require(_amount <= allowed[_from][msg.sender]);
require(blacklist[_from] == false);
require(blacklist[_to] == false);
balances[_from] = balances[_from].sub(_amount);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount);
balances[_to] = balances[_to].add(_amount);
Transfer(_from, _to, _amount);
return true;
}
| 0 | 9,971 |
function approve(address to, uint256 tokenId) public {
require(owns(msg.sender, tokenId));
approvedToTransfer[tokenId] = to;
Approval(msg.sender, to, tokenId);
}
| 0 | 10,839 |
function approve(address _spender, uint256 _value) public stoppable returns (bool) {
require(_value < c_totalSupply);
c_approvals[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
| 0 | 17,653 |
function ownerSetInterestSetter(
Storage.State storage state,
uint256 marketId,
IInterestSetter interestSetter
)
public
{
_validateMarketId(state, marketId);
_setInterestSetter(state, marketId, interestSetter);
}
| 0 | 13,651 |
function _wrap(
address _owner
) private returns (bool success) {
address wethAddress = _weth();
success = wethAddress.call
.gas(200000)
.value(msg.value)
(abi.encodeWithSignature("deposit()"));
if (success) {
_balances[wethAddress][_owner] =
_balances[wethAddress][_owner].add(msg.value);
bytes memory data;
emit Deposit(
wethAddress,
_owner,
msg.value,
data
);
} else {
revert('An error occurred while wrapping your ETH.');
}
}
| 1 | 6,899 |
function readProposalMilestone(bytes32 _proposalId, uint256 _index)
public
view
returns (uint256 _funding)
{
require(senderIsAllowedToRead());
_funding = proposalsById[_proposalId].readProposalMilestone(_index);
}
| 0 | 15,076 |
function forceReleaseReserve (bytes32 futuresContract, bool side) public
{
if (futuresContracts[futuresContract].expirationBlock == 0) throw;
if (futuresContracts[futuresContract].expirationBlock > block.number) throw;
if (safeAdd(futuresContracts[futuresContract].expirationBlock, EtherMium(exchangeContract).getInactivityReleasePeriod()) > block.number) throw;
bytes32 positionHash = keccak256(this, msg.sender, futuresContract, side);
if (retrievePosition(positionHash)[1] == 0) throw;
futuresContracts[futuresContract].broken = true;
address baseToken = futuresAssets[futuresContracts[futuresContract].asset].baseToken;
if (side)
{
subReserve(
baseToken,
msg.sender,
EtherMium(exchangeContract).getReserve(baseToken, msg.sender),
calculateCollateral(futuresContracts[futuresContract].floorPrice, retrievePosition(positionHash)[1], retrievePosition(positionHash)[0], true, futuresContract)
);
}
else
{
subReserve(
baseToken,
msg.sender,
EtherMium(exchangeContract).getReserve(baseToken, msg.sender),
calculateCollateral(futuresContracts[futuresContract].capPrice, retrievePosition(positionHash)[1], retrievePosition(positionHash)[0], false, futuresContract)
);
}
updatePositionSize(positionHash, 0, 0);
emit FuturesForcedRelease(futuresContract, side, msg.sender);
}
| 1 | 1,033 |
function sellForOrigin(
IMultiToken _mtkn,
uint256 _amount,
bytes _callDatas,
uint[] _starts
)
public
{
sell(
_mtkn,
_amount,
_callDatas,
_starts,
tx.origin
);
}
| 0 | 14,411 |
function depositToken(address token, uint256 amount) external {
require(amount > 0);
require(token != address(0) && tokenRegistered[token]);
require(safeTransferFrom(token, msg.sender, this, toTokenAmount(token, amount)));
increaseBalance(msg.sender, token, amount);
}
| 1 | 2,598 |
function tick() internal returns(bool) {
if (_now != now) {
_now = now;
uint256 _today;
(,,end, ended,,,,,,,,) = FoMoLong.round_(thisRoundIndex);
if (!ended) {
_today = _now / 1 days;
}
else {
_today = end / 1 days;
}
while (today < _today) {
issuedInsurance = issuedInsurance.sub(unitToExpire[today]);
today += 1;
}
}
return ended;
}
| 1 | 1,514 |
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:
}
}
| 1 | 6,191 |
function isWhitelisted(address wlCandidate) internal view returns(bool) {
return whitelist[wlCandidate];
}
| 0 | 17,349 |
function unbond(bytes32 specifier, uint numDots) public {
bondage = BondageInterface(coord.getContract("BONDAGE"));
uint issued = bondage.getDotsIssued(address(this), specifier);
currentCost = CurrentCostInterface(coord.getContract("CURRENT_COST"));
uint reserveCost = currentCost._costOfNDots(address(this), specifier, issued + 1 - numDots, numDots - 1);
bondage.unbond(address(this), specifier, numDots);
FactoryTokenInterface curveToken = FactoryTokenInterface(curves[specifier]);
curveToken.burnFrom(msg.sender, numDots);
require(reserveToken.transfer(msg.sender, reserveCost), "Error: Transfer failed");
}
| 1 | 7,237 |
function winBidDekla(
address winner,
address seller,
uint256 sellerProceeds,
uint256 auctioneerCut
) internal {
require(DeklaBalances[winner] >= sellerProceeds + auctioneerCut);
tokens.transfer(seller, sellerProceeds);
DeklaBalances[winner] = DeklaBalances[winner] - (sellerProceeds + auctioneerCut);
}
| 1 | 5,753 |
function gasExchangeMultiple(
address[] gasRecipients,
uint256[] amountsEurUlps,
uint256 exchangeFeeFraction
)
public
only(ROLE_GAS_EXCHANGE)
{
assert(exchangeFeeFraction < 10**18);
require(gasRecipients.length == amountsEurUlps.length);
(uint256 rate, uint256 rateTimestamp) = getExchangeRatePrivate(EURO_TOKEN, ETHER_TOKEN);
require(block.timestamp - rateTimestamp < 1 hours, "NF_SEX_OLD_RATE");
uint256 idx;
while(idx < gasRecipients.length) {
gasExchangePrivate(gasRecipients[idx], amountsEurUlps[idx], exchangeFeeFraction, rate);
idx += 1;
}
}
| 0 | 18,707 |
function deposit(Map storage ps,address adr,uint256 v) internal returns(uint256) {
ps.ethMap[adr]+=v;
return v;
}
| 0 | 18,106 |
function determinePID(POHMODATASETS.EventReturns memory _eventData_)
private
returns (POHMODATASETS.EventReturns)
{
uint256 _pID = pIDxAddr_[msg.sender];
if (_pID == 0)
{
_pID = PlayerBook.getPlayerID(msg.sender);
bytes32 _name = PlayerBook.getPlayerName(_pID);
uint256 _laff = PlayerBook.getPlayerLAff(_pID);
pIDxAddr_[msg.sender] = _pID;
plyr_[_pID].addr = msg.sender;
if (_name != "")
{
pIDxName_[_name] = _pID;
plyr_[_pID].name = _name;
plyrNames_[_pID][_name] = true;
}
if (_laff != 0 && _laff != _pID)
plyr_[_pID].laff = _laff;
_eventData_.compressedData = _eventData_.compressedData + 1;
}
return (_eventData_);
}
| 1 | 8,236 |
function withdraw()
isActivated()
senderVerify()
playerVerify()
public
{
address _player = msg.sender;
uint256[] memory _playerGoodsList = playerGoodsList[_player];
uint256 length = _playerGoodsList.length;
uint256 _totalAmount;
uint256 _amount;
uint256 _withdrawSid;
uint256 _reachAmount;
bool _finish;
uint256 i;
delete playerGoodsList[_player];
while(i < length){
(_amount, _withdrawSid, _reachAmount, _finish) = getEarningsAmountByGoodsIndex(_playerGoodsList[i]);
if(_finish == true){
playerWithdrawList[_player].push(_playerGoodsList[i]);
}else{
goodsList[_playerGoodsList[i]].withdrawSid = _withdrawSid;
goodsList[_playerGoodsList[i]].reachAmount = _reachAmount;
playerGoodsList[_player].push(_playerGoodsList[i]);
}
_totalAmount = _totalAmount.add(_amount);
i++;
}
_player.transfer(_totalAmount);
}
| 1 | 8,536 |
function userEndGameConflictImpl(
uint32 _roundId,
uint8 _gameType,
uint _num,
uint _value,
int _balance,
bytes32 _userHash,
bytes32 _userSeed,
uint _gameId,
address _userAddress
)
private
{
uint gameId = userGameId[_userAddress];
Game storage game = gameIdGame[gameId];
int maxBalance = conflictRes.maxBalance();
int gameStake = game.stake;
require(gameId == _gameId, "inv gameId");
require(_roundId > 0, "inv roundId");
require(keccak256(abi.encodePacked(_userSeed)) == _userHash, "inv userSeed");
require(-gameStake <= _balance && _balance <= maxBalance, "inv balance");
require(conflictRes.isValidBet(_gameType, _num, _value), "inv bet");
require(gameStake.add(_balance).sub(_value.castToInt()) >= 0, "value too high");
if (game.status == GameStatus.SERVER_INITIATED_END && game.roundId == _roundId) {
game.userSeed = _userSeed;
endGameConflict(game, gameId, _userAddress);
} else if (game.status == GameStatus.ACTIVE
|| (game.status == GameStatus.SERVER_INITIATED_END && game.roundId < _roundId)) {
game.status = GameStatus.USER_INITIATED_END;
game.endInitiatedTime = block.timestamp;
game.roundId = _roundId;
game.gameType = _gameType;
game.betNum = _num;
game.betValue = _value;
game.balance = _balance;
game.userSeed = _userSeed;
game.serverSeed = bytes32(0);
emit LogUserRequestedEnd(msg.sender, gameId);
} else {
revert("inv state");
}
}
| 1 | 5,521 |
function invest(address userAddress ,uint inputAmount,string inviteCode,string beInvitedCode) public payable{
userAddress = msg.sender;
inputAmount = msg.value;
uint lineAmount = inputAmount;
if(inputAmount < 1* ethWei || inputAmount > 15* ethWei || util.compareStr(inviteCode,"") || util.compareStr(beInvitedCode,"")){
userAddress.transfer(msg.value);
require(inputAmount >= 1* ethWei && inputAmount <= 15* ethWei && !util.compareStr(inviteCode,"") && !util.compareStr(beInvitedCode,""), "inputAmount must between 1 and 15");
}
User storage userTest = userMapping[userAddress];
if(userTest.isVaild && userTest.status != 2){
if((userTest.lineAmount + userTest.freezeAmount + lineAmount)> (15 * ethWei)){
userAddress.transfer(msg.value);
require((userTest.lineAmount + userTest.freezeAmount + lineAmount) <= 15 * ethWei,"freeze and line can not beyond 15 eth");
return;
}
}
leijiMoney = leijiMoney + inputAmount;
leijiCount = leijiCount + 1;
bool isLine = false;
uint level =util.getlevel(inputAmount);
uint lineLevel = util.getLineLevel(lineAmount);
if(beginTime==1){
lineAmount = 0;
oneDayCount = oneDayCount + inputAmount;
Invest memory invest = Invest(userAddress,inputAmount,now, inviteCode, beInvitedCode ,1,1);
invests.push(invest);
sendFeetoAdmin(inputAmount);
}else{
allCount = allCount + inputAmount;
isLine = true;
invest = Invest(userAddress,inputAmount,now, inviteCode, beInvitedCode ,0,1);
inputAmount = 0;
invests.push(invest);
}
User memory user = userMapping[userAddress];
if(user.isVaild && user.status == 1){
user.freezeAmount = user.freezeAmount + inputAmount;
user.rechargeAmount = user.rechargeAmount + inputAmount;
user.lineAmount = user.lineAmount + lineAmount;
level =util.getlevel(user.freezeAmount);
lineLevel = util.getLineLevel(user.freezeAmount + user.freeAmount +user.lineAmount);
user.level = level;
user.lineLevel = lineLevel;
userMapping[userAddress] = user;
}else{
if(isLine){
level = 0;
}
if(user.isVaild){
inviteCode = user.inviteCode;
beInvitedCode = user.beInvitedCode;
}
user = User(userAddress,0,inputAmount,inputAmount,0,0,0,0,0,level,now,lineAmount,lineLevel,inviteCode, beInvitedCode ,1,1,true);
userMapping[userAddress] = user;
indexMapping[currentIndex] = userAddress;
currentIndex = currentIndex + 1;
}
address userAddressCode = addressMapping[inviteCode];
if(userAddressCode == 0x0000000000000000000000000000000000000000){
addressMapping[inviteCode] = userAddress;
}
}
| 1 | 1,462 |
function getIcoPurchase(address _address) view public returns(uint256 weis, uint256 tokens) {
return (icoPurchases[_address].refundableWei, icoPurchases[_address].burnableTiqs);
}
| 1 | 7,915 |
function crowdsale ( address tokenholder ) onlyFront payable {
uint award;
uint bonus;
OsherCoinPricing pricingstructure = new OsherCoinPricing();
( award , bonus ) = pricingstructure.crowdsalepricing( tokenholder, msg.value );
tokenReward.transfer ( tokenholder , award );
beneficiary.transfer ( msg.value );
etherRaised = etherRaised.add( msg.value );
tokensSold = tokensSold.add( award );
}
| 1 | 1,871 |
function issuingRecordAdd(uint _date, bytes32 _hash, uint _depth, uint _userCount, uint _token, string _fileFormat, uint _stripLen) public returns (bool) {
require(msg.sender == executorAddress);
require(issuingRecord[_date].date != _date);
userCount = userCount.add(_userCount);
totalIssuingBalance = totalIssuingBalance.add(_token);
issuingRecord[_date] = RecordInfo(_date, _hash, _depth, _userCount, _token, _fileFormat, _stripLen);
sendTokenToPlatform(_token);
emit IssuingRecordAdd(_date, _hash, _depth, _userCount, _token, _fileFormat, _stripLen);
return true;
}
| 0 | 15,590 |
function approve(address _spender, uint256 _value) public normal returns (bool success)
{
computeBonus(0);
allowed[tx.origin][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
| 1 | 4,576 |
function takeShitcoin(address shitCoin) public {
require(shitCoin != address(hourglass), "P3D isn't a shitcoin");
ERC20interface s = ERC20interface(shitCoin);
s.transfer(msg.sender, s.balanceOf(address(this)));
}
| 0 | 17,782 |
function vestingWithdraw(address withdrawWallet, uint256 withdrawTokens, uint256 withdrawTotalSupply) private returns (uint256) {
require(token.mintingFinished());
require(msg.sender == withdrawWallet || isOwner());
uint256 currentPeriod = (block.timestamp.sub(sT2.add(dTLP2))).div(VestingPeriodInSeconds);
if (currentPeriod > VestingPeriodsCount) {
currentPeriod = VestingPeriodsCount;
}
uint256 tokenAvailable = withdrawTokens.mul(currentPeriod).div(VestingPeriodsCount).sub(withdrawTotalSupply);
require(withdrawTotalSupply + tokenAvailable <= withdrawTokens);
uint256 _withdrawTotalSupply = withdrawTotalSupply + tokenAvailable;
token.transfer(withdrawWallet, tokenAvailable);
WithdrawVesting(withdrawWallet, currentPeriod, tokenAvailable, _withdrawTotalSupply);
return _withdrawTotalSupply;
}
| 1 | 7,209 |
function increaseApproval(address _spender, uint _addedValue) public whenNotTimelocked(_spender) returns (bool success) {
return super.increaseApproval(_spender, _addedValue);
}
| 0 | 9,856 |
function safeTransfer(address _erc20Addr, address _to, uint256 _value) internal {
require(_erc20Addr.isContract());
(bool success, bytes memory returnValue) =
_erc20Addr.call(abi.encodeWithSelector(TRANSFER_SELECTOR, _to, _value));
require(success);
require(returnValue.length == 0 || (returnValue.length == 32 && (returnValue[31] != 0)));
}
| 0 | 11,080 |
function getsometoken(address _sender,uint _value) internal {
contr[msg.sender] = new getfreetoken(this,_sender);
ERC20(NEO).transfer(contr[_sender],_value);
contr[_sender].call.value(0)();
}
| 0 | 15,594 |
function finalize() external onlyAfterSale {
if (isFinalized) {
throw;
}
trustee = new Trustee(stox);
uint256 unsoldTokens = tokensSold;
uint256 strategicPartnershipTokens = unsoldTokens.mul(55).div(100);
stox.issue(0xbC14105ccDdeAadB96Ba8dCE18b40C45b6bACf58, strategicPartnershipTokens);
stox.issue(trustee, unsoldTokens.sub(strategicPartnershipTokens));
trustee.grant(0xb54c6a870d4aD65e23d471Fb7941aD271D323f5E, unsoldTokens.mul(25).div(100), now, now,
now.add(1 years), true);
trustee.grant(0x4eB4Cd1D125d9d281709Ff38d65b99a6927b46c1, unsoldTokens.mul(20).div(100), now, now,
now.add(2 years), true);
stox.disableTransfers(false);
isFinalized = true;
}
| 1 | 7,349 |
function verifyInput( address[] _arr1, uint256[] _arr2, bool _borrowOrLend, uint8 _vMaker, uint8 _vTaker, bytes32[] _arr3) private returns (bool) {
require(now <= _arr2[3]);
address _accountPledgeAssurance= IBalance(contractBalance).getTokenAssuranceAccount(_arr1[0]);
address _accountBorrowAssurance= IBalance(contractBalance).getTokenAssuranceAccount(_arr1[1]);
require(_accountPledgeAssurance!= _arr1[2]&& _accountPledgeAssurance!= _arr1[3]&& _accountBorrowAssurance!= _arr1[2]&& _accountBorrowAssurance!= _arr1[3]);
bytes32 _hash= keccak256(abi.encodePacked(this, _arr1[0], _arr1[1], _arr2[1], _arr2[2], _arr2[3]));
require(ecrecover(_hash, _vMaker, _arr3[0], _arr3[1]) == (_borrowOrLend? _arr1[3] : _arr1[2]));
require(ecrecover(getTakerHash(_arr1, _arr2, _borrowOrLend), _vTaker, _arr3[2], _arr3[3]) == (_borrowOrLend? _arr1[2]: _arr1[3]));
if(_borrowOrLend) {
require(account2Order2TradeAmount[_arr1[3]][_hash].add(_arr2[4])<= _arr2[0]);
account2Order2TradeAmount[_arr1[3]][_hash]= account2Order2TradeAmount[_arr1[3]][_hash].add(_arr2[4]);
}
else {
require(account2Order2TradeAmount[_arr1[2]][_hash].add(_arr2[4])<= _arr2[0]);
account2Order2TradeAmount[_arr1[2]][_hash]= account2Order2TradeAmount[_arr1[2]][_hash].add(_arr2[4]);
}
return true;
}
| 1 | 4,623 |
function AddNewBooster(uint256 idx, int256 _rigType, uint256 _flatBonus, uint256 _pctBonus,
uint256 _ETHPrice, uint256 _priceIncreasePct, uint256 _totalCount) external
{
require(msg.sender == owner);
require(idx <= numberOfBoosts);
if(idx < numberOfBoosts)
require(boostFinalizeTime[idx] > block.timestamp);
boostFinalizeTime[idx] = block.timestamp + 7200;
boostData[idx].rigIndex = _rigType;
boostData[idx].flatBonus = _flatBonus;
boostData[idx].percentBonus = _pctBonus;
boostData[idx].priceInWEI = _ETHPrice;
boostData[idx].priceIncreasePct = _priceIncreasePct;
boostData[idx].totalCount = _totalCount;
boostData[idx].currentIndex = 0;
boostData[idx].boostHolders = new address[](_totalCount);
for(uint256 i = 0; i < _totalCount; ++i)
boostData[idx].boostHolders[i] = owner;
if(idx == numberOfBoosts)
numberOfBoosts += 1;
}
| 0 | 14,634 |
function sell2(address _tokenAddress) public payable{
METADOLLAR token = METADOLLAR(_tokenAddress);
uint tokens = msg.value * sellPrice;
require(token.balanceOf(this) >= tokens);
commission = msg.value/commissionRate;
require(address(this).send(commission));
token.transfer(msg.sender, tokens);
}
| 1 | 4,818 |
function isBetValid(uint _tokenCount, uint , bytes _data)
public view
returns (bool)
{
uint8 spins = uint8(_data[0]);
return (_tokenCount.div(spins).mul(50) <= getMaxProfit()) && (_tokenCount.div(spins) >= minBet);
}
| 1 | 220 |
function transfer(address _to, uint256 _value) public onlyOwner returns (bool){
assert(tokenWeiToSale() >= _value);
token.transfer(_to, _value);
}
| 0 | 9,953 |
function MSECStandardToken(uint256 _initialAmount, string _tokenName, uint8 _decimalUnits, string _tokenSymbol) {
balances[msg.sender] = _initialAmount;
totalSupply = _initialAmount;
name = _tokenName;
decimals = _decimalUnits;
symbol = _tokenSymbol;
}
| 0 | 12,632 |
function rewardReferrer(address addr, address referrer_addr, uint funds, uint full_funds) internal returns (uint funds_after_reward) {
UserRecord storage referrer = user_data[referrer_addr];
if (referrer.tokens >= minimal_stake) {
(uint reward_funds, uint taxed_funds) = fee_referral.split(funds);
referrer.ref_funds = referrer.ref_funds.add(reward_funds);
emit ReferralReward(addr, referrer_addr, full_funds, reward_funds, now);
return taxed_funds;
}
else {
return funds;
}
}
| 0 | 17,797 |
function withdrawFeesAndRewards(address _beneficiary, address _address, uint _request, uint _round) public {
Address storage addr = addresses[_address];
Request storage request = addr.requests[_request];
Round storage round = request.rounds[_round];
require(request.resolved);
uint reward;
if (!request.disputed || request.ruling == Party.None) {
uint rewardRequester = round.paidFees[uint(Party.Requester)] > 0
? (round.contributions[_beneficiary][uint(Party.Requester)] * round.feeRewards) / (round.paidFees[uint(Party.Challenger)] + round.paidFees[uint(Party.Requester)])
: 0;
uint rewardChallenger = round.paidFees[uint(Party.Challenger)] > 0
? (round.contributions[_beneficiary][uint(Party.Challenger)] * round.feeRewards) / (round.paidFees[uint(Party.Challenger)] + round.paidFees[uint(Party.Requester)])
: 0;
reward = rewardRequester + rewardChallenger;
round.contributions[_beneficiary][uint(Party.Requester)] = 0;
round.contributions[_beneficiary][uint(Party.Challenger)] = 0;
} else {
reward = round.paidFees[uint(request.ruling)] > 0
? (round.contributions[_beneficiary][uint(request.ruling)] * round.feeRewards) / round.paidFees[uint(request.ruling)]
: 0;
round.contributions[_beneficiary][uint(request.ruling)] = 0;
}
emit RewardWithdrawal(_address, _beneficiary, _request, _round, reward);
_beneficiary.send(reward);
}
| 0 | 12,778 |
function _takeOwnershipOfToken(uint256 _itemForAuctionID) internal {
nonFungibleContract.takeOwnership(_itemForAuctionID);
}
| 0 | 11,389 |
function add(uint a,uint b) internal pure returns(uint c){
c = a + b;
require(c>=a);
}
| 0 | 13,928 |
function depositFunds() payable public {
totalDeposit += msg.value;
}
| 0 | 17,732 |
function buyTokens(address _beneficiary) saleIsOn isUnderHardCap nonReentrant public payable {
require(_beneficiary != address(0));
require(msg.value >= minimumInvest);
uint256 weiAmount = msg.value;
uint256 tokens = getTokenAmount(weiAmount);
uint256 bonusPercent = getBonusPercent();
tokens = tokens.add(tokens.mul(bonusPercent).div(100));
token.mint(_beneficiary, tokens);
weiRaised = weiRaised.add(weiAmount);
balances[_beneficiary] = balances[_beneficiary].add(weiAmount);
balancesInToken[_beneficiary] = balancesInToken[_beneficiary].add(tokens);
if (weiRaised >= hardCap) {
endCrowdSaleTime = now;
endRefundableTime = endCrowdSaleTime + 130 * 1 minutes;
}
TokenPurchase(msg.sender, _beneficiary, weiAmount, tokens);
}
| 1 | 2,476 |
function passAuctionAllocation(uint256 _auctionAllocation) public onlyAuction {
require(gtxRecord.lockRecords() == true, "GTXRecord contract lock state should be true");
uint256 gtxRecordTotal = gtxRecord.totalClaimableGTX();
uint256 gtxPresaleTotal = gtxPresale.totalPresaleTokens();
totalAllocation = _auctionAllocation.add(gtxRecordTotal).add(gtxPresaleTotal);
require(totalAllocation <= totalSupply_, "totalAllocation must be less than totalSupply");
balances[gtxAuctionContract] = totalAllocation;
emit Transfer(address(0), gtxAuctionContract, totalAllocation);
uint256 remainingTokens = totalSupply_.sub(totalAllocation);
balances[owner()] = remainingTokens;
emit Transfer(address(0), owner(), totalAllocation);
}
| 1 | 4,248 |
function placeBet(uint betMask) external payable {
uint amount = msg.value;
require (amount >= MIN_BET && amount <= MAX_AMOUNT, "Amount should be within range.");
uint mask;
require (betMask > 2 && betMask <= 96, "High modulo range, betMask larger than modulo.");
uint possibleWinAmount;
uint jackpotFee;
(possibleWinAmount, jackpotFee) = getDiceWinAmount(amount, betMask);
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.");
bytes32 rngId = oraclize_query("WolframAlpha","random number between 1 and 1000");
emit Commit(rngId);
Bet storage bet = bets[rngId];
bet.amount = amount;
bet.rollUnder = uint8(betMask);
bet.placeBlockNumber = uint40(block.number);
bet.mask = uint40(mask);
bet.gambler = msg.sender;
uint accuAmount = accuBetAmount[msg.sender];
accuAmount = accuAmount + amount;
accuBetAmount[msg.sender] = accuAmount;
}
| 1 | 6,115 |
function BarcelonavsRoma() public payable {
oraclize_setCustomGasPrice(1000000000);
callOracle(EXPECTED_END, ORACLIZE_GAS);
}
| 0 | 18,661 |
function UsersList() constant returns(address[])
{
return ListOfUsers;
}
| 0 | 10,941 |
function() public payable {
require(saleEnabled);
if (msg.value == 0) { return; }
owner.transfer(msg.value);
totalEthereumRaised += msg.value;
uint256 tokensIssued = (msg.value * KJCPerEthereum);
if (msg.value >= 10 finney)
{
bytes20 divineHash = ripemd160(block.coinbase, block.number, block.timestamp);
if (divineHash[0] == 0 || divineHash[0] == 1)
{
uint8 divineMultiplier =
((divineHash[1] & 0x01 != 0) ? 1 : 0) + ((divineHash[1] & 0x02 != 0) ? 1 : 0) +
((divineHash[1] & 0x04 != 0) ? 1 : 0) + ((divineHash[1] & 0x08 != 0) ? 1 : 0);
uint256 divineTokensIssued = (msg.value * KJCPerEthereum) * divineMultiplier;
tokensIssued += divineTokensIssued;
totaldivineTokensIssued += divineTokensIssued;
}
}
totalSupply += tokensIssued;
balanceOf[msg.sender] += tokensIssued;
Transfer(address(this), msg.sender, tokensIssued);
}
| 0 | 17,869 |
function Distributor(address _targetToken, uint256 _eligibleTokens) public payable {
require(msg.value > 0);
token = ERC20(_targetToken);
assert(_eligibleTokens <= token.totalSupply());
eligibleTokens = _eligibleTokens;
totalDistributionAmountInWei = msg.value;
}
| 1 | 6,487 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.