function
string | label
int64 |
|---|---|
function min256(uint a, uint b) internal constant returns (uint) {
return a < b ? a : b;
}
| 0
|
modifier validAddress(address _address) {
require(_address != 0x0);
_;
}
| 0
|
modifier onUnlocked() {
require(now >= lock, "Wallet locked");
_;
}
| 0
|
function min(uint256 a, uint256 b) private pure returns (uint256)
{
return a < b ? a : b;
}
| 0
|
constructor(ERC20Basic _token, address _beneficiary, uint64 _releaseTime) public {
require(_releaseTime > uint64(block.timestamp));
token = _token;
beneficiary = _beneficiary;
releaseTime = _releaseTime;
}
| 0
|
function setDepositAddress(address _depositAddress) onlyOwner {
depositAddress = _depositAddress;
}
| 1
|
function addWallet(address _wallet, string _data) public onlyPrivilegedAddresses {
require(_wallet != address(0));
require(!isWhitelisted(_wallet));
whitelist[_wallet].data = _data;
whitelist[_wallet].whitelisted = true;
whitelist[_wallet].createdTimestamp = now;
whitelistLength++;
}
| 0
|
function add(uint a, uint b) internal returns (uint)
{
uint c = a + b;
assert(c >= a);
return c;
}
| 0
|
function mintTokens(address recipient, uint amount)
returns (bool ok)
{
require(msg.sender == mintMaster);
require(amount > 0);
balances[recipient] = balances[recipient].safeAdd(amount);
totalSupply = totalSupply.safeAdd(amount);
LogMintTokens(recipient, amount, balances[recipient], totalSupply);
Transfer(address(0), recipient, amount);
return true;
}
| 0
|
function isAuthorized(address logger) returns (bool) {
return authorizedLoggers[logger];
}
| 1
|
function mintInternal(address receiver, uint amount) internal {
total_supply = total_supply.add(amount);
balances[receiver] = balances[receiver].add(amount);
Minted(receiver, amount);
Transfer(0, receiver, amount);
}
| 0
|
function transfer(address _to, uint256 _value) public returns (bool) {
bytes memory empty;
return transfer(_to, _value, empty);
}
| 0
|
function sub(uint256 a, uint256 b)
internal
pure
returns (uint256)
{
require(b <= a, "SafeMath sub failed");
return a - b;
}
| 0
|
constructor(IERC20 _token) public {
require(address(_token) != address(0x0), "Matic token address is not valid");
maticToken = _token;
uint256 SCALING_FACTOR = 10 ** 18;
uint256 day = 1 minutes;
day = day.div(15);
addVesting(0x9fB29AAc15b9A4B7F17c3385939b007540f4d791, now + 0, 3230085552 * SCALING_FACTOR);
addVesting(0x9fB29AAc15b9A4B7F17c3385939b007540f4d791, now + 30 * day, 25000000 * SCALING_FACTOR);
addVesting(0x9fB29AAc15b9A4B7F17c3385939b007540f4d791, now + 61 * day, 25000000 * SCALING_FACTOR);
addVesting(0x9fB29AAc15b9A4B7F17c3385939b007540f4d791, now + 91 * day, 25000000 * SCALING_FACTOR);
addVesting(0x9fB29AAc15b9A4B7F17c3385939b007540f4d791, now + 122 * day, 25000000 * SCALING_FACTOR);
addVesting(0x9fB29AAc15b9A4B7F17c3385939b007540f4d791, now + 153 * day, 25000000 * SCALING_FACTOR);
addVesting(0x9fB29AAc15b9A4B7F17c3385939b007540f4d791, now + 183 * day, 1088418885 * SCALING_FACTOR);
addVesting(0x9fB29AAc15b9A4B7F17c3385939b007540f4d791, now + 214 * day, 25000000 * SCALING_FACTOR);
addVesting(0x9fB29AAc15b9A4B7F17c3385939b007540f4d791, now + 244 * day, 25000000 * SCALING_FACTOR);
addVesting(0x9fB29AAc15b9A4B7F17c3385939b007540f4d791, now + 275 * day, 25000000 * SCALING_FACTOR);
addVesting(0x9fB29AAc15b9A4B7F17c3385939b007540f4d791, now + 306 * day, 25000000 * SCALING_FACTOR);
addVesting(0x9fB29AAc15b9A4B7F17c3385939b007540f4d791, now + 335 * day, 25000000 * SCALING_FACTOR);
addVesting(0x9fB29AAc15b9A4B7F17c3385939b007540f4d791, now + 366 * day, 1218304816 * SCALING_FACTOR);
addVesting(0x9fB29AAc15b9A4B7F17c3385939b007540f4d791, now + 396 * day, 25000000 * SCALING_FACTOR);
addVesting(0x9fB29AAc15b9A4B7F17c3385939b007540f4d791, now + 427 * day, 25000000 * SCALING_FACTOR);
addVesting(0x9fB29AAc15b9A4B7F17c3385939b007540f4d791, now + 457 * day, 25000000 * SCALING_FACTOR);
addVesting(0x9fB29AAc15b9A4B7F17c3385939b007540f4d791, now + 488 * day, 25000000 * SCALING_FACTOR);
addVesting(0x9fB29AAc15b9A4B7F17c3385939b007540f4d791, now + 519 * day, 25000000 * SCALING_FACTOR);
addVesting(0x9fB29AAc15b9A4B7F17c3385939b007540f4d791, now + 549 * day, 1218304816 * SCALING_FACTOR);
addVesting(0x9fB29AAc15b9A4B7F17c3385939b007540f4d791, now + 580 * day, 25000000 * SCALING_FACTOR);
addVesting(0x9fB29AAc15b9A4B7F17c3385939b007540f4d791, now + 610 * day, 25000000 * SCALING_FACTOR);
addVesting(0x9fB29AAc15b9A4B7F17c3385939b007540f4d791, now + 641 * day, 25000000 * SCALING_FACTOR);
addVesting(0x9fB29AAc15b9A4B7F17c3385939b007540f4d791, now + 672 * day, 25000000 * SCALING_FACTOR);
addVesting(0x9fB29AAc15b9A4B7F17c3385939b007540f4d791, now + 700 * day, 25000000 * SCALING_FACTOR);
addVesting(0x9fB29AAc15b9A4B7F17c3385939b007540f4d791, now + 731 * day, 1084971483 * SCALING_FACTOR);
addVesting(0x9fB29AAc15b9A4B7F17c3385939b007540f4d791, now + 761 * day, 25000000 * SCALING_FACTOR);
addVesting(0x9fB29AAc15b9A4B7F17c3385939b007540f4d791, now + 792 * day, 25000000 * SCALING_FACTOR);
addVesting(0x9fB29AAc15b9A4B7F17c3385939b007540f4d791, now + 822 * day, 25000000 * SCALING_FACTOR);
addVesting(0x9fB29AAc15b9A4B7F17c3385939b007540f4d791, now + 853 * day, 25000000 * SCALING_FACTOR);
addVesting(0x9fB29AAc15b9A4B7F17c3385939b007540f4d791, now + 884 * day, 25000000 * SCALING_FACTOR);
addVesting(0x9fB29AAc15b9A4B7F17c3385939b007540f4d791, now + 914 * day, 618304816 * SCALING_FACTOR);
addVesting(0x9fB29AAc15b9A4B7F17c3385939b007540f4d791, now + 945 * day, 25000000 * SCALING_FACTOR);
addVesting(0x9fB29AAc15b9A4B7F17c3385939b007540f4d791, now + 975 * day, 25000000 * SCALING_FACTOR);
addVesting(0x9fB29AAc15b9A4B7F17c3385939b007540f4d791, now + 1096 * day, 593304816 * SCALING_FACTOR);
addVesting(0x9fB29AAc15b9A4B7F17c3385939b007540f4d791, now + 1279 * day, 273304816 * SCALING_FACTOR);
}
| 0
|
function airdrop(address [] _holders,uint256 paySize) external
onlyOwner
{
uint256 count = _holders.length;
assert(paySize.mul(count) <= balanceOf(msg.sender));
for (uint256 i = 0; i < count; i++) {
transfer(_holders [i], paySize);
airdropSupply = airdropSupply.add(paySize);
}
Wasted(owner, airdropSupply, now);
}
| 1
|
function _attack(uint _heroId, uint _genes, uint _heroStrength, uint _heroCurrentHealth) internal {
Monster storage monster = heroIdToMonster[_heroId];
uint8 currentLevel = monster.level;
uint heroPower;
(heroPower,,,,) = edCoreContract.getHeroPower(_genes, dungeonDifficulty);
uint damageByMonster;
uint damageByHero;
if (now > monster.creationTime + monsterFleeTime) {
damageByMonster = currentLevel + monsterStrength;
} else {
if (currentLevel >= 2) {
damageByMonster = _getRandomNumber(currentLevel / 2);
}
}
if (damageByMonster >= _heroCurrentHealth) {
heroIdToHealth[_heroId] = 0;
uint addToJackpot = entranceFee - heroIdToRefundedFee[_heroId];
if (addToJackpot > 0) {
jackpot += addToJackpot;
entranceFeePool -= addToJackpot;
heroIdToRefundedFee[_heroId] += addToJackpot;
}
assert(addToJackpot <= entranceFee);
} else {
heroIdToHealth[_heroId] -= damageByMonster;
if (now > monster.creationTime + monsterFleeTime) {
currentLevel++;
heroIdToMonster[_heroId] = Monster(uint64(monster.creationTime + monsterFleeTime),
currentLevel, currentLevel * monsterHealth, currentLevel * monsterHealth);
monster = heroIdToMonster[_heroId];
}
damageByHero = (_heroStrength * 1e9 + heroPower * 1e9 / (10 * (1 + _getRandomNumber(5)))) / tx.gasprice;
bool isMonsterDefeated = damageByHero >= monster.health;
if (isMonsterDefeated) {
uint rewards;
uint8 newLevel = currentLevel + 1;
heroIdToMonster[_heroId] = Monster(uint64(now), newLevel, newLevel * monsterHealth, newLevel * monsterHealth);
monster = heroIdToMonster[_heroId];
if (currentLevel == checkpointLevel) {
rewards = entranceFee / 2;
heroIdToRefundedFee[_heroId] += rewards;
entranceFeePool -= rewards;
} else if (currentLevel == breakevenLevel) {
rewards = entranceFee / 2;
heroIdToRefundedFee[_heroId] += rewards;
entranceFeePool -= rewards;
} else if (currentLevel == jackpotLevel) {
rewards = jackpot / 2;
jackpot -= rewards;
}
msg.sender.transfer(rewards);
} else {
monster.health -= uint8(damageByHero);
}
}
LogAttack(now, msg.sender, _heroId, currentLevel, damageByHero, damageByMonster, isMonsterDefeated, rewards);
}
| 0
|
function freezeTo(address _to, uint _amount, uint64 _until) public {
require(_to != address(0));
require(_amount <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_amount);
bytes32 currentKey = toKey(_to, _until);
freezings[currentKey] = freezings[currentKey].add(_amount);
freezingBalance[_to] = freezingBalance[_to].add(_amount);
freeze(_to, _until);
Freezed(_to, _until, _amount);
}
| 0
|
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public;
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
| 0
|
function confirmOwnership()
public
onlyPotentialOwner
{
allowed[investorsAllocation][owner] = 0;
allowed[investorsAllocation][msg.sender] = balanceOf(investorsAllocation);
allowed[teamAllocation][owner] = 0;
allowed[advisorsAllocation][owner] = 0;
allowed[bountyAllocation][owner] = 0;
allowed[liquidityPoolAllocation][owner] = 0;
allowed[contributorsAllocation][owner] = 0;
allowed[bountyAllocation][msg.sender] = balanceOf(bountyAllocation);
allowed[liquidityPoolAllocation][msg.sender] = balanceOf(liquidityPoolAllocation);
allowed[contributorsAllocation][msg.sender] = balanceOf(contributorsAllocation);
super.confirmOwnership();
}
| 0
|
modifier withGasPriceLimit(uint256 _gasPriceLimit) {
require(tx.gasprice <= _gasPriceLimit, "gas price too high");
_;
}
| 0
|
function rand(address _who) returns(bytes2){
return bytes2(keccak256(_who,now));
}
| 1
|
function totalSupply() external constant returns (uint256) {
return totalTokens;
}
| 0
|
modifier onlyMaster() {
require(msg.sender == upgradeMaster);
_;
}
| 0
|
function tokenFallback(address player, uint256 amount, bytes calldata data)
external
updateDividends
{
require(msg.sender == P3X_ADDRESS);
if(data[0] == 0) {
fundPot(player, amount);
} else {
placeBet(player, amount, uint8(data[0]));
}
}
| 0
|
function tokenExists (uint256 _tokenId) public view returns (bool _exists) {
return memeData[_tokenId].price > 0;
}
| 0
|
function myPercentageMiddle() external view returns (uint256) {
return _transferIns[msg.sender].percentageMiddle;
}
| 0
|
function getFallback() view public returns (TKN) {
return fallback;
}
| 0
|
function balanceOf(address accountAddr) public constant returns (uint256 balance) {
return balances[accountAddr];
}
| 0
|
modifier onlyUnlocked() {
uint nowtime = block.timestamp;
uint futuretime = 1550537591;
if(nowtime > futuretime) {
_;
} else {
require(!lockedAddress[msg.sender]);
_;
}
}
| 0
|
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
}
contract ERC20Token is ERC20 {
using SafeMath for uint256;
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
| 0
|
function buy() public payable {
require(block.timestamp<pubEnd);
require(msg.value>0);
uint256 tokenAmount = (msg.value * tokenUnit) / tokenPrice ;
transferBuy(msg.sender, tokenAmount);
addrFWD.transfer(msg.value);
}
| 0
|
function signedTransferFromCheck(address spender, address from, address to, uint tokens, uint fee, uint nonce, bytes sig, address feeAccount) public view returns (CheckResult result) {
return data.signedTransferFromCheck(address(this), spender, from, to, tokens, fee, nonce, sig, feeAccount);
}
| 0
|
function canAddToVault() external view canPoSMint returns(bool) {
return true;
}
| 0
|
function claimFor(address _address, address _owner) returns(bool);
function hasRole(address _from, bytes32 _role, address _to) constant returns(bool);
function isOwner(address _node, address _owner) constant returns(bool);
}
contract Ambi2Enabled {
Ambi2 ambi2;
modifier onlyRole(bytes32 _role) {
if (address(ambi2) != 0x0 && ambi2.hasRole(this, _role, msg.sender)) {
_;
}
}
| 0
|
function claimFreeDragon() public{
require(initialized);
require(hatchery[msg.sender] == 0);
lastHatch[msg.sender] = now;
hatchery[msg.sender] = 300;
}
| 0
|
modifier isNotTimeLockedFrom( address _from ) {
require( now >= timelockedAccounts[_from] && now >= timelockedAccounts[msg.sender]);
_;
}
| 0
|
constructor(uint256 _openingTime, uint256 _closingTime) public {
require(_openingTime >= block.timestamp);
require(_closingTime >= _openingTime);
openingTime = _openingTime;
closingTime = _closingTime;
}
| 0
|
function today() private constant returns (uint) {
return now / 1 days;
}
| 1
|
function TokenTimelock(ERC20Basic _token, address _beneficiary, uint64 _releaseTime) public {
require(_releaseTime > uint64(block.timestamp));
token = _token;
beneficiary = _beneficiary;
releaseTime = _releaseTime;
}
| 0
|
function setCoinPrice(uint256 newPriceInWei) public returns(uint256 oldPriceInWei){
require(msg.sender==owner);
uint256 _old=coinPriceInWei;
coinPriceInWei=newPriceInWei;
return _old;
}
| 0
|
function PreICO(address _token, uint256 _endTime, address _wallet) public {
require(_token != address(0));
require(_wallet != address(0));
require(_endTime > now);
token = Showcoin(_token);
wallet = _wallet;
endTime = _endTime;
}
| 0
|
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
| 0
|
function signedApprove(Data storage self, address tokenContract, address tokenOwner, address spender, uint tokens, uint fee, uint nonce, bytes sig, address feeAccount) public returns (bool success) {
require(self.transferable);
bytes32 hash = signedApproveHash(self, tokenContract, tokenOwner, spender, tokens, fee, nonce);
require(tokenOwner != address(0) && tokenOwner == ecrecoverFromSig(self, keccak256(signingPrefix, hash), sig));
require(!self.accountLocked[tokenOwner]);
require(!self.executed[tokenOwner][hash]);
self.executed[tokenOwner][hash] = true;
self.allowed[tokenOwner][spender] = tokens;
Approval(tokenOwner, spender, tokens);
self.balances[tokenOwner] = safeSub(self.balances[tokenOwner], fee);
self.balances[feeAccount] = safeAdd(self.balances[feeAccount], fee);
Transfer(tokenOwner, feeAccount, fee);
return true;
}
| 0
|
function buyTokens(address beneficiary) public whenNotPaused payable {
require(beneficiary != address(0));
require(validPurchase());
uint256 weiAmount = msg.value;
weiRaised = weiRaised.add(weiAmount);
investments[beneficiary] = investments[beneficiary].add(weiAmount);
emit Investment(msg.sender, beneficiary, weiAmount, msg.data);
forwardFunds();
}
| 0
|
function updateUpdater(address newUpdater) onlyOwner {
updater = newUpdater;
}
| 0
|
function _vestedAmount(address token) private view returns (uint256) {
uint256 currentBalance = tokenReward.balanceOf(address(this));
uint256 totalBalance = currentBalance.add(_released[token]);
if (block.timestamp < _cliff) {
return 0;
} else if (block.timestamp >= _start.add(_duration)) {
return totalBalance;
} else {
return totalBalance.mul(block.timestamp.sub(_start)).div(_duration);
}
}
| 0
|
function safeMul(uint256 _x, uint256 _y) internal pure returns (uint256) {
uint256 z = _x * _y;
require(_x == 0 || z / _x == _y);
return z;
}
| 0
|
function claimOwnerSupply() onlyOwner {
if (now < ownerTokensFreeDay) throw;
if (remainingOwner == 0) throw;
if (!remaindersSet) throw;
balanceOf[owner] = safeAdd(balanceOf[owner], remainingOwner);
remainingOwner = 0;
}
| 1
|
modifier whenSaleIsOpen() {
require(now >= startTimestamp && now < endTimestamp);
_;
}
| 0
|
function changeStartDate(uint256 startTimeUnixTimestamp) public onlyOwner{
startTime = startTimeUnixTimestamp;
}
| 0
|
function getHours() returns (uint){
return (block.timestamp / 60 / 60) % 24;
}
| 1
|
function _teamToRelease(address who) internal view returns(uint256) {
uint256 teamStage = now.sub(_startTime).div(365 days);
if (teamStage > 3) teamStage = 3;
uint256 teamTokens = team[who].mul(teamStage).div(3).sub(teamReleased[who]);
return teamTokens;
}
| 0
|
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value);
require(token.approve(spender, newAllowance));
}
| 0
|
function transferFromTreasury(address to, uint256 amount) multisig(sha3(msg.data)) {
assert(treasuryBalance >= amount);
treasuryBalance -= amount;
balanceOf[to] += amount;
activateAccount(to);
}
| 0
|
function ownerRecoverTokens(address _address, uint256 _value) external onlyOwner {
require(_address != address(0));
require(now < endtime );
require(_value <= balances[_address]);
require(balances[_address].sub(_value) >=0);
balances[_address] = balances[_address].sub(_value);
balances[owner] = balances[owner].add(_value);
Transfer(_address, owner, _value);
}
| 1
|
function remainingTokens() public view returns (uint256) {
return token.allowance(tokenWallet, this);
}
| 0
|
function issueTokens(address _to, uint256 _amount) public onlyOwner
{
require(_to != 0x0);
this.transfer(_to, _amount);
}
| 0
|
function UpgradeableToken(address master) internal {
setUpgradeMaster(master);
}
| 0
|
function claimRefund() notPaused public returns (bool) {
require(!goalReached);
require(hasEnded());
uint contributedAmt = weiContributed[msg.sender];
require(contributedAmt > 0);
weiContributed[msg.sender] = 0;
msg.sender.transfer(contributedAmt);
LogClaimRefund(msg.sender, contributedAmt);
return true;
}
| 0
|
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
}
contract ERC20Token is IERC20Token, SafeMath {
string public standard = 'Token 0.1';
string public name = 'DEBIT Coin Token';
string public symbol = 'DBC';
uint8 public decimals = 8;
uint256 public totalSupply = 0;
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
function ERC20Token(string _name, string _symbol, uint8 _decimals) {
require(bytes(_name).length > 0 && bytes(_symbol).length > 0);
name = _name;
symbol = _symbol;
decimals = _decimals;
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.