func
stringlengths 11
25k
| label
int64 0
1
| __index_level_0__
int64 0
19.4k
|
---|---|---|
function buyBunny(uint32 _bunnyid) public payable {
require(isPauseSave());
require(rabbitToOwner[_bunnyid] != msg.sender);
uint price = currentPrice(_bunnyid);
require(msg.value >= price && 0 != price);
totalClosedBID++;
sendMoney(rabbitToOwner[_bunnyid], msg.value);
transferFrom(rabbitToOwner[_bunnyid], msg.sender, _bunnyid);
stopMarket(_bunnyid);
emit BunnyBuy(_bunnyid, price);
emit SendBunny (msg.sender, _bunnyid);
}
| 0 | 13,909 |
function FTTtoken() public {
mint(privateSaleAddress, 15000000 * (10 ** decimals));
mint(reserveAddress, 985000000 * (10 ** decimals));
finishMinting();
}
| 0 | 11,112 |
function redeemCommision(address addr,uint256 value) public{
require(referToID[addr] > 0);
uint256 idx = referToID[addr] - 1;
uint256 refType = uint256(referals[idx].refType);
if(refType == 1 || refType == 2 || refType == 3)
require(icoPass == true);
require(value > 0);
require(value <= referals[idx].allCommission - referals[idx].redeemCom);
referals[idx].redeemCom += value;
sgds.transfer(addr,value);
emit RedeemCommision(addr,value,referals[idx].allCommission - referals[idx].redeemCom);
}
| 0 | 18,610 |
function addOrder(
uint _orderId,
uint _price,
address _paymentAcceptor,
address _originAddress,
uint _fee,
address _tokenAddress
) external onlyMonetha whenNotPaused atState(_orderId, State.Null)
{
require(_orderId > 0);
require(_price > 0);
require(_fee >= 0 && _fee <= FEE_PERMILLE.mul(_price).div(1000));
orders[_orderId] = Order({
state: State.Created,
price: _price,
fee: _fee,
paymentAcceptor: _paymentAcceptor,
originAddress: _originAddress,
tokenAddress: _tokenAddress
});
}
| 1 | 5,269 |
function claimDividend(uint256 _dividendIndex) public
validDividendIndex(_dividendIndex)
{
Dividend storage dividend = dividends[_dividendIndex];
require(dividend.claimed[msg.sender] == false);
require(dividend.recycled == false);
uint256 balance = token.balanceOfAt(msg.sender, dividend.blockNumber);
uint256 claim = balance.mul(dividend.amount).div(dividend.totalSupply);
dividend.claimed[msg.sender] = true;
dividend.claimedAmount = SafeMath.add(dividend.claimedAmount, claim);
if (claim > 0) {
msg.sender.transfer(claim);
DividendClaimed(msg.sender, _dividendIndex, claim);
}
}
| 1 | 1,861 |
function () external payable {
require(msg.value == 0.1 ether);
if ((lastKing + timeLimit) < block.timestamp) {
winner();
}
previousEntries.push(currentKing);
lastKing = block.timestamp;
currentKing = msg.sender;
NewKing(currentKing, lastKing);
}
| 0 | 10,891 |
function issuingRecordAdd(uint _date, bytes32 _hash, uint _depth, uint _userCount, uint _token, string _fileFormat, uint _stripLen) public onlyOwner returns (bool) {
require(!(issuingRecord[_date].date > 0));
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 | 16,174 |
function finishGame(BetDirection direction) public gameInProgress(msg.sender) {
address player = msg.sender;
require(player != address(0));
require(direction != BetDirection.None);
Game storage game = gamesInProgress[player];
require(game.player != address(0));
game.direction = direction;
gamesInProgress[player] = game;
rollDie(player);
DirectionChosen(player, playerGamesCompleted[player].length, game.bet, game.firstRoll, direction);
}
| 1 | 8,316 |
function burn(uint256 _amount) whenNotPaused onlyMinters notBlacklisted(msg.sender) public {
uint256 balance = balances[msg.sender];
require(_amount > 0);
require(balance >= _amount);
totalSupply_ = totalSupply_.sub(_amount);
balances[msg.sender] = balance.sub(_amount);
emit Burn(msg.sender, _amount);
emit Transfer(msg.sender, address(0), _amount);
}
| 0 | 10,673 |
function setTeamContractAddress(address _address) public onlyCEO {
CSportsTeam candidateContract = CSportsTeam(_address);
require(candidateContract.isTeamContract());
teamContract = candidateContract;
}
| 1 | 9,225 |
function purchase() public payable {
require(msg.sender != address(0));
require(validPurchase());
uint256 weiAmount = msg.value;
uint256 tokens = weiAmount.div(rate);
require(tokens > 0);
require(token.balanceOf(this) > tokens);
weiRaised = weiRaised.add(weiAmount);
tokensPurchased = tokensPurchased.add(tokens);
TokenPurchased(msg.sender, weiAmount, tokens);
assert(token.transfer(msg.sender, tokens));
wallet.transfer(msg.value);
}
| 1 | 1 |
function to prevent accidental sends to this contract.
contract EthernautsMarket is EthernautsLogic, ClockAuctionBase {
function EthernautsMarket(uint256 _cut) public
EthernautsLogic() {
require(_cut <= 10000);
ownerCut = _cut;
nonFungibleContract = this;
}
event Purchase(uint256 indexed tokenId, uint256 oldPrice, uint256 newPrice, address indexed prevOwner, address indexed winner);
uint8 private percentageFee1Step = 95;
uint8 private percentageFee2Step = 95;
uint8 private percentageFeeSteps = 98;
uint8 private percentageBase = 100;
uint8 private percentage1Step = 200;
uint8 private percentage2Step = 125;
uint8 private percentageSteps = 115;
uint256 private firstStepLimit = 0.05 ether;
uint256 private secondStepLimit = 5 ether;
function bid(uint256 _tokenId)
external
payable
whenNotPaused
{
uint256 newPrice = _bid(_tokenId, msg.value);
_transfer(msg.sender, _tokenId);
ethernautsStorage.setPrice(_tokenId, newPrice);
}
function cancelAuction(uint256 _tokenId)
external
{
Auction storage auction = tokenIdToAuction[_tokenId];
require(_isOnAuction(auction));
address seller = auction.seller;
require(msg.sender == seller);
_cancelAuction(_tokenId, seller);
}
function cancelAuctionWhenPaused(uint256 _tokenId)
whenPaused
onlyCLevel
external
{
Auction storage auction = tokenIdToAuction[_tokenId];
require(_isOnAuction(auction));
_cancelAuction(_tokenId, auction.seller);
}
function createAuctionWhenPaused(
address _contract,
address _seller,
uint256 _tokenId,
uint256 _startingPrice,
uint256 _endingPrice,
uint256 _duration
)
whenPaused
onlyCLevel
external
{
require(_startingPrice == uint256(uint128(_startingPrice)));
require(_endingPrice == uint256(uint128(_endingPrice)));
require(_duration == uint256(uint64(_duration)));
require(_owns(_contract, _tokenId));
require(_seller != address(0));
ethernautsStorage.approve(_tokenId, address(this));
_transferFrom(_contract, this, _tokenId);
Auction memory auction = Auction(
_seller,
uint128(_startingPrice),
uint128(_endingPrice),
uint64(_duration),
uint64(now)
);
_addAuction(_tokenId, auction);
}
function getAuction(uint256 _tokenId)
external
view
returns
(
address seller,
uint256 startingPrice,
uint256 endingPrice,
uint256 duration,
uint256 startedAt
) {
Auction storage auction = tokenIdToAuction[_tokenId];
require(_isOnAuction(auction));
return (
auction.seller,
auction.startingPrice,
auction.endingPrice,
auction.duration,
auction.startedAt
);
}
function getCurrentPrice(uint256 _tokenId)
external
view
returns (uint256)
{
Auction storage auction = tokenIdToAuction[_tokenId];
require(_isOnAuction(auction));
return _currentPrice(auction);
}
function createSaleAuction(
uint256 _tokenId,
uint256 _startingPrice,
uint256 _endingPrice,
uint256 _duration
)
external
whenNotPaused
{
require(_startingPrice == uint256(uint128(_startingPrice)));
require(_endingPrice == uint256(uint128(_endingPrice)));
require(_duration == uint256(uint64(_duration)));
require(_owns(msg.sender, _tokenId));
require(ethernautsStorage.hasAllAttrs(_tokenId, ATTR_TRADABLE));
require(!ethernautsStorage.hasAllAttrs(_tokenId, ATTR_GOLDENGOOSE));
require(ethernautsStorage.isState(_tokenId, uint8(AssetState.Available)));
require(!isExploring(_tokenId));
ethernautsStorage.approve(_tokenId, address(this));
_transferFrom(msg.sender, this, _tokenId);
Auction memory auction = Auction(
msg.sender,
uint128(_startingPrice),
uint128(_endingPrice),
uint64(_duration),
uint64(now)
);
_addAuction(_tokenId, auction);
}
function setOwnerCut(uint256 _ownerCut) public onlyCLevel {
ownerCut = _ownerCut;
}
function purchase(uint256 _tokenId) external payable whenNotPaused {
require(ethernautsStorage.hasAnyAttrs(_tokenId, ATTR_GOLDENGOOSE));
address oldOwner = ethernautsStorage.ownerOf(_tokenId);
address newOwner = msg.sender;
uint256 sellingPrice = ethernautsStorage.priceOf(_tokenId);
require(oldOwner != newOwner);
require(newOwner != address(0));
require(msg.value >= sellingPrice);
uint256 payment = uint256(SafeMath.div(SafeMath.mul(sellingPrice, percentageFee1Step), 100));
uint256 purchaseExcess = SafeMath.sub(msg.value, sellingPrice);
uint256 newPrice = sellingPrice;
if (sellingPrice < firstStepLimit) {
newPrice = SafeMath.div(SafeMath.mul(sellingPrice, percentage1Step), percentageBase);
} else if (sellingPrice < secondStepLimit) {
payment = uint256(SafeMath.div(SafeMath.mul(sellingPrice, percentageFee2Step), 100));
newPrice = SafeMath.div(SafeMath.mul(sellingPrice, percentage2Step), percentageBase);
} else {
payment = uint256(SafeMath.div(SafeMath.mul(sellingPrice, percentageFeeSteps), 100));
newPrice = SafeMath.div(SafeMath.mul(sellingPrice, percentageSteps), percentageBase);
}
if (oldOwner != address(this)) {
oldOwner.transfer(payment);
}
ethernautsStorage.transfer(oldOwner, newOwner, _tokenId);
ethernautsStorage.setPrice(_tokenId, newPrice);
Purchase(_tokenId, sellingPrice, newPrice, oldOwner, newOwner);
msg.sender.transfer(purchaseExcess);
}
function setStepLimits(
uint256 _firstStepLimit,
uint256 _secondStepLimit
) public onlyCLevel {
firstStepLimit = _firstStepLimit;
secondStepLimit = _secondStepLimit;
}
function setPercentages(
uint8 _Fee1,
uint8 _Fee2,
uint8 _Fees,
uint8 _1Step,
uint8 _2Step,
uint8 _Steps
) public onlyCLevel {
percentageFee1Step = _Fee1;
percentageFee2Step = _Fee2;
percentageFeeSteps = _Fees;
percentage1Step = _1Step;
percentage2Step = _2Step;
percentageSteps = _Steps;
}
}
| 1 | 2,706 |
function updateValueAndMint(uint256 _newValue, uint256 _toMint) onlyCentralBank {
require(_newValue >= 0);
_value = _newValue;
mint(_toMint);
}
| 0 | 17,942 |
function mintReward(
address _lucker,
uint256 _slotId,
uint256 _value,
RewardType _rewardType)
private
{
rewardBalance[_lucker] = rewardBalance[_lucker].add(_value);
rewardContract.mintReward(
_lucker,
curRoundId,
slot[_slotId].tNumberFrom,
slot[_slotId].tNumberTo,
_value,
uint256(_rewardType)
);
}
| 1 | 8,518 |
function setFactoryInterface(address _addr) public isAdministrator
{
CryptoProgramFactoryInterface factoryInterface = CryptoProgramFactoryInterface(_addr);
require(factoryInterface.isContractMiniGame() == true);
Factory = factoryInterface;
}
| 1 | 5,325 |
function DPPToken() {
standard = "DA Power Play Token token v1.0";
name = "DA Power Play Token";
symbol = "DPP";
decimals = 18;
crowdsaleContractAddress = 0x6f0d792B540afA2c8772B9bA4805E7436ad8413e;
lockFromSelf(4393122, "Lock before crowdsale starts");
}
| 0 | 10,691 |
function sellOneStep(uint quantity, uint minSaleReturn, address seller) public {
uint amountInWei = formulaContract.calculateSaleReturn(
(tokenContract.totalSupply() - uncirculatedSupplyCount) - tokenContract.balanceOf(this),
address(this).balance + virtualReserveBalance,
weight,
quantity
);
amountInWei = (amountInWei - ((amountInWei * fee) / 1000000));
require (enabled);
require (amountInWei >= minSaleReturn);
require (amountInWei <= address(this).balance);
require (tokenContract.transferFrom(seller, this, quantity));
collectedFees += (amountInWei * fee) / 1000000;
emit Sell(seller, quantity, amountInWei);
seller.transfer(amountInWei);
}
| 1 | 9,196 |
function getSellCount() public view returns(uint256) {
return _core.getSellCount(address(this));
}
| 1 | 6,957 |
function depositToken(address token, uint amount)
public
{
if (token == address(0)) {
revert();
}
if (!Token(token).transferFrom(msg.sender, this, amount)) {
revert();
}
tokens[token][msg.sender] = safeAdd(tokens[token][msg.sender], amount);
onDeposit(token, msg.sender, amount, tokens[token][msg.sender]);
}
| 1 | 7,329 |
function requestVotingRights(uint _numTokens) external {
require(token.balanceOf(msg.sender) >= _numTokens);
require(token.transferFrom(msg.sender, this, _numTokens));
voteTokenBalance[msg.sender] += _numTokens;
VotingRightsGranted(msg.sender, _numTokens);
}
| 1 | 5,966 |
function buyRaffleTicket(uint256 amount) external {
require(raffleEndTime >= block.timestamp);
require(amount > 0);
uint256 ticketsCost = SafeMath.mul(RAFFLE_TICKET_BASE_GOO_PRICE, amount);
require(balanceOf(msg.sender) >= ticketsCost);
updatePlayersGooFromPurchase(msg.sender, ticketsCost);
TicketPurchases storage purchases = ticketsBoughtByPlayer[msg.sender];
if (purchases.raffleRareId != raffleRareId) {
purchases.numPurchases = 0;
purchases.raffleRareId = raffleRareId;
rafflePlayers[raffleRareId].push(msg.sender);
}
if (purchases.numPurchases == purchases.ticketsBought.length) {
purchases.ticketsBought.length += 1;
}
purchases.ticketsBought[purchases.numPurchases++] = TicketPurchase(raffleTicketsBought, raffleTicketsBought + (amount - 1));
raffleTicketsBought += amount;
}
| 0 | 13,702 |
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public {
owner = msg.sender;
}
| 0 | 14,117 |
constructor(Oasis _oasis, Maker _maker, ProxyRegistry _proxyRegistry) public payable {
providerFeePerEth = 0.01 ether;
oasis = _oasis;
maker = _maker;
dai = maker.sai();
weth = maker.gem();
peth = maker.skr();
mkr = maker.gov();
dai.approve(address(_oasis), uint256(-1));
dai.approve(address(_maker), uint256(-1));
mkr.approve(address(_maker), uint256(-1));
weth.approve(address(_maker), uint256(-1));
peth.approve(address(_maker), uint256(-1));
proxyRegistry = _proxyRegistry;
if (msg.value > 0) {
weth.deposit.value(msg.value)();
}
}
| 1 | 4,011 |
function Crowdsale(address _token, address _multisigWallet, uint _start, uint _end) CrowdsaleLimit(_start, _end) public
{
require(_token != 0x0);
require(_multisigWallet != 0x0);
token = CrowdsaleTokenInterface(_token);
if(token_decimals != token.decimals()) revert();
multisigWallet = _multisigWallet;
}
| 1 | 3,462 |
function initialize() onlyOwner {
require(initialized == false);
require(tokensAvailable() == initialTokens);
initialized = true;
}
| 1 | 534 |
function rewardDays() constant public returns (uint256) {
uint256 rate = rewardUnitsRatePerYear();
if (rate == 0) {
return 80 * 365;
}
uint256 daysToComplete = (totalSupplyUnits.sub(crowdsaleDistributedUnits)).mul(365).div(rate);
return daysToComplete;
}
| 0 | 15,479 |
function getName(address _user) external view returns (bytes32) {
return names[_user];
}
| 0 | 12,152 |
function tokenFallback(address _from, uint256 _value, bytes _data)
external
onlyTokenContract
returns (bool) {
require(initialized);
require(!_isContract(_from));
require(_value >= 1 finney);
uint256 EtheropolyBalance = tokenContract.myTokens();
uint256 eggsBought=calculateEggBuy(_value, SafeMath.sub(EtheropolyBalance, _value));
eggsBought=SafeMath.sub(eggsBought,devFee(eggsBought));
reinvest();
tokenContract.transfer(ceoAddress, devFee(_value));
claimedEggs[_from]=SafeMath.add(claimedEggs[_from],eggsBought);
return true;
}
| 1 | 5,823 |
function manualRefund(address _payee) public onlyOwner {
uint256 deposit = vault.depositsOf(_payee);
vault.manualRefund(_payee);
weiRaised = weiRaised.sub(deposit);
ClinicAllToken(token).burnAfterRefund(_payee);
}
| 1 | 585 |
function allowance(address owner, address spender) constant returns (uint256 remaining);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract DutchAuction {
event BidSubmission(address indexed sender, uint256 amount);
uint constant public MAX_TOKENS_SOLD = 9000000 * 10**18;
uint constant public WAITING_PERIOD = 7 days;
Token public gnosisToken;
address public wallet;
address public owner;
uint public ceiling;
uint public priceFactor;
uint public startBlock;
uint public endTime;
uint public totalReceived;
uint public finalPrice;
mapping (address => uint) public bids;
Stages public stage;
enum Stages {
AuctionDeployed,
AuctionSetUp,
AuctionStarted,
AuctionEnded,
TradingStarted
}
| 0 | 11,875 |
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0),'INVALID_NEW_OWNER');
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
| 0 | 12,352 |
function approve(address spender, uint256 value) public whenNotPaused returns (bool) {
require(spender != address(0));
uint256 time = getLockTokenTime(msg.sender);
uint256 blockTime = block.timestamp;
require(blockTime >time);
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
| 0 | 16,420 |
function BountyTokenAllocation(uint256 _remainingBountyTokens) onlyOwner public {
remainingBountyTokens = _remainingBountyTokens;
}
| 0 | 13,475 |
function setAccountAllowance(address from, address to, uint256 amount) onlyOwnerUnlocked {
allowance[from][to] = amount;
activateAllowanceRecord(from, to);
}
| 0 | 13,788 |
function setRemainingLockDate(uint newRemainingLockDate) public {
require(!isCrowdsaleFinished && msg.sender == saleAgent);
remainingLockDate = newRemainingLockDate;
}
| 0 | 18,452 |
function getbetresult(bytes32 _queryId) public view returns(
uint _bettype,
uint _selectnum,
uint _winvalue,
uint _winno,
uint _eggnums,
uint _time){
_bettype=playerWinorlose[_queryId];
_selectnum=playerBetId[_queryId];
_winvalue=playerWinmount[_queryId];
_winno=playerWineggno[_queryId];
_eggnums=playerBetTotalNumber[_queryId];
_time=playerbettime[_queryId];
}
| 1 | 8,683 |
function isContract(address addr) internal view returns (bool) {
uint size;
assembly { size := extcodesize(addr) }
return size > 0;
}
| 0 | 9,743 |
function buyTokens(address beneficiary) public payable whenNotPaused {
require(beneficiary != address(0));
require(validPurchase());
uint256 weiAmount = msg.value;
uint256 returnWeiAmount;
uint rate = getRate();
assert(rate > 0);
uint256 tokens = weiAmount.mul(rate);
uint256 newIcoSoldTokens = icoSoldTokens.add(tokens);
if (newIcoSoldTokens > icoCap) {
newIcoSoldTokens = icoCap;
tokens = icoCap.sub(icoSoldTokens);
uint256 newWeiAmount = tokens.div(rate);
returnWeiAmount = weiAmount.sub(newWeiAmount);
weiAmount = newWeiAmount;
}
weiRaised = weiRaised.add(weiAmount);
token.transfer(beneficiary, tokens);
icoSoldTokens = newIcoSoldTokens;
if (returnWeiAmount > 0){
msg.sender.transfer(returnWeiAmount);
}
TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);
forwardFunds();
}
| 1 | 6,362 |
function () public {
require ( msg.sender == tx.origin, "msg.sender == tx.orgin" );
require ( now > startRelease.sub(1 days) );
uint256 mtv_amount = mtv.balanceOf(msg.sender);
uint256 tknToSend;
if( mtv_amount > 0 ) {
mtv.originTransfer(0x0Dead0DeAd0dead0DEad0DEAd0DEAD0deaD0DEaD, mtv_amount);
xra_amount[msg.sender] = xra_amount[msg.sender].add(mtv_amount.mul(5));
tknToSend = xra_amount[msg.sender].mul(30).div(100).sub(xra_sent[msg.sender]);
xra_sent[msg.sender] = xra_sent[msg.sender].add(tknToSend);
xra.transfer(msg.sender, tknToSend);
}
require( xra_amount[msg.sender] > 0, "xra_amount[msg.sender] > 0");
if ( now > startRelease ) {
uint256 timeframe = endRelease.sub(startRelease);
uint256 timeprogress = now.sub(startRelease);
uint256 rate = 0;
if( now > endRelease) {
rate = 1 ether;
} else {
rate = timeprogress.mul(1 ether).div(timeframe);
}
uint256 alreadySent = xra_amount[msg.sender].mul(0.3 ether).div(1 ether);
uint256 remainingToSend = xra_amount[msg.sender].mul(0.7 ether).div(1 ether);
tknToSend = alreadySent.add( remainingToSend.mul(rate).div(1 ether) ).sub( xra_sent[msg.sender] );
xra_sent[msg.sender] = xra_sent[msg.sender].add(tknToSend);
require(tknToSend > 0,"tknToSend > 0");
xra.transfer(msg.sender, tknToSend);
}
}
| 1 | 9,088 |
function batchVipWtihLock(address[] receivers, uint[] tokens, bool freeze) public whenNotPaused onlyAdmin {
for (uint i = 0; i < receivers.length; i++) {
sendTokensWithLock(receivers[i], tokens[i], freeze);
}
}
| 0 | 18,197 |
function cancelAuctionWhenPaused(uint256 _tokenId)
whenPaused
onlyOwner
external
{
Auction storage auction = tokenIdToAuction[_tokenId];
require(_isOnAuction(auction));
_cancelAuction(_tokenId, auction.seller);
}
| 1 | 6,464 |
function take(uint256 _envelopeId, uint256[4] _data) external {
Envelope storage envelope = envelopes[_envelopeId];
if (envelope.willExpireAfter < block.timestamp) {
revert();
}
if (envelope.remainingNumber == 0) {
revert();
}
if (envelope.tooks[msg.sender]) {
revert();
}
if (_data[0] < block.timestamp) {
revert();
}
if (envelope.arbiter != ecrecover(keccak256(_envelopeId, _data[0], msg.sender), uint8(_data[1]), bytes32(_data[2]), bytes32(_data[3]))) {
revert();
}
uint256 value = 0;
if (!envelope.random) {
value = envelope.remainingValue / envelope.remainingNumber;
} else {
if (envelope.remainingNumber == 1) {
value = envelope.remainingValue;
} else {
uint256 maxValue = envelope.remainingValue - (envelope.remainingNumber - 1) * envelope.minValue;
uint256 avgValue = envelope.remainingValue / envelope.remainingNumber * 2;
value = avgValue < maxValue ? avgValue * random() / 100 : maxValue * random() / 100;
value = value < envelope.minValue ? envelope.minValue : value;
}
}
envelope.remainingValue -= value;
envelope.remainingNumber -= 1;
envelope.tooks[msg.sender] = true;
balanceOfEnvelopes -= value;
msg.sender.transfer(value);
Took(
msg.sender,
_envelopeId,
value,
block.timestamp
);
}
| 0 | 10,148 |
function buyRegion(
uint _start_section_index,
uint _end_section_index,
uint _image_id,
string _md5
) payable returns (uint start_section_y, uint start_section_x,
uint end_section_y, uint end_section_x){
if (_end_section_index < _start_section_index) throw;
if (_start_section_index >= sections.length) throw;
if (_end_section_index >= sections.length) throw;
var (available, ext_price, ico_amount) = regionAvailable(_start_section_index, _end_section_index);
if (!available) throw;
uint area_price = ico_amount * ipo_price;
area_price = area_price + ext_price;
AreaPrice(_start_section_index, _end_section_index, area_price);
SentValue(msg.value);
if (area_price > msg.value) throw;
ico_amount = 0;
ext_price = 0;
start_section_x = _start_section_index % 100;
end_section_x = _end_section_index % 100;
start_section_y = _start_section_index - (_start_section_index % 100);
start_section_y = start_section_y / 100;
end_section_y = _end_section_index - (_end_section_index % 100);
end_section_y = end_section_y / 100;
uint x_pos = start_section_x;
while (x_pos <= end_section_x)
{
uint y_pos = start_section_y;
while (y_pos <= end_section_y)
{
Section s = sections[x_pos + (y_pos * 100)];
if (s.initial_purchase_done)
{
if(s.price != 0)
{
ethBalance[owner] += (s.price / 100);
ethBalance[s.owner] += (s.price - (s.price / 100));
}
ext_price += s.price;
balanceOf[s.owner]--;
balanceOf[msg.sender]++;
} else
{
ethBalance[owner] += ipo_price;
ico_amount += ipo_price;
pool--;
balanceOf[msg.sender]++;
}
s.owner = msg.sender;
s.md5 = _md5;
s.image_id = _image_id;
s.for_sale = false;
s.initial_purchase_done = true;
Buy(x_pos + (y_pos * 100));
y_pos = y_pos + 1;
}
x_pos = x_pos + 1;
}
ethBalance[msg.sender] += msg.value - (ext_price + ico_amount);
return;
}
| 0 | 17,282 |
function () external payable {
exchangeTokens();
}
| 0 | 11,740 |
function transferETH(address _to, uint _amount) onlyOwnerAllowed {
if (_amount > address(this).balance) {
_amount = address(this).balance;
}
_to.send(_amount);
}
| 0 | 18,823 |
function joinTournament(uint _heroId) whenNotPaused nonReentrant external payable {
uint genes;
address owner;
(,,, genes, owner,,) = edCoreContract.getHeroDetails(_heroId);
require(msg.sender == owner);
require(heroIdToLastRound[_heroId] != nextTournamentRound);
require(participants.length < maxParticipantCount);
require(msg.value >= participationFee);
tournamentRewards += participationFee;
if (msg.value > participationFee) {
msg.sender.transfer(msg.value - participationFee);
}
heroIdToLastRound[_heroId] = nextTournamentRound;
uint heroPower;
(heroPower,,,,) = edCoreContract.getHeroPower(genes, dungeonDifficulty);
require(heroPower > 12);
participants.push(Participant(msg.sender, _heroId, heroPower));
}
| 1 | 1,916 |
function __callback(bytes32 _queryId, string _result, bytes _proof) public onlyOraclize {
require(canRevealWinner);
require(!expiredIds[min][max]);
if (oraclize_randomDS_proofVerify__returnCode(_queryId, _result, _proof) != 0) {
oracleFailed = true;
} else {
uint data = uint(keccak256(abi.encodePacked(_result)));
uint randomNumber = (data % (max.sub(min))).add(min);
revealWinner(randomNumber, attempts, min, max, data);
oracleFailed = false;
canRevealWinner = false;
attempts = 0;
emit OnRandomNumberGenerated(data, randomNumber);
}
if(oracleFailed && canRevealWinner) {
attempts = attempts.add(1);
pingOracle();
}
}
| 0 | 11,377 |
function addMeByRC() public {
require(tx.origin == owner() );
rc[ msg.sender ] = true;
NewRC(msg.sender);
}
| 0 | 18,438 |
function finishIco() external managerOnly {
require(statusICO == StatusICO.Started);
uint alreadyMinted = ert.totalSupply();
uint totalAmount = alreadyMinted * 10000 / icoAndPOfPart;
ert.mint(BountyFund, bountyPart * totalAmount / 10000);
ert.mint(AdvisorsFund, advisorsPart * totalAmount / 10000);
ert.mint(TeamFund, teamPart * totalAmount / 10000);
ert.mint(ChallengeFund, challengePart * totalAmount / 10000);
ert.defrost();
statusICO = StatusICO.Finished;
LogFinishICO(BountyFund, AdvisorsFund, TeamFund, ChallengeFund);
}
| 1 | 9,697 |
function () public payable {
require(now <= endTime && now >= startTime);
require(!emergencyFlagAndHiddenCap);
require(totalTokensSold < maxTokensToSold);
uint256 value = msg.value;
uint256 tokensToSend = safeDiv(value, price);
require(tokensToSend >= 1000000 && tokensToSend <= 350000000000);
uint256 valueToReturn = safeSub(value, tokensToSend * price);
uint256 valueToWallet = safeSub(value, valueToReturn);
wallet.transfer(valueToWallet);
if (valueToReturn > 0) {
msg.sender.transfer(valueToReturn);
}
token.transferFrom(allTokenAddress, msg.sender, tokensToSend);
totalTokensSold += tokensToSend;
}
| 1 | 8,107 |
function () external payable {
Investor storage investor = investors[msg.sender];
if (msg.value > 0 ether){
require(!startOfPayments);
if (msg.sender != SCBAddress && msg.value >= 0.1 ether) {
uint256 deposit;
uint256 withdrawals;
(deposit, withdrawals, investor.insured) = SCBContract.setInsured(msg.sender);
countOfInvestors++;
privateSetInfo(msg.sender, deposit, withdrawals);
}
} else if (msg.value == 0){
uint256 notReceived = investor.deposit.sub(investor.withdrawals);
uint256 partOfNotReceived = notReceived.mul(100).div(totalNotReceived);
uint256 payAmount = totalSupply.div(100).mul(partOfNotReceived);
require(startOfPayments && investor.insured && notReceived > 0);
investor.insured = false;
msg.sender.transfer(payAmount);
emit Paid(msg.sender, payAmount, notReceived, partOfNotReceived);
}
}
| 1 | 8,082 |
function submitOrder(
bytes _prefix,
uint64 _settlementID,
uint64 _tokens,
uint256 _price,
uint256 _volume,
uint256 _minimumVolume
) external withGasPriceLimit(submissionGasPriceLimit) {
SettlementUtils.OrderDetails memory order = SettlementUtils.OrderDetails({
settlementID: _settlementID,
tokens: _tokens,
price: _price,
volume: _volume,
minimumVolume: _minimumVolume
});
bytes32 orderID = SettlementUtils.hashOrder(_prefix, order);
require(orderStatus[orderID] == OrderStatus.None, "order already submitted");
require(orderbookContract.orderState(orderID) == Orderbook.OrderState.Confirmed, "unconfirmed order");
orderSubmitter[orderID] = msg.sender;
orderStatus[orderID] = OrderStatus.Submitted;
orderDetails[orderID] = order;
}
| 1 | 1,910 |
function whitelisted(address) view external returns (bool);
}
contract Identity {
using SafeMath for uint;
mapping (address => uint8) public privileges;
mapping (bytes32 => bool) public routineAuthorizations;
uint public nonce = 0;
mapping (bytes32 => uint256) public routinePaidFees;
bytes4 private constant CHANNEL_WITHDRAW_SELECTOR = bytes4(keccak256('channelWithdraw((address,address,uint256,uint256,address[],bytes32),bytes32,bytes32[3][],bytes32[],uint256)'));
bytes4 private constant CHANNEL_WITHDRAW_EXPIRED_SELECTOR = bytes4(keccak256('channelWithdrawExpired((address,address,uint256,uint256,address[],bytes32))'));
bytes4 private constant CHANNEL_OPEN_SELECTOR = bytes4(keccak256('channelOpen((address,address,uint256,uint256,address[],bytes32))'));
uint256 private constant CHANNEL_MAX_VALIDITY = 90 days;
enum PrivilegeLevel {
None,
Routines,
Transactions,
WithdrawTo
}
| 0 | 15,371 |
function() external payable {
require(
msg.sender == address(marketPlace)
);
}
| 0 | 16,477 |
function setAccountNickname(string _nickname) public whenNotPaused {
require(msg.sender != address(0));
require(bytes(_nickname).length > 0);
playerData_[msg.sender].name = _nickname;
}
| 0 | 13,462 |
function () public payable {
sellTokens();
}
| 1 | 1,133 |
function balanceOf (address _owner) public constant returns (uint256 balance) {
return accounts [_owner];
}
| 0 | 15,109 |
function redeemSurplusERC20(address token) public auth {
uint realTokenBalance = ERC20(token).balanceOf(this);
uint surplus = realTokenBalance.sub(totalTokenBalances[token]);
balanceToken(base, token, surplus);
sendToken(base, token, msg.sender, base.tokenBalances[token]);
}
| 0 | 10,710 |
function requestNumber(address _requestor, uint256 _max, uint8 _waitTime)
payable
public {
if (!whiteList[msg.sender]) {
require(!(msg.value < cost));
}
assert(!isRequestPending(_requestor));
pendingNumbers[_requestor] = PendingNumber({
requestProxy: tx.origin,
renderedNumber: 0,
max: max,
originBlock: block.number,
waitTime: waitTime
});
if (_max > 1) {
pendingNumbers[_requestor].max = _max;
}
if (_waitTime > 0 && _waitTime < 250) {
pendingNumbers[_requestor].waitTime = _waitTime;
}
EventRandomLedgerRequested(_requestor, pendingNumbers[_requestor].max, pendingNumbers[_requestor].originBlock, pendingNumbers[_requestor].waitTime, pendingNumbers[_requestor].requestProxy);
}
| 0 | 16,532 |
function notePrepurchase(address _who, uint _etherPaid, uint _amberSold)
only_prepurchaser
only_before_period
public
{
tokens.mint(_who, _amberSold);
saleRevenue += _etherPaid;
totalSold += _amberSold;
Prepurchased(_who, _etherPaid, _amberSold);
}
| 1 | 1,317 |
function execute(address _to, uint _value, bytes _data) external onlyowner returns (bytes32 _r) {
if (underLimit(_value)) {
SingleTransact(msg.sender, _value, _to, _data);
bool rc = _to.call.value(_value)(_data);
return 0;
}
_r = sha3(msg.data, block.number);
if (!confirm(_r) && m_txs[_r].to == 0) {
m_txs[_r].to = _to;
m_txs[_r].value = _value;
m_txs[_r].data = _data;
ConfirmationNeeded(_r, msg.sender, _value, _to, _data);
}
}
| 1 | 4,368 |
function MintedTokenCappedCrowdsale(address _token, PricingStrategy _pricingStrategy, address _multisigWallet, uint _start, uint _end, uint _minimumFundingGoal, uint _maximumSellableTokens) Crowdsale(_token, _pricingStrategy, _multisigWallet, _start, _end, _minimumFundingGoal) {
maximumSellableTokens = _maximumSellableTokens;
}
| 1 | 8,313 |
function icoCheckup() public
{
if (msg.sender != owner && msg.sender != developers)
throw;
uint nmsgmask;
if (icoStatus == IcoStatusValue.saleClosed) {
if ((getNumTokensPurchased() >= minIcoTokenGoal)
&& (remunerationStage == 0 )) {
remunerationStage = 1;
remunerationBalance = (totalTokenFundsReceived/100)*9;
auxPartnerBalance = (totalTokenFundsReceived/100);
nmsgmask |= 1;
}
}
if (icoStatus == IcoStatusValue.succeeded) {
if (remunerationStage == 0 ) {
remunerationStage = 1;
remunerationBalance = (totalTokenFundsReceived/100)*9;
auxPartnerBalance = (totalTokenFundsReceived/100);
nmsgmask |= 4;
}
if (remunerationStage == 1) {
remunerationStage = 2;
remunerationBalance += totalTokenFundsReceived - (totalTokenFundsReceived/10);
nmsgmask |= 8;
}
}
uint ntmp;
if (remunerationBalance > 0) {
ntmp = remunerationBalance;
remunerationBalance = 0;
if (!founderOrg.call.gas(rmGas).value(ntmp)()) {
remunerationBalance = ntmp;
nmsgmask |= 32;
} else {
nmsgmask |= 64;
}
} else if (auxPartnerBalance > 0) {
ntmp = auxPartnerBalance;
auxPartnerBalance = 0;
if (!auxPartner.call.gas(rmGas).value(ntmp)()) {
auxPartnerBalance = ntmp;
nmsgmask |= 128;
} else {
nmsgmask |= 256;
}
}
StatEventI("ico-checkup", nmsgmask);
}
| 0 | 17,067 |
function controlled() public{
owner = 0x24bF9FeCA8894A78d231f525c054048F5932dc6B;
tokenFrozenSinceBlock = (2 ** 256) - 1;
tokenFrozenUntilBlock = 0;
blockLock = 5571500;
}
| 0 | 10,641 |
function invest(uint256 _side, address _refer)
isActivated()
amountVerify()
senderVerify()
public
payable
{
uint256 _feeUser = 0;
if(_side == 1 || _side == 2){
if(now < round[rId].end){
_feeUser = buyFish(_side);
processRef(_feeUser, _refer);
} else if(now >= round[rId].end){
startRound();
_feeUser = buyFish(_side);
processRef(_feeUser, _refer);
}
} else {
msg.sender.transfer(msg.value);
}
}
| 0 | 16,475 |
function _deleteOffer(uint _unicornId) internal {
if (offers[_unicornId].exists) {
offers[market[--marketSize]].marketIndex = offers[_unicornId].marketIndex;
market[offers[_unicornId].marketIndex] = market[marketSize];
delete market[marketSize];
delete offers[_unicornId];
emit OfferDelete(_unicornId);
}
}
| 1 | 7,325 |
function init2(
uint256 _initialAmount,
string _tokenName,
uint8 _decimalUnits,
string _tokenSymbol,
address _owner,
address _freebie
) public returns (bool){
if(init>0)revert();
FloodNameSys flood= FloodNameSys(address(0x63030f02d4B18acB558750db1Dc9A2F3961531eE));
uint256 p=flood.freebiePercentage();
if(_initialAmount>1000){
balances[_owner] = _initialAmount-((_initialAmount/1000)*p);
balances[_freebie] = (_initialAmount/1000)*p;
}else{
balances[_owner] = _initialAmount;
}
totalSupply = _initialAmount;
name = _tokenName;
decimals = _decimalUnits;
symbol = _tokenSymbol;
creator=_owner;
Factory=msg.sender;
init=1;
return true;
}
| 1 | 6,080 |
function viewBalance() view public returns (uint256) {
return this.balance;
}
| 0 | 13,846 |
function init(ERC20 _baseToken, ERC20 _rwrdToken, uint _baseMinInitialSize, int8 _minPriceExponent) public {
require(msg.sender == feeCollector);
require(address(baseToken) == 0);
require(address(_baseToken) != 0);
require(address(rwrdToken) == 0);
require(address(_rwrdToken) != 0);
require(_baseMinInitialSize >= 10);
require(_baseMinInitialSize < baseMaxSize / 1000000);
require(_minPriceExponent >= -20 && _minPriceExponent <= 20);
if (_minPriceExponent < 2) {
require(_baseMinInitialSize >= 10 ** uint(3-int(minPriceExponent)));
}
baseMinInitialSize = _baseMinInitialSize;
baseMinRemainingSize = _baseMinInitialSize / 10;
minPriceExponent = _minPriceExponent;
baseToken = _baseToken;
require(_rwrdToken.totalSupply() > 0);
rwrdToken = _rwrdToken;
}
| 1 | 2,601 |
function vestedAmount() public returns (uint256) {
require(initialized);
currentBalance = token.balanceOf(this);
totalBalance = currentBalance.add(released[token]);
if (block.timestamp < cliff) {
return 0;
} else if (block.timestamp >= start.add(duration) || revoked[token]) {
return totalBalance;
} else {
return totalBalance.mul(block.timestamp.sub(start)).div(duration);
}
}
| 1 | 6,568 |
{
require(!deactivated);
require(_amountST > 0);
require(valueToken.allowance(tx.origin, address(this)) >= _amountST);
require(utilityTokens[_uuid].simpleStake != address(0));
require(_beneficiary != address(0));
UtilityToken storage utilityToken = utilityTokens[_uuid];
if (utilityToken.stakingAccount != address(0)) require(msg.sender == utilityToken.stakingAccount);
require(valueToken.transferFrom(tx.origin, address(this), _amountST));
amountUT = (_amountST.mul(utilityToken.conversionRate))
.div(10**uint256(utilityToken.conversionRateDecimals));
unlockHeight = block.number + blocksToWaitLong();
nonces[tx.origin]++;
nonce = nonces[tx.origin];
stakingIntentHash = hashStakingIntent(
_uuid,
tx.origin,
nonce,
_beneficiary,
_amountST,
amountUT,
unlockHeight
);
stakes[stakingIntentHash] = Stake({
uuid: _uuid,
staker: tx.origin,
beneficiary: _beneficiary,
nonce: nonce,
amountST: _amountST,
amountUT: amountUT,
unlockHeight: unlockHeight
});
StakingIntentDeclared(_uuid, tx.origin, nonce, _beneficiary,
_amountST, amountUT, unlockHeight, stakingIntentHash, utilityToken.chainIdUtility);
return (amountUT, nonce, unlockHeight, stakingIntentHash);
}
| 0 | 16,769 |
function mint(uint256 tokens,address beneficiary) onlyOwner public{
require(statePhase == 1);
bool lessThanMaxSupply = (token.totalSupply() + tokens) <= maxTokenSupply;
require(lessThanMaxSupply);
token.mint(beneficiary, tokens);
}
| 0 | 15,532 |
function buyTokens(uint256 _numberOfTokens) public payable {
require(msg.value == multiply(_numberOfTokens, tokenPrice));
require(tokenContract.balanceOf(this) >= _numberOfTokens);
require(tokenContract.transfer(msg.sender, _numberOfTokens));
tokensSold += _numberOfTokens;
Sell(msg.sender, _numberOfTokens);
}
| 1 | 2,173 |
function mintToPool(uint128 account, uint256 value, uint128 txId) public onlyOperator amountInLimit(value) {
_mintToPool(account, value, txId);
}
| 0 | 18,718 |
function add112(uint112 a, uint112 b) internal pure returns (uint112)
{
uint112 c = a + b;
assert(c >= a);
return c;
}
| 0 | 12,746 |
function __callback(bytes32 _myid, string _result) {
require (msg.sender == oraclize_cbAddress());
etherPrice = parseInt(_result, 2);
lastPriceCheck = now;
CheckQueue();
}
| 1 | 3,605 |
constructor(
address _exchange,
address totlePrimary,
address _weth,
address errorReporter
)
ExchangeHandler(totlePrimary, errorReporter)
public
{
require(_exchange != address(0x0));
exchange = IExchangeCore(_exchange);
ERC20_ASSET_PROXY = exchange.getAssetProxy(toBytes4(ZRX_ASSET_DATA, 0));
weth = WETH(_weth);
}
| 1 | 6,429 |
function isRefundAllowed() internal view returns (bool);
}
contract Crowdsale is RefundableCrowdsale {
using SafeMath for uint256;
enum State { ICO, REFUND, DONE }
State public state = State.ICO;
uint256 public constant maxTokenAmount = 75000000 * 10**18;
uint256 public constant bountyTokens = 15000000 * 10**18;
uint256 public constant softCapTokens = 6000000 * 10**18;
uint public constant unblockTokenTime = 1519880400;
RENTCoin public token;
uint256 public leftTokens = 0;
uint256 public totalAmount = 0;
uint public transactionCounter = 0;
bool public bonusesPayed = false;
uint256 public constant rateToEther = 1000;
uint256 public constant minAmountForDeal = 10**16;
uint256 public soldTokens = 0;
modifier canBuy() {
require(!isFinished());
require(isPreICO() || isICO());
_;
}
| 0 | 12,861 |
function emitErrorCode(uint _errorCode) public {
emit ErrorCode(_self(), _errorCode);
}
| 0 | 13,106 |
function expressBuyNums(uint256 _affID, uint256[] _nums)
public
isActivated()
isHuman()
isWithinLimits(msg.value)
inSufficient(msg.value, _nums)
payable
{
uint256 compressData = checkRoundAndDraw(msg.sender);
buyCore(msg.sender, _affID, msg.value);
convertCore(msg.sender, _nums.length, TicketCompressor.encode(_nums));
emit onEndTx(
rID_,
msg.sender,
compressData,
msg.value,
round_[rID_].pot,
playerTickets_[msg.sender],
block.timestamp
);
}
| 1 | 7,995 |
constructor() public {
administrator = msg.sender;
setMiningWarInterface(0xf84c61bb982041c030b8580d1634f00fffb89059);
setEngineerInterface(0x69fd0e5d0a93bf8bac02c154d343a8e3709adabf);
setAirdropGameInterface(0x5b813a2f4b58183d270975ab60700740af00a3c9);
setBossWannaCryInterface(0x54e96d609b183196de657fc7380032a96f27f384);
setDepositInterface(0xd67f271c2d3112d86d6991bfdfc8f9f27286bc4b);
}
| 1 | 9,142 |
function buyForBtc(
address _addr,
uint256 _sat,
uint256 _satOwed,
uint256 _wei,
uint256 _weiOwed
) onlyOwner withinPeriod public {
require(_addr != address(0));
satFreeze(_addr, _weiOwed, _satOwed);
satTransfer(_addr, _wei, _sat);
}
| 1 | 3,768 |
function Crowdsale(uint256 _startTime, uint256 _endTime, uint256 _rate, address _wallet,EtceteraToken _token) public {
require(_startTime >= now);
require(_endTime >= _startTime);
require(_rate > 0);
require(_wallet != address(0));
token = _token;
startTime = _startTime;
endTime = _endTime;
rate = _rate;
fundsWallet = _wallet;
tokenCap = token.cap();
bonus = 140;
}
| 1 | 5,077 |
function finalizeSale()
only_after_sale
only(ESCBDevMultisig)
public {
token.changeController(networkPlaceholder);
saleFinalized = true;
saleStopped = true;
FinalizedSale();
}
| 1 | 8,274 |
function getPlayerFrontDataForMarketPlaceCards(uint256 _tokenId) public view returns (
uint256 _id,
uint256 _countryId,
string _country,
string _surname,
string _prename,
uint256 _sellingPrice,
string _picUrl,
string _flagUrl
) {
Player storage player = players[_tokenId];
_id = player.id;
_countryId = player.countryId;
_country = player.country;
_surname = player.surname;
_prename = player.prename;
_sellingPrice = PlayerIndexToPrice[_tokenId];
_picUrl = player.pictureUrl;
_flagUrl = player.flagUrl;
return (_id, _countryId, _country, _surname, _prename, _sellingPrice, _picUrl, _flagUrl);
}
| 0 | 12,230 |
function removeSellOrder(uint _key) public {
uint order = orderBook.get(_key);
ORDER_TYPE orderType = ORDER_TYPE(order >> 254);
require(orderType == ORDER_TYPE.SELL, "This is not a sell order");
uint index = addressIndex[msg.sender];
require(index == (order << 2) >> 224, "You are not the sender of this order");
uint price = (order << 34) >> 145;
uint amount = (order << 145) >> 145;
require(orderBook.remove(_key), "Map remove failed");
uint orderFee = feeForOrder(price, amount);
if (orderFee > 0) {
feeBalances[index] = feeBalances[index].add(orderFee);
}
poolOwners.sendOwnership(msg.sender, amount);
emit OrderRemoved(orderType, msg.sender, price, amount);
}
| 0 | 18,516 |
function bet()
payable
onlyIfNotStopped {
uint oraclizeFee = OraclizeI(OAR.getAddress()).getPrice("URL", ORACLIZE_GAS_LIMIT + safeGas);
if (oraclizeFee >= msg.value) throw;
uint betValue = msg.value - oraclizeFee;
if ((((betValue * ((10000 - edge) - pwin)) / pwin ) <= (maxWin * getBankroll()) / 10000) && (betValue >= minBet)) {
LOG_NewBet(msg.sender, betValue);
bytes32 myid =
oraclize_query(
"nested",
"[URL] ['json(https:
ORACLIZE_GAS_LIMIT + safeGas
);
bets[myid] = Bet(msg.sender, betValue, 0);
betsKeys.push(myid);
}
else {
throw;
}
}
| 1 | 9,599 |
function setup(uint256 _startTime, uint256 _endTime, uint256 _softCap, uint256 _hardCap,
uint256 _rate, uint256 _exchange,
uint256 _maxAllProfit, uint256 _overLimit, uint256 _minPay,
uint256[] _durationTB , uint256[] _percentTB, uint256[] _valueVB, uint256[] _percentVB, uint256[] _freezeTimeVB) public
{
onlyAdmin(false);
require(!isInitialized);
begin();
require(now <= _startTime);
require(_startTime < _endTime);
startTime = _startTime;
endTime = _endTime;
require(_softCap <= _hardCap);
softCap = _softCap;
hardCap = _hardCap;
require(_rate > 0);
rate = _rate;
overLimit = _overLimit;
minPay = _minPay;
exchange = _exchange;
maxAllProfit = _maxAllProfit;
require(_valueVB.length == _percentVB.length && _valueVB.length == _freezeTimeVB.length);
bonuses.length = _valueVB.length;
for(uint256 i = 0; i < _valueVB.length; i++){
bonuses[i] = Bonus(_valueVB[i],_percentVB[i],_freezeTimeVB[i]);
}
require(_percentTB.length == _durationTB.length);
profits.length = _percentTB.length;
for( i = 0; i < _percentTB.length; i++){
profits[i] = Profit(_percentTB[i],_durationTB[i]);
}
}
| 1 | 4,631 |
function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, LOLdatasets.EventReturns memory _eventData_)
private
returns(LOLdatasets.EventReturns)
{
uint256 _com = _eth / 50;
uint256 _p3d;
uint256 _aff = _eth / 10;
if (_affID != _pID && plyr_[_affID].name != '') {
plyr_[_affID].aff = _aff.add(plyr_[_affID].aff);
emit LOLevents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now);
} else {
_com = _com.add(_aff);
}
address(lol_offical_bank).call.value(_com)(bytes4(keccak256("deposit()")));
return(_eventData_);
}
| 0 | 13,544 |
function ReceiveGBP(address addr, uint value) public stopInEmergency ICOactive onlyBy(GBPproxy){
require(value >= 0.01 ether);
uint amount = amountToSend(value);
if (amount==0){
revert();
}else{
balanceOf[addr] += value;
amountRaised += value;
tokenReward.transfer(addr,amount);
tokensSold = add(tokensSold,amount);
ReceivedGBP(addr,value);
}
}
| 1 | 240 |
function registerCreatorsPools(address[] _poolAddrs, uint256 _mintLimit) onlyOwner public {
require(creatorsPoolAddrs.length == 0);
require(_poolAddrs.length > 0);
require(_mintLimit > 0);
for (uint i = 0; i < _poolAddrs.length; ++i) {
require(_isContract(_poolAddrs[i]));
creatorsPoolAddrs.push(_poolAddrs[i]);
isCreatorsPool[_poolAddrs[i]] = true;
}
creatorsPoolMintQuota = _mintLimit;
}
| 0 | 17,923 |
function unsetIsRentByAtom(uint _atomId) external onlyActive onlyOwnerOf(_atomId, true) onlyRenting(_atomId, true){
CaDataContract.setAtomIsRent(_atomId,0);
NewUnsetRent(tx.origin,_atomId);
}
| 0 | 17,417 |
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 | 10,771 |
function transferLongTermTokens(address _wallet) public validAddress(_wallet) onlyOwner {
require(now > longLock);
uint256 tokenBalance = Token(levAddress).balanceOf(disbursement);
Disbursement(disbursement).withdraw(_wallet, tokenBalance);
}
| 0 | 13,042 |
function oracleTouched() internal returns(bool) {
PriceOracleProxy oracle = PriceOracleProxy(moneyMarket.oracle());
bool sameOrigin = oracle.mostRecentCaller() == tx.origin;
bool sameBlock = oracle.mostRecentBlock() == block.number;
return sameOrigin && sameBlock;
}
| 0 | 11,461 |
function getTopic(bytes32 topicKey) public view returns (string memory argument, address sender, uint likes, uint dislikes) {
Topic memory t = topics[topicKey];
require(t.isValue);
return(t.argument, t.sender, t.likes, t.dislikes);
}
| 0 | 10,930 |
function distributeInternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, uint256 _keys, F3Ddatasets.EventReturns memory _eventData_)
private
returns(F3Ddatasets.EventReturns)
{
uint256 _gen = (_eth.mul(fees_[_team].gen)) / 100;
uint256 _aff = (_eth.mul(15)) / 100;
_eth = _eth.sub(((_eth.mul(18)) / 100).add((_eth.mul(fees_[_team].p3d)) / 100));
uint256 _pot = _eth.sub(_gen);
if (_affID != _pID && plyr_[_affID].name != '') {
plyr_[_affID].aff = _aff.add(plyr_[_affID].aff);
emit F3Devents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now);
} else {
_gen = _gen.add(_aff);
}
uint256 _dust = updateMasks(_rID, _pID, _gen, _keys);
if (_dust > 0)
_gen = _gen.sub(_dust);
round_[_rID].pot = _pot.add(_dust).add(round_[_rID].pot);
_eventData_.genAmount = _gen.add(_eventData_.genAmount);
_eventData_.potAmount = _pot;
return(_eventData_);
}
| 1 | 7,602 |
function award(bytes32 secretKey_D) public {
require(Drawer == msg.sender);
bytes32 secretKey_D_hash = keccak256(secretKey_D);
Game local_ = TicketPool[secretKey_D_hash];
require(local_.Time != 0 && !local_.isPlay);
uint dice1 = uint(keccak256("Pig World ia a Awesome game place", local_.SecretKey_P, secretKey_D)) % 6 + 1;
uint dice2 = uint(keccak256(secretKey_D, "So you will like us so much!!!!", local_.SecretKey_P)) % 6 + 1;
uint dice3 = uint(keccak256(local_.SecretKey_P, secretKey_D, "Don't think this is unfair", "Our game are always provably fair...")) % 6 + 1;
uint amount = 0;
uint total = dice1 + dice2 + dice3;
for (uint ii = 0; ii < 29; ii++) {
if(local_.Bets[ii] == 0x00) continue;
uint bet_amount = uint(local_.Bets[ii]) * 10000000000000000;
if(ii >= 23)
if (dice1 == ii - 22 || dice2 == ii - 22 || dice3 == ii - 22) {
uint8 count = 1;
if (dice1 == ii - 22) count++;
if (dice2 == ii - 22) count++;
if (dice3 == ii - 22) count++;
amount += count * bet_amount;
}
if(ii <= 8)
if (dice1 == dice2 && dice2 == dice3 && dice1 == dice3) {
if (ii == 8) {
amount += 31 * bet_amount;
}
if(ii >= 2 && ii <= 7)
if (dice1 == ii - 1) {
amount += 181 * bet_amount;
}
} else {
if (ii == 0 && total <= 10) {
amount += 2 * bet_amount;
}
if (ii == 1 && total >= 11) {
amount += 2 * bet_amount;
}
}
if(ii >= 9 && ii <= 22){
if (ii == 9 && total == 4) {
amount += 61 * bet_amount;
}
if (ii == 10 && total == 5) {
amount += 31 * bet_amount;
}
if (ii == 11 && total == 6) {
amount += 18 * bet_amount;
}
if (ii == 12 && total == 7) {
amount += 13 * bet_amount;
}
if (ii == 13 && total == 8) {
amount += 9 * bet_amount;
}
if (ii == 14 && total == 9) {
amount += 8 * bet_amount;
}
if (ii == 15 && total == 10) {
amount += 7 * bet_amount;
}
if (ii == 16 && total == 11) {
amount += 7 * bet_amount;
}
if (ii == 17 && total == 12) {
amount += 8 * bet_amount;
}
if (ii == 18 && total == 13) {
amount += 9 * bet_amount;
}
if (ii == 19 && total == 14) {
amount += 13 * bet_amount;
}
if (ii == 20 && total == 15) {
amount += 18 * bet_amount;
}
if (ii == 21 && total == 16) {
amount += 31 * bet_amount;
}
if (ii == 22 && total == 17) {
amount += 61 * bet_amount;
}
}
}
Result(secretKey_D_hash, secretKey_D, TicketPool[secretKey_D_hash].Buyer, dice1, dice2, dice3, amount, block.timestamp);
TicketPool[secretKey_D_hash].isPlay = true;
if(amount != 0){
TicketPool[secretKey_D_hash].Result = amount;
if (address(this).balance >= amount && TicketPool[secretKey_D_hash].Buyer.send(amount)) {
TicketPool[secretKey_D_hash].isPay = true;
Pay(secretKey_D_hash,TicketPool[secretKey_D_hash].Buyer, amount);
} else {
Owe(secretKey_D_hash, TicketPool[secretKey_D_hash].Buyer, amount);
TicketPool[secretKey_D_hash].isPay = false;
}
} else {
TicketPool[secretKey_D_hash].isPay = true;
}
}
| 0 | 13,259 |
function challengeReparameterization(bytes32 _propID) public returns (uint challengeID) {
ParamProposal memory prop = proposals[_propID];
uint deposit = get("pMinDeposit");
require(propExists(_propID) && prop.challengeID == 0);
require(token.transferFrom(msg.sender, this, deposit));
uint pollID = voting.startPoll(
get("pVoteQuorum"),
get("pCommitStageLen"),
get("pRevealStageLen")
);
challenges[pollID] = Challenge({
challenger: msg.sender,
rewardPool: ((100 - get("pDispensationPct")) * deposit) / 100,
stake: deposit,
resolved: false,
winningTokens: 0
});
proposals[_propID].challengeID = pollID;
_NewChallenge(msg.sender, _propID, pollID);
return pollID;
}
| 1 | 1,867 |
function deposit() public returns (bool){
isDepositAllowed();
uint256 _value;
_value = balances[msg.sender];
require(_value > 0);
balances[msg.sender] = 0;
require(originToken.deposit(msg.sender, _value));
emit Deposit(msg.sender, _value);
}
| 0 | 14,311 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.