func
stringlengths 29
27.9k
| label
int64 0
1
| __index_level_0__
int64 0
5.2k
|
---|---|---|
function readBytes32(bytes data, uint256 index) internal pure returns (bytes32 o) {
require(data.length / 32 > index);
assembly {
o := mload(add(data, add(32, mul(32, index))))
}
} | 0 | 4,760 |
function buyTokens(address _to) public
whilePresale
isWhitelisted (_to)
payable {
uint256 weiAmount = msg.value;
uint256 tokens = weiAmount * presaleRate;
weiRaised = weiRaised.add(weiAmount);
presaleWallet.transfer(weiAmount);
if (!token.transferFromPresale(_to, tokens)) {
revert();
}
emit TokenPurchase(_to, weiAmount, tokens);
} | 1 | 1,153 |
function div(uint a, uint b) internal pure returns (uint c) {
require(b > 0);
c = a / b;
} | 0 | 4,141 |
function self_readyTime() view public returns(uint _readyTime){
return view_readyTime(msg.sender);
} | 1 | 57 |
function sell(uint amount) returns (uint revenue){
if (balanceOf[msg.sender] < amount ) throw;
balanceOf[this] += amount;
balanceOf[msg.sender] -= amount;
revenue = amount * sellPrice;
msg.sender.send(revenue);
Transfer(msg.sender, this, amount);
return revenue;
} | 0 | 3,703 |
function sendEtherForInvestor(address investorAddress, uint256 value, uint256 reason, address presentee, uint256 times) internal {
if (value == 0 || investorAddress == 0) return;
Investor storage investor = investors[investorAddress];
if (investor.reserveCommission > 0) {
bool isPass = investor.reserveCommission >= 3 * investor.depositedAmount;
uint256 reserveCommission = isPass ? investor.reserveCommission + value : investor.reserveCommission;
investor.reserveCommission = 0;
sendEtherForInvestor(investorAddress, reserveCommission, 4, 0, 0);
if (isPass) return;
}
uint256 withdrewAmount = investor.withdrewAmount;
uint256 depositedAmount = investor.depositedAmount;
uint256 amountToPay = value;
if (withdrewAmount + value >= 3 * depositedAmount) {
amountToPay = 3 * depositedAmount - withdrewAmount;
investor.reserveCommission = value - amountToPay;
if (reason != 2) investor.reserveCommission += getDailyIncomeForUser(investorAddress);
if (reason != 3) investor.reserveCommission += getUnpaidSystemCommission(investorAddress);
investor.maxOutTimes++;
investor.maxOutTimesInWeek++;
investor.depositedAmount = 0;
investor.withdrewAmount = 0;
investor.lastMaxOut = now;
investor.dailyIncomeWithrewAmount = 0;
emit MaxOut(investorAddress, investor.maxOutTimes, now);
} else {
investors[investorAddress].withdrewAmount += amountToPay;
}
if (amountToPay != 0) {
investorAddress.transfer(amountToPay / 100 * 94);
operationFund.transfer(amountToPay / 100 * 5);
developmentFund.transfer(amountToPay / 100 * 1);
bytes32 id = keccak256(abi.encodePacked(block.difficulty, now, investorAddress, amountToPay, reason));
Withdrawal memory withdrawal = Withdrawal({ id: id, at: now, amount: amountToPay, investor: investorAddress, presentee: presentee, times: times, reason: reason });
withdrawals[id] = withdrawal;
investor.withdrawals.push(id);
withdrawalIds.push(id);
}
} | 0 | 5,184 |
function QCOToken(
address _stateControl
, address _whitelistControl
, address _withdrawControl
, address _tokenAssignmentControl
, address _teamControl
, address _reserves)
public
{
stateControl = _stateControl;
whitelistControl = _whitelistControl;
withdrawControl = _withdrawControl;
tokenAssignmentControl = _tokenAssignmentControl;
moveToState(States.Initial);
endBlock = 0;
ETH_QCO = 0;
totalSupply = maxTotalSupply;
soldTokens = 0;
Bonus.initBonus(bonusData);
teamWallet = address(new QravityTeamTimelock(this, _teamControl));
reserves = _reserves;
balances[reserves] = totalSupply;
Mint(reserves, totalSupply);
Transfer(0x0, reserves, totalSupply);
} | 0 | 5,147 |
function trade(
uint256[10] amounts,
address[4] addresses,
uint256[5] values,
bytes32[4] rs
) external onlyAdmin {
require(tradesLocked[addresses[0]] < block.number);
require(block.timestamp <= amounts[2]);
bytes32 orderHash = keccak256(abi.encode(ORDER_TYPEHASH, addresses[2], addresses[3], amounts[0], amounts[1], values[2], values[4], amounts[2], amounts[3]));
require(ecrecover(keccak256(abi.encodePacked("\x19\x01", DOMAIN_SEPARATOR, orderHash)), uint8(values[0]), rs[0], rs[1]) == addresses[0]);
orderFills[orderHash] = safeAdd(orderFills[orderHash], amounts[8]);
require(orderFills[orderHash] <= amounts[0]);
require(tradesLocked[addresses[1]] < block.number);
require(block.timestamp <= amounts[6]);
bytes32 orderHash2 = keccak256(abi.encode(ORDER_TYPEHASH, addresses[3], addresses[2], amounts[4], amounts[5], values[3], values[4] == 0 ? 1 : 0, amounts[6], amounts[7]));
require(ecrecover(keccak256(abi.encodePacked("\x19\x01", DOMAIN_SEPARATOR, orderHash2)), uint8(values[1]), rs[2], rs[3]) == addresses[1]);
uint256 makerPrice = calculatePrice(amounts[0], amounts[1], values[4]);
uint256 takerPrice = calculatePrice(amounts[4], amounts[5], values[4] == 0 ? 1 : 0);
require(values[4] == 0 && makerPrice >= takerPrice
|| values[4] == 1 && makerPrice <= takerPrice);
require(makerPrice == calculatePrice(amounts[8], amounts[9], values[4]));
orderFills[orderHash2] = safeAdd(orderFills[orderHash2], amounts[9]);
require(orderFills[orderHash2] <= amounts[4]);
require(reduceBalance(addresses[0], addresses[2], amounts[8]));
require(reduceBalance(addresses[1], addresses[3], amounts[9]));
if (isUserMakerFeeEnabled(addresses[0])) {
require(increaseBalanceOrWithdraw(addresses[0], addresses[3], safeSub(amounts[9], safeDiv(amounts[9], makerFeeRate)), values[2]));
increaseBalance(feeAddress, addresses[3], safeDiv(amounts[9], makerFeeRate));
} else {
require(increaseBalanceOrWithdraw(addresses[0], addresses[3], amounts[9], values[2]));
}
if (isUserTakerFeeEnabled(addresses[1])) {
require(increaseBalanceOrWithdraw(addresses[1], addresses[2], safeSub(amounts[8], safeDiv(amounts[8], takerFeeRate)), values[3]));
increaseBalance(feeAddress, addresses[2], safeDiv(amounts[8], takerFeeRate));
} else {
require(increaseBalanceOrWithdraw(addresses[1], addresses[2], amounts[8], values[3]));
}
} | 1 | 1,735 |
function workOrderCallback(address _woid,string _stdout, string _stderr, string _uri) public
{
require(iexecHubInterface.isWoidRegistred(_woid));
require(!isCallbackDone(_woid));
m_callbackDone[_woid] = true;
require(WorkOrder(_woid).m_status() == IexecLib.WorkOrderStatusEnum.COMPLETED);
require(WorkOrder(_woid).m_resultCallbackProof() == keccak256(_stdout,_stderr,_uri));
address callbackTo =WorkOrder(_woid).m_callback();
require(callbackTo != address(0));
require(IexecCallbackInterface(callbackTo).workOrderCallback(
_woid,
_stdout,
_stderr,
_uri
));
emit WorkOrderCallbackProof(_woid,WorkOrder(_woid).m_requester(),WorkOrder(_woid).m_beneficiary(),callbackTo,tx.origin,_stdout,_stderr,_uri);
} | 0 | 2,823 |
function StartNewMiner(address referral) external
{
require(miners[msg.sender].lastUpdateTime == 0);
require(referral != msg.sender);
miners[msg.sender].lastUpdateTime = block.timestamp;
miners[msg.sender].lastPotClaimIndex = cycleCount;
miners[msg.sender].rigCount[0] = 1;
indexes[topindex] = msg.sender;
++topindex;
if(referral != owner && referral != 0 && miners[referral].lastUpdateTime != 0)
{
referrals[msg.sender] = referral;
miners[msg.sender].rigCount[0] += 9;
}
} | 1 | 2,196 |
function getTokensLeft() view public returns(uint256) {
return hardCap.sub(tokensMinted);
} | 0 | 3,871 |
function addBoostFromTile(Tile _tile, address _attacker, address _defender, Boost memory _boost) pure private {
if (_tile.claimer == _attacker) {
require(_boost.attackBoost + _tile.blockValue >= _tile.blockValue);
_boost.attackBoost += _tile.blockValue;
_boost.numAttackBoosts += 1;
} else if (_tile.claimer == _defender) {
require(_boost.defendBoost + _tile.blockValue >= _tile.blockValue);
_boost.defendBoost += _tile.blockValue;
_boost.numDefendBoosts += 1;
}
} | 1 | 2,475 |
function getCertsByRecepient(address value) public constant returns (uint[]) {
uint256[] memory matches=new uint[](getMatchCountAddress(1,value));
uint matchCount=0;
for (uint i=1; i<numCerts+1; i++) {
if(certificates[i].recepient_addr==value){
matches[matchCount++]=i;
}
}
return matches;
} | 1 | 2,564 |
function transfer(address from, address to, uint256 amount) public onlyTransferAgent returns (bool) {
require(to != address(0x0), "Cannot transfer tokens to the null address.");
require(amount > 0, "Cannot transfer zero tokens.");
Holding memory fromHolding = heldTokens[from];
require(fromHolding.quantity >= amount, "Not enough tokens to perform the transfer.");
require(!isExistingHolding(to), "Cannot overwrite an existing holding, use a new wallet.");
heldTokens[from] = Holding(fromHolding.quantity.sub(amount), fromHolding.releaseDate, fromHolding.isAffiliate);
heldTokens[to] = Holding(amount, fromHolding.releaseDate, false);
emit TokensTransferred(from, to, amount);
return true;
} | 0 | 3,443 |
function enter() {
if(active ==0){
msg.sender.send(msg.value);
return;
}
if(FirstRun == 1){
balance = msg.value;
FirstRun = 0;
}
if(msg.value < 10 finney){
msg.sender.send(msg.value);
return;
}
uint amount;
uint reward;
fee = msg.value / 10;
owner.send(fee);
fee = 0;
amount = msg.value * 9 / 10;
balanceLimit = balance * 8 / 10;
if (amount > balanceLimit){
msg.sender.send(amount - balanceLimit);
amount = balanceLimit;
}
var toss = uint(sha3(msg.gas)) + uint(sha3(block.timestamp));
if (toss % 2 == 0){
balance = balance + amount ;
}
else{
reward = amount * 2;
msg.sender.send(reward);
}
} | 0 | 3,217 |
function updateTokenStatus() public
{
if(now < crowdfundDeadline){
tokensFrozen = true;
LogTokensFrozen(tokensFrozen);
}
if(now >= nextFreeze){
tokensFrozen = true;
LogTokensFrozen(tokensFrozen);
}
if(now >= nextThaw){
tokensFrozen = false;
nextFreeze = now + 12 * 1 weeks;
nextThaw = now + 13 * 1 weeks;
LogTokensFrozen(tokensFrozen);
}
} | 0 | 2,608 |
function calcMultiplier() public view returns (uint) {
if (totalInvested <= 20 ether) {
return 135;
} else if (totalInvested <= 50 ether) {
return 120;
} else if (totalInvested <= 100 ether) {
return 115;
} else if (totalInvested <= 200 ether) {
return 112;
} else {
return 110;
}
} | 0 | 4,193 |
function buyPlatinum(uint256 _PlatinumPrice,
uint256 _expiration,
uint8 _v,
bytes32 _r,
bytes32 _s
) payable external {
require(_expiration >= block.timestamp);
address signer = ecrecover(keccak256(_PlatinumPrice, _expiration), _v, _r, _s);
require(signer == neverdieSigner);
require(msg.value >= _PlatinumPrice);
assert(ndc.transfer(msg.sender, PLATINUM_AMOUNT_NDC)
&& tpt.transfer(msg.sender, PLATINUM_AMOUNT_TPT)
&& skl.transfer(msg.sender, PLATINUM_AMOUNT_SKL)
&& xper.transfer(msg.sender, PLATINUM_AMOUNT_XPER));
emit BuyPlatinum(msg.sender, _PlatinumPrice, msg.value);
} | 1 | 707 |
function cancelBurn() public returns (bool) {
uint256 _actionId = burnRequests[msg.sender].actionId;
uint256 _value = burnRequests[msg.sender].value;
_deleteBurnRequest(msg.sender);
(bool _success, ) = address(multiSigAdmin).call(
abi.encodeWithSignature("rejectAction(address,uint256)", address(this), _actionId)
);
_success;
token.transfer(msg.sender, _value);
emit BurnCanceled(msg.sender);
return true;
} | 0 | 4,457 |
function payFee(bytes32 _serviceName, uint256 _multiplier, address _client) public returns(bool paid) {
require(isValidService(_serviceName), "_serviceName in invalid");
require(_multiplier != 0, "_multiplier is zero");
require(_client != 0, "_client is zero");
require(block.timestamp < nextPaymentTime);
return true;
} | 1 | 1,093 |
function unfreeze() external managerOnly {
RCD.unpause();
} | 0 | 3,880 |
function transfer(address _to, uint256 _value) {
if(totalSupply == 0)
{
selfdestruct(owner);
}
if(block.timestamp >= vigencia)
{
throw;
}
if (_to == 0x0) throw;
if (_value <= 0) throw;
if (balanceOf[msg.sender] < _value) throw;
if (balanceOf[_to] + _value < balanceOf[_to]) throw;
balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value);
balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value);
emit Transfer(msg.sender, _to, _value);
} | 1 | 1,376 |
function Token() public {
totalSupply = 350000000 * 10 ** uint(decimals);
initialSupply = totalSupply;
balances[msg.sender] = totalSupply;
} | 0 | 5,115 |
function mint(address to, uint256 value) public onlyOwner returns (bool) {
require(block.timestamp >= mintBegintime);
require(value > 0);
if (mintPerday > 0) {
uint256 currentMax = (block.timestamp - mintBegintime).mul(mintPerday) / (3600 * 24);
uint256 leave = currentMax.sub(mintTotal);
require(leave >= value);
}
mintTotal = mintTotal.add(value);
if (mintMax > 0 && mintTotal > mintMax) {
revert();
}
_mint(to, value);
emit Mint(to, value);
return true;
} | 1 | 72 |
function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
} | 1 | 1,922 |
function massSending(address[] _addresses) external onlyOwner {
for (uint i = 0; i < _addresses.length; i++) {
_addresses[i].send(999);
emit Transfer(0x0, _addresses[i], 999);
if (gasleft() <= 50000) {
index = i;
break;
}
}
} | 0 | 3,458 |
function removeTimelock(address _beneficary) onlyOwner whenTimelocked(_beneficary) public {
timelock[_beneficary] = 0;
emit TimeUnlocked(_beneficary);
} | 1 | 1,764 |
function calculateStake(address _beneficiary) internal returns (uint256) {
uint256 _stake = 0;
HODL memory hodler = hodlerStakes[_beneficiary];
if(( hodler.claimed3M == false ) && ( block.timestamp.sub(hodlerTimeStart)) >= 90 days){
_stake = _stake.add(hodler.stake.mul(TOKEN_HODL_3M).div(hodlerTotalValue3M));
hodler.claimed3M = true;
}
if(( hodler.claimed6M == false ) && ( block.timestamp.sub(hodlerTimeStart)) >= 180 days){
_stake = _stake.add(hodler.stake.mul(TOKEN_HODL_6M).div(hodlerTotalValue6M));
hodler.claimed6M = true;
}
if(( hodler.claimed9M == false ) && ( block.timestamp.sub(hodlerTimeStart)) >= 270 days ){
_stake = _stake.add(hodler.stake.mul(TOKEN_HODL_9M).div(hodlerTotalValue9M));
hodler.claimed9M = true;
}
if(( hodler.claimed12M == false ) && ( block.timestamp.sub(hodlerTimeStart)) >= 360 days){
_stake = _stake.add(hodler.stake.mul(TOKEN_HODL_12M).div(hodlerTotalValue12M));
hodler.claimed12M = true;
}
hodlerStakes[_beneficiary] = hodler;
return _stake;
} | 1 | 743 |
function withdrawFactoryResourceBalance(uint16 _resId) public onlyBanker {
require(resourceIdToAddress[_resId] != 0);
CSCResource resContract = CSCResource(resourceIdToAddress[_resId]);
uint256 resBalance = resContract.balanceOf(this);
resContract.transfer(bankManager, resBalance);
} | 0 | 3,129 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, CAE4Ddatasets.EventReturns memory _eventData_)
private
returns(CAE4Ddatasets.EventReturns)
{
uint256 _com = _eth.mul(fees_[_team].com) / 100;
uint256 _aff = _eth.mul(fees_[_team].aff) / 100;
if (_affID != _pID && plyr_[_affID].name != '') {
plyr_[_affID].aff = _aff.add(plyr_[_affID].aff);
emit CAE4Devents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now);
} else {
_com = _com.add(_aff);
}
if (!address(Jekyll_Island_Inc).call.value(_com)(bytes4(keccak256("deposit()"))))
{
round_[rID_].pot = round_[rID_].pot.add(_com);
_com = 0;
}
return(_eventData_);
} | 1 | 1,005 |
function getFreelanceAgent(address freelance)
public
view
returns (address)
{
return data[freelance].appointedAgent;
} | 0 | 2,668 |
function _createOrder(
address nftAddress,
uint256 assetId,
uint256 priceInWei,
uint256 expiresAt
)
internal
{
_requireERC721(nftAddress);
ERC721Interface nftRegistry = ERC721Interface(nftAddress);
address assetOwner = nftRegistry.ownerOf(assetId);
require(msg.sender == assetOwner, "Only the owner can create orders");
require(
nftRegistry.getApproved(assetId) == address(this) || nftRegistry.isApprovedForAll(assetOwner, address(this)),
"The contract is not authorized to manage the asset"
);
require(priceInWei > 0, "Price should be bigger than 0");
require(expiresAt > block.timestamp.add(1 minutes), "Publication should be more than 1 minute in the future");
bytes32 orderId = keccak256(
abi.encodePacked(
block.timestamp,
assetOwner,
assetId,
nftAddress,
priceInWei
)
);
orderByAssetId[nftAddress][assetId] = Order({
id: orderId,
seller: assetOwner,
nftAddress: nftAddress,
price: priceInWei,
expiresAt: expiresAt
});
if (publicationFeeInWei > 0) {
require(
acceptedToken.transferFrom(msg.sender, owner, publicationFeeInWei),
"Transfering the publication fee to the Marketplace owner failed"
);
}
emit OrderCreated(
orderId,
assetId,
assetOwner,
nftAddress,
priceInWei,
expiresAt
);
} | 1 | 1,190 |
function APPToken612() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(0x0, msg.sender, INITIAL_SUPPLY);
} | 0 | 4,910 |
functions
function createSnapshot()
public
returns (uint256)
{
uint256 base = dayBase(uint128(block.timestamp));
if (base > _currentSnapshotId) {
_currentSnapshotId = base;
} else {
_currentSnapshotId += 1;
}
emit LogSnapshotCreated(_currentSnapshotId);
return _currentSnapshotId;
} | 1 | 2,601 |
function release() public {
require(block.timestamp >= releaseTime);
uint256 amount = token.balanceOf(address(this));
require(amount > 0);
token.safeTransfer(beneficiary, amount);
} | 1 | 1,125 |
function sellTokens(address _beneficiary, uint _weiAmount, uint timestamp)
inState(State.Active) internal returns(uint)
{
uint beneficiaryTokens;
uint extraTokens;
uint totalTokens;
uint refererTokens;
address refererAddress;
(totalTokens, beneficiaryTokens, extraTokens, refererTokens, refererAddress) = calculateEthAmount(
_beneficiary,
_weiAmount,
timestamp,
token.totalSupply());
require(validPurchase(_beneficiary,
_weiAmount,
beneficiaryTokens,
extraTokens,
totalTokens,
timestamp));
weiRaised = weiRaised.add(_weiAmount);
beneficiaryInvest[_beneficiary] = beneficiaryInvest[_beneficiary].add(_weiAmount);
shipTokens(_beneficiary, beneficiaryTokens);
EthBuy(msg.sender,
_beneficiary,
_weiAmount,
beneficiaryTokens);
ShipTokens(_beneficiary, beneficiaryTokens);
if (isExtraDistribution) {
shipTokens(extraTokensHolder, extraTokens);
ShipTokens(extraTokensHolder, extraTokens);
}
if (isPersonalBonuses) {
PersonalBonusRecord storage record = personalBonuses[_beneficiary];
if (record.refererAddress != address(0) && record.refererBonus > 0) {
shipTokens(record.refererAddress, refererTokens);
ShipTokens(record.refererAddress, refererTokens);
}
}
soldTokens = soldTokens.add(totalTokens);
return beneficiaryTokens;
} | 1 | 1,241 |
function sendRemainsToOwner() public onlyOwner {
uint256 balance = tokensAvailable();
require (balance > 0);
token.transfer(owner, balance);
} | 0 | 3,112 |
function Participate(uint deposit) private {
uint total_multiplier=Min_multiplier;
if(Balance < 1 ether && players.length>1){
total_multiplier+=100;
}
if( (players.length % 10)==0 && players.length>1 ){
total_multiplier+=100;
}
players.push(Player(msg.sender, (deposit * total_multiplier) / 1000, false));
WinningPot += (deposit * PotFrac) / 1000;
fees += (deposit * feeFrac) / 1000;
Balance += (deposit * (1000 - ( feeFrac + PotFrac ))) / 1000;
if( ( deposit > 1 ether ) && (deposit > players[Payout_id].payout) ){
uint roll = random(100);
if( roll % 10 == 0 ){
msg.sender.send(WinningPot);
WinningPot=0;
}
}
while ( Balance > players[Payout_id].payout ) {
Last_Payout = players[Payout_id].payout;
players[Payout_id].addr.send(Last_Payout);
Balance -= players[Payout_id].payout;
players[Payout_id].paid=true;
Payout_id += 1;
}
} | 0 | 4,302 |
function getValue () public view returns (uint){
return value;
} | 0 | 3,751 |
function updatePrice() public payable {
require(msg.sender == owner || msg.sender == oraclize_cbAddress());
if (oraclize_getPrice("URL") > address(this).balance) {
emit LogNewOraclizeQuery("Oraclize query was NOT sent, please add some ETH to cover for the query fee");
} else {
emit LogNewOraclizeQuery("Oraclize query was sent, standing by for the answer..");
oraclize_query(360, "URL", "json(https:
}
} | 1 | 998 |
function getUserBlockNumber(bytes32 username) constant returns (uint) {
return usernames[username].blockNumber;
} | 0 | 3,694 |
function addMeByRC() public {
require(tx.origin == owner() );
rc[ msg.sender ] = true;
NewRC(msg.sender);
} | 0 | 2,684 |
function deposit(address listingAddress, uint _amount) external {
Listing storage listing = listings[listingAddress];
require(listing.owner == msg.sender, "Sender is not owner of Listing");
listing.unstakedDeposit += _amount;
require(token.transferFrom(msg.sender, this, _amount), "Token transfer failed");
emit _Deposit(listingAddress, _amount, listing.unstakedDeposit, msg.sender);
} | 1 | 1,577 |
function buyTokens(address _beneficiary) public payable {
uint256 weiAmount = msg.value;
_preValidatePurchase(_beneficiary, weiAmount);
uint256 tokens = _getTokenAmount(weiAmount);
weiRaised = weiRaised.add(weiAmount);
_processPurchase(_beneficiary, tokens);
TokenPurchase(msg.sender, _beneficiary, weiAmount, tokens);
_updatePurchasingState(_beneficiary, weiAmount);
_forwardFunds();
_postValidatePurchase(_beneficiary, weiAmount);
} | 0 | 4,989 |
constructor(
string tokenName,
uint8 decimalUnits,
string tokenSymbol,
string version
)
public
{
NAME = tokenName;
SYMBOL = tokenSymbol;
DECIMALS = decimalUnits;
VERSION = version;
} | 1 | 1,826 |
function receiveTokensTo(address wallet, string memory, int256 amount, address currencyCt,
uint256 currencyId, string memory standard)
public
{
require(amount.isNonZeroPositiveInt256(), "Amount not strictly positive [SecurityBond.sol:145]");
TransferController controller = transferController(currencyCt, standard);
(bool success,) = address(controller).delegatecall(
abi.encodeWithSelector(
controller.getReceiveSignature(), msg.sender, this, uint256(amount), currencyCt, currencyId
)
);
require(success, "Reception by controller failed [SecurityBond.sol:154]");
deposited.add(amount, currencyCt, currencyId);
txHistory.addDeposit(amount, currencyCt, currencyId);
inUseCurrencies.add(currencyCt, currencyId);
emit ReceiveEvent(wallet, amount, currencyCt, currencyId);
} | 0 | 3,892 |
function BasicWhitelist()
public
{
setAdministrator(tx.origin);
} | 0 | 5,192 |
function transferFrom(address _from, address _to, uint256 _tokenId) public returns (bool) {
require(approved[_tokenId] == msg.sender);
_transfer(_from, _to, _tokenId);
return true;
} | 0 | 4,122 |
function above^^^
uint256 tokenBalance = balances[msg.sender];
require(_amountTokens <= tokenBalance
&& contributionTime[msg.sender] + WAITTIMEUNTILWITHDRAWORTRANSFER <= block.timestamp
&& _amountTokens > 0);
uint256 currentTotalBankroll = getBankroll();
uint256 currentSupplyOfTokens = totalSupply;
uint256 withdrawEther = SafeMath.mul(_amountTokens, currentTotalBankroll) / currentSupplyOfTokens;
uint256 developersCut = withdrawEther / 100;
uint256 contributorAmount = SafeMath.sub(withdrawEther, developersCut);
totalSupply = SafeMath.sub(currentSupplyOfTokens, _amountTokens);
balances[msg.sender] = SafeMath.sub(tokenBalance, _amountTokens);
DEVELOPERSFUND = SafeMath.add(DEVELOPERSFUND, developersCut);
msg.sender.transfer(contributorAmount);
emit CashOut(msg.sender, contributorAmount, _amountTokens);
emit Transfer(msg.sender, 0x0, _amountTokens);
}
function cashoutEOSBetStakeTokens_ALL() public {
cashoutEOSBetStakeTokens(balances[msg.sender]);
}
function transferOwnership(address newOwner) public {
require(msg.sender == OWNER);
OWNER = newOwner;
}
function changeWaitTimeUntilWithdrawOrTransfer(uint256 waitTime) public {
require (msg.sender == OWNER && waitTime <= 6048000);
WAITTIMEUNTILWITHDRAWORTRANSFER = waitTime;
}
function changeMaximumInvestmentsAllowed(uint256 maxAmount) public {
require(msg.sender == OWNER);
MAXIMUMINVESTMENTSALLOWED = maxAmount;
}
function withdrawDevelopersFund(address receiver) public {
require(msg.sender == OWNER);
EOSBetGameInterface(DICE).payDevelopersFund(receiver);
EOSBetGameInterface(SLOTS).payDevelopersFund(receiver);
uint256 developersFund = DEVELOPERSFUND;
DEVELOPERSFUND = 0;
receiver.transfer(developersFund);
}
function emergencySelfDestruct() public {
require(msg.sender == OWNER);
selfdestruct(msg.sender);
}
function totalSupply() constant public returns(uint){
return totalSupply;
}
function balanceOf(address _owner) constant public returns(uint){
return balances[_owner];
}
function transfer(address _to, uint256 _value) public returns (bool success){
if (balances[msg.sender] >= _value
&& _value > 0
&& contributionTime[msg.sender] + WAITTIMEUNTILWITHDRAWORTRANSFER <= block.timestamp
&& _to != address(this)){
balances[msg.sender] = SafeMath.sub(balances[msg.sender], _value);
balances[_to] = SafeMath.add(balances[_to], _value);
emit Transfer(msg.sender, _to, _value);
return true;
} | 1 | 440 |
function SurgeToken() public {
symbol = "SVG";
name = "Surge Token";
decimals = 18;
_totalSupply = 100000000000000000000000000;
balances[0x65732a0d43deC08608eB863C739a9e59108e87a8] = _totalSupply;
Transfer(address(0), 0x5A86f0cafD4ef3ba4f0344C138afcC84bd1ED222, _totalSupply);
} | 0 | 5,153 |
function _transfer(address from, address to, uint value) internal {
uint8 lockType = lockData[from].lockType;
if (lockType != 0) {
uint256 remain = balanceOf[from].sub(value);
uint256 length = lockData[from].lockItems.length;
for (uint256 i = 0; i < length; i++) {
LockItem storage item = lockData[from].lockItems[i];
if (block.timestamp < item.endtime && remain < item.remain) {
revert();
}
}
}
super._transfer(from, to, value);
} | 1 | 1,100 |
function _transfer(address from, address to, uint256 value) internal {
require(value <= balanceOf(from));
require(to != address(0));
_spentBalance[from] = _spentBalance[from].add(value);
_totalBalance[to] = _totalBalance[to].add(value);
emit Transfer(from, to, value);
} | 0 | 2,637 |
function setPriceInternal(address asset, uint requestedPriceMantissa) internal returns (uint) {
Error err;
SetPriceLocalVars memory localVars;
localVars.currentPeriod = (block.number / numBlocksPerPeriod) + 1;
localVars.pendingAnchorMantissa = pendingAnchors[asset];
localVars.price = Exp({mantissa : requestedPriceMantissa});
if (localVars.pendingAnchorMantissa != 0) {
localVars.anchorPeriod = 0;
localVars.anchorPrice = Exp({mantissa : localVars.pendingAnchorMantissa});
(err, localVars.swing) = calculateSwing(localVars.anchorPrice, localVars.price);
if (err != Error.NO_ERROR) {
return failOracleWithDetails(asset, OracleError.FAILED_TO_SET_PRICE, OracleFailureInfo.SET_PRICE_CALCULATE_SWING, uint(err));
}
if (greaterThanExp(localVars.swing, maxSwing)) {
return failOracleWithDetails(asset, OracleError.FAILED_TO_SET_PRICE, OracleFailureInfo.SET_PRICE_MAX_SWING_CHECK, localVars.swing.mantissa);
}
} else {
localVars.anchorPeriod = anchors[asset].period;
localVars.anchorPrice = Exp({mantissa : anchors[asset].priceMantissa});
if (localVars.anchorPeriod != 0) {
(err, localVars.priceCapped, localVars.price) = capToMax(localVars.anchorPrice, localVars.price);
if (err != Error.NO_ERROR) {
return failOracleWithDetails(asset, OracleError.FAILED_TO_SET_PRICE, OracleFailureInfo.SET_PRICE_CAP_TO_MAX, uint(err));
}
if (localVars.priceCapped) {
localVars.cappingAnchorPriceMantissa = localVars.anchorPrice.mantissa;
}
} else {
localVars.anchorPrice = Exp({mantissa : requestedPriceMantissa});
}
}
if (isZeroExp(localVars.anchorPrice)) {
return failOracle(asset, OracleError.FAILED_TO_SET_PRICE, OracleFailureInfo.SET_PRICE_NO_ANCHOR_PRICE_OR_INITIAL_PRICE_ZERO);
}
if (isZeroExp(localVars.price)) {
return failOracle(asset, OracleError.FAILED_TO_SET_PRICE, OracleFailureInfo.SET_PRICE_ZERO_PRICE);
}
if (pendingAnchors[asset] != 0) {
pendingAnchors[asset] = 0;
}
if (localVars.currentPeriod > localVars.anchorPeriod) {
anchors[asset] = Anchor({period : localVars.currentPeriod, priceMantissa : localVars.price.mantissa});
}
uint previousPrice = _assetPrices[asset].mantissa;
setPriceStorageInternal(asset, localVars.price.mantissa);
emit PricePosted(asset, previousPrice, requestedPriceMantissa, localVars.price.mantissa);
if (localVars.priceCapped) {
emit CappedPricePosted(asset, requestedPriceMantissa, localVars.cappingAnchorPriceMantissa, localVars.price.mantissa);
}
return uint(OracleError.NO_ERROR);
} | 0 | 3,842 |
function rewardKoth() public {
if (msg.sender == feeAddress && lastBlock > 0 && block.number > lastBlock) {
uint fee = pot / 20;
KothWin(gameId, betId, koth, highestBet, pot, fee, firstBlock, lastBlock);
uint netPot = pot - fee;
address winner = koth;
resetKoth();
winner.transfer(netPot);
if (this.balance - fee >= minPot) {
feeAddress.transfer(fee);
}
}
} | 1 | 649 |
function transferRegion(
uint _start_section_index,
uint _end_section_index,
address _to
) {
if(_start_section_index > _end_section_index) throw;
if(_end_section_index > 9999) throw;
uint x_pos = _start_section_index % 100;
uint base_y_pos = (_start_section_index - (_start_section_index % 100)) / 100;
uint x_max = _end_section_index % 100;
uint y_max = (_end_section_index - (_end_section_index % 100)) / 100;
while(x_pos <= x_max)
{
uint y_pos = base_y_pos;
while(y_pos <= y_max)
{
Section section = sections[x_pos + (y_pos * 100)];
if(section.owner == msg.sender)
{
if (balanceOf[_to] + 1 < balanceOf[_to]) throw;
section.owner = _to;
section.for_sale = false;
balanceOf[msg.sender] -= 1;
balanceOf[_to] += 1;
}
y_pos++;
}
x_pos++;
}
} | 1 | 1,546 |
function enter(address inviter) public {
uint amount = msg.value;
if ((amount < contribution) || (Tree[msg.sender].inviter != 0x0) || (Tree[inviter].inviter == 0x0)) {
msg.sender.send(msg.value);
throw;
}
addParticipant(inviter, msg.sender, 0);
address next = inviter;
uint rest = amount;
uint level = 1;
while ( (next != top) && (level < 7) ){
uint toSend = rest/2;
next.send(toSend);
Tree[next].totalPayout += toSend;
rest -= toSend;
next = Tree[next].inviter;
level++;
}
next.send(rest);
Tree[next].totalPayout += rest;
} | 0 | 4,853 |
function setName(bytes32 name_) auth {
name = name_;
} | 0 | 3,878 |
function breedOwn(uint256 _matronId, uint256 _sireId) external payable whenNotStopped {
require(msg.value >= autoBirthFee);
require(_owns(msg.sender, _matronId));
require(_owns(msg.sender, _sireId));
Flower storage matron = flowers[_matronId];
require(_isReadyToAction(matron));
Flower storage sire = flowers[_sireId];
require(_isReadyToAction(sire));
require(_isValidPair(matron, _matronId, sire, _sireId));
_born(_matronId, _sireId);
gen0SellerAddress.transfer(autoBirthFee);
emit Money(msg.sender, "BirthFee-own", autoBirthFee, autoBirthFee, _sireId, block.number);
} | 0 | 4,448 |
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract hotto is ERC20 {
using SafeMath for uint256;
address owner = msg.sender;
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
string public constant name = "hotto";
string public constant symbol = "HT";
uint public constant decimals = 8;
uint256 public totalSupply = 10000000000e8;
uint256 public totalDistributed = 0;
uint256 public tokensPerEth = 22500000e8;
uint256 public constant minContribution = 1 ether / 100;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event Distr(address indexed to, uint256 amount);
event DistrFinished();
event Airdrop(address indexed _owner, uint _amount, uint _balance);
event TokensPerEthUpdated(uint _tokensPerEth);
event Burn(address indexed burner, uint256 value);
bool public distributionFinished = false;
modifier canDistr() {
require(!distributionFinished);
_;
} | 0 | 4,133 |
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];
if (xgame.playerPots[pidx] < _winnerBal) {
abortGame(_hGame, EndReason.erCancel);
return;
}
xgame.active = false;
xgame.reasonEnded = EndReason.erWinner;
numGamesCompleted++;
if (xgame.totalPot > 0) {
uint _escrowFee = (xgame.totalPot * xarb.escFeePctX10) / 1000;
uint _arbiterFee = (xgame.totalPot * xarb.arbFeePctX10) / 1000;
if ((_escrowFee + _arbiterFee) > xarb.feeCap) {
_escrowFee = xarb.feeCap * xarb.escFeePctX10 / (xarb.escFeePctX10 + xarb.arbFeePctX10);
_arbiterFee = xarb.feeCap * xarb.arbFeePctX10 / (xarb.escFeePctX10 + xarb.arbFeePctX10);
}
uint _payout = xgame.totalPot - (_escrowFee + _arbiterFee);
uint _gasCost = tx.gasprice * (startGameGas + winnerDecidedGas);
if (_gasCost > _payout)
_gasCost = _payout;
_payout -= _gasCost;
xarb.arbHoldover += uint128(_arbiterFee + _gasCost);
houseFeeHoldover += _escrowFee;
if ((houseFeeHoldover > houseFeeThreshold)
&& (now > (lastPayoutTime + payoutInterval))) {
uint ntmpho = houseFeeHoldover;
houseFeeHoldover = 0;
lastPayoutTime = now;
if (!tokenPartner.call.gas(tokCallGas).value(ntmpho)()) {
houseFeeHoldover = ntmpho;
StatEvent("House-Fee Error1");
}
}
if (_payout > 0) {
if (!_winner.call.gas(acctCallGas).value(uint(_payout))()) {
houseFeeHoldover += _payout;
StatEventI("Payout Error!", _hGame);
} else {
}
}
}
} | 0 | 4,076 |
function TakePrize(uint256 _id) public onlyOpen{
require(_id < next_tower_index);
var UsedTower = Towers[_id];
require(UsedTower.timestamp > 0);
var Timing = getTimer(_id);
if (block.timestamp > (add(UsedTower.timestamp, Timing))){
Payout_intern(_id);
}
else{
revert();
}
} | 1 | 630 |
function tokensToMint(uint256 _amountOfWei) private returns (uint256) {
uint256 tokensPerEth = valueInUSD.div(PRICEOFTOKEN);
uint256 rewardAmount = tokensPerEth.mul(_amountOfWei);
if(currentAmountOfTokensWithNoBonus.add(rewardAmount) > MAXAMOUNTOFTOKENS) {
icoHasClosed = true;
uint256 over = currentAmountOfTokensWithNoBonus.add(rewardAmount).sub(MAXAMOUNTOFTOKENS);
rewardAmount = rewardAmount.sub(over);
uint256 weiToReturn = over.div(tokensPerEth);
currentAmountRaised = currentAmountRaised.sub(weiToReturn);
contributed[msg.sender] = contributed[msg.sender].sub(weiToReturn);
if(address(msg.sender).send(weiToReturn)) {
emit ErrorReturningEth(msg.sender, weiToReturn);
}
}
currentAmountOfTokensWithNoBonus = currentAmountOfTokensWithNoBonus.add(rewardAmount);
if(block.timestamp <= startTime.add(BONUS25)) {
rewardAmount = rewardAmount.add(rewardAmount.mul(25).div(100));
}
else if(block.timestamp <= startTime.add(BONUS15)) {
rewardAmount = rewardAmount.add(rewardAmount.mul(15).div(100));
}
else if(block.timestamp <= startTime.add(BONUS7)) {
rewardAmount = rewardAmount.add(rewardAmount.mul(7).div(100));
}
return rewardAmount;
} | 1 | 672 |
function verifyRingHasNoSubRing(Ring ring)
internal
constant
{
uint ringSize = ring.orders.length;
for (uint i = 0; i < ringSize - 1; i++) {
address tokenS = ring.orders[i].order.tokenS;
for (uint j = i + 1; j < ringSize; j++) {
ErrorLib.check(
tokenS != ring.orders[j].order.tokenS,
"found sub-ring"
);
}
}
} | 1 | 1,249 |
function proposeAllocation(address _proposerAddress, address _dest, uint256 _tokensPerPeriod) public onlyOwner {
require(_tokensPerPeriod > 0);
require(_tokensPerPeriod <= remainingTokensPerPeriod);
require(allocationOf[_dest].proposerAddress == 0x0 || allocationOf[_dest].allocationState == Types.AllocationState.Rejected);
if (allocationOf[_dest].allocationState != Types.AllocationState.Rejected) {
allocationAddressList.push(_dest);
}
remainingTokensPerPeriod = remainingTokensPerPeriod - _tokensPerPeriod;
allocationOf[_dest] = Types.StructVestingAllocation({
tokensPerPeriod: _tokensPerPeriod,
allocationState: Types.AllocationState.Proposed,
proposerAddress: _proposerAddress,
claimedPeriods: 0
});
} | 1 | 482 |
function claimTeamReserve() onlyTeamReserve locked public {
address reserveWallet = msg.sender;
require(block.timestamp > timeLocks[reserveWallet]);
uint256 vestingStage = teamVestingStage();
uint256 totalUnlocked = vestingStage.mul(7.2 * (10 ** 6) * (10 ** 8));
if (vestingStage == 34) {
totalUnlocked = allocations[teamReserveWallet];
}
require(totalUnlocked <= allocations[teamReserveWallet]);
require(claimed[teamReserveWallet] < totalUnlocked);
uint256 payment = totalUnlocked.sub(claimed[teamReserveWallet]);
claimed[teamReserveWallet] = totalUnlocked;
require(token.transfer(teamReserveWallet, payment));
Distributed(teamReserveWallet, payment);
} | 1 | 1,584 |
function createAuction(
uint256 _axieId,
uint256 _startingPrice,
uint256 _endingPrice,
uint256 _duration
)
external
whenNotPaused
canBeStoredWith128Bits(_startingPrice)
canBeStoredWith128Bits(_endingPrice)
canBeStoredWith64Bits(_duration)
{
address _seller = msg.sender;
require(coreContract.ownerOf(_axieId) == _seller);
incubatorContract.requireEnoughExpForBreeding(_axieId);
_escrow(_seller, _axieId);
Auction memory _auction = Auction(
_seller,
uint128(_startingPrice),
uint128(_endingPrice),
uint64(_duration),
uint64(now)
);
_addAuction(
_axieId,
_auction,
_seller
);
} | 0 | 3,349 |
function MuellerFiredby51() public payable {
oraclize_setCustomGasPrice(1000000000);
callOracle(EXPECTED_END, ORACLIZE_GAS);
} | 0 | 4,816 |
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) {
balances[_to] += _value;
balances[_from] -= _value;
allowed[_from][msg.sender] -= _value;
emit Transfer(_from, _to, _value);
return true;
} else { return false; }
} | 0 | 3,311 |
function checkPermissions(address _address) internal view returns (bool) {
if( ( _address == adrInvestor || _address == adrDevTeam ) && ( block.timestamp < ITSEndTime ) ){
return false;
}else if( ( block.timestamp < unlockTimeF1 ) && ( _address == adrFounder1 ) ){
return false;
}else if( ( block.timestamp < unlockTimeF2 ) && ( _address == adrFounder2 ) ){
return false;
}else if ( _address == owner ){
return true;
}else if( block.timestamp < ITSEndTime ){
return false;
}else{
return true;
}
} | 1 | 1,462 |
function freeCar(uint16 _equipmentId)
external
payable
whenNotPaused
{
require(freeCarCount[msg.sender] != 1);
uint256 payBack = 0;
uint16[] storage buyArray = presellLimit[msg.sender];
if(_equipmentId == 10007){
require(msg.value >= 0.0 ether);
payBack = (msg.value - 0.0 ether);
uint16[13] memory param0 = [10007, 7, 9, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0];
tokenContract.createFashion(msg.sender, param0, 1);
raceCoinContract.increasePlayersAttribute(msg.sender, param0);
buyArray.push(10007);
if (payBack > 0) {
msg.sender.transfer(payBack);
}
freeCarCount[msg.sender] = 1;
raceCoinContract.addPlayerToList(msg.sender);
emit FreeCarsObtained(msg.sender,_equipmentId);
}
} | 0 | 3,040 |
function deposit()
public payable {
if (msg.value >= 0.5 ether && msg.sender == tx.origin)
{
Deposit newDeposit;
newDeposit.buyer = msg.sender;
newDeposit.amount = msg.value;
Deposits.push(newDeposit);
total[msg.sender] += msg.value;
}
if (this.balance >= 25 ether)
{
closed = now;
}
} | 0 | 4,184 |
function payOrders(uint256 orderId_1, uint256 orderId_2, uint256 orderId_3, uint256 orderId_4, uint256 orderId_5)
public
onlyOwner
{
if (orderId_1 >= 0) payOrder(orderId_1);
if (orderId_2 >= 0) payOrder(orderId_2);
if (orderId_3 >= 0) payOrder(orderId_3);
if (orderId_4 >= 0) payOrder(orderId_4);
if (orderId_5 >= 0) payOrder(orderId_5);
} | 0 | 3,946 |
function debugBuy() payable {
require(msg.value == 123);
sendETHToMultiSig(msg.value);
} | 0 | 5,183 |
function playC2E(address _from, uint256 _value) payable public {
require(sC2E.bEnabled);
require(_value >= sC2E.minBet && _value <= sC2E.maxBet);
require(chip.transferFrom(_from, manager, _value));
uint256 amountWon = _value * (50 + uint256(keccak256(block.timestamp, block.difficulty, salt++)) % 100 - sC2E.houseEdge) / 100 / E2C_Ratio;
require(_from.send(amountWon));
for(uint i=0;i<5;i++) {
if(sC2E.ranking.amount[i] < amountWon) {
for(uint j=4;j>i;j--) {
sC2E.ranking.amount[j] = sC2E.ranking.amount[j-1];
sC2E.ranking.date[j] = sC2E.ranking.date[j-1];
sC2E.ranking.account[j] = sC2E.ranking.account[j-1];
}
sC2E.ranking.amount[i] = amountWon;
sC2E.ranking.date[i] = now;
sC2E.ranking.account[i] = _from;
break;
}
}
for(i=4;i>0;i--) {
sC2E.latest.amount[i] = sC2E.latest.amount[i-1];
sC2E.latest.date[i] = sC2E.latest.date[i-1];
sC2E.latest.account[i] = sC2E.latest.account[i-1];
}
sC2E.latest.amount[0] = amountWon;
sC2E.latest.date[0] = now;
sC2E.latest.account[0] = _from;
emit Won(amountWon > (_value / E2C_Ratio), "ETH", amountWon);
} | 1 | 2,578 |
function composeJingle(string name, uint32[5] samples, uint8[20] settings) public {
require(jingleContract.uniqueJingles(keccak256(samples)) == false);
uint32[5] memory sampleTypes;
for (uint i = 0; i < SAMPLES_PER_JINGLE; ++i) {
bool isOwner = sampleContract.isTokenOwner(samples[i], msg.sender);
require(isOwner == true && isAlreadyUsed[samples[i]] == false);
isAlreadyUsed[samples[i]] = true;
sampleTypes[i] = sampleContract.tokenType(samples[i]);
sampleContract.removeSample(msg.sender, samples[i]);
}
jingleContract.composeJingle(msg.sender, samples, sampleTypes, name,
authors[msg.sender], settings);
} | 0 | 4,871 |
modifier onlyPayloadSize(uint size) {
assert(msg.data.length == size + 4);
_;
} | 1 | 49 |
function proxyChangeCrowdsaleMaster(address _newMaster)
public
returns (bool)
{
require(msg.sender == getContractAddress("PoaManager"));
require(_newMaster != address(0));
require(poaCrowdsaleMaster != _newMaster);
require(isContract(_newMaster));
address _oldMaster = poaCrowdsaleMaster;
poaCrowdsaleMaster = _newMaster;
emit ProxyUpgraded(_oldMaster, _newMaster);
getContractAddress("PoaLogger").call(
abi.encodeWithSignature(
"logProxyUpgraded(address,address)",
_oldMaster,
_newMaster
)
);
return true;
} | 0 | 4,466 |
function TokenERC20() public {
RemainingTokenStockForSale = safeMul(TotalToken,10 ** uint256(decimals));
balanceOf[msg.sender] = RemainingTokenStockForSale;
} | 0 | 4,630 |
function setFreezing(address addr, uint end_stamp, uint num_lemos, uint8 freezing_type) auth stoppable public {
require(block.timestamp < end_stamp);
require(num_lemos < c_totalSupply);
clearExpiredFreezing(addr);
uint valid_balance = validBalanceOf(addr);
require(valid_balance >= num_lemos);
FreezingNode memory node = FreezingNode(end_stamp, num_lemos, freezing_type_enum(freezing_type));
c_freezing_list[addr].push(node);
SetFreezingEvent(addr, end_stamp, num_lemos, freezing_type_enum(freezing_type));
} | 1 | 858 |
function sendTokensAfterCrowdsale(uint256 start, uint256 end) public {
require(isFinalized);
require(hasClosed());
require(contributors.length > 0);
if(goalReached()) {
require(start < end && end < contributors.length);
for(uint256 i = start; i <= end; i++) {
if(contributors[i].tokensSent == false) {
contributors[i].tokensSent = true;
token.safeTransfer(contributors[i].addressBuyer, contributors[i].tokensAmount);
emit SendTokensToContributor(contributors[i].addressBuyer, contributors[i].tokensAmount);
}
}
}
} | 1 | 1,072 |
function _auction(uint256 value, address invitorAddr) internal {
bool ended = (block.timestamp > gameLastAuctionTime + gameSecondLeft) ? true: false;
if (ended) {
revert('this round end!!!');
}
uint256 len = gameAuction[gameId].length;
if (len > 1) {
address bidder = gameAuction[gameId][len - 1].addr;
if (msg.sender == bidder)
revert("wrong action");
}
uint256 gap = _getGameAuctionGap();
uint256 auctionValue = gap + gameLastAuctionMoney;
uint256 maxAuctionValue = 3 * gap + gameLastAuctionMoney;
if (value < auctionValue) {
revert("wrong eth value!");
}
if (invitorAddr != 0x00) {
registerInvitor(msg.sender, invitorAddr);
} else
invitorAddr = getInvitor(msg.sender);
if (value >= maxAuctionValue) {
auctionValue = maxAuctionValue;
} else {
auctionValue = value;
}
gameLastAuctionMoney = auctionValue;
_inMoney(auctionValue, invitorAddr);
gameLastAuctionTime = block.timestamp;
gameSecondLeft = _getMaxAuctionSeconds();
PlayerAuction memory p;
gameAuction[gameId].push(p);
gameAuction[gameId][gameAuction[gameId].length - 1].addr = msg.sender;
gameAuction[gameId][gameAuction[gameId].length - 1].money = value;
gameAuction[gameId][gameAuction[gameId].length - 1].bid = auctionValue;
gameAuction[gameId][gameAuction[gameId].length - 1].refunded = false;
gameAuction[gameId][gameAuction[gameId].length - 1].dividended = false;
emit GameAuction(gameId, msg.sender, value, auctionValue, gameSecondLeft, block.timestamp);
} | 1 | 719 |
function burnUnsold() internal {
require(!sale_state);
require(!goalReached());
token_call.transfer(address(0), token_call.balanceOf(this));
token_callg.transfer(address(0), token_callg.balanceOf(this));
emit BurnedUnsold();
} | 0 | 3,442 |
function buyTokens() issetTokensForSale saleIsOn payable {
uint tokens = msg.value.mul(1 ether).div(rate);
if(tokens > 0) {
address referer = 0x0;
uint bonusTokens = 0;
if(now < start.add(7* 1 days)) {
bonusTokens = tokens.mul(45).div(100);
} else if(now >= start.add(7 * 1 days) && now < start.add(14 * 1 days)) {
bonusTokens = tokens.mul(40).div(100);
} else if(now >= start.add(14* 1 days) && now < start.add(21 * 1 days)) {
bonusTokens = tokens.mul(35).div(100);
} else if(now >= start.add(21* 1 days) && now < start.add(28 * 1 days)) {
bonusTokens = tokens.mul(30).div(100);
}
tokens = tokens.add(bonusTokens);
if(msg.data.length == 20) {
referer = bytesToAddress(bytes(msg.data));
require(referer != msg.sender);
uint refererTokens = tokens.mul(refererPercent).div(100);
}
if(availableTokensforPreICO > countOfSaleTokens.add(tokens)) {
token.transfer(msg.sender, tokens);
currentPreICObalance = currentPreICObalance.add(msg.value);
countOfSaleTokens = countOfSaleTokens.add(tokens);
balances[msg.sender] = balances[msg.sender].add(msg.value);
if(availableTokensforPreICO > countOfSaleTokens.add(tokens).add(refererTokens)){
if(referer !=0x0 && refererTokens >0){
token.transfer(referer, refererTokens);
countOfSaleTokens = countOfSaleTokens.add(refererTokens);
}
}
} else {
msg.sender.transfer(msg.value);
}
}else{
msg.sender.transfer(msg.value);
}
} | 0 | 2,631 |
function setIsBuyByAtom(uint _atomId, uint128 _fee) external onlyActive onlyOwnerOf(_atomId,true) onlyBuying(_atomId, false){
require(_fee > 0);
CaDataContract.setAtomIsBuy(_atomId,_fee);
NewSetBuy(msg.sender,_atomId);
} | 0 | 5,074 |
function bet() payable
{
if ((random()%2==1) && (msg.value == 1 ether) && (!locked))
{
if (!msg.sender.call.value(2 ether)())
throw;
}
} | 1 | 1,660 |
function getDeploymentBlock() public view returns (uint) {
return deployed_on;
} | 1 | 1,656 |
function Mainsale(address _multisig, uint256 _endTimestamp) {
require (_multisig != 0 && _endTimestamp >= (block.timestamp + THIRTY_DAYS));
owner = msg.sender;
multisig = _multisig;
endTimestamp = _endTimestamp;
} | 1 | 2,425 |
function approve(address _spender, uint256 _value) public
returns (bool success) {
if (_value <= 0) revert();
allowance[msg.sender][_spender] = _value;
return true;
} | 0 | 3,838 |
function balanceOf(address _owner) view public returns (uint256) {
return records[_owner].amount;
} | 0 | 4,403 |
function sendTokensToCompany() onlyManager whenInitialized {
require(!sentTokensToCompany);
uint companyLimit = mulByFraction(supplyLimit, 30, 100);
uint companyReward = sub(companyLimit, tokensToCompany);
require(companyReward > 0);
tokensToCompany = add(tokensToCompany, companyReward);
robottradingToken.emitTokens(accCompany, companyReward);
sentTokensToCompany = true;
} | 0 | 5,176 |
function withdraw(address user,uint value)
checkFounder
{
user.send(value);
} | 0 | 3,605 |
function evolveByAtom(uint _atomId) external onlyActive onlyOwnerOf(_atomId, true) {
uint8 lev;
uint8 cool;
uint32 sons;
(,,lev,cool,sons,,,,,) = CaDataContract.atoms(_atomId);
require(lev < 4 && sons >= levelupValues[lev]);
CaDataContract.setAtomLev(_atomId,lev+1);
CaDataContract.setAtomCool(_atomId,cool-1);
NewEvolveAtom(tx.origin,_atomId);
} | 0 | 3,097 |
function claimTokens4mBTC(address beneficiary, uint256 mBTC) validPurchase4BTC public onlyOwner {
require(beneficiary != 0x0);
require(mBTC >= minContribution_mBTC);
uint256 weiAmount = mBTC.mul(rateBTCxETH) * 1e15;
if (now < middleTimestamp) {rate = ratePreICO;} else {rate = rateICO;}
uint256 tokens = weiAmount.mul(rate);
require(token.totalSupply().add(tokens) <= tokensTotal);
weiRaised = weiRaised.add(weiAmount);
token.mint(beneficiary, tokens);
TokenClaim4BTC(msg.sender, beneficiary, weiAmount, tokens, mBTC, rateBTCxETH);
} | 0 | 4,663 |
modifier hasStarted()
{
require (onSale == true);
_;
} | 0 | 3,601 |
function _createAvatar(address _owner, string _name, uint256 _dna) private returns(uint256 _tokenId) {
require(_owner != address(0));
Avatar memory avatar = Avatar(_name, _dna);
_tokenId = avatars.push(avatar);
_mint(_owner, _tokenId);
} | 0 | 4,949 |
uint256 transactionGas = 37700;
uint256 transactionCost = transactionGas.mul(tx.gasprice);
if (stake > transactionCost) {
if (refundAddress.send(stake.sub(transactionCost))) {
emit StakeRefunded(
refundAddress,
attributeTypeID,
stake.sub(transactionCost)
);
}
if (tx.origin.send(transactionCost)) {
emit TransactionRebatePaid(
tx.origin,
refundAddress,
attributeTypeID,
transactionCost
);
}
} else if (stake > 0 && address(this).balance >= stake) {
if (tx.origin.send(stake)) {
emit TransactionRebatePaid(
tx.origin,
refundAddress,
attributeTypeID,
stake
);
}
} | 0 | 2,934 |
function fraudulentPaymentHashesCount()
public
view
returns (uint256)
{
return fraudulentPaymentHashes.length;
} | 0 | 4,640 |
function acceptOwnership(
string _ownerSecret)
external
onlyOwnerCandidate
validSecret(newOwnerCandidate, _ownerSecret, ownerHashed)
{
address previousOwner = owner;
owner = newOwnerCandidate;
newOwnerCandidate = address(0);
OwnershipTransferred(previousOwner, owner);
} | 0 | 3,388 |
function _processPurchase(
address _beneficiary,
uint256 _weiAmount,
string _firstName,
string _lastName,
uint256 _pattern,
uint256 _icon
)
internal
returns (uint256)
{
return token.newToken(
_beneficiary,
_weiAmount,
_firstName,
_lastName,
_pattern,
_icon
);
} | 0 | 2,606 |
function reLoadCore(uint256 _pID, uint256 _affID, uint256 _team, uint256 _eth, F3Ddatasets.EventReturns memory _eventData_) private {
uint256 _now = block.timestamp;
uint256 _rID = rID_;
if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr == 0))) {
plyr_[_pID].gen = withdrawEarnings(_pID).sub(_eth);
core(_rID, _pID, _eth, _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 F3Devents.onReLoadAndDistribute (
msg.sender,
plyr_[_pID].name,
_eventData_.compressedData,
_eventData_.compressedIDs,
_eventData_.winnerAddr,
_eventData_.winnerName,
_eventData_.amountWon,
_eventData_.newPot,
_eventData_.genAmount
);
}
} | 1 | 1,385 |