contract_name
stringlengths
1
61
file_path
stringlengths
5
50.4k
contract_address
stringlengths
42
42
language
stringclasses
1 value
class_name
stringlengths
1
61
class_code
stringlengths
4
330k
class_documentation
stringlengths
0
29.1k
class_documentation_type
stringclasses
6 values
func_name
stringlengths
0
62
func_code
stringlengths
1
303k
func_documentation
stringlengths
2
14.9k
func_documentation_type
stringclasses
4 values
compiler_version
stringlengths
15
42
license_type
stringclasses
14 values
swarm_source
stringlengths
0
71
meta
dict
__index_level_0__
int64
0
60.4k
KamikazeRocket
KamikazeRocket.sol
0xaac8e7b0944f7e45f12a27760c4c13f8cf3b3ed8
Solidity
KamikazeRocket
contract KamikazeRocket is Context, IERC20, Ownable { using SafeMath for uint256; using Address for address; mapping(address => uint256) private _rOwned; mapping(address => uint256) private _tOwned; mapping(address => mapping(address => uint256)) private _allowances; mapping(address => bool) private _isExcludedFromFee; mapping(address => uint256) public _lastBuyTime; mapping(address => bool) private _isExcluded; address[] private _excluded; mapping(address => bool) private _isBlackListedBot; address[] private _blackListedBots; uint256 private constant MAX = ~uint256(0); uint256 private _tTotal = 1000000 * 10**6 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 public cooltime = 0 seconds; string private _name = "KamiKaze Rocket"; string private _symbol = "KAMIKAZE"; uint8 private _decimals = 9; uint256 public _taxFee = 1; uint256 private _previousTaxFee = _taxFee; uint256 public _liquidityFee = 10; uint256 private _previousLiquidityFee = _liquidityFee; address payable public _devWalletAddress; IUniswapV2Router02 public immutable uniswapV2Router; address public immutable uniswapV2Pair; bool inSwapAndLiquify; bool public swapAndLiquifyEnabled = true; bool public _translimited = true; uint256 public _maxTxAmount = 1000000 * 10**6 * 10**9; uint256 private numTokensSellToAddToLiquidity = 5 * 10**6 * 10**9; event MinTokensBeforeSwapUpdated(uint256 minTokensBeforeSwap); event SwapAndLiquifyEnabledUpdated(bool enabled); event limitedsitUpdate(bool enabled); event SwapAndLiquify(uint256 tokensSwapped, uint256 ethReceived); modifier lockTheSwap() { inSwapAndLiquify = true; _; inSwapAndLiquify = false; } constructor(address payable devWalletAddress) { _devWalletAddress = devWalletAddress; _rOwned[_msgSender()] = _rTotal; IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ); //0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); // Create a uniswap pair for this new token uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) .createPair(address(this), _uniswapV2Router.WETH()); // set the rest of the contract variables uniswapV2Router = _uniswapV2Router; //exclude owner and this contract from fee _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; emit Transfer( 0x0000000000000000000000000000000000000000, _msgSender(), _tTotal ); } function name() public view returns (string memory) { return _name; } function symbol() public view returns (string memory) { return _symbol; } function decimals() public view returns (uint8) { return _decimals; } function setDevFeeDisabled(bool _devFeeEnabled) public returns (bool) { require( msg.sender == _devWalletAddress, "Only Dev Address can disable dev fee" ); swapAndLiquifyEnabled = _devFeeEnabled; return (swapAndLiquifyEnabled); } function totalSupply() public view override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { if (_isExcluded[account]) return _tOwned[account]; return tokenFromReflection(_rOwned[account]); } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom( address sender, address recipient, uint256 amount ) public override returns (bool) { _transfer(sender, recipient, amount); _approve( sender, _msgSender(), _allowances[sender][_msgSender()].sub( amount, "ERC20: transfer amount exceeds allowance" ) ); return true; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve( _msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue) ); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve( _msgSender(), spender, _allowances[_msgSender()][spender].sub( subtractedValue, "ERC20: decreased allowance below zero" ) ); return true; } function isExcludedFromReward(address account) public view returns (bool) { return _isExcluded[account]; } function totalFees() public view returns (uint256) { return _tFeeTotal; } function deliver(uint256 tAmount) public { address sender = _msgSender(); require( !_isExcluded[sender], "Excluded addresses cannot call this function" ); (uint256 rAmount, , , , , ) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rTotal = _rTotal.sub(rAmount); _tFeeTotal = _tFeeTotal.add(tAmount); } function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns (uint256) { require(tAmount <= _tTotal, "Amount must be less than supply"); if (!deductTransferFee) { (uint256 rAmount, , , , , ) = _getValues(tAmount); return rAmount; } else { (, uint256 rTransferAmount, , , , ) = _getValues(tAmount); return rTransferAmount; } } function tokenFromReflection(uint256 rAmount) public view returns (uint256) { require( rAmount <= _rTotal, "Amount must be less than total reflections" ); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } function excludeFromReward(address account) public onlyOwner { // require(account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 'We can not exclude Uniswap router.'); require(!_isExcluded[account], "Account is already excluded"); if (_rOwned[account] > 0) { _tOwned[account] = tokenFromReflection(_rOwned[account]); } _isExcluded[account] = true; _excluded.push(account); } function includeInReward(address account) external onlyOwner { require(_isExcluded[account], "Account is already excluded"); for (uint256 i = 0; i < _excluded.length; i++) { if (_excluded[i] == account) { _excluded[i] = _excluded[_excluded.length - 1]; _tOwned[account] = 0; _isExcluded[account] = false; _excluded.pop(); break; } } } function _transferBothExcluded( address sender, address recipient, uint256 tAmount ) private { ( uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity ) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function excludeFromFee(address account) public onlyOwner { _isExcludedFromFee[account] = true; } function includeInFee(address account) public onlyOwner { _isExcludedFromFee[account] = false; } function setTaxFeePercent(uint256 taxFee) external onlyOwner { _taxFee = taxFee; } function setLiquidityFeePercent(uint256 liquidityFee) external onlyOwner { _liquidityFee = liquidityFee; } function _setdevWallet(address payable devWalletAddress) external onlyOwner { _devWalletAddress = devWalletAddress; } function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner { _maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2); } function translimitedStatus(bool _state) public onlyOwner { _translimited = _state; emit limitedsitUpdate(_state); } function setSwapAndLiquifyEnabled(bool _enabled) public onlyOwner { swapAndLiquifyEnabled = _enabled; emit SwapAndLiquifyEnabledUpdated(_enabled); } function changetranslimitedTime(uint256 _time) public onlyOwner { cooltime = _time; } //to recieve ETH from uniswapV2Router when swaping receive() external payable {} function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } function _getValues(uint256 tAmount) private view returns ( uint256, uint256, uint256, uint256, uint256, uint256 ) { ( uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity ) = _getTValues(tAmount); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues( tAmount, tFee, tLiquidity, _getRate() ); return ( rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tLiquidity ); } function _getTValues(uint256 tAmount) private view returns ( uint256, uint256, uint256 ) { uint256 tFee = calculateTaxFee(tAmount); uint256 tLiquidity = calculateLiquidityFee(tAmount); uint256 tTransferAmount = tAmount.sub(tFee).sub(tLiquidity); return (tTransferAmount, tFee, tLiquidity); } function _getRValues( uint256 tAmount, uint256 tFee, uint256 tLiquidity, uint256 currentRate ) private pure returns ( uint256, uint256, uint256 ) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rLiquidity = tLiquidity.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rLiquidity); return (rAmount, rTransferAmount, rFee); } function _getRate() private view returns (uint256) { (uint256 rSupply, uint256 tSupply) = _getCurrentSupply(); return rSupply.div(tSupply); } function _getCurrentSupply() private view returns (uint256, uint256) { uint256 rSupply = _rTotal; uint256 tSupply = _tTotal; for (uint256 i = 0; i < _excluded.length; i++) { if ( _rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply ) return (_rTotal, _tTotal); rSupply = rSupply.sub(_rOwned[_excluded[i]]); tSupply = tSupply.sub(_tOwned[_excluded[i]]); } if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } function _takeLiquidity(uint256 tLiquidity) private { uint256 currentRate = _getRate(); uint256 rLiquidity = tLiquidity.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rLiquidity); if (_isExcluded[address(this)]) _tOwned[address(this)] = _tOwned[address(this)].add(tLiquidity); } function calculateTaxFee(uint256 _amount) private view returns (uint256) { return _amount.mul(_taxFee).div(10**2); } function calculateLiquidityFee(uint256 _amount) private view returns (uint256) { return _amount.mul(_liquidityFee).div(10**2); } function addBotToBlackList(address account) external onlyOwner { require( account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, "We can not blacklist Uniswap router." ); require(!_isBlackListedBot[account], "Account is already blacklisted"); _isBlackListedBot[account] = true; _blackListedBots.push(account); } function removeBotFromBlackList(address account) external onlyOwner { require(_isBlackListedBot[account], "Account is not blacklisted"); for (uint256 i = 0; i < _blackListedBots.length; i++) { if (_blackListedBots[i] == account) { _blackListedBots[i] = _blackListedBots[ _blackListedBots.length - 1 ]; _isBlackListedBot[account] = false; _blackListedBots.pop(); break; } } } function removeAllFee() private { if (_taxFee == 0 && _liquidityFee == 0) return; _previousTaxFee = _taxFee; _previousLiquidityFee = _liquidityFee; _taxFee = 0; _liquidityFee = 0; } function restoreAllFee() private { _taxFee = _previousTaxFee; _liquidityFee = _previousLiquidityFee; } function isExcludedFromFee(address account) public view returns (bool) { return _isExcludedFromFee[account]; } function _approve( address owner, address spender, uint256 amount ) private { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _transfer( address from, address to, uint256 amount ) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); require(!_isBlackListedBot[to], "You have no power here!"); require(!_isBlackListedBot[msg.sender], "You have no power here!"); require(!_isBlackListedBot[from], "You have no power here!"); if (from != owner() && to != owner()) require( amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount." ); if (from == uniswapV2Pair) { _lastBuyTime[to] = block.timestamp; } if (!_translimited) { require(to != uniswapV2Pair, " Not available right now"); } else if (_translimited && to == uniswapV2Pair) { require( block.timestamp >= _lastBuyTime[from] + cooltime, "wait for next sell" ); } // is the token balance of this contract address over the min number of // tokens that we need to initiate a swap + liquidity lock? // also, don't get caught in a circular liquidity event. // also, don't swap & liquify if sender is uniswap pair. uint256 contractTokenBalance = balanceOf(address(this)); if (contractTokenBalance >= _maxTxAmount) { contractTokenBalance = _maxTxAmount; } bool overMinTokenBalance = contractTokenBalance >= numTokensSellToAddToLiquidity; if ( overMinTokenBalance && !inSwapAndLiquify && from != uniswapV2Pair && swapAndLiquifyEnabled ) { //add liquidity swapAndLiquify(contractTokenBalance); } //indicates if fee should be deducted from transfer bool takeFee = true; //if any account belongs to _isExcludedFromFee account then remove the fee if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) { takeFee = false; } //transfer amount, it will take tax, burn, liquidity fee _tokenTransfer(from, to, amount, takeFee); } function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap { // split the contract balance into halves uint256 tokenBalance = contractTokenBalance; // capture the contract's current ETH balance. // this is so that we can capture exactly the amount of ETH that the // swap creates, and not make the liquidity event include any ETH that // has been manually sent to the contract uint256 initialBalance = address(this).balance; // swap tokens for ETH swapTokensForEth(tokenBalance); // <- breaks the ETH -> HATE swap when swap+liquify is triggered // how much ETH did we just swap into? uint256 newBalance = address(this).balance.sub(initialBalance); sendETHTodev(newBalance); // add liquidity to uniswap emit SwapAndLiquify(tokenBalance, newBalance); } function sendETHTodev(uint256 amount) private { _devWalletAddress.transfer(amount); } function swapTokensForEth(uint256 tokenAmount) private { // generate the uniswap pair path of token -> weth address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); // make the swap uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, // accept any amount of ETH path, address(this), block.timestamp ); } function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private { // approve token transfer to cover all possible scenarios _approve(address(this), address(uniswapV2Router), tokenAmount); // add the liquidity uniswapV2Router.addLiquidityETH{value: ethAmount}( address(this), tokenAmount, 0, // slippage is unavoidable 0, // slippage is unavoidable owner(), block.timestamp ); } //this method is responsible for taking all fee, if takeFee is true function _tokenTransfer( address sender, address recipient, uint256 amount, bool takeFee ) private { if (!takeFee) removeAllFee(); if (_isExcluded[sender] && !_isExcluded[recipient]) { _transferFromExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && _isExcluded[recipient]) { _transferToExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && !_isExcluded[recipient]) { _transferStandard(sender, recipient, amount); } else if (_isExcluded[sender] && _isExcluded[recipient]) { _transferBothExcluded(sender, recipient, amount); } else { _transferStandard(sender, recipient, amount); } if (!takeFee) restoreAllFee(); } function _transferStandard( address sender, address recipient, uint256 tAmount ) private { ( uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity ) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _transferToExcluded( address sender, address recipient, uint256 tAmount ) private { ( uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity ) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _transferFromExcluded( address sender, address recipient, uint256 tAmount ) private { ( uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity ) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } }
//to recieve ETH from uniswapV2Router when swaping
LineComment
v0.8.9+commit.e5eed63a
None
ipfs://7595e41aacbaba142bcbf687f083c110f9028403b596fffbfc51b164200f93a5
{ "func_code_index": [ 9923, 9957 ] }
9,907
KamikazeRocket
KamikazeRocket.sol
0xaac8e7b0944f7e45f12a27760c4c13f8cf3b3ed8
Solidity
KamikazeRocket
contract KamikazeRocket is Context, IERC20, Ownable { using SafeMath for uint256; using Address for address; mapping(address => uint256) private _rOwned; mapping(address => uint256) private _tOwned; mapping(address => mapping(address => uint256)) private _allowances; mapping(address => bool) private _isExcludedFromFee; mapping(address => uint256) public _lastBuyTime; mapping(address => bool) private _isExcluded; address[] private _excluded; mapping(address => bool) private _isBlackListedBot; address[] private _blackListedBots; uint256 private constant MAX = ~uint256(0); uint256 private _tTotal = 1000000 * 10**6 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 public cooltime = 0 seconds; string private _name = "KamiKaze Rocket"; string private _symbol = "KAMIKAZE"; uint8 private _decimals = 9; uint256 public _taxFee = 1; uint256 private _previousTaxFee = _taxFee; uint256 public _liquidityFee = 10; uint256 private _previousLiquidityFee = _liquidityFee; address payable public _devWalletAddress; IUniswapV2Router02 public immutable uniswapV2Router; address public immutable uniswapV2Pair; bool inSwapAndLiquify; bool public swapAndLiquifyEnabled = true; bool public _translimited = true; uint256 public _maxTxAmount = 1000000 * 10**6 * 10**9; uint256 private numTokensSellToAddToLiquidity = 5 * 10**6 * 10**9; event MinTokensBeforeSwapUpdated(uint256 minTokensBeforeSwap); event SwapAndLiquifyEnabledUpdated(bool enabled); event limitedsitUpdate(bool enabled); event SwapAndLiquify(uint256 tokensSwapped, uint256 ethReceived); modifier lockTheSwap() { inSwapAndLiquify = true; _; inSwapAndLiquify = false; } constructor(address payable devWalletAddress) { _devWalletAddress = devWalletAddress; _rOwned[_msgSender()] = _rTotal; IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ); //0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); // Create a uniswap pair for this new token uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) .createPair(address(this), _uniswapV2Router.WETH()); // set the rest of the contract variables uniswapV2Router = _uniswapV2Router; //exclude owner and this contract from fee _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; emit Transfer( 0x0000000000000000000000000000000000000000, _msgSender(), _tTotal ); } function name() public view returns (string memory) { return _name; } function symbol() public view returns (string memory) { return _symbol; } function decimals() public view returns (uint8) { return _decimals; } function setDevFeeDisabled(bool _devFeeEnabled) public returns (bool) { require( msg.sender == _devWalletAddress, "Only Dev Address can disable dev fee" ); swapAndLiquifyEnabled = _devFeeEnabled; return (swapAndLiquifyEnabled); } function totalSupply() public view override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { if (_isExcluded[account]) return _tOwned[account]; return tokenFromReflection(_rOwned[account]); } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom( address sender, address recipient, uint256 amount ) public override returns (bool) { _transfer(sender, recipient, amount); _approve( sender, _msgSender(), _allowances[sender][_msgSender()].sub( amount, "ERC20: transfer amount exceeds allowance" ) ); return true; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve( _msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue) ); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve( _msgSender(), spender, _allowances[_msgSender()][spender].sub( subtractedValue, "ERC20: decreased allowance below zero" ) ); return true; } function isExcludedFromReward(address account) public view returns (bool) { return _isExcluded[account]; } function totalFees() public view returns (uint256) { return _tFeeTotal; } function deliver(uint256 tAmount) public { address sender = _msgSender(); require( !_isExcluded[sender], "Excluded addresses cannot call this function" ); (uint256 rAmount, , , , , ) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rTotal = _rTotal.sub(rAmount); _tFeeTotal = _tFeeTotal.add(tAmount); } function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns (uint256) { require(tAmount <= _tTotal, "Amount must be less than supply"); if (!deductTransferFee) { (uint256 rAmount, , , , , ) = _getValues(tAmount); return rAmount; } else { (, uint256 rTransferAmount, , , , ) = _getValues(tAmount); return rTransferAmount; } } function tokenFromReflection(uint256 rAmount) public view returns (uint256) { require( rAmount <= _rTotal, "Amount must be less than total reflections" ); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } function excludeFromReward(address account) public onlyOwner { // require(account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 'We can not exclude Uniswap router.'); require(!_isExcluded[account], "Account is already excluded"); if (_rOwned[account] > 0) { _tOwned[account] = tokenFromReflection(_rOwned[account]); } _isExcluded[account] = true; _excluded.push(account); } function includeInReward(address account) external onlyOwner { require(_isExcluded[account], "Account is already excluded"); for (uint256 i = 0; i < _excluded.length; i++) { if (_excluded[i] == account) { _excluded[i] = _excluded[_excluded.length - 1]; _tOwned[account] = 0; _isExcluded[account] = false; _excluded.pop(); break; } } } function _transferBothExcluded( address sender, address recipient, uint256 tAmount ) private { ( uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity ) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function excludeFromFee(address account) public onlyOwner { _isExcludedFromFee[account] = true; } function includeInFee(address account) public onlyOwner { _isExcludedFromFee[account] = false; } function setTaxFeePercent(uint256 taxFee) external onlyOwner { _taxFee = taxFee; } function setLiquidityFeePercent(uint256 liquidityFee) external onlyOwner { _liquidityFee = liquidityFee; } function _setdevWallet(address payable devWalletAddress) external onlyOwner { _devWalletAddress = devWalletAddress; } function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner { _maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2); } function translimitedStatus(bool _state) public onlyOwner { _translimited = _state; emit limitedsitUpdate(_state); } function setSwapAndLiquifyEnabled(bool _enabled) public onlyOwner { swapAndLiquifyEnabled = _enabled; emit SwapAndLiquifyEnabledUpdated(_enabled); } function changetranslimitedTime(uint256 _time) public onlyOwner { cooltime = _time; } //to recieve ETH from uniswapV2Router when swaping receive() external payable {} function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } function _getValues(uint256 tAmount) private view returns ( uint256, uint256, uint256, uint256, uint256, uint256 ) { ( uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity ) = _getTValues(tAmount); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues( tAmount, tFee, tLiquidity, _getRate() ); return ( rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tLiquidity ); } function _getTValues(uint256 tAmount) private view returns ( uint256, uint256, uint256 ) { uint256 tFee = calculateTaxFee(tAmount); uint256 tLiquidity = calculateLiquidityFee(tAmount); uint256 tTransferAmount = tAmount.sub(tFee).sub(tLiquidity); return (tTransferAmount, tFee, tLiquidity); } function _getRValues( uint256 tAmount, uint256 tFee, uint256 tLiquidity, uint256 currentRate ) private pure returns ( uint256, uint256, uint256 ) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rLiquidity = tLiquidity.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rLiquidity); return (rAmount, rTransferAmount, rFee); } function _getRate() private view returns (uint256) { (uint256 rSupply, uint256 tSupply) = _getCurrentSupply(); return rSupply.div(tSupply); } function _getCurrentSupply() private view returns (uint256, uint256) { uint256 rSupply = _rTotal; uint256 tSupply = _tTotal; for (uint256 i = 0; i < _excluded.length; i++) { if ( _rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply ) return (_rTotal, _tTotal); rSupply = rSupply.sub(_rOwned[_excluded[i]]); tSupply = tSupply.sub(_tOwned[_excluded[i]]); } if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } function _takeLiquidity(uint256 tLiquidity) private { uint256 currentRate = _getRate(); uint256 rLiquidity = tLiquidity.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rLiquidity); if (_isExcluded[address(this)]) _tOwned[address(this)] = _tOwned[address(this)].add(tLiquidity); } function calculateTaxFee(uint256 _amount) private view returns (uint256) { return _amount.mul(_taxFee).div(10**2); } function calculateLiquidityFee(uint256 _amount) private view returns (uint256) { return _amount.mul(_liquidityFee).div(10**2); } function addBotToBlackList(address account) external onlyOwner { require( account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, "We can not blacklist Uniswap router." ); require(!_isBlackListedBot[account], "Account is already blacklisted"); _isBlackListedBot[account] = true; _blackListedBots.push(account); } function removeBotFromBlackList(address account) external onlyOwner { require(_isBlackListedBot[account], "Account is not blacklisted"); for (uint256 i = 0; i < _blackListedBots.length; i++) { if (_blackListedBots[i] == account) { _blackListedBots[i] = _blackListedBots[ _blackListedBots.length - 1 ]; _isBlackListedBot[account] = false; _blackListedBots.pop(); break; } } } function removeAllFee() private { if (_taxFee == 0 && _liquidityFee == 0) return; _previousTaxFee = _taxFee; _previousLiquidityFee = _liquidityFee; _taxFee = 0; _liquidityFee = 0; } function restoreAllFee() private { _taxFee = _previousTaxFee; _liquidityFee = _previousLiquidityFee; } function isExcludedFromFee(address account) public view returns (bool) { return _isExcludedFromFee[account]; } function _approve( address owner, address spender, uint256 amount ) private { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _transfer( address from, address to, uint256 amount ) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); require(!_isBlackListedBot[to], "You have no power here!"); require(!_isBlackListedBot[msg.sender], "You have no power here!"); require(!_isBlackListedBot[from], "You have no power here!"); if (from != owner() && to != owner()) require( amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount." ); if (from == uniswapV2Pair) { _lastBuyTime[to] = block.timestamp; } if (!_translimited) { require(to != uniswapV2Pair, " Not available right now"); } else if (_translimited && to == uniswapV2Pair) { require( block.timestamp >= _lastBuyTime[from] + cooltime, "wait for next sell" ); } // is the token balance of this contract address over the min number of // tokens that we need to initiate a swap + liquidity lock? // also, don't get caught in a circular liquidity event. // also, don't swap & liquify if sender is uniswap pair. uint256 contractTokenBalance = balanceOf(address(this)); if (contractTokenBalance >= _maxTxAmount) { contractTokenBalance = _maxTxAmount; } bool overMinTokenBalance = contractTokenBalance >= numTokensSellToAddToLiquidity; if ( overMinTokenBalance && !inSwapAndLiquify && from != uniswapV2Pair && swapAndLiquifyEnabled ) { //add liquidity swapAndLiquify(contractTokenBalance); } //indicates if fee should be deducted from transfer bool takeFee = true; //if any account belongs to _isExcludedFromFee account then remove the fee if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) { takeFee = false; } //transfer amount, it will take tax, burn, liquidity fee _tokenTransfer(from, to, amount, takeFee); } function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap { // split the contract balance into halves uint256 tokenBalance = contractTokenBalance; // capture the contract's current ETH balance. // this is so that we can capture exactly the amount of ETH that the // swap creates, and not make the liquidity event include any ETH that // has been manually sent to the contract uint256 initialBalance = address(this).balance; // swap tokens for ETH swapTokensForEth(tokenBalance); // <- breaks the ETH -> HATE swap when swap+liquify is triggered // how much ETH did we just swap into? uint256 newBalance = address(this).balance.sub(initialBalance); sendETHTodev(newBalance); // add liquidity to uniswap emit SwapAndLiquify(tokenBalance, newBalance); } function sendETHTodev(uint256 amount) private { _devWalletAddress.transfer(amount); } function swapTokensForEth(uint256 tokenAmount) private { // generate the uniswap pair path of token -> weth address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); // make the swap uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, // accept any amount of ETH path, address(this), block.timestamp ); } function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private { // approve token transfer to cover all possible scenarios _approve(address(this), address(uniswapV2Router), tokenAmount); // add the liquidity uniswapV2Router.addLiquidityETH{value: ethAmount}( address(this), tokenAmount, 0, // slippage is unavoidable 0, // slippage is unavoidable owner(), block.timestamp ); } //this method is responsible for taking all fee, if takeFee is true function _tokenTransfer( address sender, address recipient, uint256 amount, bool takeFee ) private { if (!takeFee) removeAllFee(); if (_isExcluded[sender] && !_isExcluded[recipient]) { _transferFromExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && _isExcluded[recipient]) { _transferToExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && !_isExcluded[recipient]) { _transferStandard(sender, recipient, amount); } else if (_isExcluded[sender] && _isExcluded[recipient]) { _transferBothExcluded(sender, recipient, amount); } else { _transferStandard(sender, recipient, amount); } if (!takeFee) restoreAllFee(); } function _transferStandard( address sender, address recipient, uint256 tAmount ) private { ( uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity ) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _transferToExcluded( address sender, address recipient, uint256 tAmount ) private { ( uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity ) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _transferFromExcluded( address sender, address recipient, uint256 tAmount ) private { ( uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity ) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } }
_tokenTransfer
function _tokenTransfer( address sender, address recipient, uint256 amount, bool takeFee ) private { if (!takeFee) removeAllFee(); if (_isExcluded[sender] && !_isExcluded[recipient]) { _transferFromExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && _isExcluded[recipient]) { _transferToExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && !_isExcluded[recipient]) { _transferStandard(sender, recipient, amount); } else if (_isExcluded[sender] && _isExcluded[recipient]) { _transferBothExcluded(sender, recipient, amount); } else { _transferStandard(sender, recipient, amount); } if (!takeFee) restoreAllFee(); }
//this method is responsible for taking all fee, if takeFee is true
LineComment
v0.8.9+commit.e5eed63a
None
ipfs://7595e41aacbaba142bcbf687f083c110f9028403b596fffbfc51b164200f93a5
{ "func_code_index": [ 19767, 20610 ] }
9,908
HDT
HDT.sol
0x52e31d8637dacf608ec1e9287a8fcc3dc0d1f857
Solidity
HDT
contract HDT is SafeMath{ string public name; string public symbol; uint8 public decimals; uint256 public totalSupply; address public owner; /* This creates an array with all balances */ mapping (address => uint256) public balanceOf; mapping (address => uint256) public freezeOf; mapping (address => mapping (address => uint256)) public allowance; /* This generates a public event on the blockchain that will notify clients */ event Transfer(address indexed from, address indexed to, uint256 value); /* This notifies clients about the amount burnt */ event Burn(address indexed from, uint256 value); /* This notifies clients about the amount frozen */ event Freeze(address indexed from, uint256 value); /* This notifies clients about the amount unfrozen */ event Unfreeze(address indexed from, uint256 value); /* Initializes contract with initial supply tokens to the creator of the contract */ function HDT( uint256 initialSupply, string tokenName, uint8 decimalUnits, string tokenSymbol ) { balanceOf[msg.sender] = initialSupply; // Give the creator all initial tokens totalSupply = initialSupply; // Update total supply name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes decimals = decimalUnits; // Amount of decimals for display purposes owner = msg.sender; } /* Send coins */ function transfer(address _to, uint256 _value) { if (_to == 0x0) throw; // Prevent transfer to 0x0 address. Use burn() instead if (_value <= 0) throw; if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient Transfer(msg.sender, _to, _value); // Notify anyone listening that this transfer took place } /* Allow another contract to spend some tokens in your behalf */ function approve(address _spender, uint256 _value) returns (bool success) { if (_value <= 0) throw; allowance[msg.sender][_spender] = _value; return true; } /* A contract attempts to get the coins */ function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { if (_to == 0x0) throw; // Prevent transfer to 0x0 address. Use burn() instead if (_value <= 0) throw; if (balanceOf[_from] < _value) throw; // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows if (_value > allowance[_from][msg.sender]) throw; // Check allowance balanceOf[_from] = SafeMath.safeSub(balanceOf[_from], _value); // Subtract from the sender balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient allowance[_from][msg.sender] = SafeMath.safeSub(allowance[_from][msg.sender], _value); Transfer(_from, _to, _value); return true; } function burn(uint256 _value) returns (bool success) { if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender totalSupply = SafeMath.safeSub(totalSupply,_value); // Updates totalSupply Burn(msg.sender, _value); return true; } function freeze(uint256 _value) returns (bool success) { if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender freezeOf[msg.sender] = SafeMath.safeAdd(freezeOf[msg.sender], _value); // Updates totalSupply Freeze(msg.sender, _value); return true; } function unfreeze(uint256 _value) returns (bool success) { if (freezeOf[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; freezeOf[msg.sender] = SafeMath.safeSub(freezeOf[msg.sender], _value); // Subtract from the sender balanceOf[msg.sender] = SafeMath.safeAdd(balanceOf[msg.sender], _value); Unfreeze(msg.sender, _value); return true; } // transfer balance to owner function withdrawEther(uint256 amount) { if(msg.sender != owner)throw; owner.transfer(amount); } // can accept ether function() payable { } }
HDT
function HDT( uint256 initialSupply, string tokenName, uint8 decimalUnits, string tokenSymbol ) { balanceOf[msg.sender] = initialSupply; // Give the creator all initial tokens totalSupply = initialSupply; // Update total supply name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes decimals = decimalUnits; // Amount of decimals for display purposes ner = msg.sender; }
/* Initializes contract with initial supply tokens to the creator of the contract */
Comment
v0.4.24+commit.e67f0147
bzzr://341f776b11968e35f45ec9639617a0f62f26e9992768dbd71fc3752e9b2513a6
{ "func_code_index": [ 988, 1651 ] }
9,909
HDT
HDT.sol
0x52e31d8637dacf608ec1e9287a8fcc3dc0d1f857
Solidity
HDT
contract HDT is SafeMath{ string public name; string public symbol; uint8 public decimals; uint256 public totalSupply; address public owner; /* This creates an array with all balances */ mapping (address => uint256) public balanceOf; mapping (address => uint256) public freezeOf; mapping (address => mapping (address => uint256)) public allowance; /* This generates a public event on the blockchain that will notify clients */ event Transfer(address indexed from, address indexed to, uint256 value); /* This notifies clients about the amount burnt */ event Burn(address indexed from, uint256 value); /* This notifies clients about the amount frozen */ event Freeze(address indexed from, uint256 value); /* This notifies clients about the amount unfrozen */ event Unfreeze(address indexed from, uint256 value); /* Initializes contract with initial supply tokens to the creator of the contract */ function HDT( uint256 initialSupply, string tokenName, uint8 decimalUnits, string tokenSymbol ) { balanceOf[msg.sender] = initialSupply; // Give the creator all initial tokens totalSupply = initialSupply; // Update total supply name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes decimals = decimalUnits; // Amount of decimals for display purposes owner = msg.sender; } /* Send coins */ function transfer(address _to, uint256 _value) { if (_to == 0x0) throw; // Prevent transfer to 0x0 address. Use burn() instead if (_value <= 0) throw; if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient Transfer(msg.sender, _to, _value); // Notify anyone listening that this transfer took place } /* Allow another contract to spend some tokens in your behalf */ function approve(address _spender, uint256 _value) returns (bool success) { if (_value <= 0) throw; allowance[msg.sender][_spender] = _value; return true; } /* A contract attempts to get the coins */ function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { if (_to == 0x0) throw; // Prevent transfer to 0x0 address. Use burn() instead if (_value <= 0) throw; if (balanceOf[_from] < _value) throw; // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows if (_value > allowance[_from][msg.sender]) throw; // Check allowance balanceOf[_from] = SafeMath.safeSub(balanceOf[_from], _value); // Subtract from the sender balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient allowance[_from][msg.sender] = SafeMath.safeSub(allowance[_from][msg.sender], _value); Transfer(_from, _to, _value); return true; } function burn(uint256 _value) returns (bool success) { if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender totalSupply = SafeMath.safeSub(totalSupply,_value); // Updates totalSupply Burn(msg.sender, _value); return true; } function freeze(uint256 _value) returns (bool success) { if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender freezeOf[msg.sender] = SafeMath.safeAdd(freezeOf[msg.sender], _value); // Updates totalSupply Freeze(msg.sender, _value); return true; } function unfreeze(uint256 _value) returns (bool success) { if (freezeOf[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; freezeOf[msg.sender] = SafeMath.safeSub(freezeOf[msg.sender], _value); // Subtract from the sender balanceOf[msg.sender] = SafeMath.safeAdd(balanceOf[msg.sender], _value); Unfreeze(msg.sender, _value); return true; } // transfer balance to owner function withdrawEther(uint256 amount) { if(msg.sender != owner)throw; owner.transfer(amount); } // can accept ether function() payable { } }
transfer
function transfer(address _to, uint256 _value) { if (_to == 0x0) throw; // Prevent transfer to 0x0 address. Use burn() instead (_value <= 0) throw; if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient Transfer(msg.sender, _to, _value); // Notify anyone listening that this transfer took place }
/* Send coins */
Comment
v0.4.24+commit.e67f0147
bzzr://341f776b11968e35f45ec9639617a0f62f26e9992768dbd71fc3752e9b2513a6
{ "func_code_index": [ 1676, 2439 ] }
9,910
HDT
HDT.sol
0x52e31d8637dacf608ec1e9287a8fcc3dc0d1f857
Solidity
HDT
contract HDT is SafeMath{ string public name; string public symbol; uint8 public decimals; uint256 public totalSupply; address public owner; /* This creates an array with all balances */ mapping (address => uint256) public balanceOf; mapping (address => uint256) public freezeOf; mapping (address => mapping (address => uint256)) public allowance; /* This generates a public event on the blockchain that will notify clients */ event Transfer(address indexed from, address indexed to, uint256 value); /* This notifies clients about the amount burnt */ event Burn(address indexed from, uint256 value); /* This notifies clients about the amount frozen */ event Freeze(address indexed from, uint256 value); /* This notifies clients about the amount unfrozen */ event Unfreeze(address indexed from, uint256 value); /* Initializes contract with initial supply tokens to the creator of the contract */ function HDT( uint256 initialSupply, string tokenName, uint8 decimalUnits, string tokenSymbol ) { balanceOf[msg.sender] = initialSupply; // Give the creator all initial tokens totalSupply = initialSupply; // Update total supply name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes decimals = decimalUnits; // Amount of decimals for display purposes owner = msg.sender; } /* Send coins */ function transfer(address _to, uint256 _value) { if (_to == 0x0) throw; // Prevent transfer to 0x0 address. Use burn() instead if (_value <= 0) throw; if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient Transfer(msg.sender, _to, _value); // Notify anyone listening that this transfer took place } /* Allow another contract to spend some tokens in your behalf */ function approve(address _spender, uint256 _value) returns (bool success) { if (_value <= 0) throw; allowance[msg.sender][_spender] = _value; return true; } /* A contract attempts to get the coins */ function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { if (_to == 0x0) throw; // Prevent transfer to 0x0 address. Use burn() instead if (_value <= 0) throw; if (balanceOf[_from] < _value) throw; // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows if (_value > allowance[_from][msg.sender]) throw; // Check allowance balanceOf[_from] = SafeMath.safeSub(balanceOf[_from], _value); // Subtract from the sender balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient allowance[_from][msg.sender] = SafeMath.safeSub(allowance[_from][msg.sender], _value); Transfer(_from, _to, _value); return true; } function burn(uint256 _value) returns (bool success) { if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender totalSupply = SafeMath.safeSub(totalSupply,_value); // Updates totalSupply Burn(msg.sender, _value); return true; } function freeze(uint256 _value) returns (bool success) { if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender freezeOf[msg.sender] = SafeMath.safeAdd(freezeOf[msg.sender], _value); // Updates totalSupply Freeze(msg.sender, _value); return true; } function unfreeze(uint256 _value) returns (bool success) { if (freezeOf[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; freezeOf[msg.sender] = SafeMath.safeSub(freezeOf[msg.sender], _value); // Subtract from the sender balanceOf[msg.sender] = SafeMath.safeAdd(balanceOf[msg.sender], _value); Unfreeze(msg.sender, _value); return true; } // transfer balance to owner function withdrawEther(uint256 amount) { if(msg.sender != owner)throw; owner.transfer(amount); } // can accept ether function() payable { } }
approve
function approve(address _spender, uint256 _value) returns (bool success) { (_value <= 0) throw; allowance[msg.sender][_spender] = _value; return true; }
/* Allow another contract to spend some tokens in your behalf */
Comment
v0.4.24+commit.e67f0147
bzzr://341f776b11968e35f45ec9639617a0f62f26e9992768dbd71fc3752e9b2513a6
{ "func_code_index": [ 2512, 2709 ] }
9,911
HDT
HDT.sol
0x52e31d8637dacf608ec1e9287a8fcc3dc0d1f857
Solidity
HDT
contract HDT is SafeMath{ string public name; string public symbol; uint8 public decimals; uint256 public totalSupply; address public owner; /* This creates an array with all balances */ mapping (address => uint256) public balanceOf; mapping (address => uint256) public freezeOf; mapping (address => mapping (address => uint256)) public allowance; /* This generates a public event on the blockchain that will notify clients */ event Transfer(address indexed from, address indexed to, uint256 value); /* This notifies clients about the amount burnt */ event Burn(address indexed from, uint256 value); /* This notifies clients about the amount frozen */ event Freeze(address indexed from, uint256 value); /* This notifies clients about the amount unfrozen */ event Unfreeze(address indexed from, uint256 value); /* Initializes contract with initial supply tokens to the creator of the contract */ function HDT( uint256 initialSupply, string tokenName, uint8 decimalUnits, string tokenSymbol ) { balanceOf[msg.sender] = initialSupply; // Give the creator all initial tokens totalSupply = initialSupply; // Update total supply name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes decimals = decimalUnits; // Amount of decimals for display purposes owner = msg.sender; } /* Send coins */ function transfer(address _to, uint256 _value) { if (_to == 0x0) throw; // Prevent transfer to 0x0 address. Use burn() instead if (_value <= 0) throw; if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient Transfer(msg.sender, _to, _value); // Notify anyone listening that this transfer took place } /* Allow another contract to spend some tokens in your behalf */ function approve(address _spender, uint256 _value) returns (bool success) { if (_value <= 0) throw; allowance[msg.sender][_spender] = _value; return true; } /* A contract attempts to get the coins */ function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { if (_to == 0x0) throw; // Prevent transfer to 0x0 address. Use burn() instead if (_value <= 0) throw; if (balanceOf[_from] < _value) throw; // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows if (_value > allowance[_from][msg.sender]) throw; // Check allowance balanceOf[_from] = SafeMath.safeSub(balanceOf[_from], _value); // Subtract from the sender balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient allowance[_from][msg.sender] = SafeMath.safeSub(allowance[_from][msg.sender], _value); Transfer(_from, _to, _value); return true; } function burn(uint256 _value) returns (bool success) { if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender totalSupply = SafeMath.safeSub(totalSupply,_value); // Updates totalSupply Burn(msg.sender, _value); return true; } function freeze(uint256 _value) returns (bool success) { if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender freezeOf[msg.sender] = SafeMath.safeAdd(freezeOf[msg.sender], _value); // Updates totalSupply Freeze(msg.sender, _value); return true; } function unfreeze(uint256 _value) returns (bool success) { if (freezeOf[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; freezeOf[msg.sender] = SafeMath.safeSub(freezeOf[msg.sender], _value); // Subtract from the sender balanceOf[msg.sender] = SafeMath.safeAdd(balanceOf[msg.sender], _value); Unfreeze(msg.sender, _value); return true; } // transfer balance to owner function withdrawEther(uint256 amount) { if(msg.sender != owner)throw; owner.transfer(amount); } // can accept ether function() payable { } }
transferFrom
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { if (_to == 0x0) throw; // Prevent transfer to 0x0 address. Use burn() instead (_value <= 0) throw; if (balanceOf[_from] < _value) throw; // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows if (_value > allowance[_from][msg.sender]) throw; // Check allowance balanceOf[_from] = SafeMath.safeSub(balanceOf[_from], _value); // Subtract from the sender balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient allowance[_from][msg.sender] = SafeMath.safeSub(allowance[_from][msg.sender], _value); Transfer(_from, _to, _value); return true; }
/* A contract attempts to get the coins */
Comment
v0.4.24+commit.e67f0147
bzzr://341f776b11968e35f45ec9639617a0f62f26e9992768dbd71fc3752e9b2513a6
{ "func_code_index": [ 2769, 3694 ] }
9,912
HDT
HDT.sol
0x52e31d8637dacf608ec1e9287a8fcc3dc0d1f857
Solidity
HDT
contract HDT is SafeMath{ string public name; string public symbol; uint8 public decimals; uint256 public totalSupply; address public owner; /* This creates an array with all balances */ mapping (address => uint256) public balanceOf; mapping (address => uint256) public freezeOf; mapping (address => mapping (address => uint256)) public allowance; /* This generates a public event on the blockchain that will notify clients */ event Transfer(address indexed from, address indexed to, uint256 value); /* This notifies clients about the amount burnt */ event Burn(address indexed from, uint256 value); /* This notifies clients about the amount frozen */ event Freeze(address indexed from, uint256 value); /* This notifies clients about the amount unfrozen */ event Unfreeze(address indexed from, uint256 value); /* Initializes contract with initial supply tokens to the creator of the contract */ function HDT( uint256 initialSupply, string tokenName, uint8 decimalUnits, string tokenSymbol ) { balanceOf[msg.sender] = initialSupply; // Give the creator all initial tokens totalSupply = initialSupply; // Update total supply name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes decimals = decimalUnits; // Amount of decimals for display purposes owner = msg.sender; } /* Send coins */ function transfer(address _to, uint256 _value) { if (_to == 0x0) throw; // Prevent transfer to 0x0 address. Use burn() instead if (_value <= 0) throw; if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient Transfer(msg.sender, _to, _value); // Notify anyone listening that this transfer took place } /* Allow another contract to spend some tokens in your behalf */ function approve(address _spender, uint256 _value) returns (bool success) { if (_value <= 0) throw; allowance[msg.sender][_spender] = _value; return true; } /* A contract attempts to get the coins */ function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { if (_to == 0x0) throw; // Prevent transfer to 0x0 address. Use burn() instead if (_value <= 0) throw; if (balanceOf[_from] < _value) throw; // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows if (_value > allowance[_from][msg.sender]) throw; // Check allowance balanceOf[_from] = SafeMath.safeSub(balanceOf[_from], _value); // Subtract from the sender balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient allowance[_from][msg.sender] = SafeMath.safeSub(allowance[_from][msg.sender], _value); Transfer(_from, _to, _value); return true; } function burn(uint256 _value) returns (bool success) { if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender totalSupply = SafeMath.safeSub(totalSupply,_value); // Updates totalSupply Burn(msg.sender, _value); return true; } function freeze(uint256 _value) returns (bool success) { if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender freezeOf[msg.sender] = SafeMath.safeAdd(freezeOf[msg.sender], _value); // Updates totalSupply Freeze(msg.sender, _value); return true; } function unfreeze(uint256 _value) returns (bool success) { if (freezeOf[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; freezeOf[msg.sender] = SafeMath.safeSub(freezeOf[msg.sender], _value); // Subtract from the sender balanceOf[msg.sender] = SafeMath.safeAdd(balanceOf[msg.sender], _value); Unfreeze(msg.sender, _value); return true; } // transfer balance to owner function withdrawEther(uint256 amount) { if(msg.sender != owner)throw; owner.transfer(amount); } // can accept ether function() payable { } }
withdrawEther
function withdrawEther(uint256 amount) { if(msg.sender != owner)throw; owner.transfer(amount); }
// transfer balance to owner
LineComment
v0.4.24+commit.e67f0147
bzzr://341f776b11968e35f45ec9639617a0f62f26e9992768dbd71fc3752e9b2513a6
{ "func_code_index": [ 5205, 5311 ] }
9,913
HDT
HDT.sol
0x52e31d8637dacf608ec1e9287a8fcc3dc0d1f857
Solidity
HDT
contract HDT is SafeMath{ string public name; string public symbol; uint8 public decimals; uint256 public totalSupply; address public owner; /* This creates an array with all balances */ mapping (address => uint256) public balanceOf; mapping (address => uint256) public freezeOf; mapping (address => mapping (address => uint256)) public allowance; /* This generates a public event on the blockchain that will notify clients */ event Transfer(address indexed from, address indexed to, uint256 value); /* This notifies clients about the amount burnt */ event Burn(address indexed from, uint256 value); /* This notifies clients about the amount frozen */ event Freeze(address indexed from, uint256 value); /* This notifies clients about the amount unfrozen */ event Unfreeze(address indexed from, uint256 value); /* Initializes contract with initial supply tokens to the creator of the contract */ function HDT( uint256 initialSupply, string tokenName, uint8 decimalUnits, string tokenSymbol ) { balanceOf[msg.sender] = initialSupply; // Give the creator all initial tokens totalSupply = initialSupply; // Update total supply name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes decimals = decimalUnits; // Amount of decimals for display purposes owner = msg.sender; } /* Send coins */ function transfer(address _to, uint256 _value) { if (_to == 0x0) throw; // Prevent transfer to 0x0 address. Use burn() instead if (_value <= 0) throw; if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient Transfer(msg.sender, _to, _value); // Notify anyone listening that this transfer took place } /* Allow another contract to spend some tokens in your behalf */ function approve(address _spender, uint256 _value) returns (bool success) { if (_value <= 0) throw; allowance[msg.sender][_spender] = _value; return true; } /* A contract attempts to get the coins */ function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { if (_to == 0x0) throw; // Prevent transfer to 0x0 address. Use burn() instead if (_value <= 0) throw; if (balanceOf[_from] < _value) throw; // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows if (_value > allowance[_from][msg.sender]) throw; // Check allowance balanceOf[_from] = SafeMath.safeSub(balanceOf[_from], _value); // Subtract from the sender balanceOf[_to] = SafeMath.safeAdd(balanceOf[_to], _value); // Add the same to the recipient allowance[_from][msg.sender] = SafeMath.safeSub(allowance[_from][msg.sender], _value); Transfer(_from, _to, _value); return true; } function burn(uint256 _value) returns (bool success) { if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender totalSupply = SafeMath.safeSub(totalSupply,_value); // Updates totalSupply Burn(msg.sender, _value); return true; } function freeze(uint256 _value) returns (bool success) { if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; balanceOf[msg.sender] = SafeMath.safeSub(balanceOf[msg.sender], _value); // Subtract from the sender freezeOf[msg.sender] = SafeMath.safeAdd(freezeOf[msg.sender], _value); // Updates totalSupply Freeze(msg.sender, _value); return true; } function unfreeze(uint256 _value) returns (bool success) { if (freezeOf[msg.sender] < _value) throw; // Check if the sender has enough if (_value <= 0) throw; freezeOf[msg.sender] = SafeMath.safeSub(freezeOf[msg.sender], _value); // Subtract from the sender balanceOf[msg.sender] = SafeMath.safeAdd(balanceOf[msg.sender], _value); Unfreeze(msg.sender, _value); return true; } // transfer balance to owner function withdrawEther(uint256 amount) { if(msg.sender != owner)throw; owner.transfer(amount); } // can accept ether function() payable { } }
function() payable { }
// can accept ether
LineComment
v0.4.24+commit.e67f0147
bzzr://341f776b11968e35f45ec9639617a0f62f26e9992768dbd71fc3752e9b2513a6
{ "func_code_index": [ 5337, 5366 ] }
9,914
AUEBToken
AUEBToken.sol
0x22cb61acda96372510b70034d71f09b695e0345d
Solidity
Token
contract Token { /// @return total amount of tokens function totalSupply() constant returns (uint256 supply) {} /// @param _owner The address from which the balance will be retrieved /// @return The balance function balanceOf(address _owner) constant returns (uint256 balance) {} /// @notice send `_value` token to `_to` from `msg.sender` /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transfer(address _to, uint256 _value) returns (bool success) {} /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {} /// @notice `msg.sender` approves `_addr` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of wei to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint256 _value) returns (bool success) {} /// @param _owner The address of the account owning tokens /// @param _spender The address of the account able to transfer the tokens /// @return Amount of remaining tokens allowed to spent 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); }
/* * Copyright © 2018 by Capital Trust Group Limited * Author : legal@ctgexchange.com */
Comment
totalSupply
function totalSupply() constant returns (uint256 supply) {}
/// @return total amount of tokens
NatSpecSingleLine
v0.4.23+commit.124ca40d
bzzr://501172fd3a1633d324437efb3812f160dca38cf1ab5eadebfc2cd38894e77a05
{ "func_code_index": [ 60, 124 ] }
9,915
AUEBToken
AUEBToken.sol
0x22cb61acda96372510b70034d71f09b695e0345d
Solidity
Token
contract Token { /// @return total amount of tokens function totalSupply() constant returns (uint256 supply) {} /// @param _owner The address from which the balance will be retrieved /// @return The balance function balanceOf(address _owner) constant returns (uint256 balance) {} /// @notice send `_value` token to `_to` from `msg.sender` /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transfer(address _to, uint256 _value) returns (bool success) {} /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {} /// @notice `msg.sender` approves `_addr` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of wei to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint256 _value) returns (bool success) {} /// @param _owner The address of the account owning tokens /// @param _spender The address of the account able to transfer the tokens /// @return Amount of remaining tokens allowed to spent 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); }
/* * Copyright © 2018 by Capital Trust Group Limited * Author : legal@ctgexchange.com */
Comment
balanceOf
function balanceOf(address _owner) constant returns (uint256 balance) {}
/// @param _owner The address from which the balance will be retrieved /// @return The balance
NatSpecSingleLine
v0.4.23+commit.124ca40d
bzzr://501172fd3a1633d324437efb3812f160dca38cf1ab5eadebfc2cd38894e77a05
{ "func_code_index": [ 232, 309 ] }
9,916
AUEBToken
AUEBToken.sol
0x22cb61acda96372510b70034d71f09b695e0345d
Solidity
Token
contract Token { /// @return total amount of tokens function totalSupply() constant returns (uint256 supply) {} /// @param _owner The address from which the balance will be retrieved /// @return The balance function balanceOf(address _owner) constant returns (uint256 balance) {} /// @notice send `_value` token to `_to` from `msg.sender` /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transfer(address _to, uint256 _value) returns (bool success) {} /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {} /// @notice `msg.sender` approves `_addr` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of wei to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint256 _value) returns (bool success) {} /// @param _owner The address of the account owning tokens /// @param _spender The address of the account able to transfer the tokens /// @return Amount of remaining tokens allowed to spent 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); }
/* * Copyright © 2018 by Capital Trust Group Limited * Author : legal@ctgexchange.com */
Comment
transfer
function transfer(address _to, uint256 _value) returns (bool success) {}
/// @notice send `_value` token to `_to` from `msg.sender` /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not
NatSpecSingleLine
v0.4.23+commit.124ca40d
bzzr://501172fd3a1633d324437efb3812f160dca38cf1ab5eadebfc2cd38894e77a05
{ "func_code_index": [ 546, 623 ] }
9,917
AUEBToken
AUEBToken.sol
0x22cb61acda96372510b70034d71f09b695e0345d
Solidity
Token
contract Token { /// @return total amount of tokens function totalSupply() constant returns (uint256 supply) {} /// @param _owner The address from which the balance will be retrieved /// @return The balance function balanceOf(address _owner) constant returns (uint256 balance) {} /// @notice send `_value` token to `_to` from `msg.sender` /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transfer(address _to, uint256 _value) returns (bool success) {} /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {} /// @notice `msg.sender` approves `_addr` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of wei to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint256 _value) returns (bool success) {} /// @param _owner The address of the account owning tokens /// @param _spender The address of the account able to transfer the tokens /// @return Amount of remaining tokens allowed to spent 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); }
/* * Copyright © 2018 by Capital Trust Group Limited * Author : legal@ctgexchange.com */
Comment
transferFrom
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {}
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not
NatSpecSingleLine
v0.4.23+commit.124ca40d
bzzr://501172fd3a1633d324437efb3812f160dca38cf1ab5eadebfc2cd38894e77a05
{ "func_code_index": [ 946, 1042 ] }
9,918
AUEBToken
AUEBToken.sol
0x22cb61acda96372510b70034d71f09b695e0345d
Solidity
Token
contract Token { /// @return total amount of tokens function totalSupply() constant returns (uint256 supply) {} /// @param _owner The address from which the balance will be retrieved /// @return The balance function balanceOf(address _owner) constant returns (uint256 balance) {} /// @notice send `_value` token to `_to` from `msg.sender` /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transfer(address _to, uint256 _value) returns (bool success) {} /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {} /// @notice `msg.sender` approves `_addr` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of wei to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint256 _value) returns (bool success) {} /// @param _owner The address of the account owning tokens /// @param _spender The address of the account able to transfer the tokens /// @return Amount of remaining tokens allowed to spent 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); }
/* * Copyright © 2018 by Capital Trust Group Limited * Author : legal@ctgexchange.com */
Comment
approve
function approve(address _spender, uint256 _value) returns (bool success) {}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of wei to be approved for transfer /// @return Whether the approval was successful or not
NatSpecSingleLine
v0.4.23+commit.124ca40d
bzzr://501172fd3a1633d324437efb3812f160dca38cf1ab5eadebfc2cd38894e77a05
{ "func_code_index": [ 1326, 1407 ] }
9,919
AUEBToken
AUEBToken.sol
0x22cb61acda96372510b70034d71f09b695e0345d
Solidity
Token
contract Token { /// @return total amount of tokens function totalSupply() constant returns (uint256 supply) {} /// @param _owner The address from which the balance will be retrieved /// @return The balance function balanceOf(address _owner) constant returns (uint256 balance) {} /// @notice send `_value` token to `_to` from `msg.sender` /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transfer(address _to, uint256 _value) returns (bool success) {} /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {} /// @notice `msg.sender` approves `_addr` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of wei to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint256 _value) returns (bool success) {} /// @param _owner The address of the account owning tokens /// @param _spender The address of the account able to transfer the tokens /// @return Amount of remaining tokens allowed to spent 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); }
/* * Copyright © 2018 by Capital Trust Group Limited * Author : legal@ctgexchange.com */
Comment
allowance
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {}
/// @param _owner The address of the account owning tokens /// @param _spender The address of the account able to transfer the tokens /// @return Amount of remaining tokens allowed to spent
NatSpecSingleLine
v0.4.23+commit.124ca40d
bzzr://501172fd3a1633d324437efb3812f160dca38cf1ab5eadebfc2cd38894e77a05
{ "func_code_index": [ 1615, 1712 ] }
9,920
AUEBToken
AUEBToken.sol
0x22cb61acda96372510b70034d71f09b695e0345d
Solidity
AUEBToken
contract AUEBToken is StandardToken { function () { //if ether is sent to this address, send it back. throw; } /* Public variables of the token */ string public name; uint8 public decimals; string public symbol; string public version = 'H1.0'; function AUEBToken( ) { balances[msg.sender] = 22000000000 * 1000000000000000000; // Give the creator all initial tokens, 18 zero is 18 Decimals totalSupply = 22000000000 * 1000000000000000000; // Update total supply, , 18 zero is 18 Decimals name = "Australia Energy Bond"; // Token Name decimals = 18; // Amount of decimals for display purposes symbol = "AUEB"; // Token Symbol } /* Approves and then calls the receiving contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); if(!_spender.call(bytes4(bytes32(sha3("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData)) { throw; } return true; } }
approveAndCall
function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); if(!_spender.call(bytes4(bytes32(sha3("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData)) { throw; } return true; }
/* Approves and then calls the receiving contract */
Comment
v0.4.23+commit.124ca40d
bzzr://501172fd3a1633d324437efb3812f160dca38cf1ab5eadebfc2cd38894e77a05
{ "func_code_index": [ 988, 1372 ] }
9,921
KBToken
KBToken.sol
0x3d74549f0960abc42faaa1687fa1f24871acafb8
Solidity
KBToken
contract KBToken is StandardToken, SafeMath { // metadata string public constant name = "2K BLOCKCHAIN"; string public constant symbol = "2KB"; uint256 public constant decimals = 18; string public version = "1.0"; // contracts address public ethFundDeposit; // ETH存放地址 address public newContractAddr; // token更新地址 // crowdsale parameters bool public isFunding; // 状态切换到true uint256 public fundingStartBlock; uint256 public fundingStopBlock; uint256 public currentSupply; // 正在售卖中的tokens数量 uint256 public tokenRaised = 0; // 总的售卖数量token uint256 public tokenMigrated = 0; // 总的已经交易的 token uint256 public tokenExchangeRate = 1; // 代币兑换比例 N代币 兑换 1 ETH // events event AllocateToken(address indexed _to, uint256 _value); // 分配的私有交易token; event IssueToken(address indexed _to, uint256 _value); // 公开发行售卖的token; event IncreaseSupply(uint256 _value); event DecreaseSupply(uint256 _value); event Migrate(address indexed _to, uint256 _value); // 转换 function formatDecimals(uint256 _value) internal pure returns (uint256 ) { return _value * 10 ** decimals; } // constructor constructor( address _ethFundDeposit, uint256 _currentSupply) public { ethFundDeposit = _ethFundDeposit; isFunding = false; //通过控制预CrowdS ale状态 fundingStartBlock = 0; fundingStopBlock = 0; currentSupply = formatDecimals(_currentSupply); totalSupply = formatDecimals(1000000000); balances[msg.sender] = totalSupply; require(currentSupply <= totalSupply); } modifier isOwner() { require(msg.sender == ethFundDeposit); _; } /// 设置token汇率 function setTokenExchangeRate(uint256 _tokenExchangeRate) isOwner external { require(_tokenExchangeRate != 0); require(_tokenExchangeRate != tokenExchangeRate); tokenExchangeRate = _tokenExchangeRate; } /// @dev 超发token处理 function increaseSupply (uint256 _value) isOwner external { uint256 value = formatDecimals(_value); require(value + currentSupply <= totalSupply); currentSupply = safeAdd(currentSupply, value); emit IncreaseSupply(value); } /// @dev 被盗token处理 function decreaseSupply (uint256 _value) isOwner external { uint256 value = formatDecimals(_value); require(value + tokenRaised <= currentSupply); currentSupply = safeSubtract(currentSupply, value); emit DecreaseSupply(value); } /// 启动区块检测 异常的处理 function startFunding (uint256 _fundingStartBlock, uint256 _fundingStopBlock) isOwner external { require(!isFunding); require(_fundingStartBlock < _fundingStopBlock); require(block.number < _fundingStartBlock); fundingStartBlock = _fundingStartBlock; fundingStopBlock = _fundingStopBlock; isFunding = true; } /// 关闭区块异常处理 function stopFunding() isOwner external { require(isFunding); isFunding = false; } /// 开发了一个新的合同来接收token(或者更新token) function setMigrateContract(address _newContractAddr) isOwner external { require(_newContractAddr != newContractAddr); newContractAddr = _newContractAddr; } /// 设置新的所有者地址 function changeOwner(address _newFundDeposit) isOwner() external { require(_newFundDeposit != address(0x0)); ethFundDeposit = _newFundDeposit; } ///转移token到新的合约 function migrate() external { require(!isFunding); require(newContractAddr != address(0x0)); uint256 tokens = balances[msg.sender]; require(tokens != 0); balances[msg.sender] = 0; tokenMigrated = safeAdd(tokenMigrated, tokens); IMigrationContract newContract = IMigrationContract(newContractAddr); require(newContract.migrate(msg.sender, tokens)); emit Migrate(msg.sender, tokens); // log it } /// 转账ETH 到团队 function transferETH() isOwner external { require(address(this).balance != 0); require(ethFundDeposit.send(address(this).balance)); } /// 将token分配到预处理地址。 function allocateToken (address _addr, uint256 _eth) isOwner external { require(_eth != 0); require(_addr != address(0x0)); uint256 tokens = safeMult(formatDecimals(_eth), tokenExchangeRate); require(tokens + tokenRaised <= currentSupply); tokenRaised = safeAdd(tokenRaised, tokens); balances[_addr] += tokens; emit AllocateToken(_addr, tokens); // 记录token日志 } /// 购买token function () public payable { require(isFunding); require(msg.value != 0); require(block.number >= fundingStartBlock); require(block.number <= fundingStopBlock); uint256 tokens = safeMult(msg.value, tokenExchangeRate); require(tokens + tokenRaised <= currentSupply); tokenRaised = safeAdd(tokenRaised, tokens); balances[msg.sender] += tokens; emit IssueToken(msg.sender, tokens); //记录日志 } }
formatDecimals
function formatDecimals(uint256 _value) internal pure returns (uint256 ) { return _value * 10 ** decimals; }
// 转换
LineComment
v0.4.24+commit.e67f0147
bzzr://0add7557bda029003db6e53f77302f4d7656f94684d48ebb5a4b44f0cdf56568
{ "func_code_index": [ 1150, 1277 ] }
9,922
KBToken
KBToken.sol
0x3d74549f0960abc42faaa1687fa1f24871acafb8
Solidity
KBToken
contract KBToken is StandardToken, SafeMath { // metadata string public constant name = "2K BLOCKCHAIN"; string public constant symbol = "2KB"; uint256 public constant decimals = 18; string public version = "1.0"; // contracts address public ethFundDeposit; // ETH存放地址 address public newContractAddr; // token更新地址 // crowdsale parameters bool public isFunding; // 状态切换到true uint256 public fundingStartBlock; uint256 public fundingStopBlock; uint256 public currentSupply; // 正在售卖中的tokens数量 uint256 public tokenRaised = 0; // 总的售卖数量token uint256 public tokenMigrated = 0; // 总的已经交易的 token uint256 public tokenExchangeRate = 1; // 代币兑换比例 N代币 兑换 1 ETH // events event AllocateToken(address indexed _to, uint256 _value); // 分配的私有交易token; event IssueToken(address indexed _to, uint256 _value); // 公开发行售卖的token; event IncreaseSupply(uint256 _value); event DecreaseSupply(uint256 _value); event Migrate(address indexed _to, uint256 _value); // 转换 function formatDecimals(uint256 _value) internal pure returns (uint256 ) { return _value * 10 ** decimals; } // constructor constructor( address _ethFundDeposit, uint256 _currentSupply) public { ethFundDeposit = _ethFundDeposit; isFunding = false; //通过控制预CrowdS ale状态 fundingStartBlock = 0; fundingStopBlock = 0; currentSupply = formatDecimals(_currentSupply); totalSupply = formatDecimals(1000000000); balances[msg.sender] = totalSupply; require(currentSupply <= totalSupply); } modifier isOwner() { require(msg.sender == ethFundDeposit); _; } /// 设置token汇率 function setTokenExchangeRate(uint256 _tokenExchangeRate) isOwner external { require(_tokenExchangeRate != 0); require(_tokenExchangeRate != tokenExchangeRate); tokenExchangeRate = _tokenExchangeRate; } /// @dev 超发token处理 function increaseSupply (uint256 _value) isOwner external { uint256 value = formatDecimals(_value); require(value + currentSupply <= totalSupply); currentSupply = safeAdd(currentSupply, value); emit IncreaseSupply(value); } /// @dev 被盗token处理 function decreaseSupply (uint256 _value) isOwner external { uint256 value = formatDecimals(_value); require(value + tokenRaised <= currentSupply); currentSupply = safeSubtract(currentSupply, value); emit DecreaseSupply(value); } /// 启动区块检测 异常的处理 function startFunding (uint256 _fundingStartBlock, uint256 _fundingStopBlock) isOwner external { require(!isFunding); require(_fundingStartBlock < _fundingStopBlock); require(block.number < _fundingStartBlock); fundingStartBlock = _fundingStartBlock; fundingStopBlock = _fundingStopBlock; isFunding = true; } /// 关闭区块异常处理 function stopFunding() isOwner external { require(isFunding); isFunding = false; } /// 开发了一个新的合同来接收token(或者更新token) function setMigrateContract(address _newContractAddr) isOwner external { require(_newContractAddr != newContractAddr); newContractAddr = _newContractAddr; } /// 设置新的所有者地址 function changeOwner(address _newFundDeposit) isOwner() external { require(_newFundDeposit != address(0x0)); ethFundDeposit = _newFundDeposit; } ///转移token到新的合约 function migrate() external { require(!isFunding); require(newContractAddr != address(0x0)); uint256 tokens = balances[msg.sender]; require(tokens != 0); balances[msg.sender] = 0; tokenMigrated = safeAdd(tokenMigrated, tokens); IMigrationContract newContract = IMigrationContract(newContractAddr); require(newContract.migrate(msg.sender, tokens)); emit Migrate(msg.sender, tokens); // log it } /// 转账ETH 到团队 function transferETH() isOwner external { require(address(this).balance != 0); require(ethFundDeposit.send(address(this).balance)); } /// 将token分配到预处理地址。 function allocateToken (address _addr, uint256 _eth) isOwner external { require(_eth != 0); require(_addr != address(0x0)); uint256 tokens = safeMult(formatDecimals(_eth), tokenExchangeRate); require(tokens + tokenRaised <= currentSupply); tokenRaised = safeAdd(tokenRaised, tokens); balances[_addr] += tokens; emit AllocateToken(_addr, tokens); // 记录token日志 } /// 购买token function () public payable { require(isFunding); require(msg.value != 0); require(block.number >= fundingStartBlock); require(block.number <= fundingStopBlock); uint256 tokens = safeMult(msg.value, tokenExchangeRate); require(tokens + tokenRaised <= currentSupply); tokenRaised = safeAdd(tokenRaised, tokens); balances[msg.sender] += tokens; emit IssueToken(msg.sender, tokens); //记录日志 } }
setTokenExchangeRate
function setTokenExchangeRate(uint256 _tokenExchangeRate) isOwner external { require(_tokenExchangeRate != 0); require(_tokenExchangeRate != tokenExchangeRate); tokenExchangeRate = _tokenExchangeRate; }
/// 设置token汇率
NatSpecSingleLine
v0.4.24+commit.e67f0147
bzzr://0add7557bda029003db6e53f77302f4d7656f94684d48ebb5a4b44f0cdf56568
{ "func_code_index": [ 1890, 2131 ] }
9,923
KBToken
KBToken.sol
0x3d74549f0960abc42faaa1687fa1f24871acafb8
Solidity
KBToken
contract KBToken is StandardToken, SafeMath { // metadata string public constant name = "2K BLOCKCHAIN"; string public constant symbol = "2KB"; uint256 public constant decimals = 18; string public version = "1.0"; // contracts address public ethFundDeposit; // ETH存放地址 address public newContractAddr; // token更新地址 // crowdsale parameters bool public isFunding; // 状态切换到true uint256 public fundingStartBlock; uint256 public fundingStopBlock; uint256 public currentSupply; // 正在售卖中的tokens数量 uint256 public tokenRaised = 0; // 总的售卖数量token uint256 public tokenMigrated = 0; // 总的已经交易的 token uint256 public tokenExchangeRate = 1; // 代币兑换比例 N代币 兑换 1 ETH // events event AllocateToken(address indexed _to, uint256 _value); // 分配的私有交易token; event IssueToken(address indexed _to, uint256 _value); // 公开发行售卖的token; event IncreaseSupply(uint256 _value); event DecreaseSupply(uint256 _value); event Migrate(address indexed _to, uint256 _value); // 转换 function formatDecimals(uint256 _value) internal pure returns (uint256 ) { return _value * 10 ** decimals; } // constructor constructor( address _ethFundDeposit, uint256 _currentSupply) public { ethFundDeposit = _ethFundDeposit; isFunding = false; //通过控制预CrowdS ale状态 fundingStartBlock = 0; fundingStopBlock = 0; currentSupply = formatDecimals(_currentSupply); totalSupply = formatDecimals(1000000000); balances[msg.sender] = totalSupply; require(currentSupply <= totalSupply); } modifier isOwner() { require(msg.sender == ethFundDeposit); _; } /// 设置token汇率 function setTokenExchangeRate(uint256 _tokenExchangeRate) isOwner external { require(_tokenExchangeRate != 0); require(_tokenExchangeRate != tokenExchangeRate); tokenExchangeRate = _tokenExchangeRate; } /// @dev 超发token处理 function increaseSupply (uint256 _value) isOwner external { uint256 value = formatDecimals(_value); require(value + currentSupply <= totalSupply); currentSupply = safeAdd(currentSupply, value); emit IncreaseSupply(value); } /// @dev 被盗token处理 function decreaseSupply (uint256 _value) isOwner external { uint256 value = formatDecimals(_value); require(value + tokenRaised <= currentSupply); currentSupply = safeSubtract(currentSupply, value); emit DecreaseSupply(value); } /// 启动区块检测 异常的处理 function startFunding (uint256 _fundingStartBlock, uint256 _fundingStopBlock) isOwner external { require(!isFunding); require(_fundingStartBlock < _fundingStopBlock); require(block.number < _fundingStartBlock); fundingStartBlock = _fundingStartBlock; fundingStopBlock = _fundingStopBlock; isFunding = true; } /// 关闭区块异常处理 function stopFunding() isOwner external { require(isFunding); isFunding = false; } /// 开发了一个新的合同来接收token(或者更新token) function setMigrateContract(address _newContractAddr) isOwner external { require(_newContractAddr != newContractAddr); newContractAddr = _newContractAddr; } /// 设置新的所有者地址 function changeOwner(address _newFundDeposit) isOwner() external { require(_newFundDeposit != address(0x0)); ethFundDeposit = _newFundDeposit; } ///转移token到新的合约 function migrate() external { require(!isFunding); require(newContractAddr != address(0x0)); uint256 tokens = balances[msg.sender]; require(tokens != 0); balances[msg.sender] = 0; tokenMigrated = safeAdd(tokenMigrated, tokens); IMigrationContract newContract = IMigrationContract(newContractAddr); require(newContract.migrate(msg.sender, tokens)); emit Migrate(msg.sender, tokens); // log it } /// 转账ETH 到团队 function transferETH() isOwner external { require(address(this).balance != 0); require(ethFundDeposit.send(address(this).balance)); } /// 将token分配到预处理地址。 function allocateToken (address _addr, uint256 _eth) isOwner external { require(_eth != 0); require(_addr != address(0x0)); uint256 tokens = safeMult(formatDecimals(_eth), tokenExchangeRate); require(tokens + tokenRaised <= currentSupply); tokenRaised = safeAdd(tokenRaised, tokens); balances[_addr] += tokens; emit AllocateToken(_addr, tokens); // 记录token日志 } /// 购买token function () public payable { require(isFunding); require(msg.value != 0); require(block.number >= fundingStartBlock); require(block.number <= fundingStopBlock); uint256 tokens = safeMult(msg.value, tokenExchangeRate); require(tokens + tokenRaised <= currentSupply); tokenRaised = safeAdd(tokenRaised, tokens); balances[msg.sender] += tokens; emit IssueToken(msg.sender, tokens); //记录日志 } }
increaseSupply
function increaseSupply (uint256 _value) isOwner external { uint256 value = formatDecimals(_value); require(value + currentSupply <= totalSupply); currentSupply = safeAdd(currentSupply, value); emit IncreaseSupply(value); }
/// @dev 超发token处理
NatSpecSingleLine
v0.4.24+commit.e67f0147
bzzr://0add7557bda029003db6e53f77302f4d7656f94684d48ebb5a4b44f0cdf56568
{ "func_code_index": [ 2158, 2427 ] }
9,924
KBToken
KBToken.sol
0x3d74549f0960abc42faaa1687fa1f24871acafb8
Solidity
KBToken
contract KBToken is StandardToken, SafeMath { // metadata string public constant name = "2K BLOCKCHAIN"; string public constant symbol = "2KB"; uint256 public constant decimals = 18; string public version = "1.0"; // contracts address public ethFundDeposit; // ETH存放地址 address public newContractAddr; // token更新地址 // crowdsale parameters bool public isFunding; // 状态切换到true uint256 public fundingStartBlock; uint256 public fundingStopBlock; uint256 public currentSupply; // 正在售卖中的tokens数量 uint256 public tokenRaised = 0; // 总的售卖数量token uint256 public tokenMigrated = 0; // 总的已经交易的 token uint256 public tokenExchangeRate = 1; // 代币兑换比例 N代币 兑换 1 ETH // events event AllocateToken(address indexed _to, uint256 _value); // 分配的私有交易token; event IssueToken(address indexed _to, uint256 _value); // 公开发行售卖的token; event IncreaseSupply(uint256 _value); event DecreaseSupply(uint256 _value); event Migrate(address indexed _to, uint256 _value); // 转换 function formatDecimals(uint256 _value) internal pure returns (uint256 ) { return _value * 10 ** decimals; } // constructor constructor( address _ethFundDeposit, uint256 _currentSupply) public { ethFundDeposit = _ethFundDeposit; isFunding = false; //通过控制预CrowdS ale状态 fundingStartBlock = 0; fundingStopBlock = 0; currentSupply = formatDecimals(_currentSupply); totalSupply = formatDecimals(1000000000); balances[msg.sender] = totalSupply; require(currentSupply <= totalSupply); } modifier isOwner() { require(msg.sender == ethFundDeposit); _; } /// 设置token汇率 function setTokenExchangeRate(uint256 _tokenExchangeRate) isOwner external { require(_tokenExchangeRate != 0); require(_tokenExchangeRate != tokenExchangeRate); tokenExchangeRate = _tokenExchangeRate; } /// @dev 超发token处理 function increaseSupply (uint256 _value) isOwner external { uint256 value = formatDecimals(_value); require(value + currentSupply <= totalSupply); currentSupply = safeAdd(currentSupply, value); emit IncreaseSupply(value); } /// @dev 被盗token处理 function decreaseSupply (uint256 _value) isOwner external { uint256 value = formatDecimals(_value); require(value + tokenRaised <= currentSupply); currentSupply = safeSubtract(currentSupply, value); emit DecreaseSupply(value); } /// 启动区块检测 异常的处理 function startFunding (uint256 _fundingStartBlock, uint256 _fundingStopBlock) isOwner external { require(!isFunding); require(_fundingStartBlock < _fundingStopBlock); require(block.number < _fundingStartBlock); fundingStartBlock = _fundingStartBlock; fundingStopBlock = _fundingStopBlock; isFunding = true; } /// 关闭区块异常处理 function stopFunding() isOwner external { require(isFunding); isFunding = false; } /// 开发了一个新的合同来接收token(或者更新token) function setMigrateContract(address _newContractAddr) isOwner external { require(_newContractAddr != newContractAddr); newContractAddr = _newContractAddr; } /// 设置新的所有者地址 function changeOwner(address _newFundDeposit) isOwner() external { require(_newFundDeposit != address(0x0)); ethFundDeposit = _newFundDeposit; } ///转移token到新的合约 function migrate() external { require(!isFunding); require(newContractAddr != address(0x0)); uint256 tokens = balances[msg.sender]; require(tokens != 0); balances[msg.sender] = 0; tokenMigrated = safeAdd(tokenMigrated, tokens); IMigrationContract newContract = IMigrationContract(newContractAddr); require(newContract.migrate(msg.sender, tokens)); emit Migrate(msg.sender, tokens); // log it } /// 转账ETH 到团队 function transferETH() isOwner external { require(address(this).balance != 0); require(ethFundDeposit.send(address(this).balance)); } /// 将token分配到预处理地址。 function allocateToken (address _addr, uint256 _eth) isOwner external { require(_eth != 0); require(_addr != address(0x0)); uint256 tokens = safeMult(formatDecimals(_eth), tokenExchangeRate); require(tokens + tokenRaised <= currentSupply); tokenRaised = safeAdd(tokenRaised, tokens); balances[_addr] += tokens; emit AllocateToken(_addr, tokens); // 记录token日志 } /// 购买token function () public payable { require(isFunding); require(msg.value != 0); require(block.number >= fundingStartBlock); require(block.number <= fundingStopBlock); uint256 tokens = safeMult(msg.value, tokenExchangeRate); require(tokens + tokenRaised <= currentSupply); tokenRaised = safeAdd(tokenRaised, tokens); balances[msg.sender] += tokens; emit IssueToken(msg.sender, tokens); //记录日志 } }
decreaseSupply
function decreaseSupply (uint256 _value) isOwner external { uint256 value = formatDecimals(_value); require(value + tokenRaised <= currentSupply); currentSupply = safeSubtract(currentSupply, value); emit DecreaseSupply(value); }
/// @dev 被盗token处理
NatSpecSingleLine
v0.4.24+commit.e67f0147
bzzr://0add7557bda029003db6e53f77302f4d7656f94684d48ebb5a4b44f0cdf56568
{ "func_code_index": [ 2454, 2730 ] }
9,925
KBToken
KBToken.sol
0x3d74549f0960abc42faaa1687fa1f24871acafb8
Solidity
KBToken
contract KBToken is StandardToken, SafeMath { // metadata string public constant name = "2K BLOCKCHAIN"; string public constant symbol = "2KB"; uint256 public constant decimals = 18; string public version = "1.0"; // contracts address public ethFundDeposit; // ETH存放地址 address public newContractAddr; // token更新地址 // crowdsale parameters bool public isFunding; // 状态切换到true uint256 public fundingStartBlock; uint256 public fundingStopBlock; uint256 public currentSupply; // 正在售卖中的tokens数量 uint256 public tokenRaised = 0; // 总的售卖数量token uint256 public tokenMigrated = 0; // 总的已经交易的 token uint256 public tokenExchangeRate = 1; // 代币兑换比例 N代币 兑换 1 ETH // events event AllocateToken(address indexed _to, uint256 _value); // 分配的私有交易token; event IssueToken(address indexed _to, uint256 _value); // 公开发行售卖的token; event IncreaseSupply(uint256 _value); event DecreaseSupply(uint256 _value); event Migrate(address indexed _to, uint256 _value); // 转换 function formatDecimals(uint256 _value) internal pure returns (uint256 ) { return _value * 10 ** decimals; } // constructor constructor( address _ethFundDeposit, uint256 _currentSupply) public { ethFundDeposit = _ethFundDeposit; isFunding = false; //通过控制预CrowdS ale状态 fundingStartBlock = 0; fundingStopBlock = 0; currentSupply = formatDecimals(_currentSupply); totalSupply = formatDecimals(1000000000); balances[msg.sender] = totalSupply; require(currentSupply <= totalSupply); } modifier isOwner() { require(msg.sender == ethFundDeposit); _; } /// 设置token汇率 function setTokenExchangeRate(uint256 _tokenExchangeRate) isOwner external { require(_tokenExchangeRate != 0); require(_tokenExchangeRate != tokenExchangeRate); tokenExchangeRate = _tokenExchangeRate; } /// @dev 超发token处理 function increaseSupply (uint256 _value) isOwner external { uint256 value = formatDecimals(_value); require(value + currentSupply <= totalSupply); currentSupply = safeAdd(currentSupply, value); emit IncreaseSupply(value); } /// @dev 被盗token处理 function decreaseSupply (uint256 _value) isOwner external { uint256 value = formatDecimals(_value); require(value + tokenRaised <= currentSupply); currentSupply = safeSubtract(currentSupply, value); emit DecreaseSupply(value); } /// 启动区块检测 异常的处理 function startFunding (uint256 _fundingStartBlock, uint256 _fundingStopBlock) isOwner external { require(!isFunding); require(_fundingStartBlock < _fundingStopBlock); require(block.number < _fundingStartBlock); fundingStartBlock = _fundingStartBlock; fundingStopBlock = _fundingStopBlock; isFunding = true; } /// 关闭区块异常处理 function stopFunding() isOwner external { require(isFunding); isFunding = false; } /// 开发了一个新的合同来接收token(或者更新token) function setMigrateContract(address _newContractAddr) isOwner external { require(_newContractAddr != newContractAddr); newContractAddr = _newContractAddr; } /// 设置新的所有者地址 function changeOwner(address _newFundDeposit) isOwner() external { require(_newFundDeposit != address(0x0)); ethFundDeposit = _newFundDeposit; } ///转移token到新的合约 function migrate() external { require(!isFunding); require(newContractAddr != address(0x0)); uint256 tokens = balances[msg.sender]; require(tokens != 0); balances[msg.sender] = 0; tokenMigrated = safeAdd(tokenMigrated, tokens); IMigrationContract newContract = IMigrationContract(newContractAddr); require(newContract.migrate(msg.sender, tokens)); emit Migrate(msg.sender, tokens); // log it } /// 转账ETH 到团队 function transferETH() isOwner external { require(address(this).balance != 0); require(ethFundDeposit.send(address(this).balance)); } /// 将token分配到预处理地址。 function allocateToken (address _addr, uint256 _eth) isOwner external { require(_eth != 0); require(_addr != address(0x0)); uint256 tokens = safeMult(formatDecimals(_eth), tokenExchangeRate); require(tokens + tokenRaised <= currentSupply); tokenRaised = safeAdd(tokenRaised, tokens); balances[_addr] += tokens; emit AllocateToken(_addr, tokens); // 记录token日志 } /// 购买token function () public payable { require(isFunding); require(msg.value != 0); require(block.number >= fundingStartBlock); require(block.number <= fundingStopBlock); uint256 tokens = safeMult(msg.value, tokenExchangeRate); require(tokens + tokenRaised <= currentSupply); tokenRaised = safeAdd(tokenRaised, tokens); balances[msg.sender] += tokens; emit IssueToken(msg.sender, tokens); //记录日志 } }
startFunding
function startFunding (uint256 _fundingStartBlock, uint256 _fundingStopBlock) isOwner external { require(!isFunding); require(_fundingStartBlock < _fundingStopBlock); require(block.number < _fundingStartBlock); fundingStartBlock = _fundingStartBlock; fundingStopBlock = _fundingStopBlock; isFunding = true; }
/// 启动区块检测 异常的处理
NatSpecSingleLine
v0.4.24+commit.e67f0147
bzzr://0add7557bda029003db6e53f77302f4d7656f94684d48ebb5a4b44f0cdf56568
{ "func_code_index": [ 2756, 3130 ] }
9,926
KBToken
KBToken.sol
0x3d74549f0960abc42faaa1687fa1f24871acafb8
Solidity
KBToken
contract KBToken is StandardToken, SafeMath { // metadata string public constant name = "2K BLOCKCHAIN"; string public constant symbol = "2KB"; uint256 public constant decimals = 18; string public version = "1.0"; // contracts address public ethFundDeposit; // ETH存放地址 address public newContractAddr; // token更新地址 // crowdsale parameters bool public isFunding; // 状态切换到true uint256 public fundingStartBlock; uint256 public fundingStopBlock; uint256 public currentSupply; // 正在售卖中的tokens数量 uint256 public tokenRaised = 0; // 总的售卖数量token uint256 public tokenMigrated = 0; // 总的已经交易的 token uint256 public tokenExchangeRate = 1; // 代币兑换比例 N代币 兑换 1 ETH // events event AllocateToken(address indexed _to, uint256 _value); // 分配的私有交易token; event IssueToken(address indexed _to, uint256 _value); // 公开发行售卖的token; event IncreaseSupply(uint256 _value); event DecreaseSupply(uint256 _value); event Migrate(address indexed _to, uint256 _value); // 转换 function formatDecimals(uint256 _value) internal pure returns (uint256 ) { return _value * 10 ** decimals; } // constructor constructor( address _ethFundDeposit, uint256 _currentSupply) public { ethFundDeposit = _ethFundDeposit; isFunding = false; //通过控制预CrowdS ale状态 fundingStartBlock = 0; fundingStopBlock = 0; currentSupply = formatDecimals(_currentSupply); totalSupply = formatDecimals(1000000000); balances[msg.sender] = totalSupply; require(currentSupply <= totalSupply); } modifier isOwner() { require(msg.sender == ethFundDeposit); _; } /// 设置token汇率 function setTokenExchangeRate(uint256 _tokenExchangeRate) isOwner external { require(_tokenExchangeRate != 0); require(_tokenExchangeRate != tokenExchangeRate); tokenExchangeRate = _tokenExchangeRate; } /// @dev 超发token处理 function increaseSupply (uint256 _value) isOwner external { uint256 value = formatDecimals(_value); require(value + currentSupply <= totalSupply); currentSupply = safeAdd(currentSupply, value); emit IncreaseSupply(value); } /// @dev 被盗token处理 function decreaseSupply (uint256 _value) isOwner external { uint256 value = formatDecimals(_value); require(value + tokenRaised <= currentSupply); currentSupply = safeSubtract(currentSupply, value); emit DecreaseSupply(value); } /// 启动区块检测 异常的处理 function startFunding (uint256 _fundingStartBlock, uint256 _fundingStopBlock) isOwner external { require(!isFunding); require(_fundingStartBlock < _fundingStopBlock); require(block.number < _fundingStartBlock); fundingStartBlock = _fundingStartBlock; fundingStopBlock = _fundingStopBlock; isFunding = true; } /// 关闭区块异常处理 function stopFunding() isOwner external { require(isFunding); isFunding = false; } /// 开发了一个新的合同来接收token(或者更新token) function setMigrateContract(address _newContractAddr) isOwner external { require(_newContractAddr != newContractAddr); newContractAddr = _newContractAddr; } /// 设置新的所有者地址 function changeOwner(address _newFundDeposit) isOwner() external { require(_newFundDeposit != address(0x0)); ethFundDeposit = _newFundDeposit; } ///转移token到新的合约 function migrate() external { require(!isFunding); require(newContractAddr != address(0x0)); uint256 tokens = balances[msg.sender]; require(tokens != 0); balances[msg.sender] = 0; tokenMigrated = safeAdd(tokenMigrated, tokens); IMigrationContract newContract = IMigrationContract(newContractAddr); require(newContract.migrate(msg.sender, tokens)); emit Migrate(msg.sender, tokens); // log it } /// 转账ETH 到团队 function transferETH() isOwner external { require(address(this).balance != 0); require(ethFundDeposit.send(address(this).balance)); } /// 将token分配到预处理地址。 function allocateToken (address _addr, uint256 _eth) isOwner external { require(_eth != 0); require(_addr != address(0x0)); uint256 tokens = safeMult(formatDecimals(_eth), tokenExchangeRate); require(tokens + tokenRaised <= currentSupply); tokenRaised = safeAdd(tokenRaised, tokens); balances[_addr] += tokens; emit AllocateToken(_addr, tokens); // 记录token日志 } /// 购买token function () public payable { require(isFunding); require(msg.value != 0); require(block.number >= fundingStartBlock); require(block.number <= fundingStopBlock); uint256 tokens = safeMult(msg.value, tokenExchangeRate); require(tokens + tokenRaised <= currentSupply); tokenRaised = safeAdd(tokenRaised, tokens); balances[msg.sender] += tokens; emit IssueToken(msg.sender, tokens); //记录日志 } }
stopFunding
function stopFunding() isOwner external { require(isFunding); isFunding = false; }
/// 关闭区块异常处理
NatSpecSingleLine
v0.4.24+commit.e67f0147
bzzr://0add7557bda029003db6e53f77302f4d7656f94684d48ebb5a4b44f0cdf56568
{ "func_code_index": [ 3152, 3262 ] }
9,927
KBToken
KBToken.sol
0x3d74549f0960abc42faaa1687fa1f24871acafb8
Solidity
KBToken
contract KBToken is StandardToken, SafeMath { // metadata string public constant name = "2K BLOCKCHAIN"; string public constant symbol = "2KB"; uint256 public constant decimals = 18; string public version = "1.0"; // contracts address public ethFundDeposit; // ETH存放地址 address public newContractAddr; // token更新地址 // crowdsale parameters bool public isFunding; // 状态切换到true uint256 public fundingStartBlock; uint256 public fundingStopBlock; uint256 public currentSupply; // 正在售卖中的tokens数量 uint256 public tokenRaised = 0; // 总的售卖数量token uint256 public tokenMigrated = 0; // 总的已经交易的 token uint256 public tokenExchangeRate = 1; // 代币兑换比例 N代币 兑换 1 ETH // events event AllocateToken(address indexed _to, uint256 _value); // 分配的私有交易token; event IssueToken(address indexed _to, uint256 _value); // 公开发行售卖的token; event IncreaseSupply(uint256 _value); event DecreaseSupply(uint256 _value); event Migrate(address indexed _to, uint256 _value); // 转换 function formatDecimals(uint256 _value) internal pure returns (uint256 ) { return _value * 10 ** decimals; } // constructor constructor( address _ethFundDeposit, uint256 _currentSupply) public { ethFundDeposit = _ethFundDeposit; isFunding = false; //通过控制预CrowdS ale状态 fundingStartBlock = 0; fundingStopBlock = 0; currentSupply = formatDecimals(_currentSupply); totalSupply = formatDecimals(1000000000); balances[msg.sender] = totalSupply; require(currentSupply <= totalSupply); } modifier isOwner() { require(msg.sender == ethFundDeposit); _; } /// 设置token汇率 function setTokenExchangeRate(uint256 _tokenExchangeRate) isOwner external { require(_tokenExchangeRate != 0); require(_tokenExchangeRate != tokenExchangeRate); tokenExchangeRate = _tokenExchangeRate; } /// @dev 超发token处理 function increaseSupply (uint256 _value) isOwner external { uint256 value = formatDecimals(_value); require(value + currentSupply <= totalSupply); currentSupply = safeAdd(currentSupply, value); emit IncreaseSupply(value); } /// @dev 被盗token处理 function decreaseSupply (uint256 _value) isOwner external { uint256 value = formatDecimals(_value); require(value + tokenRaised <= currentSupply); currentSupply = safeSubtract(currentSupply, value); emit DecreaseSupply(value); } /// 启动区块检测 异常的处理 function startFunding (uint256 _fundingStartBlock, uint256 _fundingStopBlock) isOwner external { require(!isFunding); require(_fundingStartBlock < _fundingStopBlock); require(block.number < _fundingStartBlock); fundingStartBlock = _fundingStartBlock; fundingStopBlock = _fundingStopBlock; isFunding = true; } /// 关闭区块异常处理 function stopFunding() isOwner external { require(isFunding); isFunding = false; } /// 开发了一个新的合同来接收token(或者更新token) function setMigrateContract(address _newContractAddr) isOwner external { require(_newContractAddr != newContractAddr); newContractAddr = _newContractAddr; } /// 设置新的所有者地址 function changeOwner(address _newFundDeposit) isOwner() external { require(_newFundDeposit != address(0x0)); ethFundDeposit = _newFundDeposit; } ///转移token到新的合约 function migrate() external { require(!isFunding); require(newContractAddr != address(0x0)); uint256 tokens = balances[msg.sender]; require(tokens != 0); balances[msg.sender] = 0; tokenMigrated = safeAdd(tokenMigrated, tokens); IMigrationContract newContract = IMigrationContract(newContractAddr); require(newContract.migrate(msg.sender, tokens)); emit Migrate(msg.sender, tokens); // log it } /// 转账ETH 到团队 function transferETH() isOwner external { require(address(this).balance != 0); require(ethFundDeposit.send(address(this).balance)); } /// 将token分配到预处理地址。 function allocateToken (address _addr, uint256 _eth) isOwner external { require(_eth != 0); require(_addr != address(0x0)); uint256 tokens = safeMult(formatDecimals(_eth), tokenExchangeRate); require(tokens + tokenRaised <= currentSupply); tokenRaised = safeAdd(tokenRaised, tokens); balances[_addr] += tokens; emit AllocateToken(_addr, tokens); // 记录token日志 } /// 购买token function () public payable { require(isFunding); require(msg.value != 0); require(block.number >= fundingStartBlock); require(block.number <= fundingStopBlock); uint256 tokens = safeMult(msg.value, tokenExchangeRate); require(tokens + tokenRaised <= currentSupply); tokenRaised = safeAdd(tokenRaised, tokens); balances[msg.sender] += tokens; emit IssueToken(msg.sender, tokens); //记录日志 } }
setMigrateContract
function setMigrateContract(address _newContractAddr) isOwner external { require(_newContractAddr != newContractAddr); newContractAddr = _newContractAddr; }
/// 开发了一个新的合同来接收token(或者更新token)
NatSpecSingleLine
v0.4.24+commit.e67f0147
bzzr://0add7557bda029003db6e53f77302f4d7656f94684d48ebb5a4b44f0cdf56568
{ "func_code_index": [ 3303, 3487 ] }
9,928
KBToken
KBToken.sol
0x3d74549f0960abc42faaa1687fa1f24871acafb8
Solidity
KBToken
contract KBToken is StandardToken, SafeMath { // metadata string public constant name = "2K BLOCKCHAIN"; string public constant symbol = "2KB"; uint256 public constant decimals = 18; string public version = "1.0"; // contracts address public ethFundDeposit; // ETH存放地址 address public newContractAddr; // token更新地址 // crowdsale parameters bool public isFunding; // 状态切换到true uint256 public fundingStartBlock; uint256 public fundingStopBlock; uint256 public currentSupply; // 正在售卖中的tokens数量 uint256 public tokenRaised = 0; // 总的售卖数量token uint256 public tokenMigrated = 0; // 总的已经交易的 token uint256 public tokenExchangeRate = 1; // 代币兑换比例 N代币 兑换 1 ETH // events event AllocateToken(address indexed _to, uint256 _value); // 分配的私有交易token; event IssueToken(address indexed _to, uint256 _value); // 公开发行售卖的token; event IncreaseSupply(uint256 _value); event DecreaseSupply(uint256 _value); event Migrate(address indexed _to, uint256 _value); // 转换 function formatDecimals(uint256 _value) internal pure returns (uint256 ) { return _value * 10 ** decimals; } // constructor constructor( address _ethFundDeposit, uint256 _currentSupply) public { ethFundDeposit = _ethFundDeposit; isFunding = false; //通过控制预CrowdS ale状态 fundingStartBlock = 0; fundingStopBlock = 0; currentSupply = formatDecimals(_currentSupply); totalSupply = formatDecimals(1000000000); balances[msg.sender] = totalSupply; require(currentSupply <= totalSupply); } modifier isOwner() { require(msg.sender == ethFundDeposit); _; } /// 设置token汇率 function setTokenExchangeRate(uint256 _tokenExchangeRate) isOwner external { require(_tokenExchangeRate != 0); require(_tokenExchangeRate != tokenExchangeRate); tokenExchangeRate = _tokenExchangeRate; } /// @dev 超发token处理 function increaseSupply (uint256 _value) isOwner external { uint256 value = formatDecimals(_value); require(value + currentSupply <= totalSupply); currentSupply = safeAdd(currentSupply, value); emit IncreaseSupply(value); } /// @dev 被盗token处理 function decreaseSupply (uint256 _value) isOwner external { uint256 value = formatDecimals(_value); require(value + tokenRaised <= currentSupply); currentSupply = safeSubtract(currentSupply, value); emit DecreaseSupply(value); } /// 启动区块检测 异常的处理 function startFunding (uint256 _fundingStartBlock, uint256 _fundingStopBlock) isOwner external { require(!isFunding); require(_fundingStartBlock < _fundingStopBlock); require(block.number < _fundingStartBlock); fundingStartBlock = _fundingStartBlock; fundingStopBlock = _fundingStopBlock; isFunding = true; } /// 关闭区块异常处理 function stopFunding() isOwner external { require(isFunding); isFunding = false; } /// 开发了一个新的合同来接收token(或者更新token) function setMigrateContract(address _newContractAddr) isOwner external { require(_newContractAddr != newContractAddr); newContractAddr = _newContractAddr; } /// 设置新的所有者地址 function changeOwner(address _newFundDeposit) isOwner() external { require(_newFundDeposit != address(0x0)); ethFundDeposit = _newFundDeposit; } ///转移token到新的合约 function migrate() external { require(!isFunding); require(newContractAddr != address(0x0)); uint256 tokens = balances[msg.sender]; require(tokens != 0); balances[msg.sender] = 0; tokenMigrated = safeAdd(tokenMigrated, tokens); IMigrationContract newContract = IMigrationContract(newContractAddr); require(newContract.migrate(msg.sender, tokens)); emit Migrate(msg.sender, tokens); // log it } /// 转账ETH 到团队 function transferETH() isOwner external { require(address(this).balance != 0); require(ethFundDeposit.send(address(this).balance)); } /// 将token分配到预处理地址。 function allocateToken (address _addr, uint256 _eth) isOwner external { require(_eth != 0); require(_addr != address(0x0)); uint256 tokens = safeMult(formatDecimals(_eth), tokenExchangeRate); require(tokens + tokenRaised <= currentSupply); tokenRaised = safeAdd(tokenRaised, tokens); balances[_addr] += tokens; emit AllocateToken(_addr, tokens); // 记录token日志 } /// 购买token function () public payable { require(isFunding); require(msg.value != 0); require(block.number >= fundingStartBlock); require(block.number <= fundingStopBlock); uint256 tokens = safeMult(msg.value, tokenExchangeRate); require(tokens + tokenRaised <= currentSupply); tokenRaised = safeAdd(tokenRaised, tokens); balances[msg.sender] += tokens; emit IssueToken(msg.sender, tokens); //记录日志 } }
changeOwner
function changeOwner(address _newFundDeposit) isOwner() external { require(_newFundDeposit != address(0x0)); ethFundDeposit = _newFundDeposit; }
/// 设置新的所有者地址
NatSpecSingleLine
v0.4.24+commit.e67f0147
bzzr://0add7557bda029003db6e53f77302f4d7656f94684d48ebb5a4b44f0cdf56568
{ "func_code_index": [ 3509, 3681 ] }
9,929
KBToken
KBToken.sol
0x3d74549f0960abc42faaa1687fa1f24871acafb8
Solidity
KBToken
contract KBToken is StandardToken, SafeMath { // metadata string public constant name = "2K BLOCKCHAIN"; string public constant symbol = "2KB"; uint256 public constant decimals = 18; string public version = "1.0"; // contracts address public ethFundDeposit; // ETH存放地址 address public newContractAddr; // token更新地址 // crowdsale parameters bool public isFunding; // 状态切换到true uint256 public fundingStartBlock; uint256 public fundingStopBlock; uint256 public currentSupply; // 正在售卖中的tokens数量 uint256 public tokenRaised = 0; // 总的售卖数量token uint256 public tokenMigrated = 0; // 总的已经交易的 token uint256 public tokenExchangeRate = 1; // 代币兑换比例 N代币 兑换 1 ETH // events event AllocateToken(address indexed _to, uint256 _value); // 分配的私有交易token; event IssueToken(address indexed _to, uint256 _value); // 公开发行售卖的token; event IncreaseSupply(uint256 _value); event DecreaseSupply(uint256 _value); event Migrate(address indexed _to, uint256 _value); // 转换 function formatDecimals(uint256 _value) internal pure returns (uint256 ) { return _value * 10 ** decimals; } // constructor constructor( address _ethFundDeposit, uint256 _currentSupply) public { ethFundDeposit = _ethFundDeposit; isFunding = false; //通过控制预CrowdS ale状态 fundingStartBlock = 0; fundingStopBlock = 0; currentSupply = formatDecimals(_currentSupply); totalSupply = formatDecimals(1000000000); balances[msg.sender] = totalSupply; require(currentSupply <= totalSupply); } modifier isOwner() { require(msg.sender == ethFundDeposit); _; } /// 设置token汇率 function setTokenExchangeRate(uint256 _tokenExchangeRate) isOwner external { require(_tokenExchangeRate != 0); require(_tokenExchangeRate != tokenExchangeRate); tokenExchangeRate = _tokenExchangeRate; } /// @dev 超发token处理 function increaseSupply (uint256 _value) isOwner external { uint256 value = formatDecimals(_value); require(value + currentSupply <= totalSupply); currentSupply = safeAdd(currentSupply, value); emit IncreaseSupply(value); } /// @dev 被盗token处理 function decreaseSupply (uint256 _value) isOwner external { uint256 value = formatDecimals(_value); require(value + tokenRaised <= currentSupply); currentSupply = safeSubtract(currentSupply, value); emit DecreaseSupply(value); } /// 启动区块检测 异常的处理 function startFunding (uint256 _fundingStartBlock, uint256 _fundingStopBlock) isOwner external { require(!isFunding); require(_fundingStartBlock < _fundingStopBlock); require(block.number < _fundingStartBlock); fundingStartBlock = _fundingStartBlock; fundingStopBlock = _fundingStopBlock; isFunding = true; } /// 关闭区块异常处理 function stopFunding() isOwner external { require(isFunding); isFunding = false; } /// 开发了一个新的合同来接收token(或者更新token) function setMigrateContract(address _newContractAddr) isOwner external { require(_newContractAddr != newContractAddr); newContractAddr = _newContractAddr; } /// 设置新的所有者地址 function changeOwner(address _newFundDeposit) isOwner() external { require(_newFundDeposit != address(0x0)); ethFundDeposit = _newFundDeposit; } ///转移token到新的合约 function migrate() external { require(!isFunding); require(newContractAddr != address(0x0)); uint256 tokens = balances[msg.sender]; require(tokens != 0); balances[msg.sender] = 0; tokenMigrated = safeAdd(tokenMigrated, tokens); IMigrationContract newContract = IMigrationContract(newContractAddr); require(newContract.migrate(msg.sender, tokens)); emit Migrate(msg.sender, tokens); // log it } /// 转账ETH 到团队 function transferETH() isOwner external { require(address(this).balance != 0); require(ethFundDeposit.send(address(this).balance)); } /// 将token分配到预处理地址。 function allocateToken (address _addr, uint256 _eth) isOwner external { require(_eth != 0); require(_addr != address(0x0)); uint256 tokens = safeMult(formatDecimals(_eth), tokenExchangeRate); require(tokens + tokenRaised <= currentSupply); tokenRaised = safeAdd(tokenRaised, tokens); balances[_addr] += tokens; emit AllocateToken(_addr, tokens); // 记录token日志 } /// 购买token function () public payable { require(isFunding); require(msg.value != 0); require(block.number >= fundingStartBlock); require(block.number <= fundingStopBlock); uint256 tokens = safeMult(msg.value, tokenExchangeRate); require(tokens + tokenRaised <= currentSupply); tokenRaised = safeAdd(tokenRaised, tokens); balances[msg.sender] += tokens; emit IssueToken(msg.sender, tokens); //记录日志 } }
migrate
function migrate() external { require(!isFunding); require(newContractAddr != address(0x0)); uint256 tokens = balances[msg.sender]; require(tokens != 0); balances[msg.sender] = 0; tokenMigrated = safeAdd(tokenMigrated, tokens); IMigrationContract newContract = IMigrationContract(newContractAddr); require(newContract.migrate(msg.sender, tokens)); emit Migrate(msg.sender, tokens); // log it }
///转移token到新的合约
NatSpecSingleLine
v0.4.24+commit.e67f0147
bzzr://0add7557bda029003db6e53f77302f4d7656f94684d48ebb5a4b44f0cdf56568
{ "func_code_index": [ 3705, 4211 ] }
9,930
KBToken
KBToken.sol
0x3d74549f0960abc42faaa1687fa1f24871acafb8
Solidity
KBToken
contract KBToken is StandardToken, SafeMath { // metadata string public constant name = "2K BLOCKCHAIN"; string public constant symbol = "2KB"; uint256 public constant decimals = 18; string public version = "1.0"; // contracts address public ethFundDeposit; // ETH存放地址 address public newContractAddr; // token更新地址 // crowdsale parameters bool public isFunding; // 状态切换到true uint256 public fundingStartBlock; uint256 public fundingStopBlock; uint256 public currentSupply; // 正在售卖中的tokens数量 uint256 public tokenRaised = 0; // 总的售卖数量token uint256 public tokenMigrated = 0; // 总的已经交易的 token uint256 public tokenExchangeRate = 1; // 代币兑换比例 N代币 兑换 1 ETH // events event AllocateToken(address indexed _to, uint256 _value); // 分配的私有交易token; event IssueToken(address indexed _to, uint256 _value); // 公开发行售卖的token; event IncreaseSupply(uint256 _value); event DecreaseSupply(uint256 _value); event Migrate(address indexed _to, uint256 _value); // 转换 function formatDecimals(uint256 _value) internal pure returns (uint256 ) { return _value * 10 ** decimals; } // constructor constructor( address _ethFundDeposit, uint256 _currentSupply) public { ethFundDeposit = _ethFundDeposit; isFunding = false; //通过控制预CrowdS ale状态 fundingStartBlock = 0; fundingStopBlock = 0; currentSupply = formatDecimals(_currentSupply); totalSupply = formatDecimals(1000000000); balances[msg.sender] = totalSupply; require(currentSupply <= totalSupply); } modifier isOwner() { require(msg.sender == ethFundDeposit); _; } /// 设置token汇率 function setTokenExchangeRate(uint256 _tokenExchangeRate) isOwner external { require(_tokenExchangeRate != 0); require(_tokenExchangeRate != tokenExchangeRate); tokenExchangeRate = _tokenExchangeRate; } /// @dev 超发token处理 function increaseSupply (uint256 _value) isOwner external { uint256 value = formatDecimals(_value); require(value + currentSupply <= totalSupply); currentSupply = safeAdd(currentSupply, value); emit IncreaseSupply(value); } /// @dev 被盗token处理 function decreaseSupply (uint256 _value) isOwner external { uint256 value = formatDecimals(_value); require(value + tokenRaised <= currentSupply); currentSupply = safeSubtract(currentSupply, value); emit DecreaseSupply(value); } /// 启动区块检测 异常的处理 function startFunding (uint256 _fundingStartBlock, uint256 _fundingStopBlock) isOwner external { require(!isFunding); require(_fundingStartBlock < _fundingStopBlock); require(block.number < _fundingStartBlock); fundingStartBlock = _fundingStartBlock; fundingStopBlock = _fundingStopBlock; isFunding = true; } /// 关闭区块异常处理 function stopFunding() isOwner external { require(isFunding); isFunding = false; } /// 开发了一个新的合同来接收token(或者更新token) function setMigrateContract(address _newContractAddr) isOwner external { require(_newContractAddr != newContractAddr); newContractAddr = _newContractAddr; } /// 设置新的所有者地址 function changeOwner(address _newFundDeposit) isOwner() external { require(_newFundDeposit != address(0x0)); ethFundDeposit = _newFundDeposit; } ///转移token到新的合约 function migrate() external { require(!isFunding); require(newContractAddr != address(0x0)); uint256 tokens = balances[msg.sender]; require(tokens != 0); balances[msg.sender] = 0; tokenMigrated = safeAdd(tokenMigrated, tokens); IMigrationContract newContract = IMigrationContract(newContractAddr); require(newContract.migrate(msg.sender, tokens)); emit Migrate(msg.sender, tokens); // log it } /// 转账ETH 到团队 function transferETH() isOwner external { require(address(this).balance != 0); require(ethFundDeposit.send(address(this).balance)); } /// 将token分配到预处理地址。 function allocateToken (address _addr, uint256 _eth) isOwner external { require(_eth != 0); require(_addr != address(0x0)); uint256 tokens = safeMult(formatDecimals(_eth), tokenExchangeRate); require(tokens + tokenRaised <= currentSupply); tokenRaised = safeAdd(tokenRaised, tokens); balances[_addr] += tokens; emit AllocateToken(_addr, tokens); // 记录token日志 } /// 购买token function () public payable { require(isFunding); require(msg.value != 0); require(block.number >= fundingStartBlock); require(block.number <= fundingStopBlock); uint256 tokens = safeMult(msg.value, tokenExchangeRate); require(tokens + tokenRaised <= currentSupply); tokenRaised = safeAdd(tokenRaised, tokens); balances[msg.sender] += tokens; emit IssueToken(msg.sender, tokens); //记录日志 } }
transferETH
function transferETH() isOwner external { require(address(this).balance != 0); require(ethFundDeposit.send(address(this).balance)); }
/// 转账ETH 到团队
NatSpecSingleLine
v0.4.24+commit.e67f0147
bzzr://0add7557bda029003db6e53f77302f4d7656f94684d48ebb5a4b44f0cdf56568
{ "func_code_index": [ 4233, 4394 ] }
9,931
KBToken
KBToken.sol
0x3d74549f0960abc42faaa1687fa1f24871acafb8
Solidity
KBToken
contract KBToken is StandardToken, SafeMath { // metadata string public constant name = "2K BLOCKCHAIN"; string public constant symbol = "2KB"; uint256 public constant decimals = 18; string public version = "1.0"; // contracts address public ethFundDeposit; // ETH存放地址 address public newContractAddr; // token更新地址 // crowdsale parameters bool public isFunding; // 状态切换到true uint256 public fundingStartBlock; uint256 public fundingStopBlock; uint256 public currentSupply; // 正在售卖中的tokens数量 uint256 public tokenRaised = 0; // 总的售卖数量token uint256 public tokenMigrated = 0; // 总的已经交易的 token uint256 public tokenExchangeRate = 1; // 代币兑换比例 N代币 兑换 1 ETH // events event AllocateToken(address indexed _to, uint256 _value); // 分配的私有交易token; event IssueToken(address indexed _to, uint256 _value); // 公开发行售卖的token; event IncreaseSupply(uint256 _value); event DecreaseSupply(uint256 _value); event Migrate(address indexed _to, uint256 _value); // 转换 function formatDecimals(uint256 _value) internal pure returns (uint256 ) { return _value * 10 ** decimals; } // constructor constructor( address _ethFundDeposit, uint256 _currentSupply) public { ethFundDeposit = _ethFundDeposit; isFunding = false; //通过控制预CrowdS ale状态 fundingStartBlock = 0; fundingStopBlock = 0; currentSupply = formatDecimals(_currentSupply); totalSupply = formatDecimals(1000000000); balances[msg.sender] = totalSupply; require(currentSupply <= totalSupply); } modifier isOwner() { require(msg.sender == ethFundDeposit); _; } /// 设置token汇率 function setTokenExchangeRate(uint256 _tokenExchangeRate) isOwner external { require(_tokenExchangeRate != 0); require(_tokenExchangeRate != tokenExchangeRate); tokenExchangeRate = _tokenExchangeRate; } /// @dev 超发token处理 function increaseSupply (uint256 _value) isOwner external { uint256 value = formatDecimals(_value); require(value + currentSupply <= totalSupply); currentSupply = safeAdd(currentSupply, value); emit IncreaseSupply(value); } /// @dev 被盗token处理 function decreaseSupply (uint256 _value) isOwner external { uint256 value = formatDecimals(_value); require(value + tokenRaised <= currentSupply); currentSupply = safeSubtract(currentSupply, value); emit DecreaseSupply(value); } /// 启动区块检测 异常的处理 function startFunding (uint256 _fundingStartBlock, uint256 _fundingStopBlock) isOwner external { require(!isFunding); require(_fundingStartBlock < _fundingStopBlock); require(block.number < _fundingStartBlock); fundingStartBlock = _fundingStartBlock; fundingStopBlock = _fundingStopBlock; isFunding = true; } /// 关闭区块异常处理 function stopFunding() isOwner external { require(isFunding); isFunding = false; } /// 开发了一个新的合同来接收token(或者更新token) function setMigrateContract(address _newContractAddr) isOwner external { require(_newContractAddr != newContractAddr); newContractAddr = _newContractAddr; } /// 设置新的所有者地址 function changeOwner(address _newFundDeposit) isOwner() external { require(_newFundDeposit != address(0x0)); ethFundDeposit = _newFundDeposit; } ///转移token到新的合约 function migrate() external { require(!isFunding); require(newContractAddr != address(0x0)); uint256 tokens = balances[msg.sender]; require(tokens != 0); balances[msg.sender] = 0; tokenMigrated = safeAdd(tokenMigrated, tokens); IMigrationContract newContract = IMigrationContract(newContractAddr); require(newContract.migrate(msg.sender, tokens)); emit Migrate(msg.sender, tokens); // log it } /// 转账ETH 到团队 function transferETH() isOwner external { require(address(this).balance != 0); require(ethFundDeposit.send(address(this).balance)); } /// 将token分配到预处理地址。 function allocateToken (address _addr, uint256 _eth) isOwner external { require(_eth != 0); require(_addr != address(0x0)); uint256 tokens = safeMult(formatDecimals(_eth), tokenExchangeRate); require(tokens + tokenRaised <= currentSupply); tokenRaised = safeAdd(tokenRaised, tokens); balances[_addr] += tokens; emit AllocateToken(_addr, tokens); // 记录token日志 } /// 购买token function () public payable { require(isFunding); require(msg.value != 0); require(block.number >= fundingStartBlock); require(block.number <= fundingStopBlock); uint256 tokens = safeMult(msg.value, tokenExchangeRate); require(tokens + tokenRaised <= currentSupply); tokenRaised = safeAdd(tokenRaised, tokens); balances[msg.sender] += tokens; emit IssueToken(msg.sender, tokens); //记录日志 } }
allocateToken
function allocateToken (address _addr, uint256 _eth) isOwner external { require(_eth != 0); require(_addr != address(0x0)); uint256 tokens = safeMult(formatDecimals(_eth), tokenExchangeRate); require(tokens + tokenRaised <= currentSupply); tokenRaised = safeAdd(tokenRaised, tokens); balances[_addr] += tokens; emit AllocateToken(_addr, tokens); // 记录token日志 }
/// 将token分配到预处理地址。
NatSpecSingleLine
v0.4.24+commit.e67f0147
bzzr://0add7557bda029003db6e53f77302f4d7656f94684d48ebb5a4b44f0cdf56568
{ "func_code_index": [ 4423, 4863 ] }
9,932
KBToken
KBToken.sol
0x3d74549f0960abc42faaa1687fa1f24871acafb8
Solidity
KBToken
contract KBToken is StandardToken, SafeMath { // metadata string public constant name = "2K BLOCKCHAIN"; string public constant symbol = "2KB"; uint256 public constant decimals = 18; string public version = "1.0"; // contracts address public ethFundDeposit; // ETH存放地址 address public newContractAddr; // token更新地址 // crowdsale parameters bool public isFunding; // 状态切换到true uint256 public fundingStartBlock; uint256 public fundingStopBlock; uint256 public currentSupply; // 正在售卖中的tokens数量 uint256 public tokenRaised = 0; // 总的售卖数量token uint256 public tokenMigrated = 0; // 总的已经交易的 token uint256 public tokenExchangeRate = 1; // 代币兑换比例 N代币 兑换 1 ETH // events event AllocateToken(address indexed _to, uint256 _value); // 分配的私有交易token; event IssueToken(address indexed _to, uint256 _value); // 公开发行售卖的token; event IncreaseSupply(uint256 _value); event DecreaseSupply(uint256 _value); event Migrate(address indexed _to, uint256 _value); // 转换 function formatDecimals(uint256 _value) internal pure returns (uint256 ) { return _value * 10 ** decimals; } // constructor constructor( address _ethFundDeposit, uint256 _currentSupply) public { ethFundDeposit = _ethFundDeposit; isFunding = false; //通过控制预CrowdS ale状态 fundingStartBlock = 0; fundingStopBlock = 0; currentSupply = formatDecimals(_currentSupply); totalSupply = formatDecimals(1000000000); balances[msg.sender] = totalSupply; require(currentSupply <= totalSupply); } modifier isOwner() { require(msg.sender == ethFundDeposit); _; } /// 设置token汇率 function setTokenExchangeRate(uint256 _tokenExchangeRate) isOwner external { require(_tokenExchangeRate != 0); require(_tokenExchangeRate != tokenExchangeRate); tokenExchangeRate = _tokenExchangeRate; } /// @dev 超发token处理 function increaseSupply (uint256 _value) isOwner external { uint256 value = formatDecimals(_value); require(value + currentSupply <= totalSupply); currentSupply = safeAdd(currentSupply, value); emit IncreaseSupply(value); } /// @dev 被盗token处理 function decreaseSupply (uint256 _value) isOwner external { uint256 value = formatDecimals(_value); require(value + tokenRaised <= currentSupply); currentSupply = safeSubtract(currentSupply, value); emit DecreaseSupply(value); } /// 启动区块检测 异常的处理 function startFunding (uint256 _fundingStartBlock, uint256 _fundingStopBlock) isOwner external { require(!isFunding); require(_fundingStartBlock < _fundingStopBlock); require(block.number < _fundingStartBlock); fundingStartBlock = _fundingStartBlock; fundingStopBlock = _fundingStopBlock; isFunding = true; } /// 关闭区块异常处理 function stopFunding() isOwner external { require(isFunding); isFunding = false; } /// 开发了一个新的合同来接收token(或者更新token) function setMigrateContract(address _newContractAddr) isOwner external { require(_newContractAddr != newContractAddr); newContractAddr = _newContractAddr; } /// 设置新的所有者地址 function changeOwner(address _newFundDeposit) isOwner() external { require(_newFundDeposit != address(0x0)); ethFundDeposit = _newFundDeposit; } ///转移token到新的合约 function migrate() external { require(!isFunding); require(newContractAddr != address(0x0)); uint256 tokens = balances[msg.sender]; require(tokens != 0); balances[msg.sender] = 0; tokenMigrated = safeAdd(tokenMigrated, tokens); IMigrationContract newContract = IMigrationContract(newContractAddr); require(newContract.migrate(msg.sender, tokens)); emit Migrate(msg.sender, tokens); // log it } /// 转账ETH 到团队 function transferETH() isOwner external { require(address(this).balance != 0); require(ethFundDeposit.send(address(this).balance)); } /// 将token分配到预处理地址。 function allocateToken (address _addr, uint256 _eth) isOwner external { require(_eth != 0); require(_addr != address(0x0)); uint256 tokens = safeMult(formatDecimals(_eth), tokenExchangeRate); require(tokens + tokenRaised <= currentSupply); tokenRaised = safeAdd(tokenRaised, tokens); balances[_addr] += tokens; emit AllocateToken(_addr, tokens); // 记录token日志 } /// 购买token function () public payable { require(isFunding); require(msg.value != 0); require(block.number >= fundingStartBlock); require(block.number <= fundingStopBlock); uint256 tokens = safeMult(msg.value, tokenExchangeRate); require(tokens + tokenRaised <= currentSupply); tokenRaised = safeAdd(tokenRaised, tokens); balances[msg.sender] += tokens; emit IssueToken(msg.sender, tokens); //记录日志 } }
function () public payable { require(isFunding); require(msg.value != 0); require(block.number >= fundingStartBlock); require(block.number <= fundingStopBlock); uint256 tokens = safeMult(msg.value, tokenExchangeRate); require(tokens + tokenRaised <= currentSupply); tokenRaised = safeAdd(tokenRaised, tokens); balances[msg.sender] += tokens; emit IssueToken(msg.sender, tokens); //记录日志 }
/// 购买token
NatSpecSingleLine
v0.4.24+commit.e67f0147
bzzr://0add7557bda029003db6e53f77302f4d7656f94684d48ebb5a4b44f0cdf56568
{ "func_code_index": [ 4883, 5370 ] }
9,933
BBX
BBX.sol
0x421a0ee46dbfee7f65076c7e0c32fa86918bf62d
Solidity
BBX
contract BBX { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; // 18 decimals is the strongly suggested default, avoid changing it uint256 public totalSupply; // This creates an array with all balances mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients event Transfer(address indexed from, address indexed to, uint256 value); // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); /** * Constructor function * * Initializes contract with initial supply tokens to the creator of the contract */ function BBX( uint256 initialSupply, string tokenName, string tokenSymbol ) public { totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != 0x0); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value > balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public { _transfer(msg.sender, _to, _value); } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply Burn(_from, _value); return true; } }
BBX
function BBX( uint256 initialSupply, string tokenName, string tokenSymbol ) public { totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes }
/** * Constructor function * * Initializes contract with initial supply tokens to the creator of the contract */
NatSpecMultiLine
v0.4.16+commit.d7661dd9
None
bzzr://14ee66b310f3ca70b61c06f38688ec1708d8e919f4d04ee56bc19c4b9800ce1e
{ "func_code_index": [ 834, 1372 ] }
9,934
BBX
BBX.sol
0x421a0ee46dbfee7f65076c7e0c32fa86918bf62d
Solidity
BBX
contract BBX { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; // 18 decimals is the strongly suggested default, avoid changing it uint256 public totalSupply; // This creates an array with all balances mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients event Transfer(address indexed from, address indexed to, uint256 value); // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); /** * Constructor function * * Initializes contract with initial supply tokens to the creator of the contract */ function BBX( uint256 initialSupply, string tokenName, string tokenSymbol ) public { totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != 0x0); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value > balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public { _transfer(msg.sender, _to, _value); } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply Burn(_from, _value); return true; } }
_transfer
function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != 0x0); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value > balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); }
/** * Internal transfer, only can be called by this contract */
NatSpecMultiLine
v0.4.16+commit.d7661dd9
None
bzzr://14ee66b310f3ca70b61c06f38688ec1708d8e919f4d04ee56bc19c4b9800ce1e
{ "func_code_index": [ 1456, 2298 ] }
9,935
BBX
BBX.sol
0x421a0ee46dbfee7f65076c7e0c32fa86918bf62d
Solidity
BBX
contract BBX { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; // 18 decimals is the strongly suggested default, avoid changing it uint256 public totalSupply; // This creates an array with all balances mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients event Transfer(address indexed from, address indexed to, uint256 value); // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); /** * Constructor function * * Initializes contract with initial supply tokens to the creator of the contract */ function BBX( uint256 initialSupply, string tokenName, string tokenSymbol ) public { totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != 0x0); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value > balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public { _transfer(msg.sender, _to, _value); } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply Burn(_from, _value); return true; } }
transfer
function transfer(address _to, uint256 _value) public { _transfer(msg.sender, _to, _value); }
/** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */
NatSpecMultiLine
v0.4.16+commit.d7661dd9
None
bzzr://14ee66b310f3ca70b61c06f38688ec1708d8e919f4d04ee56bc19c4b9800ce1e
{ "func_code_index": [ 2504, 2616 ] }
9,936
BBX
BBX.sol
0x421a0ee46dbfee7f65076c7e0c32fa86918bf62d
Solidity
BBX
contract BBX { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; // 18 decimals is the strongly suggested default, avoid changing it uint256 public totalSupply; // This creates an array with all balances mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients event Transfer(address indexed from, address indexed to, uint256 value); // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); /** * Constructor function * * Initializes contract with initial supply tokens to the creator of the contract */ function BBX( uint256 initialSupply, string tokenName, string tokenSymbol ) public { totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != 0x0); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value > balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public { _transfer(msg.sender, _to, _value); } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply Burn(_from, _value); return true; } }
transferFrom
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; }
/** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */
NatSpecMultiLine
v0.4.16+commit.d7661dd9
None
bzzr://14ee66b310f3ca70b61c06f38688ec1708d8e919f4d04ee56bc19c4b9800ce1e
{ "func_code_index": [ 2891, 3192 ] }
9,937
BBX
BBX.sol
0x421a0ee46dbfee7f65076c7e0c32fa86918bf62d
Solidity
BBX
contract BBX { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; // 18 decimals is the strongly suggested default, avoid changing it uint256 public totalSupply; // This creates an array with all balances mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients event Transfer(address indexed from, address indexed to, uint256 value); // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); /** * Constructor function * * Initializes contract with initial supply tokens to the creator of the contract */ function BBX( uint256 initialSupply, string tokenName, string tokenSymbol ) public { totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != 0x0); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value > balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public { _transfer(msg.sender, _to, _value); } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply Burn(_from, _value); return true; } }
approve
function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; return true; }
/** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */
NatSpecMultiLine
v0.4.16+commit.d7661dd9
None
bzzr://14ee66b310f3ca70b61c06f38688ec1708d8e919f4d04ee56bc19c4b9800ce1e
{ "func_code_index": [ 3456, 3632 ] }
9,938
BBX
BBX.sol
0x421a0ee46dbfee7f65076c7e0c32fa86918bf62d
Solidity
BBX
contract BBX { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; // 18 decimals is the strongly suggested default, avoid changing it uint256 public totalSupply; // This creates an array with all balances mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients event Transfer(address indexed from, address indexed to, uint256 value); // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); /** * Constructor function * * Initializes contract with initial supply tokens to the creator of the contract */ function BBX( uint256 initialSupply, string tokenName, string tokenSymbol ) public { totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != 0x0); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value > balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public { _transfer(msg.sender, _to, _value); } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply Burn(_from, _value); return true; } }
approveAndCall
function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } }
/** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */
NatSpecMultiLine
v0.4.16+commit.d7661dd9
None
bzzr://14ee66b310f3ca70b61c06f38688ec1708d8e919f4d04ee56bc19c4b9800ce1e
{ "func_code_index": [ 4026, 4378 ] }
9,939
BBX
BBX.sol
0x421a0ee46dbfee7f65076c7e0c32fa86918bf62d
Solidity
BBX
contract BBX { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; // 18 decimals is the strongly suggested default, avoid changing it uint256 public totalSupply; // This creates an array with all balances mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients event Transfer(address indexed from, address indexed to, uint256 value); // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); /** * Constructor function * * Initializes contract with initial supply tokens to the creator of the contract */ function BBX( uint256 initialSupply, string tokenName, string tokenSymbol ) public { totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != 0x0); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value > balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public { _transfer(msg.sender, _to, _value); } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply Burn(_from, _value); return true; } }
burn
function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; }
/** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */
NatSpecMultiLine
v0.4.16+commit.d7661dd9
None
bzzr://14ee66b310f3ca70b61c06f38688ec1708d8e919f4d04ee56bc19c4b9800ce1e
{ "func_code_index": [ 4548, 4922 ] }
9,940
BBX
BBX.sol
0x421a0ee46dbfee7f65076c7e0c32fa86918bf62d
Solidity
BBX
contract BBX { // Public variables of the token string public name; string public symbol; uint8 public decimals = 18; // 18 decimals is the strongly suggested default, avoid changing it uint256 public totalSupply; // This creates an array with all balances mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients event Transfer(address indexed from, address indexed to, uint256 value); // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); /** * Constructor function * * Initializes contract with initial supply tokens to the creator of the contract */ function BBX( uint256 initialSupply, string tokenName, string tokenSymbol ) public { totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != 0x0); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value > balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public { _transfer(msg.sender, _to, _value); } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply Burn(_from, _value); return true; } }
burnFrom
function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply Burn(_from, _value); return true; }
/** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */
NatSpecMultiLine
v0.4.16+commit.d7661dd9
None
bzzr://14ee66b310f3ca70b61c06f38688ec1708d8e919f4d04ee56bc19c4b9800ce1e
{ "func_code_index": [ 5180, 5791 ] }
9,941
VinToken
VinToken.sol
0xff6f22397ced567c4bf0adaa6fd4d81c87299331
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; } }
/** * @title SafeMath * @dev Math operations with safety checks that throw on error */
NatSpecMultiLine
mul
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; }
/** * @dev Multiplies two numbers, throws on overflow. */
NatSpecMultiLine
v0.4.21+commit.dfe3193c
bzzr://647be87715d9dbf43b1b7118cee9df622382cc07d5919a810f811f080e19ae8f
{ "func_code_index": [ 95, 302 ] }
9,942
VinToken
VinToken.sol
0xff6f22397ced567c4bf0adaa6fd4d81c87299331
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; } }
/** * @title SafeMath * @dev Math operations with safety checks that throw on error */
NatSpecMultiLine
div
function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; }
/** * @dev Integer division of two numbers, truncating the quotient. */
NatSpecMultiLine
v0.4.21+commit.dfe3193c
bzzr://647be87715d9dbf43b1b7118cee9df622382cc07d5919a810f811f080e19ae8f
{ "func_code_index": [ 392, 692 ] }
9,943
VinToken
VinToken.sol
0xff6f22397ced567c4bf0adaa6fd4d81c87299331
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; } }
/** * @title SafeMath * @dev Math operations with safety checks that throw on error */
NatSpecMultiLine
sub
function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; }
/** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */
NatSpecMultiLine
v0.4.21+commit.dfe3193c
bzzr://647be87715d9dbf43b1b7118cee9df622382cc07d5919a810f811f080e19ae8f
{ "func_code_index": [ 812, 940 ] }
9,944
VinToken
VinToken.sol
0xff6f22397ced567c4bf0adaa6fd4d81c87299331
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; } }
/** * @title SafeMath * @dev Math operations with safety checks that throw on error */
NatSpecMultiLine
add
function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; }
/** * @dev Adds two numbers, throws on overflow. */
NatSpecMultiLine
v0.4.21+commit.dfe3193c
bzzr://647be87715d9dbf43b1b7118cee9df622382cc07d5919a810f811f080e19ae8f
{ "func_code_index": [ 1010, 1156 ] }
9,945
MenloTokenSale
MenloTokenSale.sol
0x1c9a4895ca840b25e83c472d5aa7e59f22a027fe
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (_a == 0) { return 0; } c = _a * _b; assert(c / _a == _b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 _a, uint256 _b) internal pure returns (uint256) { // assert(_b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = _a / _b; // assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold return _a / _b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 _a, uint256 _b) internal pure returns (uint256) { assert(_b <= _a); return _a - _b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) { c = _a + _b; assert(c >= _a); return c; } }
mul
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (_a == 0) { return 0; } c = _a * _b; assert(c / _a == _b); return c; }
/** * @dev Multiplies two numbers, throws on overflow. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://6227e3dd53f44d457ce57232ba52d472334fd2a58e36680bc74401c4c15591b0
{ "func_code_index": [ 89, 483 ] }
9,946
MenloTokenSale
MenloTokenSale.sol
0x1c9a4895ca840b25e83c472d5aa7e59f22a027fe
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (_a == 0) { return 0; } c = _a * _b; assert(c / _a == _b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 _a, uint256 _b) internal pure returns (uint256) { // assert(_b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = _a / _b; // assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold return _a / _b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 _a, uint256 _b) internal pure returns (uint256) { assert(_b <= _a); return _a - _b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) { c = _a + _b; assert(c >= _a); return c; } }
div
function div(uint256 _a, uint256 _b) internal pure returns (uint256) { // assert(_b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = _a / _b; // assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold return _a / _b; }
/** * @dev Integer division of two numbers, truncating the quotient. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://6227e3dd53f44d457ce57232ba52d472334fd2a58e36680bc74401c4c15591b0
{ "func_code_index": [ 567, 858 ] }
9,947
MenloTokenSale
MenloTokenSale.sol
0x1c9a4895ca840b25e83c472d5aa7e59f22a027fe
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (_a == 0) { return 0; } c = _a * _b; assert(c / _a == _b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 _a, uint256 _b) internal pure returns (uint256) { // assert(_b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = _a / _b; // assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold return _a / _b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 _a, uint256 _b) internal pure returns (uint256) { assert(_b <= _a); return _a - _b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) { c = _a + _b; assert(c >= _a); return c; } }
sub
function sub(uint256 _a, uint256 _b) internal pure returns (uint256) { assert(_b <= _a); return _a - _b; }
/** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://6227e3dd53f44d457ce57232ba52d472334fd2a58e36680bc74401c4c15591b0
{ "func_code_index": [ 972, 1094 ] }
9,948
MenloTokenSale
MenloTokenSale.sol
0x1c9a4895ca840b25e83c472d5aa7e59f22a027fe
Solidity
SafeMath
library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (_a == 0) { return 0; } c = _a * _b; assert(c / _a == _b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 _a, uint256 _b) internal pure returns (uint256) { // assert(_b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = _a / _b; // assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold return _a / _b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 _a, uint256 _b) internal pure returns (uint256) { assert(_b <= _a); return _a - _b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) { c = _a + _b; assert(c >= _a); return c; } }
add
function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) { c = _a + _b; assert(c >= _a); return c; }
/** * @dev Adds two numbers, throws on overflow. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://6227e3dd53f44d457ce57232ba52d472334fd2a58e36680bc74401c4c15591b0
{ "func_code_index": [ 1158, 1293 ] }
9,949
MenloTokenSale
MenloTokenSale.sol
0x1c9a4895ca840b25e83c472d5aa7e59f22a027fe
Solidity
Ownable
contract Ownable { address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to relinquish control of the contract. * @notice Renouncing to ownership will leave the contract without an owner. * It will not be possible to call the functions with the `onlyOwner` * modifier anymore. */ function renounceOwnership() public onlyOwner { emit OwnershipRenounced(owner); owner = address(0); } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferOwnership(address _newOwner) public onlyOwner { _transferOwnership(_newOwner); } /** * @dev Transfers control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0)); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; } }
renounceOwnership
function renounceOwnership() public onlyOwner { emit OwnershipRenounced(owner); owner = address(0); }
/** * @dev Allows the current owner to relinquish control of the contract. * @notice Renouncing to ownership will leave the contract without an owner. * It will not be possible to call the functions with the `onlyOwner` * modifier anymore. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://6227e3dd53f44d457ce57232ba52d472334fd2a58e36680bc74401c4c15591b0
{ "func_code_index": [ 815, 932 ] }
9,950
MenloTokenSale
MenloTokenSale.sol
0x1c9a4895ca840b25e83c472d5aa7e59f22a027fe
Solidity
Ownable
contract Ownable { address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to relinquish control of the contract. * @notice Renouncing to ownership will leave the contract without an owner. * It will not be possible to call the functions with the `onlyOwner` * modifier anymore. */ function renounceOwnership() public onlyOwner { emit OwnershipRenounced(owner); owner = address(0); } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferOwnership(address _newOwner) public onlyOwner { _transferOwnership(_newOwner); } /** * @dev Transfers control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0)); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; } }
transferOwnership
function transferOwnership(address _newOwner) public onlyOwner { _transferOwnership(_newOwner); }
/** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://6227e3dd53f44d457ce57232ba52d472334fd2a58e36680bc74401c4c15591b0
{ "func_code_index": [ 1097, 1205 ] }
9,951
MenloTokenSale
MenloTokenSale.sol
0x1c9a4895ca840b25e83c472d5aa7e59f22a027fe
Solidity
Ownable
contract Ownable { address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to relinquish control of the contract. * @notice Renouncing to ownership will leave the contract without an owner. * It will not be possible to call the functions with the `onlyOwner` * modifier anymore. */ function renounceOwnership() public onlyOwner { emit OwnershipRenounced(owner); owner = address(0); } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferOwnership(address _newOwner) public onlyOwner { _transferOwnership(_newOwner); } /** * @dev Transfers control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0)); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; } }
_transferOwnership
function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0)); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; }
/** * @dev Transfers control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://6227e3dd53f44d457ce57232ba52d472334fd2a58e36680bc74401c4c15591b0
{ "func_code_index": [ 1343, 1521 ] }
9,952
MenloTokenSale
MenloTokenSale.sol
0x1c9a4895ca840b25e83c472d5aa7e59f22a027fe
Solidity
Pausable
contract Pausable is Ownable { event Pause(); event Unpause(); bool public paused = false; /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { require(!paused); _; } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { require(paused); _; } /** * @dev called by the owner to pause, triggers stopped state */ function pause() public onlyOwner whenNotPaused { paused = true; emit Pause(); } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() public onlyOwner whenPaused { paused = false; emit Unpause(); } }
pause
function pause() public onlyOwner whenNotPaused { paused = true; emit Pause(); }
/** * @dev called by the owner to pause, triggers stopped state */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://6227e3dd53f44d457ce57232ba52d472334fd2a58e36680bc74401c4c15591b0
{ "func_code_index": [ 513, 609 ] }
9,953
MenloTokenSale
MenloTokenSale.sol
0x1c9a4895ca840b25e83c472d5aa7e59f22a027fe
Solidity
Pausable
contract Pausable is Ownable { event Pause(); event Unpause(); bool public paused = false; /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { require(!paused); _; } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { require(paused); _; } /** * @dev called by the owner to pause, triggers stopped state */ function pause() public onlyOwner whenNotPaused { paused = true; emit Pause(); } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() public onlyOwner whenPaused { paused = false; emit Unpause(); } }
unpause
function unpause() public onlyOwner whenPaused { paused = false; emit Unpause(); }
/** * @dev called by the owner to unpause, returns to normal state */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://6227e3dd53f44d457ce57232ba52d472334fd2a58e36680bc74401c4c15591b0
{ "func_code_index": [ 693, 791 ] }
9,954
MenloTokenSale
MenloTokenSale.sol
0x1c9a4895ca840b25e83c472d5aa7e59f22a027fe
Solidity
CanReclaimToken
contract CanReclaimToken is Ownable { using SafeERC20 for ERC20Basic; /** * @dev Reclaim all ERC20Basic compatible tokens * @param _token ERC20Basic The address of the token contract */ function reclaimToken(ERC20Basic _token) external onlyOwner { uint256 balance = _token.balanceOf(this); _token.safeTransfer(owner, balance); } }
reclaimToken
function reclaimToken(ERC20Basic _token) external onlyOwner { uint256 balance = _token.balanceOf(this); _token.safeTransfer(owner, balance); }
/** * @dev Reclaim all ERC20Basic compatible tokens * @param _token ERC20Basic The address of the token contract */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://6227e3dd53f44d457ce57232ba52d472334fd2a58e36680bc74401c4c15591b0
{ "func_code_index": [ 207, 365 ] }
9,955
MenloTokenSale
MenloTokenSale.sol
0x1c9a4895ca840b25e83c472d5aa7e59f22a027fe
Solidity
BasicToken
contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) internal balances; uint256 internal totalSupply_; /** * @dev Total number of tokens in existence */ function totalSupply() public view returns (uint256) { return totalSupply_; } /** * @dev Transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_value <= balances[msg.sender]); require(_to != address(0)); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256) { return balances[_owner]; } }
totalSupply
function totalSupply() public view returns (uint256) { return totalSupply_; }
/** * @dev Total number of tokens in existence */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://6227e3dd53f44d457ce57232ba52d472334fd2a58e36680bc74401c4c15591b0
{ "func_code_index": [ 217, 305 ] }
9,956
MenloTokenSale
MenloTokenSale.sol
0x1c9a4895ca840b25e83c472d5aa7e59f22a027fe
Solidity
BasicToken
contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) internal balances; uint256 internal totalSupply_; /** * @dev Total number of tokens in existence */ function totalSupply() public view returns (uint256) { return totalSupply_; } /** * @dev Transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_value <= balances[msg.sender]); require(_to != address(0)); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256) { return balances[_owner]; } }
transfer
function transfer(address _to, uint256 _value) public returns (bool) { require(_value <= balances[msg.sender]); require(_to != address(0)); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; }
/** * @dev Transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://6227e3dd53f44d457ce57232ba52d472334fd2a58e36680bc74401c4c15591b0
{ "func_code_index": [ 463, 795 ] }
9,957
MenloTokenSale
MenloTokenSale.sol
0x1c9a4895ca840b25e83c472d5aa7e59f22a027fe
Solidity
BasicToken
contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) internal balances; uint256 internal totalSupply_; /** * @dev Total number of tokens in existence */ function totalSupply() public view returns (uint256) { return totalSupply_; } /** * @dev Transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_value <= balances[msg.sender]); require(_to != address(0)); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256) { return balances[_owner]; } }
balanceOf
function balanceOf(address _owner) public view returns (uint256) { return balances[_owner]; }
/** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://6227e3dd53f44d457ce57232ba52d472334fd2a58e36680bc74401c4c15591b0
{ "func_code_index": [ 1001, 1105 ] }
9,958
MenloTokenSale
MenloTokenSale.sol
0x1c9a4895ca840b25e83c472d5aa7e59f22a027fe
Solidity
BurnableToken
contract BurnableToken is BasicToken { event Burn(address indexed burner, uint256 value); /** * @dev Burns a specific amount of tokens. * @param _value The amount of token to be burned. */ function burn(uint256 _value) public { _burn(msg.sender, _value); } function _burn(address _who, uint256 _value) internal { require(_value <= balances[_who]); // no need to require value <= totalSupply, since that would imply the // sender's balance is greater than the totalSupply, which *should* be an assertion failure balances[_who] = balances[_who].sub(_value); totalSupply_ = totalSupply_.sub(_value); emit Burn(_who, _value); emit Transfer(_who, address(0), _value); } }
burn
function burn(uint256 _value) public { _burn(msg.sender, _value); }
/** * @dev Burns a specific amount of tokens. * @param _value The amount of token to be burned. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://6227e3dd53f44d457ce57232ba52d472334fd2a58e36680bc74401c4c15591b0
{ "func_code_index": [ 212, 290 ] }
9,959
MenloTokenSale
MenloTokenSale.sol
0x1c9a4895ca840b25e83c472d5aa7e59f22a027fe
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); require(_to != address(0)); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance( address _owner, address _spender ) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval( address _spender, uint256 _addedValue ) public returns (bool) { allowed[msg.sender][_spender] = ( allowed[msg.sender][_spender].add(_addedValue)); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval( address _spender, uint256 _subtractedValue ) public returns (bool) { uint256 oldValue = allowed[msg.sender][_spender]; if (_subtractedValue >= oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } }
transferFrom
function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); require(_to != address(0)); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; }
/** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://6227e3dd53f44d457ce57232ba52d472334fd2a58e36680bc74401c4c15591b0
{ "func_code_index": [ 401, 891 ] }
9,960
MenloTokenSale
MenloTokenSale.sol
0x1c9a4895ca840b25e83c472d5aa7e59f22a027fe
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); require(_to != address(0)); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance( address _owner, address _spender ) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval( address _spender, uint256 _addedValue ) public returns (bool) { allowed[msg.sender][_spender] = ( allowed[msg.sender][_spender].add(_addedValue)); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval( address _spender, uint256 _subtractedValue ) public returns (bool) { uint256 oldValue = allowed[msg.sender][_spender]; if (_subtractedValue >= oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } }
approve
function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; }
/** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://6227e3dd53f44d457ce57232ba52d472334fd2a58e36680bc74401c4c15591b0
{ "func_code_index": [ 1517, 1712 ] }
9,961
MenloTokenSale
MenloTokenSale.sol
0x1c9a4895ca840b25e83c472d5aa7e59f22a027fe
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); require(_to != address(0)); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance( address _owner, address _spender ) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval( address _spender, uint256 _addedValue ) public returns (bool) { allowed[msg.sender][_spender] = ( allowed[msg.sender][_spender].add(_addedValue)); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval( address _spender, uint256 _subtractedValue ) public returns (bool) { uint256 oldValue = allowed[msg.sender][_spender]; if (_subtractedValue >= oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } }
allowance
function allowance( address _owner, address _spender ) public view returns (uint256) { return allowed[_owner][_spender]; }
/** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://6227e3dd53f44d457ce57232ba52d472334fd2a58e36680bc74401c4c15591b0
{ "func_code_index": [ 2036, 2201 ] }
9,962
MenloTokenSale
MenloTokenSale.sol
0x1c9a4895ca840b25e83c472d5aa7e59f22a027fe
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); require(_to != address(0)); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance( address _owner, address _spender ) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval( address _spender, uint256 _addedValue ) public returns (bool) { allowed[msg.sender][_spender] = ( allowed[msg.sender][_spender].add(_addedValue)); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval( address _spender, uint256 _subtractedValue ) public returns (bool) { uint256 oldValue = allowed[msg.sender][_spender]; if (_subtractedValue >= oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } }
increaseApproval
function increaseApproval( address _spender, uint256 _addedValue ) public returns (bool) { allowed[msg.sender][_spender] = ( allowed[msg.sender][_spender].add(_addedValue)); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; }
/** * @dev Increase the amount of tokens that an owner allowed to a spender. * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://6227e3dd53f44d457ce57232ba52d472334fd2a58e36680bc74401c4c15591b0
{ "func_code_index": [ 2661, 2971 ] }
9,963
MenloTokenSale
MenloTokenSale.sol
0x1c9a4895ca840b25e83c472d5aa7e59f22a027fe
Solidity
StandardToken
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); require(_to != address(0)); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance( address _owner, address _spender ) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval( address _spender, uint256 _addedValue ) public returns (bool) { allowed[msg.sender][_spender] = ( allowed[msg.sender][_spender].add(_addedValue)); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval( address _spender, uint256 _subtractedValue ) public returns (bool) { uint256 oldValue = allowed[msg.sender][_spender]; if (_subtractedValue >= oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } }
decreaseApproval
function decreaseApproval( address _spender, uint256 _subtractedValue ) public returns (bool) { uint256 oldValue = allowed[msg.sender][_spender]; if (_subtractedValue >= oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; }
/** * @dev Decrease the amount of tokens that an owner allowed to a spender. * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://6227e3dd53f44d457ce57232ba52d472334fd2a58e36680bc74401c4c15591b0
{ "func_code_index": [ 3436, 3886 ] }
9,964
MenloTokenSale
MenloTokenSale.sol
0x1c9a4895ca840b25e83c472d5aa7e59f22a027fe
Solidity
MenloSaleBase
contract MenloSaleBase is Ownable { using SafeMath for uint256; // Whitelisted investors mapping (address => bool) public whitelist; // Special role used exclusively for managing the whitelist address public whitelister; // manual early close flag bool public isFinalized; // cap for crowdsale in wei uint256 public cap; // The token being sold MenloToken public token; // start and end timestamps where contributions are allowed (both inclusive) uint256 public startTime; uint256 public endTime; // address where funds are collected address public wallet; // amount of raised money in wei uint256 public weiRaised; /** * @dev Throws if called by any account other than the whitelister. */ modifier onlyWhitelister() { require(msg.sender == whitelister, "Sender should be whitelister"); _; } /** * event for token purchase logging * @param purchaser who bought the tokens * @param value weis paid for purchase * @param amount amount of tokens purchased */ event TokenPurchase(address indexed purchaser, uint256 value, uint256 amount); /** * event for token redemption logging * @param purchaser who bought the tokens * @param amount amount of tokens redeemed */ event TokenRedeem(address indexed purchaser, uint256 amount); // termination early or otherwise event Finalized(); event TokensRefund(uint256 amount); /** * event refund of excess ETH if purchase is above the cap * @param amount amount of ETH (in wei) refunded */ event Refund(address indexed purchaser, uint256 amount); constructor( MenloToken _token, uint256 _startTime, uint256 _endTime, uint256 _cap, address _wallet ) public { require(_startTime >= getBlockTimestamp(), "Start time should be in the future"); require(_endTime >= _startTime, "End time should be after start time"); require(_wallet != address(0), "Wallet address should be non-zero"); require(_token != address(0), "Token address should be non-zero"); require(_cap > 0, "Cap should be greater than zero"); token = _token; startTime = _startTime; endTime = _endTime; cap = _cap; wallet = _wallet; } // fallback function can be used to buy tokens function () public payable { buyTokens(); } // Abstract methods function calculateBonusRate() public view returns (uint256); function buyTokensHook(uint256 _tokens) internal; function buyTokens() public payable returns (uint256) { require(whitelist[msg.sender], "Expected msg.sender to be whitelisted"); checkFinalize(); require(!isFinalized, "Should not be finalized when purchasing"); require(getBlockTimestamp() >= startTime && getBlockTimestamp() <= endTime, "Should be during sale"); require(msg.value != 0, "Value should not be zero"); require(token.balanceOf(this) > 0, "This contract must have tokens"); uint256 _weiAmount = msg.value; uint256 _remainingToFund = cap.sub(weiRaised); if (_weiAmount > _remainingToFund) { _weiAmount = _remainingToFund; } uint256 _totalTokens = _weiAmount.mul(calculateBonusRate()); if (_totalTokens > token.balanceOf(this)) { // Change _wei to buy rest of remaining tokens _weiAmount = token.balanceOf(this).div(calculateBonusRate()); } token.unpause(); weiRaised = weiRaised.add(_weiAmount); forwardFunds(_weiAmount); uint256 _weiToReturn = msg.value.sub(_weiAmount); if (_weiToReturn > 0) { msg.sender.transfer(_weiToReturn); emit Refund(msg.sender, _weiToReturn); } uint256 _tokens = ethToTokens(_weiAmount); emit TokenPurchase(msg.sender, _weiAmount, _tokens); buyTokensHook(_tokens); token.pause(); checkFinalize(); return _tokens; } // Allows the owner to take back the tokens that are assigned to the sale contract. function refund() external onlyOwner returns (bool) { require(hasEnded(), "Sale should have ended when refunding"); uint256 _tokens = token.balanceOf(address(this)); if (_tokens == 0) { return false; } require(token.transfer(owner, _tokens), "Expected token transfer to succeed"); emit TokensRefund(_tokens); return true; } /// @notice interface for founders to whitelist investors /// @param _addresses array of investors /// @param _status enable or disable function whitelistAddresses(address[] _addresses, bool _status) public onlyWhitelister { for (uint256 i = 0; i < _addresses.length; i++) { address _investorAddress = _addresses[i]; if (whitelist[_investorAddress] != _status) { whitelist[_investorAddress] = _status; } } } function setWhitelister(address _whitelister) public onlyOwner { whitelister = _whitelister; } function checkFinalize() public { if (hasEnded()) { finalize(); } } function emergencyFinalize() public onlyOwner { finalize(); } function withdraw() public onlyOwner { owner.transfer(address(this).balance); } function hasEnded() public constant returns (bool) { if (isFinalized) { return true; } bool _capReached = weiRaised >= cap; bool _passedEndTime = getBlockTimestamp() > endTime; return _passedEndTime || _capReached; } // @dev does not require that crowdsale `hasEnded()` to leave safegaurd // in place if ETH rises in price too much during crowdsale. // Allows team to close early if cap is exceeded in USD in this event. function finalize() internal { require(!isFinalized, "Should not be finalized when finalizing"); emit Finalized(); isFinalized = true; token.transferOwnership(owner); } // send ether to the fund collection wallet // override to create custom fund forwarding mechanisms function forwardFunds(uint256 _amount) internal { wallet.transfer(_amount); } function ethToTokens(uint256 _ethAmount) internal view returns (uint256) { return _ethAmount.mul(calculateBonusRate()); } function getBlockTimestamp() internal view returns (uint256) { return block.timestamp; } }
function () public payable { buyTokens(); }
// fallback function can be used to buy tokens
LineComment
v0.4.24+commit.e67f0147
bzzr://6227e3dd53f44d457ce57232ba52d472334fd2a58e36680bc74401c4c15591b0
{ "func_code_index": [ 2367, 2421 ] }
9,965
MenloTokenSale
MenloTokenSale.sol
0x1c9a4895ca840b25e83c472d5aa7e59f22a027fe
Solidity
MenloSaleBase
contract MenloSaleBase is Ownable { using SafeMath for uint256; // Whitelisted investors mapping (address => bool) public whitelist; // Special role used exclusively for managing the whitelist address public whitelister; // manual early close flag bool public isFinalized; // cap for crowdsale in wei uint256 public cap; // The token being sold MenloToken public token; // start and end timestamps where contributions are allowed (both inclusive) uint256 public startTime; uint256 public endTime; // address where funds are collected address public wallet; // amount of raised money in wei uint256 public weiRaised; /** * @dev Throws if called by any account other than the whitelister. */ modifier onlyWhitelister() { require(msg.sender == whitelister, "Sender should be whitelister"); _; } /** * event for token purchase logging * @param purchaser who bought the tokens * @param value weis paid for purchase * @param amount amount of tokens purchased */ event TokenPurchase(address indexed purchaser, uint256 value, uint256 amount); /** * event for token redemption logging * @param purchaser who bought the tokens * @param amount amount of tokens redeemed */ event TokenRedeem(address indexed purchaser, uint256 amount); // termination early or otherwise event Finalized(); event TokensRefund(uint256 amount); /** * event refund of excess ETH if purchase is above the cap * @param amount amount of ETH (in wei) refunded */ event Refund(address indexed purchaser, uint256 amount); constructor( MenloToken _token, uint256 _startTime, uint256 _endTime, uint256 _cap, address _wallet ) public { require(_startTime >= getBlockTimestamp(), "Start time should be in the future"); require(_endTime >= _startTime, "End time should be after start time"); require(_wallet != address(0), "Wallet address should be non-zero"); require(_token != address(0), "Token address should be non-zero"); require(_cap > 0, "Cap should be greater than zero"); token = _token; startTime = _startTime; endTime = _endTime; cap = _cap; wallet = _wallet; } // fallback function can be used to buy tokens function () public payable { buyTokens(); } // Abstract methods function calculateBonusRate() public view returns (uint256); function buyTokensHook(uint256 _tokens) internal; function buyTokens() public payable returns (uint256) { require(whitelist[msg.sender], "Expected msg.sender to be whitelisted"); checkFinalize(); require(!isFinalized, "Should not be finalized when purchasing"); require(getBlockTimestamp() >= startTime && getBlockTimestamp() <= endTime, "Should be during sale"); require(msg.value != 0, "Value should not be zero"); require(token.balanceOf(this) > 0, "This contract must have tokens"); uint256 _weiAmount = msg.value; uint256 _remainingToFund = cap.sub(weiRaised); if (_weiAmount > _remainingToFund) { _weiAmount = _remainingToFund; } uint256 _totalTokens = _weiAmount.mul(calculateBonusRate()); if (_totalTokens > token.balanceOf(this)) { // Change _wei to buy rest of remaining tokens _weiAmount = token.balanceOf(this).div(calculateBonusRate()); } token.unpause(); weiRaised = weiRaised.add(_weiAmount); forwardFunds(_weiAmount); uint256 _weiToReturn = msg.value.sub(_weiAmount); if (_weiToReturn > 0) { msg.sender.transfer(_weiToReturn); emit Refund(msg.sender, _weiToReturn); } uint256 _tokens = ethToTokens(_weiAmount); emit TokenPurchase(msg.sender, _weiAmount, _tokens); buyTokensHook(_tokens); token.pause(); checkFinalize(); return _tokens; } // Allows the owner to take back the tokens that are assigned to the sale contract. function refund() external onlyOwner returns (bool) { require(hasEnded(), "Sale should have ended when refunding"); uint256 _tokens = token.balanceOf(address(this)); if (_tokens == 0) { return false; } require(token.transfer(owner, _tokens), "Expected token transfer to succeed"); emit TokensRefund(_tokens); return true; } /// @notice interface for founders to whitelist investors /// @param _addresses array of investors /// @param _status enable or disable function whitelistAddresses(address[] _addresses, bool _status) public onlyWhitelister { for (uint256 i = 0; i < _addresses.length; i++) { address _investorAddress = _addresses[i]; if (whitelist[_investorAddress] != _status) { whitelist[_investorAddress] = _status; } } } function setWhitelister(address _whitelister) public onlyOwner { whitelister = _whitelister; } function checkFinalize() public { if (hasEnded()) { finalize(); } } function emergencyFinalize() public onlyOwner { finalize(); } function withdraw() public onlyOwner { owner.transfer(address(this).balance); } function hasEnded() public constant returns (bool) { if (isFinalized) { return true; } bool _capReached = weiRaised >= cap; bool _passedEndTime = getBlockTimestamp() > endTime; return _passedEndTime || _capReached; } // @dev does not require that crowdsale `hasEnded()` to leave safegaurd // in place if ETH rises in price too much during crowdsale. // Allows team to close early if cap is exceeded in USD in this event. function finalize() internal { require(!isFinalized, "Should not be finalized when finalizing"); emit Finalized(); isFinalized = true; token.transferOwnership(owner); } // send ether to the fund collection wallet // override to create custom fund forwarding mechanisms function forwardFunds(uint256 _amount) internal { wallet.transfer(_amount); } function ethToTokens(uint256 _ethAmount) internal view returns (uint256) { return _ethAmount.mul(calculateBonusRate()); } function getBlockTimestamp() internal view returns (uint256) { return block.timestamp; } }
calculateBonusRate
function calculateBonusRate() public view returns (uint256);
// Abstract methods
LineComment
v0.4.24+commit.e67f0147
bzzr://6227e3dd53f44d457ce57232ba52d472334fd2a58e36680bc74401c4c15591b0
{ "func_code_index": [ 2447, 2510 ] }
9,966
MenloTokenSale
MenloTokenSale.sol
0x1c9a4895ca840b25e83c472d5aa7e59f22a027fe
Solidity
MenloSaleBase
contract MenloSaleBase is Ownable { using SafeMath for uint256; // Whitelisted investors mapping (address => bool) public whitelist; // Special role used exclusively for managing the whitelist address public whitelister; // manual early close flag bool public isFinalized; // cap for crowdsale in wei uint256 public cap; // The token being sold MenloToken public token; // start and end timestamps where contributions are allowed (both inclusive) uint256 public startTime; uint256 public endTime; // address where funds are collected address public wallet; // amount of raised money in wei uint256 public weiRaised; /** * @dev Throws if called by any account other than the whitelister. */ modifier onlyWhitelister() { require(msg.sender == whitelister, "Sender should be whitelister"); _; } /** * event for token purchase logging * @param purchaser who bought the tokens * @param value weis paid for purchase * @param amount amount of tokens purchased */ event TokenPurchase(address indexed purchaser, uint256 value, uint256 amount); /** * event for token redemption logging * @param purchaser who bought the tokens * @param amount amount of tokens redeemed */ event TokenRedeem(address indexed purchaser, uint256 amount); // termination early or otherwise event Finalized(); event TokensRefund(uint256 amount); /** * event refund of excess ETH if purchase is above the cap * @param amount amount of ETH (in wei) refunded */ event Refund(address indexed purchaser, uint256 amount); constructor( MenloToken _token, uint256 _startTime, uint256 _endTime, uint256 _cap, address _wallet ) public { require(_startTime >= getBlockTimestamp(), "Start time should be in the future"); require(_endTime >= _startTime, "End time should be after start time"); require(_wallet != address(0), "Wallet address should be non-zero"); require(_token != address(0), "Token address should be non-zero"); require(_cap > 0, "Cap should be greater than zero"); token = _token; startTime = _startTime; endTime = _endTime; cap = _cap; wallet = _wallet; } // fallback function can be used to buy tokens function () public payable { buyTokens(); } // Abstract methods function calculateBonusRate() public view returns (uint256); function buyTokensHook(uint256 _tokens) internal; function buyTokens() public payable returns (uint256) { require(whitelist[msg.sender], "Expected msg.sender to be whitelisted"); checkFinalize(); require(!isFinalized, "Should not be finalized when purchasing"); require(getBlockTimestamp() >= startTime && getBlockTimestamp() <= endTime, "Should be during sale"); require(msg.value != 0, "Value should not be zero"); require(token.balanceOf(this) > 0, "This contract must have tokens"); uint256 _weiAmount = msg.value; uint256 _remainingToFund = cap.sub(weiRaised); if (_weiAmount > _remainingToFund) { _weiAmount = _remainingToFund; } uint256 _totalTokens = _weiAmount.mul(calculateBonusRate()); if (_totalTokens > token.balanceOf(this)) { // Change _wei to buy rest of remaining tokens _weiAmount = token.balanceOf(this).div(calculateBonusRate()); } token.unpause(); weiRaised = weiRaised.add(_weiAmount); forwardFunds(_weiAmount); uint256 _weiToReturn = msg.value.sub(_weiAmount); if (_weiToReturn > 0) { msg.sender.transfer(_weiToReturn); emit Refund(msg.sender, _weiToReturn); } uint256 _tokens = ethToTokens(_weiAmount); emit TokenPurchase(msg.sender, _weiAmount, _tokens); buyTokensHook(_tokens); token.pause(); checkFinalize(); return _tokens; } // Allows the owner to take back the tokens that are assigned to the sale contract. function refund() external onlyOwner returns (bool) { require(hasEnded(), "Sale should have ended when refunding"); uint256 _tokens = token.balanceOf(address(this)); if (_tokens == 0) { return false; } require(token.transfer(owner, _tokens), "Expected token transfer to succeed"); emit TokensRefund(_tokens); return true; } /// @notice interface for founders to whitelist investors /// @param _addresses array of investors /// @param _status enable or disable function whitelistAddresses(address[] _addresses, bool _status) public onlyWhitelister { for (uint256 i = 0; i < _addresses.length; i++) { address _investorAddress = _addresses[i]; if (whitelist[_investorAddress] != _status) { whitelist[_investorAddress] = _status; } } } function setWhitelister(address _whitelister) public onlyOwner { whitelister = _whitelister; } function checkFinalize() public { if (hasEnded()) { finalize(); } } function emergencyFinalize() public onlyOwner { finalize(); } function withdraw() public onlyOwner { owner.transfer(address(this).balance); } function hasEnded() public constant returns (bool) { if (isFinalized) { return true; } bool _capReached = weiRaised >= cap; bool _passedEndTime = getBlockTimestamp() > endTime; return _passedEndTime || _capReached; } // @dev does not require that crowdsale `hasEnded()` to leave safegaurd // in place if ETH rises in price too much during crowdsale. // Allows team to close early if cap is exceeded in USD in this event. function finalize() internal { require(!isFinalized, "Should not be finalized when finalizing"); emit Finalized(); isFinalized = true; token.transferOwnership(owner); } // send ether to the fund collection wallet // override to create custom fund forwarding mechanisms function forwardFunds(uint256 _amount) internal { wallet.transfer(_amount); } function ethToTokens(uint256 _ethAmount) internal view returns (uint256) { return _ethAmount.mul(calculateBonusRate()); } function getBlockTimestamp() internal view returns (uint256) { return block.timestamp; } }
refund
function refund() external onlyOwner returns (bool) { require(hasEnded(), "Sale should have ended when refunding"); uint256 _tokens = token.balanceOf(address(this)); if (_tokens == 0) { return false; } require(token.transfer(owner, _tokens), "Expected token transfer to succeed"); emit TokensRefund(_tokens); return true; }
// Allows the owner to take back the tokens that are assigned to the sale contract.
LineComment
v0.4.24+commit.e67f0147
bzzr://6227e3dd53f44d457ce57232ba52d472334fd2a58e36680bc74401c4c15591b0
{ "func_code_index": [ 4041, 4420 ] }
9,967
MenloTokenSale
MenloTokenSale.sol
0x1c9a4895ca840b25e83c472d5aa7e59f22a027fe
Solidity
MenloSaleBase
contract MenloSaleBase is Ownable { using SafeMath for uint256; // Whitelisted investors mapping (address => bool) public whitelist; // Special role used exclusively for managing the whitelist address public whitelister; // manual early close flag bool public isFinalized; // cap for crowdsale in wei uint256 public cap; // The token being sold MenloToken public token; // start and end timestamps where contributions are allowed (both inclusive) uint256 public startTime; uint256 public endTime; // address where funds are collected address public wallet; // amount of raised money in wei uint256 public weiRaised; /** * @dev Throws if called by any account other than the whitelister. */ modifier onlyWhitelister() { require(msg.sender == whitelister, "Sender should be whitelister"); _; } /** * event for token purchase logging * @param purchaser who bought the tokens * @param value weis paid for purchase * @param amount amount of tokens purchased */ event TokenPurchase(address indexed purchaser, uint256 value, uint256 amount); /** * event for token redemption logging * @param purchaser who bought the tokens * @param amount amount of tokens redeemed */ event TokenRedeem(address indexed purchaser, uint256 amount); // termination early or otherwise event Finalized(); event TokensRefund(uint256 amount); /** * event refund of excess ETH if purchase is above the cap * @param amount amount of ETH (in wei) refunded */ event Refund(address indexed purchaser, uint256 amount); constructor( MenloToken _token, uint256 _startTime, uint256 _endTime, uint256 _cap, address _wallet ) public { require(_startTime >= getBlockTimestamp(), "Start time should be in the future"); require(_endTime >= _startTime, "End time should be after start time"); require(_wallet != address(0), "Wallet address should be non-zero"); require(_token != address(0), "Token address should be non-zero"); require(_cap > 0, "Cap should be greater than zero"); token = _token; startTime = _startTime; endTime = _endTime; cap = _cap; wallet = _wallet; } // fallback function can be used to buy tokens function () public payable { buyTokens(); } // Abstract methods function calculateBonusRate() public view returns (uint256); function buyTokensHook(uint256 _tokens) internal; function buyTokens() public payable returns (uint256) { require(whitelist[msg.sender], "Expected msg.sender to be whitelisted"); checkFinalize(); require(!isFinalized, "Should not be finalized when purchasing"); require(getBlockTimestamp() >= startTime && getBlockTimestamp() <= endTime, "Should be during sale"); require(msg.value != 0, "Value should not be zero"); require(token.balanceOf(this) > 0, "This contract must have tokens"); uint256 _weiAmount = msg.value; uint256 _remainingToFund = cap.sub(weiRaised); if (_weiAmount > _remainingToFund) { _weiAmount = _remainingToFund; } uint256 _totalTokens = _weiAmount.mul(calculateBonusRate()); if (_totalTokens > token.balanceOf(this)) { // Change _wei to buy rest of remaining tokens _weiAmount = token.balanceOf(this).div(calculateBonusRate()); } token.unpause(); weiRaised = weiRaised.add(_weiAmount); forwardFunds(_weiAmount); uint256 _weiToReturn = msg.value.sub(_weiAmount); if (_weiToReturn > 0) { msg.sender.transfer(_weiToReturn); emit Refund(msg.sender, _weiToReturn); } uint256 _tokens = ethToTokens(_weiAmount); emit TokenPurchase(msg.sender, _weiAmount, _tokens); buyTokensHook(_tokens); token.pause(); checkFinalize(); return _tokens; } // Allows the owner to take back the tokens that are assigned to the sale contract. function refund() external onlyOwner returns (bool) { require(hasEnded(), "Sale should have ended when refunding"); uint256 _tokens = token.balanceOf(address(this)); if (_tokens == 0) { return false; } require(token.transfer(owner, _tokens), "Expected token transfer to succeed"); emit TokensRefund(_tokens); return true; } /// @notice interface for founders to whitelist investors /// @param _addresses array of investors /// @param _status enable or disable function whitelistAddresses(address[] _addresses, bool _status) public onlyWhitelister { for (uint256 i = 0; i < _addresses.length; i++) { address _investorAddress = _addresses[i]; if (whitelist[_investorAddress] != _status) { whitelist[_investorAddress] = _status; } } } function setWhitelister(address _whitelister) public onlyOwner { whitelister = _whitelister; } function checkFinalize() public { if (hasEnded()) { finalize(); } } function emergencyFinalize() public onlyOwner { finalize(); } function withdraw() public onlyOwner { owner.transfer(address(this).balance); } function hasEnded() public constant returns (bool) { if (isFinalized) { return true; } bool _capReached = weiRaised >= cap; bool _passedEndTime = getBlockTimestamp() > endTime; return _passedEndTime || _capReached; } // @dev does not require that crowdsale `hasEnded()` to leave safegaurd // in place if ETH rises in price too much during crowdsale. // Allows team to close early if cap is exceeded in USD in this event. function finalize() internal { require(!isFinalized, "Should not be finalized when finalizing"); emit Finalized(); isFinalized = true; token.transferOwnership(owner); } // send ether to the fund collection wallet // override to create custom fund forwarding mechanisms function forwardFunds(uint256 _amount) internal { wallet.transfer(_amount); } function ethToTokens(uint256 _ethAmount) internal view returns (uint256) { return _ethAmount.mul(calculateBonusRate()); } function getBlockTimestamp() internal view returns (uint256) { return block.timestamp; } }
whitelistAddresses
function whitelistAddresses(address[] _addresses, bool _status) public onlyWhitelister { for (uint256 i = 0; i < _addresses.length; i++) { address _investorAddress = _addresses[i]; if (whitelist[_investorAddress] != _status) { whitelist[_investorAddress] = _status; } } }
/// @notice interface for founders to whitelist investors /// @param _addresses array of investors /// @param _status enable or disable
NatSpecSingleLine
v0.4.24+commit.e67f0147
bzzr://6227e3dd53f44d457ce57232ba52d472334fd2a58e36680bc74401c4c15591b0
{ "func_code_index": [ 4568, 4885 ] }
9,968
MenloTokenSale
MenloTokenSale.sol
0x1c9a4895ca840b25e83c472d5aa7e59f22a027fe
Solidity
MenloSaleBase
contract MenloSaleBase is Ownable { using SafeMath for uint256; // Whitelisted investors mapping (address => bool) public whitelist; // Special role used exclusively for managing the whitelist address public whitelister; // manual early close flag bool public isFinalized; // cap for crowdsale in wei uint256 public cap; // The token being sold MenloToken public token; // start and end timestamps where contributions are allowed (both inclusive) uint256 public startTime; uint256 public endTime; // address where funds are collected address public wallet; // amount of raised money in wei uint256 public weiRaised; /** * @dev Throws if called by any account other than the whitelister. */ modifier onlyWhitelister() { require(msg.sender == whitelister, "Sender should be whitelister"); _; } /** * event for token purchase logging * @param purchaser who bought the tokens * @param value weis paid for purchase * @param amount amount of tokens purchased */ event TokenPurchase(address indexed purchaser, uint256 value, uint256 amount); /** * event for token redemption logging * @param purchaser who bought the tokens * @param amount amount of tokens redeemed */ event TokenRedeem(address indexed purchaser, uint256 amount); // termination early or otherwise event Finalized(); event TokensRefund(uint256 amount); /** * event refund of excess ETH if purchase is above the cap * @param amount amount of ETH (in wei) refunded */ event Refund(address indexed purchaser, uint256 amount); constructor( MenloToken _token, uint256 _startTime, uint256 _endTime, uint256 _cap, address _wallet ) public { require(_startTime >= getBlockTimestamp(), "Start time should be in the future"); require(_endTime >= _startTime, "End time should be after start time"); require(_wallet != address(0), "Wallet address should be non-zero"); require(_token != address(0), "Token address should be non-zero"); require(_cap > 0, "Cap should be greater than zero"); token = _token; startTime = _startTime; endTime = _endTime; cap = _cap; wallet = _wallet; } // fallback function can be used to buy tokens function () public payable { buyTokens(); } // Abstract methods function calculateBonusRate() public view returns (uint256); function buyTokensHook(uint256 _tokens) internal; function buyTokens() public payable returns (uint256) { require(whitelist[msg.sender], "Expected msg.sender to be whitelisted"); checkFinalize(); require(!isFinalized, "Should not be finalized when purchasing"); require(getBlockTimestamp() >= startTime && getBlockTimestamp() <= endTime, "Should be during sale"); require(msg.value != 0, "Value should not be zero"); require(token.balanceOf(this) > 0, "This contract must have tokens"); uint256 _weiAmount = msg.value; uint256 _remainingToFund = cap.sub(weiRaised); if (_weiAmount > _remainingToFund) { _weiAmount = _remainingToFund; } uint256 _totalTokens = _weiAmount.mul(calculateBonusRate()); if (_totalTokens > token.balanceOf(this)) { // Change _wei to buy rest of remaining tokens _weiAmount = token.balanceOf(this).div(calculateBonusRate()); } token.unpause(); weiRaised = weiRaised.add(_weiAmount); forwardFunds(_weiAmount); uint256 _weiToReturn = msg.value.sub(_weiAmount); if (_weiToReturn > 0) { msg.sender.transfer(_weiToReturn); emit Refund(msg.sender, _weiToReturn); } uint256 _tokens = ethToTokens(_weiAmount); emit TokenPurchase(msg.sender, _weiAmount, _tokens); buyTokensHook(_tokens); token.pause(); checkFinalize(); return _tokens; } // Allows the owner to take back the tokens that are assigned to the sale contract. function refund() external onlyOwner returns (bool) { require(hasEnded(), "Sale should have ended when refunding"); uint256 _tokens = token.balanceOf(address(this)); if (_tokens == 0) { return false; } require(token.transfer(owner, _tokens), "Expected token transfer to succeed"); emit TokensRefund(_tokens); return true; } /// @notice interface for founders to whitelist investors /// @param _addresses array of investors /// @param _status enable or disable function whitelistAddresses(address[] _addresses, bool _status) public onlyWhitelister { for (uint256 i = 0; i < _addresses.length; i++) { address _investorAddress = _addresses[i]; if (whitelist[_investorAddress] != _status) { whitelist[_investorAddress] = _status; } } } function setWhitelister(address _whitelister) public onlyOwner { whitelister = _whitelister; } function checkFinalize() public { if (hasEnded()) { finalize(); } } function emergencyFinalize() public onlyOwner { finalize(); } function withdraw() public onlyOwner { owner.transfer(address(this).balance); } function hasEnded() public constant returns (bool) { if (isFinalized) { return true; } bool _capReached = weiRaised >= cap; bool _passedEndTime = getBlockTimestamp() > endTime; return _passedEndTime || _capReached; } // @dev does not require that crowdsale `hasEnded()` to leave safegaurd // in place if ETH rises in price too much during crowdsale. // Allows team to close early if cap is exceeded in USD in this event. function finalize() internal { require(!isFinalized, "Should not be finalized when finalizing"); emit Finalized(); isFinalized = true; token.transferOwnership(owner); } // send ether to the fund collection wallet // override to create custom fund forwarding mechanisms function forwardFunds(uint256 _amount) internal { wallet.transfer(_amount); } function ethToTokens(uint256 _ethAmount) internal view returns (uint256) { return _ethAmount.mul(calculateBonusRate()); } function getBlockTimestamp() internal view returns (uint256) { return block.timestamp; } }
finalize
function finalize() internal { require(!isFinalized, "Should not be finalized when finalizing"); emit Finalized(); isFinalized = true; token.transferOwnership(owner); }
// @dev does not require that crowdsale `hasEnded()` to leave safegaurd // in place if ETH rises in price too much during crowdsale. // Allows team to close early if cap is exceeded in USD in this event.
LineComment
v0.4.24+commit.e67f0147
bzzr://6227e3dd53f44d457ce57232ba52d472334fd2a58e36680bc74401c4c15591b0
{ "func_code_index": [ 5727, 5921 ] }
9,969
MenloTokenSale
MenloTokenSale.sol
0x1c9a4895ca840b25e83c472d5aa7e59f22a027fe
Solidity
MenloSaleBase
contract MenloSaleBase is Ownable { using SafeMath for uint256; // Whitelisted investors mapping (address => bool) public whitelist; // Special role used exclusively for managing the whitelist address public whitelister; // manual early close flag bool public isFinalized; // cap for crowdsale in wei uint256 public cap; // The token being sold MenloToken public token; // start and end timestamps where contributions are allowed (both inclusive) uint256 public startTime; uint256 public endTime; // address where funds are collected address public wallet; // amount of raised money in wei uint256 public weiRaised; /** * @dev Throws if called by any account other than the whitelister. */ modifier onlyWhitelister() { require(msg.sender == whitelister, "Sender should be whitelister"); _; } /** * event for token purchase logging * @param purchaser who bought the tokens * @param value weis paid for purchase * @param amount amount of tokens purchased */ event TokenPurchase(address indexed purchaser, uint256 value, uint256 amount); /** * event for token redemption logging * @param purchaser who bought the tokens * @param amount amount of tokens redeemed */ event TokenRedeem(address indexed purchaser, uint256 amount); // termination early or otherwise event Finalized(); event TokensRefund(uint256 amount); /** * event refund of excess ETH if purchase is above the cap * @param amount amount of ETH (in wei) refunded */ event Refund(address indexed purchaser, uint256 amount); constructor( MenloToken _token, uint256 _startTime, uint256 _endTime, uint256 _cap, address _wallet ) public { require(_startTime >= getBlockTimestamp(), "Start time should be in the future"); require(_endTime >= _startTime, "End time should be after start time"); require(_wallet != address(0), "Wallet address should be non-zero"); require(_token != address(0), "Token address should be non-zero"); require(_cap > 0, "Cap should be greater than zero"); token = _token; startTime = _startTime; endTime = _endTime; cap = _cap; wallet = _wallet; } // fallback function can be used to buy tokens function () public payable { buyTokens(); } // Abstract methods function calculateBonusRate() public view returns (uint256); function buyTokensHook(uint256 _tokens) internal; function buyTokens() public payable returns (uint256) { require(whitelist[msg.sender], "Expected msg.sender to be whitelisted"); checkFinalize(); require(!isFinalized, "Should not be finalized when purchasing"); require(getBlockTimestamp() >= startTime && getBlockTimestamp() <= endTime, "Should be during sale"); require(msg.value != 0, "Value should not be zero"); require(token.balanceOf(this) > 0, "This contract must have tokens"); uint256 _weiAmount = msg.value; uint256 _remainingToFund = cap.sub(weiRaised); if (_weiAmount > _remainingToFund) { _weiAmount = _remainingToFund; } uint256 _totalTokens = _weiAmount.mul(calculateBonusRate()); if (_totalTokens > token.balanceOf(this)) { // Change _wei to buy rest of remaining tokens _weiAmount = token.balanceOf(this).div(calculateBonusRate()); } token.unpause(); weiRaised = weiRaised.add(_weiAmount); forwardFunds(_weiAmount); uint256 _weiToReturn = msg.value.sub(_weiAmount); if (_weiToReturn > 0) { msg.sender.transfer(_weiToReturn); emit Refund(msg.sender, _weiToReturn); } uint256 _tokens = ethToTokens(_weiAmount); emit TokenPurchase(msg.sender, _weiAmount, _tokens); buyTokensHook(_tokens); token.pause(); checkFinalize(); return _tokens; } // Allows the owner to take back the tokens that are assigned to the sale contract. function refund() external onlyOwner returns (bool) { require(hasEnded(), "Sale should have ended when refunding"); uint256 _tokens = token.balanceOf(address(this)); if (_tokens == 0) { return false; } require(token.transfer(owner, _tokens), "Expected token transfer to succeed"); emit TokensRefund(_tokens); return true; } /// @notice interface for founders to whitelist investors /// @param _addresses array of investors /// @param _status enable or disable function whitelistAddresses(address[] _addresses, bool _status) public onlyWhitelister { for (uint256 i = 0; i < _addresses.length; i++) { address _investorAddress = _addresses[i]; if (whitelist[_investorAddress] != _status) { whitelist[_investorAddress] = _status; } } } function setWhitelister(address _whitelister) public onlyOwner { whitelister = _whitelister; } function checkFinalize() public { if (hasEnded()) { finalize(); } } function emergencyFinalize() public onlyOwner { finalize(); } function withdraw() public onlyOwner { owner.transfer(address(this).balance); } function hasEnded() public constant returns (bool) { if (isFinalized) { return true; } bool _capReached = weiRaised >= cap; bool _passedEndTime = getBlockTimestamp() > endTime; return _passedEndTime || _capReached; } // @dev does not require that crowdsale `hasEnded()` to leave safegaurd // in place if ETH rises in price too much during crowdsale. // Allows team to close early if cap is exceeded in USD in this event. function finalize() internal { require(!isFinalized, "Should not be finalized when finalizing"); emit Finalized(); isFinalized = true; token.transferOwnership(owner); } // send ether to the fund collection wallet // override to create custom fund forwarding mechanisms function forwardFunds(uint256 _amount) internal { wallet.transfer(_amount); } function ethToTokens(uint256 _ethAmount) internal view returns (uint256) { return _ethAmount.mul(calculateBonusRate()); } function getBlockTimestamp() internal view returns (uint256) { return block.timestamp; } }
forwardFunds
function forwardFunds(uint256 _amount) internal { wallet.transfer(_amount); }
// send ether to the fund collection wallet // override to create custom fund forwarding mechanisms
LineComment
v0.4.24+commit.e67f0147
bzzr://6227e3dd53f44d457ce57232ba52d472334fd2a58e36680bc74401c4c15591b0
{ "func_code_index": [ 6030, 6118 ] }
9,970
MenloTokenSale
MenloTokenSale.sol
0x1c9a4895ca840b25e83c472d5aa7e59f22a027fe
Solidity
MenloToken
contract MenloToken is PausableToken, BurnableToken, CanReclaimToken { // Token properties string public constant name = 'Menlo One'; string public constant symbol = 'ONE'; uint8 public constant decimals = 18; uint256 private constant token_factor = 10**uint256(decimals); // 1 billion ONE tokens in units divisible up to 18 decimals uint256 public constant INITIAL_SUPPLY = 1000000000 * token_factor; uint256 public constant PUBLICSALE_SUPPLY = 354000000 * token_factor; uint256 public constant GROWTH_SUPPLY = 246000000 * token_factor; uint256 public constant TEAM_SUPPLY = 200000000 * token_factor; uint256 public constant ADVISOR_SUPPLY = 100000000 * token_factor; uint256 public constant PARTNER_SUPPLY = 100000000 * token_factor; /** * @dev Magic value to be returned upon successful reception of Menlo Tokens */ bytes4 internal constant ONE_RECEIVED = 0x150b7a03; address public crowdsale; address public teamTimelock; address public advisorTimelock; modifier notInitialized(address saleAddress) { require(address(saleAddress) == address(0), "Expected address to be null"); _; } constructor(address _growth, address _teamTimelock, address _advisorTimelock, address _partner) public { assert(INITIAL_SUPPLY > 0); assert((PUBLICSALE_SUPPLY + GROWTH_SUPPLY + TEAM_SUPPLY + ADVISOR_SUPPLY + PARTNER_SUPPLY) == INITIAL_SUPPLY); uint256 _poolTotal = GROWTH_SUPPLY + TEAM_SUPPLY + ADVISOR_SUPPLY + PARTNER_SUPPLY; uint256 _availableForSales = INITIAL_SUPPLY - _poolTotal; assert(_availableForSales == PUBLICSALE_SUPPLY); teamTimelock = _teamTimelock; advisorTimelock = _advisorTimelock; mint(msg.sender, _availableForSales); mint(_growth, GROWTH_SUPPLY); mint(_teamTimelock, TEAM_SUPPLY); mint(_advisorTimelock, ADVISOR_SUPPLY); mint(_partner, PARTNER_SUPPLY); assert(totalSupply_ == INITIAL_SUPPLY); pause(); } function initializeCrowdsale(address _crowdsale) public onlyOwner notInitialized(crowdsale) { unpause(); transfer(_crowdsale, balances[msg.sender]); // Transfer left over balance after private presale allocations crowdsale = _crowdsale; pause(); transferOwnership(_crowdsale); } function mint(address _to, uint256 _amount) internal { balances[_to] = _amount; totalSupply_ = totalSupply_.add(_amount); emit Transfer(address(0), _to, _amount); } /** * @dev Safely transfers the ownership of a given token ID to another address * If the target address is a contract, it must implement `onERC721Received`, * which is called upon a safe transfer, and return the magic value `bytes4(0x150b7a03)`; * otherwise, the transfer is reverted. * Requires the msg sender to be the owner, approved, or operator * @param _to address to receive the tokens. Must be a MenloTokenReceiver based contract * @param _value uint256 number of tokens to transfer * @param _action uint256 action to perform in target _to contract * @param _data bytes data to send along with a safe transfer check **/ function transferAndCall(address _to, uint256 _value, uint256 _action, bytes _data) public returns (bool) { if (transfer(_to, _value)) { require (MenloTokenReceiver(_to).onTokenReceived(msg.sender, _value, _action, _data) == ONE_RECEIVED, "Target contract onTokenReceived failed"); return true; } return false; } }
transferAndCall
function transferAndCall(address _to, uint256 _value, uint256 _action, bytes _data) public returns (bool) { if (transfer(_to, _value)) { require (MenloTokenReceiver(_to).onTokenReceived(msg.sender, _value, _action, _data) == ONE_RECEIVED, "Target contract onTokenReceived failed"); return true; } return false; }
/** * @dev Safely transfers the ownership of a given token ID to another address * If the target address is a contract, it must implement `onERC721Received`, * which is called upon a safe transfer, and return the magic value `bytes4(0x150b7a03)`; * otherwise, the transfer is reverted. * Requires the msg sender to be the owner, approved, or operator * @param _to address to receive the tokens. Must be a MenloTokenReceiver based contract * @param _value uint256 number of tokens to transfer * @param _action uint256 action to perform in target _to contract * @param _data bytes data to send along with a safe transfer check **/
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://6227e3dd53f44d457ce57232ba52d472334fd2a58e36680bc74401c4c15591b0
{ "func_code_index": [ 3185, 3534 ] }
9,971
MenloTokenSale
MenloTokenSale.sol
0x1c9a4895ca840b25e83c472d5aa7e59f22a027fe
Solidity
MenloTokenReceiver
contract MenloTokenReceiver { /* * @dev Address of the MenloToken contract */ MenloToken token; constructor(MenloToken _tokenContract) public { token = _tokenContract; } /** * @dev Magic value to be returned upon successful reception of Menlo Tokens */ bytes4 internal constant ONE_RECEIVED = 0x150b7a03; /** * @dev Throws if called by any account other than the Menlo Token contract. */ modifier onlyTokenContract() { require(msg.sender == address(token)); _; } /** * @notice Handle the receipt of Menlo Tokens * @dev The MenloToken contract calls this function on the recipient * after a `transferAndCall`. This function MAY throw to revert and reject the * transfer. Return of other than the magic value MUST result in the * transaction being reverted. * Warning: this function must call the onlyTokenContract modifier to trust * the transfer took place * @param _from The address which previously owned the token * @param _value Number of tokens that were transfered * @param _action Used to define enumeration of possible functions to call * @param _data Additional data with no specified format * @return `bytes4(0x150b7a03)` */ function onTokenReceived( address _from, uint256 _value, uint256 _action, bytes _data ) public /* onlyTokenContract */ returns(bytes4); }
onTokenReceived
function onTokenReceived( address _from, uint256 _value, uint256 _action, bytes _data ) public /* onlyTokenContract */ returns(bytes4);
/** * @notice Handle the receipt of Menlo Tokens * @dev The MenloToken contract calls this function on the recipient * after a `transferAndCall`. This function MAY throw to revert and reject the * transfer. Return of other than the magic value MUST result in the * transaction being reverted. * Warning: this function must call the onlyTokenContract modifier to trust * the transfer took place * @param _from The address which previously owned the token * @param _value Number of tokens that were transfered * @param _action Used to define enumeration of possible functions to call * @param _data Additional data with no specified format * @return `bytes4(0x150b7a03)` */
NatSpecMultiLine
v0.4.24+commit.e67f0147
bzzr://6227e3dd53f44d457ce57232ba52d472334fd2a58e36680bc74401c4c15591b0
{ "func_code_index": [ 1337, 1518 ] }
9,972
MenloTokenSale
MenloTokenSale.sol
0x1c9a4895ca840b25e83c472d5aa7e59f22a027fe
Solidity
MenloTokenSale
contract MenloTokenSale is MenloSaleBase { // Timestamps for the bonus periods, set in the constructor uint256 public HOUR1; uint256 public WEEK1; uint256 public WEEK2; uint256 public WEEK3; uint256 public WEEK4; constructor( MenloToken _token, uint256 _startTime, uint256 _endTime, uint256 _cap, address _wallet ) MenloSaleBase( _token, _startTime, _endTime, _cap, _wallet ) public { HOUR1 = startTime + 1 hours; WEEK1 = startTime + 1 weeks; WEEK2 = startTime + 2 weeks; WEEK3 = startTime + 3 weeks; } // Hour 1: 30% Bonus // Week 1: 15% Bonus // Week 2: 10% Bonus // Week 3: 5% Bonus // Week 4: 0% Bonus function calculateBonusRate() public view returns (uint256) { uint256 _bonusRate = 12000; uint256 _currentTime = getBlockTimestamp(); if (_currentTime > startTime && _currentTime <= HOUR1) { _bonusRate = 15600; } else if (_currentTime <= WEEK1) { _bonusRate = 13800; // week 1 } else if (_currentTime <= WEEK2) { _bonusRate = 13200; // week 2 } else if (_currentTime <= WEEK3) { _bonusRate = 12600; // week 3 } return _bonusRate; } function buyTokensHook(uint256 _tokens) internal { token.transfer(msg.sender, _tokens); emit TokenRedeem(msg.sender, _tokens); } }
calculateBonusRate
function calculateBonusRate() public view returns (uint256) { uint256 _bonusRate = 12000; uint256 _currentTime = getBlockTimestamp(); if (_currentTime > startTime && _currentTime <= HOUR1) { _bonusRate = 15600; } else if (_currentTime <= WEEK1) { _bonusRate = 13800; // week 1 } else if (_currentTime <= WEEK2) { _bonusRate = 13200; // week 2 } else if (_currentTime <= WEEK3) { _bonusRate = 12600; // week 3 } return _bonusRate; }
// Hour 1: 30% Bonus // Week 1: 15% Bonus // Week 2: 10% Bonus // Week 3: 5% Bonus // Week 4: 0% Bonus
LineComment
v0.4.24+commit.e67f0147
bzzr://6227e3dd53f44d457ce57232ba52d472334fd2a58e36680bc74401c4c15591b0
{ "func_code_index": [ 728, 1239 ] }
9,973
SCTToken
SCTToken.sol
0x496d00092e63608bae5ba52d08bab580d8509615
Solidity
SafeMath
contract SafeMath { uint256 constant private MAX_UINT256 = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; /** * Add two uint256 values, throw in case of overflow. * * @param x first value to add * @param y second value to add * @return x + y */ function safeAdd (uint256 x, uint256 y) pure internal returns (uint256 z) { assert (x <= MAX_UINT256 - y); return x + y; } /** * Subtract one uint256 value from another, throw in case of underflow. * * @param x value to subtract from * @param y value to subtract * @return x - y */ function safeSub (uint256 x, uint256 y) pure internal returns (uint256 z) { assert (x >= y); return x - y; } /** * Multiply two uint256 values, throw in case of overflow. * * @param x first value to multiply * @param y second value to multiply * @return x * y */ function safeMul (uint256 x, uint256 y) pure internal returns (uint256 z) { if (y == 0) return 0; // Prevent division by zero at the next line assert (x <= MAX_UINT256 / y); return x * y; } }
/** * Provides methods to safely add, subtract and multiply uint256 numbers. */
NatSpecMultiLine
safeAdd
function safeAdd (uint256 x, uint256 y) pure internal returns (uint256 z) { assert (x <= MAX_UINT256 - y); return x + y; }
/** * Add two uint256 values, throw in case of overflow. * * @param x first value to add * @param y second value to add * @return x + y */
NatSpecMultiLine
v0.4.26+commit.4563c3fc
MIT
bzzr://973479d5005c09b517f485895207c838a621123b5fa0024729e4c5583ad46f81
{ "func_code_index": [ 304, 448 ] }
9,974
SCTToken
SCTToken.sol
0x496d00092e63608bae5ba52d08bab580d8509615
Solidity
SafeMath
contract SafeMath { uint256 constant private MAX_UINT256 = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; /** * Add two uint256 values, throw in case of overflow. * * @param x first value to add * @param y second value to add * @return x + y */ function safeAdd (uint256 x, uint256 y) pure internal returns (uint256 z) { assert (x <= MAX_UINT256 - y); return x + y; } /** * Subtract one uint256 value from another, throw in case of underflow. * * @param x value to subtract from * @param y value to subtract * @return x - y */ function safeSub (uint256 x, uint256 y) pure internal returns (uint256 z) { assert (x >= y); return x - y; } /** * Multiply two uint256 values, throw in case of overflow. * * @param x first value to multiply * @param y second value to multiply * @return x * y */ function safeMul (uint256 x, uint256 y) pure internal returns (uint256 z) { if (y == 0) return 0; // Prevent division by zero at the next line assert (x <= MAX_UINT256 / y); return x * y; } }
/** * Provides methods to safely add, subtract and multiply uint256 numbers. */
NatSpecMultiLine
safeSub
function safeSub (uint256 x, uint256 y) pure internal returns (uint256 z) { assert (x >= y); return x - y; }
/** * Subtract one uint256 value from another, throw in case of underflow. * * @param x value to subtract from * @param y value to subtract * @return x - y */
NatSpecMultiLine
v0.4.26+commit.4563c3fc
MIT
bzzr://973479d5005c09b517f485895207c838a621123b5fa0024729e4c5583ad46f81
{ "func_code_index": [ 637, 767 ] }
9,975
SCTToken
SCTToken.sol
0x496d00092e63608bae5ba52d08bab580d8509615
Solidity
SafeMath
contract SafeMath { uint256 constant private MAX_UINT256 = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; /** * Add two uint256 values, throw in case of overflow. * * @param x first value to add * @param y second value to add * @return x + y */ function safeAdd (uint256 x, uint256 y) pure internal returns (uint256 z) { assert (x <= MAX_UINT256 - y); return x + y; } /** * Subtract one uint256 value from another, throw in case of underflow. * * @param x value to subtract from * @param y value to subtract * @return x - y */ function safeSub (uint256 x, uint256 y) pure internal returns (uint256 z) { assert (x >= y); return x - y; } /** * Multiply two uint256 values, throw in case of overflow. * * @param x first value to multiply * @param y second value to multiply * @return x * y */ function safeMul (uint256 x, uint256 y) pure internal returns (uint256 z) { if (y == 0) return 0; // Prevent division by zero at the next line assert (x <= MAX_UINT256 / y); return x * y; } }
/** * Provides methods to safely add, subtract and multiply uint256 numbers. */
NatSpecMultiLine
safeMul
function safeMul (uint256 x, uint256 y) pure internal returns (uint256 z) { if (y == 0) return 0; // Prevent division by zero at the next line assert (x <= MAX_UINT256 / y); return x * y; }
/** * Multiply two uint256 values, throw in case of overflow. * * @param x first value to multiply * @param y second value to multiply * @return x * y */
NatSpecMultiLine
v0.4.26+commit.4563c3fc
MIT
bzzr://973479d5005c09b517f485895207c838a621123b5fa0024729e4c5583ad46f81
{ "func_code_index": [ 951, 1167 ] }
9,976
SCTToken
SCTToken.sol
0x496d00092e63608bae5ba52d08bab580d8509615
Solidity
Token
contract Token { /** * Get total number of tokens in circulation. * * @return total number of tokens in circulation */ function totalSupply () public view returns (uint256 supply); /** * Get number of tokens currently belonging to given owner. * * @param _owner address to get number of tokens currently belonging to the * owner of * @return number of tokens currently belonging to the owner of given address */ function balanceOf (address _owner) public view returns (uint256 balance); /** * Transfer given number of tokens from message sender to given recipient. * * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise */ function transfer (address _to, uint256 _value) public returns (bool success); /** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise */ function transferFrom (address _from, address _to, uint256 _value) public returns (bool success); /** * Allow given spender to transfer given number of tokens from message sender. * * @param _spender address to allow the owner of to transfer tokens from * message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */ function approve (address _spender, uint256 _value) public returns (bool success); /** * Tell how many tokens given spender is currently allowed to transfer from * given owner. * * @param _owner address to get number of tokens allowed to be transferred * from the owner of * @param _spender address to get number of tokens allowed to be transferred * by the owner of * @return number of tokens given spender is currently allowed to transfer * from given owner */ function allowance (address _owner, address _spender) public view returns (uint256 remaining); /** * Logged when tokens were transferred from one owner to another. * * @param _from address of the owner, tokens were transferred from * @param _to address of the owner, tokens were transferred to * @param _value number of tokens transferred */ event Transfer (address indexed _from, address indexed _to, uint256 _value); /** * Logged when owner approved his tokens to be transferred by some spender. * * @param _owner owner who approved his tokens to be transferred * @param _spender spender who were allowed to transfer the tokens belonging * to the owner * @param _value number of tokens belonging to the owner, approved to be * transferred by the spender */ event Approval ( address indexed _owner, address indexed _spender, uint256 _value); }
/** * ERC-20 standard token interface, as defined * <a href="https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md">here</a>. */
NatSpecMultiLine
totalSupply
function totalSupply () public view returns (uint256 supply);
/** * Get total number of tokens in circulation. * * @return total number of tokens in circulation */
NatSpecMultiLine
v0.4.26+commit.4563c3fc
MIT
bzzr://973479d5005c09b517f485895207c838a621123b5fa0024729e4c5583ad46f81
{ "func_code_index": [ 139, 203 ] }
9,977
SCTToken
SCTToken.sol
0x496d00092e63608bae5ba52d08bab580d8509615
Solidity
Token
contract Token { /** * Get total number of tokens in circulation. * * @return total number of tokens in circulation */ function totalSupply () public view returns (uint256 supply); /** * Get number of tokens currently belonging to given owner. * * @param _owner address to get number of tokens currently belonging to the * owner of * @return number of tokens currently belonging to the owner of given address */ function balanceOf (address _owner) public view returns (uint256 balance); /** * Transfer given number of tokens from message sender to given recipient. * * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise */ function transfer (address _to, uint256 _value) public returns (bool success); /** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise */ function transferFrom (address _from, address _to, uint256 _value) public returns (bool success); /** * Allow given spender to transfer given number of tokens from message sender. * * @param _spender address to allow the owner of to transfer tokens from * message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */ function approve (address _spender, uint256 _value) public returns (bool success); /** * Tell how many tokens given spender is currently allowed to transfer from * given owner. * * @param _owner address to get number of tokens allowed to be transferred * from the owner of * @param _spender address to get number of tokens allowed to be transferred * by the owner of * @return number of tokens given spender is currently allowed to transfer * from given owner */ function allowance (address _owner, address _spender) public view returns (uint256 remaining); /** * Logged when tokens were transferred from one owner to another. * * @param _from address of the owner, tokens were transferred from * @param _to address of the owner, tokens were transferred to * @param _value number of tokens transferred */ event Transfer (address indexed _from, address indexed _to, uint256 _value); /** * Logged when owner approved his tokens to be transferred by some spender. * * @param _owner owner who approved his tokens to be transferred * @param _spender spender who were allowed to transfer the tokens belonging * to the owner * @param _value number of tokens belonging to the owner, approved to be * transferred by the spender */ event Approval ( address indexed _owner, address indexed _spender, uint256 _value); }
/** * ERC-20 standard token interface, as defined * <a href="https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md">here</a>. */
NatSpecMultiLine
balanceOf
function balanceOf (address _owner) public view returns (uint256 balance);
/** * Get number of tokens currently belonging to given owner. * * @param _owner address to get number of tokens currently belonging to the * owner of * @return number of tokens currently belonging to the owner of given address */
NatSpecMultiLine
v0.4.26+commit.4563c3fc
MIT
bzzr://973479d5005c09b517f485895207c838a621123b5fa0024729e4c5583ad46f81
{ "func_code_index": [ 471, 548 ] }
9,978
SCTToken
SCTToken.sol
0x496d00092e63608bae5ba52d08bab580d8509615
Solidity
Token
contract Token { /** * Get total number of tokens in circulation. * * @return total number of tokens in circulation */ function totalSupply () public view returns (uint256 supply); /** * Get number of tokens currently belonging to given owner. * * @param _owner address to get number of tokens currently belonging to the * owner of * @return number of tokens currently belonging to the owner of given address */ function balanceOf (address _owner) public view returns (uint256 balance); /** * Transfer given number of tokens from message sender to given recipient. * * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise */ function transfer (address _to, uint256 _value) public returns (bool success); /** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise */ function transferFrom (address _from, address _to, uint256 _value) public returns (bool success); /** * Allow given spender to transfer given number of tokens from message sender. * * @param _spender address to allow the owner of to transfer tokens from * message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */ function approve (address _spender, uint256 _value) public returns (bool success); /** * Tell how many tokens given spender is currently allowed to transfer from * given owner. * * @param _owner address to get number of tokens allowed to be transferred * from the owner of * @param _spender address to get number of tokens allowed to be transferred * by the owner of * @return number of tokens given spender is currently allowed to transfer * from given owner */ function allowance (address _owner, address _spender) public view returns (uint256 remaining); /** * Logged when tokens were transferred from one owner to another. * * @param _from address of the owner, tokens were transferred from * @param _to address of the owner, tokens were transferred to * @param _value number of tokens transferred */ event Transfer (address indexed _from, address indexed _to, uint256 _value); /** * Logged when owner approved his tokens to be transferred by some spender. * * @param _owner owner who approved his tokens to be transferred * @param _spender spender who were allowed to transfer the tokens belonging * to the owner * @param _value number of tokens belonging to the owner, approved to be * transferred by the spender */ event Approval ( address indexed _owner, address indexed _spender, uint256 _value); }
/** * ERC-20 standard token interface, as defined * <a href="https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md">here</a>. */
NatSpecMultiLine
transfer
function transfer (address _to, uint256 _value) public returns (bool success);
/** * Transfer given number of tokens from message sender to given recipient. * * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise */
NatSpecMultiLine
v0.4.26+commit.4563c3fc
MIT
bzzr://973479d5005c09b517f485895207c838a621123b5fa0024729e4c5583ad46f81
{ "func_code_index": [ 864, 948 ] }
9,979
SCTToken
SCTToken.sol
0x496d00092e63608bae5ba52d08bab580d8509615
Solidity
Token
contract Token { /** * Get total number of tokens in circulation. * * @return total number of tokens in circulation */ function totalSupply () public view returns (uint256 supply); /** * Get number of tokens currently belonging to given owner. * * @param _owner address to get number of tokens currently belonging to the * owner of * @return number of tokens currently belonging to the owner of given address */ function balanceOf (address _owner) public view returns (uint256 balance); /** * Transfer given number of tokens from message sender to given recipient. * * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise */ function transfer (address _to, uint256 _value) public returns (bool success); /** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise */ function transferFrom (address _from, address _to, uint256 _value) public returns (bool success); /** * Allow given spender to transfer given number of tokens from message sender. * * @param _spender address to allow the owner of to transfer tokens from * message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */ function approve (address _spender, uint256 _value) public returns (bool success); /** * Tell how many tokens given spender is currently allowed to transfer from * given owner. * * @param _owner address to get number of tokens allowed to be transferred * from the owner of * @param _spender address to get number of tokens allowed to be transferred * by the owner of * @return number of tokens given spender is currently allowed to transfer * from given owner */ function allowance (address _owner, address _spender) public view returns (uint256 remaining); /** * Logged when tokens were transferred from one owner to another. * * @param _from address of the owner, tokens were transferred from * @param _to address of the owner, tokens were transferred to * @param _value number of tokens transferred */ event Transfer (address indexed _from, address indexed _to, uint256 _value); /** * Logged when owner approved his tokens to be transferred by some spender. * * @param _owner owner who approved his tokens to be transferred * @param _spender spender who were allowed to transfer the tokens belonging * to the owner * @param _value number of tokens belonging to the owner, approved to be * transferred by the spender */ event Approval ( address indexed _owner, address indexed _spender, uint256 _value); }
/** * ERC-20 standard token interface, as defined * <a href="https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md">here</a>. */
NatSpecMultiLine
transferFrom
function transferFrom (address _from, address _to, uint256 _value) public returns (bool success);
/** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise */
NatSpecMultiLine
v0.4.26+commit.4563c3fc
MIT
bzzr://973479d5005c09b517f485895207c838a621123b5fa0024729e4c5583ad46f81
{ "func_code_index": [ 1344, 1447 ] }
9,980
SCTToken
SCTToken.sol
0x496d00092e63608bae5ba52d08bab580d8509615
Solidity
Token
contract Token { /** * Get total number of tokens in circulation. * * @return total number of tokens in circulation */ function totalSupply () public view returns (uint256 supply); /** * Get number of tokens currently belonging to given owner. * * @param _owner address to get number of tokens currently belonging to the * owner of * @return number of tokens currently belonging to the owner of given address */ function balanceOf (address _owner) public view returns (uint256 balance); /** * Transfer given number of tokens from message sender to given recipient. * * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise */ function transfer (address _to, uint256 _value) public returns (bool success); /** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise */ function transferFrom (address _from, address _to, uint256 _value) public returns (bool success); /** * Allow given spender to transfer given number of tokens from message sender. * * @param _spender address to allow the owner of to transfer tokens from * message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */ function approve (address _spender, uint256 _value) public returns (bool success); /** * Tell how many tokens given spender is currently allowed to transfer from * given owner. * * @param _owner address to get number of tokens allowed to be transferred * from the owner of * @param _spender address to get number of tokens allowed to be transferred * by the owner of * @return number of tokens given spender is currently allowed to transfer * from given owner */ function allowance (address _owner, address _spender) public view returns (uint256 remaining); /** * Logged when tokens were transferred from one owner to another. * * @param _from address of the owner, tokens were transferred from * @param _to address of the owner, tokens were transferred to * @param _value number of tokens transferred */ event Transfer (address indexed _from, address indexed _to, uint256 _value); /** * Logged when owner approved his tokens to be transferred by some spender. * * @param _owner owner who approved his tokens to be transferred * @param _spender spender who were allowed to transfer the tokens belonging * to the owner * @param _value number of tokens belonging to the owner, approved to be * transferred by the spender */ event Approval ( address indexed _owner, address indexed _spender, uint256 _value); }
/** * ERC-20 standard token interface, as defined * <a href="https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md">here</a>. */
NatSpecMultiLine
approve
function approve (address _spender, uint256 _value) public returns (bool success);
/** * Allow given spender to transfer given number of tokens from message sender. * * @param _spender address to allow the owner of to transfer tokens from * message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */
NatSpecMultiLine
v0.4.26+commit.4563c3fc
MIT
bzzr://973479d5005c09b517f485895207c838a621123b5fa0024729e4c5583ad46f81
{ "func_code_index": [ 1794, 1882 ] }
9,981
SCTToken
SCTToken.sol
0x496d00092e63608bae5ba52d08bab580d8509615
Solidity
Token
contract Token { /** * Get total number of tokens in circulation. * * @return total number of tokens in circulation */ function totalSupply () public view returns (uint256 supply); /** * Get number of tokens currently belonging to given owner. * * @param _owner address to get number of tokens currently belonging to the * owner of * @return number of tokens currently belonging to the owner of given address */ function balanceOf (address _owner) public view returns (uint256 balance); /** * Transfer given number of tokens from message sender to given recipient. * * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise */ function transfer (address _to, uint256 _value) public returns (bool success); /** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise */ function transferFrom (address _from, address _to, uint256 _value) public returns (bool success); /** * Allow given spender to transfer given number of tokens from message sender. * * @param _spender address to allow the owner of to transfer tokens from * message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */ function approve (address _spender, uint256 _value) public returns (bool success); /** * Tell how many tokens given spender is currently allowed to transfer from * given owner. * * @param _owner address to get number of tokens allowed to be transferred * from the owner of * @param _spender address to get number of tokens allowed to be transferred * by the owner of * @return number of tokens given spender is currently allowed to transfer * from given owner */ function allowance (address _owner, address _spender) public view returns (uint256 remaining); /** * Logged when tokens were transferred from one owner to another. * * @param _from address of the owner, tokens were transferred from * @param _to address of the owner, tokens were transferred to * @param _value number of tokens transferred */ event Transfer (address indexed _from, address indexed _to, uint256 _value); /** * Logged when owner approved his tokens to be transferred by some spender. * * @param _owner owner who approved his tokens to be transferred * @param _spender spender who were allowed to transfer the tokens belonging * to the owner * @param _value number of tokens belonging to the owner, approved to be * transferred by the spender */ event Approval ( address indexed _owner, address indexed _spender, uint256 _value); }
/** * ERC-20 standard token interface, as defined * <a href="https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md">here</a>. */
NatSpecMultiLine
allowance
function allowance (address _owner, address _spender) public view returns (uint256 remaining);
/** * Tell how many tokens given spender is currently allowed to transfer from * given owner. * * @param _owner address to get number of tokens allowed to be transferred * from the owner of * @param _spender address to get number of tokens allowed to be transferred * by the owner of * @return number of tokens given spender is currently allowed to transfer * from given owner */
NatSpecMultiLine
v0.4.26+commit.4563c3fc
MIT
bzzr://973479d5005c09b517f485895207c838a621123b5fa0024729e4c5583ad46f81
{ "func_code_index": [ 2330, 2430 ] }
9,982
SCTToken
SCTToken.sol
0x496d00092e63608bae5ba52d08bab580d8509615
Solidity
AbstractToken
contract AbstractToken is Token, SafeMath { /** * Create new Abstract Token contract. */ constructor () public { // Do nothing } /** * Get number of tokens currently belonging to given owner. * * @param _owner address to get number of tokens currently belonging to the * owner of * @return number of tokens currently belonging to the owner of given address */ function balanceOf (address _owner) public view returns (uint256 balance) { return accounts [_owner]; } /** * Transfer given number of tokens from message sender to given recipient. * * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise */ function transfer (address _to, uint256 _value) public returns (bool success) { uint256 fromBalance = accounts [msg.sender]; if (fromBalance < _value) return false; if (_value > 0 && msg.sender != _to) { accounts [msg.sender] = safeSub (fromBalance, _value); accounts [_to] = safeAdd (accounts [_to], _value); } emit Transfer (msg.sender, _to, _value); return true; } /** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise */ function transferFrom (address _from, address _to, uint256 _value) public returns (bool success) { uint256 spenderAllowance = allowances [_from][msg.sender]; if (spenderAllowance < _value) return false; uint256 fromBalance = accounts [_from]; if (fromBalance < _value) return false; allowances [_from][msg.sender] = safeSub (spenderAllowance, _value); if (_value > 0 && _from != _to) { accounts [_from] = safeSub (fromBalance, _value); accounts [_to] = safeAdd (accounts [_to], _value); } emit Transfer (_from, _to, _value); return true; } /** * Allow given spender to transfer given number of tokens from message sender. * * @param _spender address to allow the owner of to transfer tokens from * message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */ function approve (address _spender, uint256 _value) public returns (bool success) { allowances [msg.sender][_spender] = _value; emit Approval (msg.sender, _spender, _value); return true; } /** * Tell how many tokens given spender is currently allowed to transfer from * given owner. * * @param _owner address to get number of tokens allowed to be transferred * from the owner of * @param _spender address to get number of tokens allowed to be transferred * by the owner of * @return number of tokens given spender is currently allowed to transfer * from given owner */ function allowance (address _owner, address _spender) public view returns (uint256 remaining) { return allowances [_owner][_spender]; } /** * Mapping from addresses of token holders to the numbers of tokens belonging * to these token holders. */ mapping (address => uint256) internal accounts; /** * Mapping from addresses of token holders to the mapping of addresses of * spenders to the allowances set by these token holders to these spenders. */ mapping (address => mapping (address => uint256)) internal allowances; }
/** * Abstract Token Smart Contract that could be used as a base contract for * ERC-20 token contracts. */
NatSpecMultiLine
balanceOf
function balanceOf (address _owner) public view returns (uint256 balance) { return accounts [_owner]; }
/** * Get number of tokens currently belonging to given owner. * * @param _owner address to get number of tokens currently belonging to the * owner of * @return number of tokens currently belonging to the owner of given address */
NatSpecMultiLine
v0.4.26+commit.4563c3fc
MIT
bzzr://973479d5005c09b517f485895207c838a621123b5fa0024729e4c5583ad46f81
{ "func_code_index": [ 419, 533 ] }
9,983
SCTToken
SCTToken.sol
0x496d00092e63608bae5ba52d08bab580d8509615
Solidity
AbstractToken
contract AbstractToken is Token, SafeMath { /** * Create new Abstract Token contract. */ constructor () public { // Do nothing } /** * Get number of tokens currently belonging to given owner. * * @param _owner address to get number of tokens currently belonging to the * owner of * @return number of tokens currently belonging to the owner of given address */ function balanceOf (address _owner) public view returns (uint256 balance) { return accounts [_owner]; } /** * Transfer given number of tokens from message sender to given recipient. * * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise */ function transfer (address _to, uint256 _value) public returns (bool success) { uint256 fromBalance = accounts [msg.sender]; if (fromBalance < _value) return false; if (_value > 0 && msg.sender != _to) { accounts [msg.sender] = safeSub (fromBalance, _value); accounts [_to] = safeAdd (accounts [_to], _value); } emit Transfer (msg.sender, _to, _value); return true; } /** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise */ function transferFrom (address _from, address _to, uint256 _value) public returns (bool success) { uint256 spenderAllowance = allowances [_from][msg.sender]; if (spenderAllowance < _value) return false; uint256 fromBalance = accounts [_from]; if (fromBalance < _value) return false; allowances [_from][msg.sender] = safeSub (spenderAllowance, _value); if (_value > 0 && _from != _to) { accounts [_from] = safeSub (fromBalance, _value); accounts [_to] = safeAdd (accounts [_to], _value); } emit Transfer (_from, _to, _value); return true; } /** * Allow given spender to transfer given number of tokens from message sender. * * @param _spender address to allow the owner of to transfer tokens from * message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */ function approve (address _spender, uint256 _value) public returns (bool success) { allowances [msg.sender][_spender] = _value; emit Approval (msg.sender, _spender, _value); return true; } /** * Tell how many tokens given spender is currently allowed to transfer from * given owner. * * @param _owner address to get number of tokens allowed to be transferred * from the owner of * @param _spender address to get number of tokens allowed to be transferred * by the owner of * @return number of tokens given spender is currently allowed to transfer * from given owner */ function allowance (address _owner, address _spender) public view returns (uint256 remaining) { return allowances [_owner][_spender]; } /** * Mapping from addresses of token holders to the numbers of tokens belonging * to these token holders. */ mapping (address => uint256) internal accounts; /** * Mapping from addresses of token holders to the mapping of addresses of * spenders to the allowances set by these token holders to these spenders. */ mapping (address => mapping (address => uint256)) internal allowances; }
/** * Abstract Token Smart Contract that could be used as a base contract for * ERC-20 token contracts. */
NatSpecMultiLine
transfer
function transfer (address _to, uint256 _value) public returns (bool success) { uint256 fromBalance = accounts [msg.sender]; if (fromBalance < _value) return false; if (_value > 0 && msg.sender != _to) { accounts [msg.sender] = safeSub (fromBalance, _value); accounts [_to] = safeAdd (accounts [_to], _value); } emit Transfer (msg.sender, _to, _value); return true; }
/** * Transfer given number of tokens from message sender to given recipient. * * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise */
NatSpecMultiLine
v0.4.26+commit.4563c3fc
MIT
bzzr://973479d5005c09b517f485895207c838a621123b5fa0024729e4c5583ad46f81
{ "func_code_index": [ 849, 1269 ] }
9,984
SCTToken
SCTToken.sol
0x496d00092e63608bae5ba52d08bab580d8509615
Solidity
AbstractToken
contract AbstractToken is Token, SafeMath { /** * Create new Abstract Token contract. */ constructor () public { // Do nothing } /** * Get number of tokens currently belonging to given owner. * * @param _owner address to get number of tokens currently belonging to the * owner of * @return number of tokens currently belonging to the owner of given address */ function balanceOf (address _owner) public view returns (uint256 balance) { return accounts [_owner]; } /** * Transfer given number of tokens from message sender to given recipient. * * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise */ function transfer (address _to, uint256 _value) public returns (bool success) { uint256 fromBalance = accounts [msg.sender]; if (fromBalance < _value) return false; if (_value > 0 && msg.sender != _to) { accounts [msg.sender] = safeSub (fromBalance, _value); accounts [_to] = safeAdd (accounts [_to], _value); } emit Transfer (msg.sender, _to, _value); return true; } /** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise */ function transferFrom (address _from, address _to, uint256 _value) public returns (bool success) { uint256 spenderAllowance = allowances [_from][msg.sender]; if (spenderAllowance < _value) return false; uint256 fromBalance = accounts [_from]; if (fromBalance < _value) return false; allowances [_from][msg.sender] = safeSub (spenderAllowance, _value); if (_value > 0 && _from != _to) { accounts [_from] = safeSub (fromBalance, _value); accounts [_to] = safeAdd (accounts [_to], _value); } emit Transfer (_from, _to, _value); return true; } /** * Allow given spender to transfer given number of tokens from message sender. * * @param _spender address to allow the owner of to transfer tokens from * message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */ function approve (address _spender, uint256 _value) public returns (bool success) { allowances [msg.sender][_spender] = _value; emit Approval (msg.sender, _spender, _value); return true; } /** * Tell how many tokens given spender is currently allowed to transfer from * given owner. * * @param _owner address to get number of tokens allowed to be transferred * from the owner of * @param _spender address to get number of tokens allowed to be transferred * by the owner of * @return number of tokens given spender is currently allowed to transfer * from given owner */ function allowance (address _owner, address _spender) public view returns (uint256 remaining) { return allowances [_owner][_spender]; } /** * Mapping from addresses of token holders to the numbers of tokens belonging * to these token holders. */ mapping (address => uint256) internal accounts; /** * Mapping from addresses of token holders to the mapping of addresses of * spenders to the allowances set by these token holders to these spenders. */ mapping (address => mapping (address => uint256)) internal allowances; }
/** * Abstract Token Smart Contract that could be used as a base contract for * ERC-20 token contracts. */
NatSpecMultiLine
transferFrom
function transferFrom (address _from, address _to, uint256 _value) public returns (bool success) { uint256 spenderAllowance = allowances [_from][msg.sender]; if (spenderAllowance < _value) return false; uint256 fromBalance = accounts [_from]; if (fromBalance < _value) return false; allowances [_from][msg.sender] = safeSub (spenderAllowance, _value); if (_value > 0 && _from != _to) { accounts [_from] = safeSub (fromBalance, _value); accounts [_to] = safeAdd (accounts [_to], _value); } emit Transfer (_from, _to, _value); return true; }
/** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise */
NatSpecMultiLine
v0.4.26+commit.4563c3fc
MIT
bzzr://973479d5005c09b517f485895207c838a621123b5fa0024729e4c5583ad46f81
{ "func_code_index": [ 1665, 2283 ] }
9,985
SCTToken
SCTToken.sol
0x496d00092e63608bae5ba52d08bab580d8509615
Solidity
AbstractToken
contract AbstractToken is Token, SafeMath { /** * Create new Abstract Token contract. */ constructor () public { // Do nothing } /** * Get number of tokens currently belonging to given owner. * * @param _owner address to get number of tokens currently belonging to the * owner of * @return number of tokens currently belonging to the owner of given address */ function balanceOf (address _owner) public view returns (uint256 balance) { return accounts [_owner]; } /** * Transfer given number of tokens from message sender to given recipient. * * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise */ function transfer (address _to, uint256 _value) public returns (bool success) { uint256 fromBalance = accounts [msg.sender]; if (fromBalance < _value) return false; if (_value > 0 && msg.sender != _to) { accounts [msg.sender] = safeSub (fromBalance, _value); accounts [_to] = safeAdd (accounts [_to], _value); } emit Transfer (msg.sender, _to, _value); return true; } /** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise */ function transferFrom (address _from, address _to, uint256 _value) public returns (bool success) { uint256 spenderAllowance = allowances [_from][msg.sender]; if (spenderAllowance < _value) return false; uint256 fromBalance = accounts [_from]; if (fromBalance < _value) return false; allowances [_from][msg.sender] = safeSub (spenderAllowance, _value); if (_value > 0 && _from != _to) { accounts [_from] = safeSub (fromBalance, _value); accounts [_to] = safeAdd (accounts [_to], _value); } emit Transfer (_from, _to, _value); return true; } /** * Allow given spender to transfer given number of tokens from message sender. * * @param _spender address to allow the owner of to transfer tokens from * message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */ function approve (address _spender, uint256 _value) public returns (bool success) { allowances [msg.sender][_spender] = _value; emit Approval (msg.sender, _spender, _value); return true; } /** * Tell how many tokens given spender is currently allowed to transfer from * given owner. * * @param _owner address to get number of tokens allowed to be transferred * from the owner of * @param _spender address to get number of tokens allowed to be transferred * by the owner of * @return number of tokens given spender is currently allowed to transfer * from given owner */ function allowance (address _owner, address _spender) public view returns (uint256 remaining) { return allowances [_owner][_spender]; } /** * Mapping from addresses of token holders to the numbers of tokens belonging * to these token holders. */ mapping (address => uint256) internal accounts; /** * Mapping from addresses of token holders to the mapping of addresses of * spenders to the allowances set by these token holders to these spenders. */ mapping (address => mapping (address => uint256)) internal allowances; }
/** * Abstract Token Smart Contract that could be used as a base contract for * ERC-20 token contracts. */
NatSpecMultiLine
approve
function approve (address _spender, uint256 _value) public returns (bool success) { allowances [msg.sender][_spender] = _value; emit Approval (msg.sender, _spender, _value); return true; }
/** * Allow given spender to transfer given number of tokens from message sender. * * @param _spender address to allow the owner of to transfer tokens from * message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */
NatSpecMultiLine
v0.4.26+commit.4563c3fc
MIT
bzzr://973479d5005c09b517f485895207c838a621123b5fa0024729e4c5583ad46f81
{ "func_code_index": [ 2630, 2844 ] }
9,986
SCTToken
SCTToken.sol
0x496d00092e63608bae5ba52d08bab580d8509615
Solidity
AbstractToken
contract AbstractToken is Token, SafeMath { /** * Create new Abstract Token contract. */ constructor () public { // Do nothing } /** * Get number of tokens currently belonging to given owner. * * @param _owner address to get number of tokens currently belonging to the * owner of * @return number of tokens currently belonging to the owner of given address */ function balanceOf (address _owner) public view returns (uint256 balance) { return accounts [_owner]; } /** * Transfer given number of tokens from message sender to given recipient. * * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise */ function transfer (address _to, uint256 _value) public returns (bool success) { uint256 fromBalance = accounts [msg.sender]; if (fromBalance < _value) return false; if (_value > 0 && msg.sender != _to) { accounts [msg.sender] = safeSub (fromBalance, _value); accounts [_to] = safeAdd (accounts [_to], _value); } emit Transfer (msg.sender, _to, _value); return true; } /** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise */ function transferFrom (address _from, address _to, uint256 _value) public returns (bool success) { uint256 spenderAllowance = allowances [_from][msg.sender]; if (spenderAllowance < _value) return false; uint256 fromBalance = accounts [_from]; if (fromBalance < _value) return false; allowances [_from][msg.sender] = safeSub (spenderAllowance, _value); if (_value > 0 && _from != _to) { accounts [_from] = safeSub (fromBalance, _value); accounts [_to] = safeAdd (accounts [_to], _value); } emit Transfer (_from, _to, _value); return true; } /** * Allow given spender to transfer given number of tokens from message sender. * * @param _spender address to allow the owner of to transfer tokens from * message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */ function approve (address _spender, uint256 _value) public returns (bool success) { allowances [msg.sender][_spender] = _value; emit Approval (msg.sender, _spender, _value); return true; } /** * Tell how many tokens given spender is currently allowed to transfer from * given owner. * * @param _owner address to get number of tokens allowed to be transferred * from the owner of * @param _spender address to get number of tokens allowed to be transferred * by the owner of * @return number of tokens given spender is currently allowed to transfer * from given owner */ function allowance (address _owner, address _spender) public view returns (uint256 remaining) { return allowances [_owner][_spender]; } /** * Mapping from addresses of token holders to the numbers of tokens belonging * to these token holders. */ mapping (address => uint256) internal accounts; /** * Mapping from addresses of token holders to the mapping of addresses of * spenders to the allowances set by these token holders to these spenders. */ mapping (address => mapping (address => uint256)) internal allowances; }
/** * Abstract Token Smart Contract that could be used as a base contract for * ERC-20 token contracts. */
NatSpecMultiLine
allowance
function allowance (address _owner, address _spender) public view returns (uint256 remaining) { return allowances [_owner][_spender]; }
/** * Tell how many tokens given spender is currently allowed to transfer from * given owner. * * @param _owner address to get number of tokens allowed to be transferred * from the owner of * @param _spender address to get number of tokens allowed to be transferred * by the owner of * @return number of tokens given spender is currently allowed to transfer * from given owner */
NatSpecMultiLine
v0.4.26+commit.4563c3fc
MIT
bzzr://973479d5005c09b517f485895207c838a621123b5fa0024729e4c5583ad46f81
{ "func_code_index": [ 3292, 3441 ] }
9,987
SCTToken
SCTToken.sol
0x496d00092e63608bae5ba52d08bab580d8509615
Solidity
SCTToken
contract SCTToken is AbstractToken { uint256 constant internal MAX_TOKENS_COUNT = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - 1; /** * Create SCT Token smart contract with message sender as an owner. * */ constructor () public { owner = msg.sender; } /** * Delegate unrecognized functions. */ function () public payable { revert (); // Revert if not delegated } /** * Get name of the token. * * @return name of the token */ function name () public pure returns (string) { return "STASIS token"; } /** * Get symbol of the token. * * @return symbol of the token */ function symbol () public pure returns (string) { return "STSS"; } /** * Get number of decimals for the token. * * @return number of decimals for the token */ function decimals () public pure returns (uint8) { return 18; } /** * Get total number of tokens in circulation. * * @return total number of tokens in circulation */ function totalSupply () public view returns (uint256) { return tokensCount; } /** * Get number of tokens currently belonging to given owner. * * @param _owner address to get number of tokens currently belonging to the * owner of * @return number of tokens currently belonging to the owner of given address */ function balanceOf (address _owner) public view returns (uint256 balance) { return AbstractToken.balanceOf (_owner); } /** * Transfer given number of tokens from message sender to given recipient. * * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise */ function transfer (address _to, uint256 _value) public returns (bool) { if (frozen) return false; else { if (_value <= accounts [msg.sender]) { require (AbstractToken.transfer (_to, _value)); return true; } else return false; } } /** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise */ function transferFrom (address _from, address _to, uint256 _value) public returns (bool) { if (frozen) return false; else { if (_value <= allowances [_from][msg.sender] && _value <= accounts [_from]) { require (AbstractToken.transferFrom (_from, _to, _value)); return true; } else return false; } } /** * Allow given spender to transfer given number of tokens from message sender. * * @param _spender address to allow the owner of to transfer tokens from * message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */ function approve (address _spender, uint256 _value) public returns (bool success) { return AbstractToken.approve (_spender, _value); } /** * Tell how many tokens given spender is currently allowed to transfer from * given owner. * * @param _owner address to get number of tokens allowed to be transferred * from the owner of * @param _spender address to get number of tokens allowed to be transferred * by the owner of * @return number of tokens given spender is currently allowed to transfer * from given owner */ function allowance (address _owner, address _spender) public view returns (uint256 remaining) { return AbstractToken.allowance (_owner, _spender); } /** * Transfer given number of token from the signed defined by digital signature * to given recipient. * * @param _to address to transfer token to the owner of * @param _value number of tokens to transfer * @param _fee number of tokens to give to message sender * @param _nonce nonce of the transfer * @param _v parameter V of digital signature * @param _r parameter R of digital signature * @param _s parameter S of digital signature */ function delegatedTransfer ( address _to, uint256 _value, uint256 _fee, uint256 _nonce, uint8 _v, bytes32 _r, bytes32 _s) public returns (bool) { if (frozen) return false; else { address _from = ecrecover ( keccak256 ( thisAddress (), messageSenderAddress (), _to, _value, _fee, _nonce), _v, _r, _s); if (_nonce != nonces [_from]) return false; uint256 balance = accounts [_from]; if (_value > balance) return false; balance = safeSub (balance, _value); if (_fee > balance) return false; balance = safeSub (balance, _fee); nonces [_from] = _nonce + 1; accounts [_from] = balance; accounts [_to] = safeAdd (accounts [_to], _value); accounts [msg.sender] = safeAdd (accounts [msg.sender], _fee); emit Transfer (_from, _to, _value); emit Transfer (_from, msg.sender, _fee); return true; } } /** * Create tokens. * * @param _value number of tokens to be created. */ function createTokens (uint256 _value) public returns (bool) { require (msg.sender == owner); if (_value > 0) { if (_value <= safeSub (MAX_TOKENS_COUNT, tokensCount)) { accounts [msg.sender] = safeAdd (accounts [msg.sender], _value); tokensCount = safeAdd (tokensCount, _value); emit Transfer (address (0), msg.sender, _value); return true; } else return false; } else return true; } /** * Burn tokens. * * @param _value number of tokens to burn */ function burnTokens (uint256 _value) public returns (bool) { require (msg.sender == owner); if (_value > 0) { if (_value <= accounts [msg.sender]) { accounts [msg.sender] = safeSub (accounts [msg.sender], _value); tokensCount = safeSub (tokensCount, _value); emit Transfer (msg.sender, address (0), _value); return true; } else return false; } else return true; } /** * Freeze token transfers. */ function freezeTransfers () public { require (msg.sender == owner); if (!frozen) { frozen = true; emit Freeze (); } } /** * Unfreeze token transfers. */ function unfreezeTransfers () public { require (msg.sender == owner); if (frozen) { frozen = false; emit Unfreeze (); } } /** * Set smart contract owner. * * @param _newOwner address of the new owner */ function setOwner (address _newOwner) public { require (msg.sender == owner); owner = _newOwner; } /** * Get current nonce for token holder with given address, i.e. nonce this * token holder should use for next delegated transfer. * * @param _owner address of the token holder to get nonce for * @return current nonce for token holder with give address */ function nonce (address _owner) public view returns (uint256) { return nonces [_owner]; } /** * Get address of this smart contract. * * @return address of this smart contract */ function thisAddress () internal view returns (address) { return this; } /** * Get address of message sender. * * @return address of this smart contract */ function messageSenderAddress () internal view returns (address) { return msg.sender; } /** * Owner of the smart contract. */ address internal owner; /** * Number of tokens in circulation. */ uint256 internal tokensCount; /** * Whether token transfers are currently frozen. */ bool internal frozen; /** * Mapping from sender's address to the next delegated transfer nonce. */ mapping (address => uint256) internal nonces; /** * Logged when token transfers were frozen. */ event Freeze (); /** * Logged when token transfers were unfrozen. */ event Unfreeze (); }
/** * SCT Token Smart Contract: EIP-20 compatible token smart contract that manages * SCT tokens. */
NatSpecMultiLine
function () public payable { revert (); // Revert if not delegated }
/** * Delegate unrecognized functions. */
NatSpecMultiLine
v0.4.26+commit.4563c3fc
MIT
bzzr://973479d5005c09b517f485895207c838a621123b5fa0024729e4c5583ad46f81
{ "func_code_index": [ 367, 446 ] }
9,988
SCTToken
SCTToken.sol
0x496d00092e63608bae5ba52d08bab580d8509615
Solidity
SCTToken
contract SCTToken is AbstractToken { uint256 constant internal MAX_TOKENS_COUNT = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - 1; /** * Create SCT Token smart contract with message sender as an owner. * */ constructor () public { owner = msg.sender; } /** * Delegate unrecognized functions. */ function () public payable { revert (); // Revert if not delegated } /** * Get name of the token. * * @return name of the token */ function name () public pure returns (string) { return "STASIS token"; } /** * Get symbol of the token. * * @return symbol of the token */ function symbol () public pure returns (string) { return "STSS"; } /** * Get number of decimals for the token. * * @return number of decimals for the token */ function decimals () public pure returns (uint8) { return 18; } /** * Get total number of tokens in circulation. * * @return total number of tokens in circulation */ function totalSupply () public view returns (uint256) { return tokensCount; } /** * Get number of tokens currently belonging to given owner. * * @param _owner address to get number of tokens currently belonging to the * owner of * @return number of tokens currently belonging to the owner of given address */ function balanceOf (address _owner) public view returns (uint256 balance) { return AbstractToken.balanceOf (_owner); } /** * Transfer given number of tokens from message sender to given recipient. * * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise */ function transfer (address _to, uint256 _value) public returns (bool) { if (frozen) return false; else { if (_value <= accounts [msg.sender]) { require (AbstractToken.transfer (_to, _value)); return true; } else return false; } } /** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise */ function transferFrom (address _from, address _to, uint256 _value) public returns (bool) { if (frozen) return false; else { if (_value <= allowances [_from][msg.sender] && _value <= accounts [_from]) { require (AbstractToken.transferFrom (_from, _to, _value)); return true; } else return false; } } /** * Allow given spender to transfer given number of tokens from message sender. * * @param _spender address to allow the owner of to transfer tokens from * message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */ function approve (address _spender, uint256 _value) public returns (bool success) { return AbstractToken.approve (_spender, _value); } /** * Tell how many tokens given spender is currently allowed to transfer from * given owner. * * @param _owner address to get number of tokens allowed to be transferred * from the owner of * @param _spender address to get number of tokens allowed to be transferred * by the owner of * @return number of tokens given spender is currently allowed to transfer * from given owner */ function allowance (address _owner, address _spender) public view returns (uint256 remaining) { return AbstractToken.allowance (_owner, _spender); } /** * Transfer given number of token from the signed defined by digital signature * to given recipient. * * @param _to address to transfer token to the owner of * @param _value number of tokens to transfer * @param _fee number of tokens to give to message sender * @param _nonce nonce of the transfer * @param _v parameter V of digital signature * @param _r parameter R of digital signature * @param _s parameter S of digital signature */ function delegatedTransfer ( address _to, uint256 _value, uint256 _fee, uint256 _nonce, uint8 _v, bytes32 _r, bytes32 _s) public returns (bool) { if (frozen) return false; else { address _from = ecrecover ( keccak256 ( thisAddress (), messageSenderAddress (), _to, _value, _fee, _nonce), _v, _r, _s); if (_nonce != nonces [_from]) return false; uint256 balance = accounts [_from]; if (_value > balance) return false; balance = safeSub (balance, _value); if (_fee > balance) return false; balance = safeSub (balance, _fee); nonces [_from] = _nonce + 1; accounts [_from] = balance; accounts [_to] = safeAdd (accounts [_to], _value); accounts [msg.sender] = safeAdd (accounts [msg.sender], _fee); emit Transfer (_from, _to, _value); emit Transfer (_from, msg.sender, _fee); return true; } } /** * Create tokens. * * @param _value number of tokens to be created. */ function createTokens (uint256 _value) public returns (bool) { require (msg.sender == owner); if (_value > 0) { if (_value <= safeSub (MAX_TOKENS_COUNT, tokensCount)) { accounts [msg.sender] = safeAdd (accounts [msg.sender], _value); tokensCount = safeAdd (tokensCount, _value); emit Transfer (address (0), msg.sender, _value); return true; } else return false; } else return true; } /** * Burn tokens. * * @param _value number of tokens to burn */ function burnTokens (uint256 _value) public returns (bool) { require (msg.sender == owner); if (_value > 0) { if (_value <= accounts [msg.sender]) { accounts [msg.sender] = safeSub (accounts [msg.sender], _value); tokensCount = safeSub (tokensCount, _value); emit Transfer (msg.sender, address (0), _value); return true; } else return false; } else return true; } /** * Freeze token transfers. */ function freezeTransfers () public { require (msg.sender == owner); if (!frozen) { frozen = true; emit Freeze (); } } /** * Unfreeze token transfers. */ function unfreezeTransfers () public { require (msg.sender == owner); if (frozen) { frozen = false; emit Unfreeze (); } } /** * Set smart contract owner. * * @param _newOwner address of the new owner */ function setOwner (address _newOwner) public { require (msg.sender == owner); owner = _newOwner; } /** * Get current nonce for token holder with given address, i.e. nonce this * token holder should use for next delegated transfer. * * @param _owner address of the token holder to get nonce for * @return current nonce for token holder with give address */ function nonce (address _owner) public view returns (uint256) { return nonces [_owner]; } /** * Get address of this smart contract. * * @return address of this smart contract */ function thisAddress () internal view returns (address) { return this; } /** * Get address of message sender. * * @return address of this smart contract */ function messageSenderAddress () internal view returns (address) { return msg.sender; } /** * Owner of the smart contract. */ address internal owner; /** * Number of tokens in circulation. */ uint256 internal tokensCount; /** * Whether token transfers are currently frozen. */ bool internal frozen; /** * Mapping from sender's address to the next delegated transfer nonce. */ mapping (address => uint256) internal nonces; /** * Logged when token transfers were frozen. */ event Freeze (); /** * Logged when token transfers were unfrozen. */ event Unfreeze (); }
/** * SCT Token Smart Contract: EIP-20 compatible token smart contract that manages * SCT tokens. */
NatSpecMultiLine
name
function name () public pure returns (string) { return "STASIS token"; }
/** * Get name of the token. * * @return name of the token */
NatSpecMultiLine
v0.4.26+commit.4563c3fc
MIT
bzzr://973479d5005c09b517f485895207c838a621123b5fa0024729e4c5583ad46f81
{ "func_code_index": [ 530, 613 ] }
9,989
SCTToken
SCTToken.sol
0x496d00092e63608bae5ba52d08bab580d8509615
Solidity
SCTToken
contract SCTToken is AbstractToken { uint256 constant internal MAX_TOKENS_COUNT = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - 1; /** * Create SCT Token smart contract with message sender as an owner. * */ constructor () public { owner = msg.sender; } /** * Delegate unrecognized functions. */ function () public payable { revert (); // Revert if not delegated } /** * Get name of the token. * * @return name of the token */ function name () public pure returns (string) { return "STASIS token"; } /** * Get symbol of the token. * * @return symbol of the token */ function symbol () public pure returns (string) { return "STSS"; } /** * Get number of decimals for the token. * * @return number of decimals for the token */ function decimals () public pure returns (uint8) { return 18; } /** * Get total number of tokens in circulation. * * @return total number of tokens in circulation */ function totalSupply () public view returns (uint256) { return tokensCount; } /** * Get number of tokens currently belonging to given owner. * * @param _owner address to get number of tokens currently belonging to the * owner of * @return number of tokens currently belonging to the owner of given address */ function balanceOf (address _owner) public view returns (uint256 balance) { return AbstractToken.balanceOf (_owner); } /** * Transfer given number of tokens from message sender to given recipient. * * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise */ function transfer (address _to, uint256 _value) public returns (bool) { if (frozen) return false; else { if (_value <= accounts [msg.sender]) { require (AbstractToken.transfer (_to, _value)); return true; } else return false; } } /** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise */ function transferFrom (address _from, address _to, uint256 _value) public returns (bool) { if (frozen) return false; else { if (_value <= allowances [_from][msg.sender] && _value <= accounts [_from]) { require (AbstractToken.transferFrom (_from, _to, _value)); return true; } else return false; } } /** * Allow given spender to transfer given number of tokens from message sender. * * @param _spender address to allow the owner of to transfer tokens from * message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */ function approve (address _spender, uint256 _value) public returns (bool success) { return AbstractToken.approve (_spender, _value); } /** * Tell how many tokens given spender is currently allowed to transfer from * given owner. * * @param _owner address to get number of tokens allowed to be transferred * from the owner of * @param _spender address to get number of tokens allowed to be transferred * by the owner of * @return number of tokens given spender is currently allowed to transfer * from given owner */ function allowance (address _owner, address _spender) public view returns (uint256 remaining) { return AbstractToken.allowance (_owner, _spender); } /** * Transfer given number of token from the signed defined by digital signature * to given recipient. * * @param _to address to transfer token to the owner of * @param _value number of tokens to transfer * @param _fee number of tokens to give to message sender * @param _nonce nonce of the transfer * @param _v parameter V of digital signature * @param _r parameter R of digital signature * @param _s parameter S of digital signature */ function delegatedTransfer ( address _to, uint256 _value, uint256 _fee, uint256 _nonce, uint8 _v, bytes32 _r, bytes32 _s) public returns (bool) { if (frozen) return false; else { address _from = ecrecover ( keccak256 ( thisAddress (), messageSenderAddress (), _to, _value, _fee, _nonce), _v, _r, _s); if (_nonce != nonces [_from]) return false; uint256 balance = accounts [_from]; if (_value > balance) return false; balance = safeSub (balance, _value); if (_fee > balance) return false; balance = safeSub (balance, _fee); nonces [_from] = _nonce + 1; accounts [_from] = balance; accounts [_to] = safeAdd (accounts [_to], _value); accounts [msg.sender] = safeAdd (accounts [msg.sender], _fee); emit Transfer (_from, _to, _value); emit Transfer (_from, msg.sender, _fee); return true; } } /** * Create tokens. * * @param _value number of tokens to be created. */ function createTokens (uint256 _value) public returns (bool) { require (msg.sender == owner); if (_value > 0) { if (_value <= safeSub (MAX_TOKENS_COUNT, tokensCount)) { accounts [msg.sender] = safeAdd (accounts [msg.sender], _value); tokensCount = safeAdd (tokensCount, _value); emit Transfer (address (0), msg.sender, _value); return true; } else return false; } else return true; } /** * Burn tokens. * * @param _value number of tokens to burn */ function burnTokens (uint256 _value) public returns (bool) { require (msg.sender == owner); if (_value > 0) { if (_value <= accounts [msg.sender]) { accounts [msg.sender] = safeSub (accounts [msg.sender], _value); tokensCount = safeSub (tokensCount, _value); emit Transfer (msg.sender, address (0), _value); return true; } else return false; } else return true; } /** * Freeze token transfers. */ function freezeTransfers () public { require (msg.sender == owner); if (!frozen) { frozen = true; emit Freeze (); } } /** * Unfreeze token transfers. */ function unfreezeTransfers () public { require (msg.sender == owner); if (frozen) { frozen = false; emit Unfreeze (); } } /** * Set smart contract owner. * * @param _newOwner address of the new owner */ function setOwner (address _newOwner) public { require (msg.sender == owner); owner = _newOwner; } /** * Get current nonce for token holder with given address, i.e. nonce this * token holder should use for next delegated transfer. * * @param _owner address of the token holder to get nonce for * @return current nonce for token holder with give address */ function nonce (address _owner) public view returns (uint256) { return nonces [_owner]; } /** * Get address of this smart contract. * * @return address of this smart contract */ function thisAddress () internal view returns (address) { return this; } /** * Get address of message sender. * * @return address of this smart contract */ function messageSenderAddress () internal view returns (address) { return msg.sender; } /** * Owner of the smart contract. */ address internal owner; /** * Number of tokens in circulation. */ uint256 internal tokensCount; /** * Whether token transfers are currently frozen. */ bool internal frozen; /** * Mapping from sender's address to the next delegated transfer nonce. */ mapping (address => uint256) internal nonces; /** * Logged when token transfers were frozen. */ event Freeze (); /** * Logged when token transfers were unfrozen. */ event Unfreeze (); }
/** * SCT Token Smart Contract: EIP-20 compatible token smart contract that manages * SCT tokens. */
NatSpecMultiLine
symbol
function symbol () public pure returns (string) { return "STSS"; }
/** * Get symbol of the token. * * @return symbol of the token */
NatSpecMultiLine
v0.4.26+commit.4563c3fc
MIT
bzzr://973479d5005c09b517f485895207c838a621123b5fa0024729e4c5583ad46f81
{ "func_code_index": [ 701, 778 ] }
9,990
SCTToken
SCTToken.sol
0x496d00092e63608bae5ba52d08bab580d8509615
Solidity
SCTToken
contract SCTToken is AbstractToken { uint256 constant internal MAX_TOKENS_COUNT = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - 1; /** * Create SCT Token smart contract with message sender as an owner. * */ constructor () public { owner = msg.sender; } /** * Delegate unrecognized functions. */ function () public payable { revert (); // Revert if not delegated } /** * Get name of the token. * * @return name of the token */ function name () public pure returns (string) { return "STASIS token"; } /** * Get symbol of the token. * * @return symbol of the token */ function symbol () public pure returns (string) { return "STSS"; } /** * Get number of decimals for the token. * * @return number of decimals for the token */ function decimals () public pure returns (uint8) { return 18; } /** * Get total number of tokens in circulation. * * @return total number of tokens in circulation */ function totalSupply () public view returns (uint256) { return tokensCount; } /** * Get number of tokens currently belonging to given owner. * * @param _owner address to get number of tokens currently belonging to the * owner of * @return number of tokens currently belonging to the owner of given address */ function balanceOf (address _owner) public view returns (uint256 balance) { return AbstractToken.balanceOf (_owner); } /** * Transfer given number of tokens from message sender to given recipient. * * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise */ function transfer (address _to, uint256 _value) public returns (bool) { if (frozen) return false; else { if (_value <= accounts [msg.sender]) { require (AbstractToken.transfer (_to, _value)); return true; } else return false; } } /** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise */ function transferFrom (address _from, address _to, uint256 _value) public returns (bool) { if (frozen) return false; else { if (_value <= allowances [_from][msg.sender] && _value <= accounts [_from]) { require (AbstractToken.transferFrom (_from, _to, _value)); return true; } else return false; } } /** * Allow given spender to transfer given number of tokens from message sender. * * @param _spender address to allow the owner of to transfer tokens from * message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */ function approve (address _spender, uint256 _value) public returns (bool success) { return AbstractToken.approve (_spender, _value); } /** * Tell how many tokens given spender is currently allowed to transfer from * given owner. * * @param _owner address to get number of tokens allowed to be transferred * from the owner of * @param _spender address to get number of tokens allowed to be transferred * by the owner of * @return number of tokens given spender is currently allowed to transfer * from given owner */ function allowance (address _owner, address _spender) public view returns (uint256 remaining) { return AbstractToken.allowance (_owner, _spender); } /** * Transfer given number of token from the signed defined by digital signature * to given recipient. * * @param _to address to transfer token to the owner of * @param _value number of tokens to transfer * @param _fee number of tokens to give to message sender * @param _nonce nonce of the transfer * @param _v parameter V of digital signature * @param _r parameter R of digital signature * @param _s parameter S of digital signature */ function delegatedTransfer ( address _to, uint256 _value, uint256 _fee, uint256 _nonce, uint8 _v, bytes32 _r, bytes32 _s) public returns (bool) { if (frozen) return false; else { address _from = ecrecover ( keccak256 ( thisAddress (), messageSenderAddress (), _to, _value, _fee, _nonce), _v, _r, _s); if (_nonce != nonces [_from]) return false; uint256 balance = accounts [_from]; if (_value > balance) return false; balance = safeSub (balance, _value); if (_fee > balance) return false; balance = safeSub (balance, _fee); nonces [_from] = _nonce + 1; accounts [_from] = balance; accounts [_to] = safeAdd (accounts [_to], _value); accounts [msg.sender] = safeAdd (accounts [msg.sender], _fee); emit Transfer (_from, _to, _value); emit Transfer (_from, msg.sender, _fee); return true; } } /** * Create tokens. * * @param _value number of tokens to be created. */ function createTokens (uint256 _value) public returns (bool) { require (msg.sender == owner); if (_value > 0) { if (_value <= safeSub (MAX_TOKENS_COUNT, tokensCount)) { accounts [msg.sender] = safeAdd (accounts [msg.sender], _value); tokensCount = safeAdd (tokensCount, _value); emit Transfer (address (0), msg.sender, _value); return true; } else return false; } else return true; } /** * Burn tokens. * * @param _value number of tokens to burn */ function burnTokens (uint256 _value) public returns (bool) { require (msg.sender == owner); if (_value > 0) { if (_value <= accounts [msg.sender]) { accounts [msg.sender] = safeSub (accounts [msg.sender], _value); tokensCount = safeSub (tokensCount, _value); emit Transfer (msg.sender, address (0), _value); return true; } else return false; } else return true; } /** * Freeze token transfers. */ function freezeTransfers () public { require (msg.sender == owner); if (!frozen) { frozen = true; emit Freeze (); } } /** * Unfreeze token transfers. */ function unfreezeTransfers () public { require (msg.sender == owner); if (frozen) { frozen = false; emit Unfreeze (); } } /** * Set smart contract owner. * * @param _newOwner address of the new owner */ function setOwner (address _newOwner) public { require (msg.sender == owner); owner = _newOwner; } /** * Get current nonce for token holder with given address, i.e. nonce this * token holder should use for next delegated transfer. * * @param _owner address of the token holder to get nonce for * @return current nonce for token holder with give address */ function nonce (address _owner) public view returns (uint256) { return nonces [_owner]; } /** * Get address of this smart contract. * * @return address of this smart contract */ function thisAddress () internal view returns (address) { return this; } /** * Get address of message sender. * * @return address of this smart contract */ function messageSenderAddress () internal view returns (address) { return msg.sender; } /** * Owner of the smart contract. */ address internal owner; /** * Number of tokens in circulation. */ uint256 internal tokensCount; /** * Whether token transfers are currently frozen. */ bool internal frozen; /** * Mapping from sender's address to the next delegated transfer nonce. */ mapping (address => uint256) internal nonces; /** * Logged when token transfers were frozen. */ event Freeze (); /** * Logged when token transfers were unfrozen. */ event Unfreeze (); }
/** * SCT Token Smart Contract: EIP-20 compatible token smart contract that manages * SCT tokens. */
NatSpecMultiLine
decimals
function decimals () public pure returns (uint8) { return 18; }
/** * Get number of decimals for the token. * * @return number of decimals for the token */
NatSpecMultiLine
v0.4.26+commit.4563c3fc
MIT
bzzr://973479d5005c09b517f485895207c838a621123b5fa0024729e4c5583ad46f81
{ "func_code_index": [ 892, 966 ] }
9,991
SCTToken
SCTToken.sol
0x496d00092e63608bae5ba52d08bab580d8509615
Solidity
SCTToken
contract SCTToken is AbstractToken { uint256 constant internal MAX_TOKENS_COUNT = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - 1; /** * Create SCT Token smart contract with message sender as an owner. * */ constructor () public { owner = msg.sender; } /** * Delegate unrecognized functions. */ function () public payable { revert (); // Revert if not delegated } /** * Get name of the token. * * @return name of the token */ function name () public pure returns (string) { return "STASIS token"; } /** * Get symbol of the token. * * @return symbol of the token */ function symbol () public pure returns (string) { return "STSS"; } /** * Get number of decimals for the token. * * @return number of decimals for the token */ function decimals () public pure returns (uint8) { return 18; } /** * Get total number of tokens in circulation. * * @return total number of tokens in circulation */ function totalSupply () public view returns (uint256) { return tokensCount; } /** * Get number of tokens currently belonging to given owner. * * @param _owner address to get number of tokens currently belonging to the * owner of * @return number of tokens currently belonging to the owner of given address */ function balanceOf (address _owner) public view returns (uint256 balance) { return AbstractToken.balanceOf (_owner); } /** * Transfer given number of tokens from message sender to given recipient. * * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise */ function transfer (address _to, uint256 _value) public returns (bool) { if (frozen) return false; else { if (_value <= accounts [msg.sender]) { require (AbstractToken.transfer (_to, _value)); return true; } else return false; } } /** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise */ function transferFrom (address _from, address _to, uint256 _value) public returns (bool) { if (frozen) return false; else { if (_value <= allowances [_from][msg.sender] && _value <= accounts [_from]) { require (AbstractToken.transferFrom (_from, _to, _value)); return true; } else return false; } } /** * Allow given spender to transfer given number of tokens from message sender. * * @param _spender address to allow the owner of to transfer tokens from * message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */ function approve (address _spender, uint256 _value) public returns (bool success) { return AbstractToken.approve (_spender, _value); } /** * Tell how many tokens given spender is currently allowed to transfer from * given owner. * * @param _owner address to get number of tokens allowed to be transferred * from the owner of * @param _spender address to get number of tokens allowed to be transferred * by the owner of * @return number of tokens given spender is currently allowed to transfer * from given owner */ function allowance (address _owner, address _spender) public view returns (uint256 remaining) { return AbstractToken.allowance (_owner, _spender); } /** * Transfer given number of token from the signed defined by digital signature * to given recipient. * * @param _to address to transfer token to the owner of * @param _value number of tokens to transfer * @param _fee number of tokens to give to message sender * @param _nonce nonce of the transfer * @param _v parameter V of digital signature * @param _r parameter R of digital signature * @param _s parameter S of digital signature */ function delegatedTransfer ( address _to, uint256 _value, uint256 _fee, uint256 _nonce, uint8 _v, bytes32 _r, bytes32 _s) public returns (bool) { if (frozen) return false; else { address _from = ecrecover ( keccak256 ( thisAddress (), messageSenderAddress (), _to, _value, _fee, _nonce), _v, _r, _s); if (_nonce != nonces [_from]) return false; uint256 balance = accounts [_from]; if (_value > balance) return false; balance = safeSub (balance, _value); if (_fee > balance) return false; balance = safeSub (balance, _fee); nonces [_from] = _nonce + 1; accounts [_from] = balance; accounts [_to] = safeAdd (accounts [_to], _value); accounts [msg.sender] = safeAdd (accounts [msg.sender], _fee); emit Transfer (_from, _to, _value); emit Transfer (_from, msg.sender, _fee); return true; } } /** * Create tokens. * * @param _value number of tokens to be created. */ function createTokens (uint256 _value) public returns (bool) { require (msg.sender == owner); if (_value > 0) { if (_value <= safeSub (MAX_TOKENS_COUNT, tokensCount)) { accounts [msg.sender] = safeAdd (accounts [msg.sender], _value); tokensCount = safeAdd (tokensCount, _value); emit Transfer (address (0), msg.sender, _value); return true; } else return false; } else return true; } /** * Burn tokens. * * @param _value number of tokens to burn */ function burnTokens (uint256 _value) public returns (bool) { require (msg.sender == owner); if (_value > 0) { if (_value <= accounts [msg.sender]) { accounts [msg.sender] = safeSub (accounts [msg.sender], _value); tokensCount = safeSub (tokensCount, _value); emit Transfer (msg.sender, address (0), _value); return true; } else return false; } else return true; } /** * Freeze token transfers. */ function freezeTransfers () public { require (msg.sender == owner); if (!frozen) { frozen = true; emit Freeze (); } } /** * Unfreeze token transfers. */ function unfreezeTransfers () public { require (msg.sender == owner); if (frozen) { frozen = false; emit Unfreeze (); } } /** * Set smart contract owner. * * @param _newOwner address of the new owner */ function setOwner (address _newOwner) public { require (msg.sender == owner); owner = _newOwner; } /** * Get current nonce for token holder with given address, i.e. nonce this * token holder should use for next delegated transfer. * * @param _owner address of the token holder to get nonce for * @return current nonce for token holder with give address */ function nonce (address _owner) public view returns (uint256) { return nonces [_owner]; } /** * Get address of this smart contract. * * @return address of this smart contract */ function thisAddress () internal view returns (address) { return this; } /** * Get address of message sender. * * @return address of this smart contract */ function messageSenderAddress () internal view returns (address) { return msg.sender; } /** * Owner of the smart contract. */ address internal owner; /** * Number of tokens in circulation. */ uint256 internal tokensCount; /** * Whether token transfers are currently frozen. */ bool internal frozen; /** * Mapping from sender's address to the next delegated transfer nonce. */ mapping (address => uint256) internal nonces; /** * Logged when token transfers were frozen. */ event Freeze (); /** * Logged when token transfers were unfrozen. */ event Unfreeze (); }
/** * SCT Token Smart Contract: EIP-20 compatible token smart contract that manages * SCT tokens. */
NatSpecMultiLine
totalSupply
function totalSupply () public view returns (uint256) { return tokensCount; }
/** * Get total number of tokens in circulation. * * @return total number of tokens in circulation */
NatSpecMultiLine
v0.4.26+commit.4563c3fc
MIT
bzzr://973479d5005c09b517f485895207c838a621123b5fa0024729e4c5583ad46f81
{ "func_code_index": [ 1090, 1178 ] }
9,992
SCTToken
SCTToken.sol
0x496d00092e63608bae5ba52d08bab580d8509615
Solidity
SCTToken
contract SCTToken is AbstractToken { uint256 constant internal MAX_TOKENS_COUNT = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - 1; /** * Create SCT Token smart contract with message sender as an owner. * */ constructor () public { owner = msg.sender; } /** * Delegate unrecognized functions. */ function () public payable { revert (); // Revert if not delegated } /** * Get name of the token. * * @return name of the token */ function name () public pure returns (string) { return "STASIS token"; } /** * Get symbol of the token. * * @return symbol of the token */ function symbol () public pure returns (string) { return "STSS"; } /** * Get number of decimals for the token. * * @return number of decimals for the token */ function decimals () public pure returns (uint8) { return 18; } /** * Get total number of tokens in circulation. * * @return total number of tokens in circulation */ function totalSupply () public view returns (uint256) { return tokensCount; } /** * Get number of tokens currently belonging to given owner. * * @param _owner address to get number of tokens currently belonging to the * owner of * @return number of tokens currently belonging to the owner of given address */ function balanceOf (address _owner) public view returns (uint256 balance) { return AbstractToken.balanceOf (_owner); } /** * Transfer given number of tokens from message sender to given recipient. * * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise */ function transfer (address _to, uint256 _value) public returns (bool) { if (frozen) return false; else { if (_value <= accounts [msg.sender]) { require (AbstractToken.transfer (_to, _value)); return true; } else return false; } } /** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise */ function transferFrom (address _from, address _to, uint256 _value) public returns (bool) { if (frozen) return false; else { if (_value <= allowances [_from][msg.sender] && _value <= accounts [_from]) { require (AbstractToken.transferFrom (_from, _to, _value)); return true; } else return false; } } /** * Allow given spender to transfer given number of tokens from message sender. * * @param _spender address to allow the owner of to transfer tokens from * message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */ function approve (address _spender, uint256 _value) public returns (bool success) { return AbstractToken.approve (_spender, _value); } /** * Tell how many tokens given spender is currently allowed to transfer from * given owner. * * @param _owner address to get number of tokens allowed to be transferred * from the owner of * @param _spender address to get number of tokens allowed to be transferred * by the owner of * @return number of tokens given spender is currently allowed to transfer * from given owner */ function allowance (address _owner, address _spender) public view returns (uint256 remaining) { return AbstractToken.allowance (_owner, _spender); } /** * Transfer given number of token from the signed defined by digital signature * to given recipient. * * @param _to address to transfer token to the owner of * @param _value number of tokens to transfer * @param _fee number of tokens to give to message sender * @param _nonce nonce of the transfer * @param _v parameter V of digital signature * @param _r parameter R of digital signature * @param _s parameter S of digital signature */ function delegatedTransfer ( address _to, uint256 _value, uint256 _fee, uint256 _nonce, uint8 _v, bytes32 _r, bytes32 _s) public returns (bool) { if (frozen) return false; else { address _from = ecrecover ( keccak256 ( thisAddress (), messageSenderAddress (), _to, _value, _fee, _nonce), _v, _r, _s); if (_nonce != nonces [_from]) return false; uint256 balance = accounts [_from]; if (_value > balance) return false; balance = safeSub (balance, _value); if (_fee > balance) return false; balance = safeSub (balance, _fee); nonces [_from] = _nonce + 1; accounts [_from] = balance; accounts [_to] = safeAdd (accounts [_to], _value); accounts [msg.sender] = safeAdd (accounts [msg.sender], _fee); emit Transfer (_from, _to, _value); emit Transfer (_from, msg.sender, _fee); return true; } } /** * Create tokens. * * @param _value number of tokens to be created. */ function createTokens (uint256 _value) public returns (bool) { require (msg.sender == owner); if (_value > 0) { if (_value <= safeSub (MAX_TOKENS_COUNT, tokensCount)) { accounts [msg.sender] = safeAdd (accounts [msg.sender], _value); tokensCount = safeAdd (tokensCount, _value); emit Transfer (address (0), msg.sender, _value); return true; } else return false; } else return true; } /** * Burn tokens. * * @param _value number of tokens to burn */ function burnTokens (uint256 _value) public returns (bool) { require (msg.sender == owner); if (_value > 0) { if (_value <= accounts [msg.sender]) { accounts [msg.sender] = safeSub (accounts [msg.sender], _value); tokensCount = safeSub (tokensCount, _value); emit Transfer (msg.sender, address (0), _value); return true; } else return false; } else return true; } /** * Freeze token transfers. */ function freezeTransfers () public { require (msg.sender == owner); if (!frozen) { frozen = true; emit Freeze (); } } /** * Unfreeze token transfers. */ function unfreezeTransfers () public { require (msg.sender == owner); if (frozen) { frozen = false; emit Unfreeze (); } } /** * Set smart contract owner. * * @param _newOwner address of the new owner */ function setOwner (address _newOwner) public { require (msg.sender == owner); owner = _newOwner; } /** * Get current nonce for token holder with given address, i.e. nonce this * token holder should use for next delegated transfer. * * @param _owner address of the token holder to get nonce for * @return current nonce for token holder with give address */ function nonce (address _owner) public view returns (uint256) { return nonces [_owner]; } /** * Get address of this smart contract. * * @return address of this smart contract */ function thisAddress () internal view returns (address) { return this; } /** * Get address of message sender. * * @return address of this smart contract */ function messageSenderAddress () internal view returns (address) { return msg.sender; } /** * Owner of the smart contract. */ address internal owner; /** * Number of tokens in circulation. */ uint256 internal tokensCount; /** * Whether token transfers are currently frozen. */ bool internal frozen; /** * Mapping from sender's address to the next delegated transfer nonce. */ mapping (address => uint256) internal nonces; /** * Logged when token transfers were frozen. */ event Freeze (); /** * Logged when token transfers were unfrozen. */ event Unfreeze (); }
/** * SCT Token Smart Contract: EIP-20 compatible token smart contract that manages * SCT tokens. */
NatSpecMultiLine
balanceOf
function balanceOf (address _owner) public view returns (uint256 balance) { return AbstractToken.balanceOf (_owner); }
/** * Get number of tokens currently belonging to given owner. * * @param _owner address to get number of tokens currently belonging to the * owner of * @return number of tokens currently belonging to the owner of given address */
NatSpecMultiLine
v0.4.26+commit.4563c3fc
MIT
bzzr://973479d5005c09b517f485895207c838a621123b5fa0024729e4c5583ad46f81
{ "func_code_index": [ 1446, 1580 ] }
9,993
SCTToken
SCTToken.sol
0x496d00092e63608bae5ba52d08bab580d8509615
Solidity
SCTToken
contract SCTToken is AbstractToken { uint256 constant internal MAX_TOKENS_COUNT = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - 1; /** * Create SCT Token smart contract with message sender as an owner. * */ constructor () public { owner = msg.sender; } /** * Delegate unrecognized functions. */ function () public payable { revert (); // Revert if not delegated } /** * Get name of the token. * * @return name of the token */ function name () public pure returns (string) { return "STASIS token"; } /** * Get symbol of the token. * * @return symbol of the token */ function symbol () public pure returns (string) { return "STSS"; } /** * Get number of decimals for the token. * * @return number of decimals for the token */ function decimals () public pure returns (uint8) { return 18; } /** * Get total number of tokens in circulation. * * @return total number of tokens in circulation */ function totalSupply () public view returns (uint256) { return tokensCount; } /** * Get number of tokens currently belonging to given owner. * * @param _owner address to get number of tokens currently belonging to the * owner of * @return number of tokens currently belonging to the owner of given address */ function balanceOf (address _owner) public view returns (uint256 balance) { return AbstractToken.balanceOf (_owner); } /** * Transfer given number of tokens from message sender to given recipient. * * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise */ function transfer (address _to, uint256 _value) public returns (bool) { if (frozen) return false; else { if (_value <= accounts [msg.sender]) { require (AbstractToken.transfer (_to, _value)); return true; } else return false; } } /** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise */ function transferFrom (address _from, address _to, uint256 _value) public returns (bool) { if (frozen) return false; else { if (_value <= allowances [_from][msg.sender] && _value <= accounts [_from]) { require (AbstractToken.transferFrom (_from, _to, _value)); return true; } else return false; } } /** * Allow given spender to transfer given number of tokens from message sender. * * @param _spender address to allow the owner of to transfer tokens from * message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */ function approve (address _spender, uint256 _value) public returns (bool success) { return AbstractToken.approve (_spender, _value); } /** * Tell how many tokens given spender is currently allowed to transfer from * given owner. * * @param _owner address to get number of tokens allowed to be transferred * from the owner of * @param _spender address to get number of tokens allowed to be transferred * by the owner of * @return number of tokens given spender is currently allowed to transfer * from given owner */ function allowance (address _owner, address _spender) public view returns (uint256 remaining) { return AbstractToken.allowance (_owner, _spender); } /** * Transfer given number of token from the signed defined by digital signature * to given recipient. * * @param _to address to transfer token to the owner of * @param _value number of tokens to transfer * @param _fee number of tokens to give to message sender * @param _nonce nonce of the transfer * @param _v parameter V of digital signature * @param _r parameter R of digital signature * @param _s parameter S of digital signature */ function delegatedTransfer ( address _to, uint256 _value, uint256 _fee, uint256 _nonce, uint8 _v, bytes32 _r, bytes32 _s) public returns (bool) { if (frozen) return false; else { address _from = ecrecover ( keccak256 ( thisAddress (), messageSenderAddress (), _to, _value, _fee, _nonce), _v, _r, _s); if (_nonce != nonces [_from]) return false; uint256 balance = accounts [_from]; if (_value > balance) return false; balance = safeSub (balance, _value); if (_fee > balance) return false; balance = safeSub (balance, _fee); nonces [_from] = _nonce + 1; accounts [_from] = balance; accounts [_to] = safeAdd (accounts [_to], _value); accounts [msg.sender] = safeAdd (accounts [msg.sender], _fee); emit Transfer (_from, _to, _value); emit Transfer (_from, msg.sender, _fee); return true; } } /** * Create tokens. * * @param _value number of tokens to be created. */ function createTokens (uint256 _value) public returns (bool) { require (msg.sender == owner); if (_value > 0) { if (_value <= safeSub (MAX_TOKENS_COUNT, tokensCount)) { accounts [msg.sender] = safeAdd (accounts [msg.sender], _value); tokensCount = safeAdd (tokensCount, _value); emit Transfer (address (0), msg.sender, _value); return true; } else return false; } else return true; } /** * Burn tokens. * * @param _value number of tokens to burn */ function burnTokens (uint256 _value) public returns (bool) { require (msg.sender == owner); if (_value > 0) { if (_value <= accounts [msg.sender]) { accounts [msg.sender] = safeSub (accounts [msg.sender], _value); tokensCount = safeSub (tokensCount, _value); emit Transfer (msg.sender, address (0), _value); return true; } else return false; } else return true; } /** * Freeze token transfers. */ function freezeTransfers () public { require (msg.sender == owner); if (!frozen) { frozen = true; emit Freeze (); } } /** * Unfreeze token transfers. */ function unfreezeTransfers () public { require (msg.sender == owner); if (frozen) { frozen = false; emit Unfreeze (); } } /** * Set smart contract owner. * * @param _newOwner address of the new owner */ function setOwner (address _newOwner) public { require (msg.sender == owner); owner = _newOwner; } /** * Get current nonce for token holder with given address, i.e. nonce this * token holder should use for next delegated transfer. * * @param _owner address of the token holder to get nonce for * @return current nonce for token holder with give address */ function nonce (address _owner) public view returns (uint256) { return nonces [_owner]; } /** * Get address of this smart contract. * * @return address of this smart contract */ function thisAddress () internal view returns (address) { return this; } /** * Get address of message sender. * * @return address of this smart contract */ function messageSenderAddress () internal view returns (address) { return msg.sender; } /** * Owner of the smart contract. */ address internal owner; /** * Number of tokens in circulation. */ uint256 internal tokensCount; /** * Whether token transfers are currently frozen. */ bool internal frozen; /** * Mapping from sender's address to the next delegated transfer nonce. */ mapping (address => uint256) internal nonces; /** * Logged when token transfers were frozen. */ event Freeze (); /** * Logged when token transfers were unfrozen. */ event Unfreeze (); }
/** * SCT Token Smart Contract: EIP-20 compatible token smart contract that manages * SCT tokens. */
NatSpecMultiLine
transfer
function transfer (address _to, uint256 _value) public returns (bool) { if (frozen) return false; else { if (_value <= accounts [msg.sender]) { require (AbstractToken.transfer (_to, _value)); return true; } else return false; } }
/** * Transfer given number of tokens from message sender to given recipient. * * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise */
NatSpecMultiLine
v0.4.26+commit.4563c3fc
MIT
bzzr://973479d5005c09b517f485895207c838a621123b5fa0024729e4c5583ad46f81
{ "func_code_index": [ 1896, 2189 ] }
9,994
SCTToken
SCTToken.sol
0x496d00092e63608bae5ba52d08bab580d8509615
Solidity
SCTToken
contract SCTToken is AbstractToken { uint256 constant internal MAX_TOKENS_COUNT = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - 1; /** * Create SCT Token smart contract with message sender as an owner. * */ constructor () public { owner = msg.sender; } /** * Delegate unrecognized functions. */ function () public payable { revert (); // Revert if not delegated } /** * Get name of the token. * * @return name of the token */ function name () public pure returns (string) { return "STASIS token"; } /** * Get symbol of the token. * * @return symbol of the token */ function symbol () public pure returns (string) { return "STSS"; } /** * Get number of decimals for the token. * * @return number of decimals for the token */ function decimals () public pure returns (uint8) { return 18; } /** * Get total number of tokens in circulation. * * @return total number of tokens in circulation */ function totalSupply () public view returns (uint256) { return tokensCount; } /** * Get number of tokens currently belonging to given owner. * * @param _owner address to get number of tokens currently belonging to the * owner of * @return number of tokens currently belonging to the owner of given address */ function balanceOf (address _owner) public view returns (uint256 balance) { return AbstractToken.balanceOf (_owner); } /** * Transfer given number of tokens from message sender to given recipient. * * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise */ function transfer (address _to, uint256 _value) public returns (bool) { if (frozen) return false; else { if (_value <= accounts [msg.sender]) { require (AbstractToken.transfer (_to, _value)); return true; } else return false; } } /** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise */ function transferFrom (address _from, address _to, uint256 _value) public returns (bool) { if (frozen) return false; else { if (_value <= allowances [_from][msg.sender] && _value <= accounts [_from]) { require (AbstractToken.transferFrom (_from, _to, _value)); return true; } else return false; } } /** * Allow given spender to transfer given number of tokens from message sender. * * @param _spender address to allow the owner of to transfer tokens from * message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */ function approve (address _spender, uint256 _value) public returns (bool success) { return AbstractToken.approve (_spender, _value); } /** * Tell how many tokens given spender is currently allowed to transfer from * given owner. * * @param _owner address to get number of tokens allowed to be transferred * from the owner of * @param _spender address to get number of tokens allowed to be transferred * by the owner of * @return number of tokens given spender is currently allowed to transfer * from given owner */ function allowance (address _owner, address _spender) public view returns (uint256 remaining) { return AbstractToken.allowance (_owner, _spender); } /** * Transfer given number of token from the signed defined by digital signature * to given recipient. * * @param _to address to transfer token to the owner of * @param _value number of tokens to transfer * @param _fee number of tokens to give to message sender * @param _nonce nonce of the transfer * @param _v parameter V of digital signature * @param _r parameter R of digital signature * @param _s parameter S of digital signature */ function delegatedTransfer ( address _to, uint256 _value, uint256 _fee, uint256 _nonce, uint8 _v, bytes32 _r, bytes32 _s) public returns (bool) { if (frozen) return false; else { address _from = ecrecover ( keccak256 ( thisAddress (), messageSenderAddress (), _to, _value, _fee, _nonce), _v, _r, _s); if (_nonce != nonces [_from]) return false; uint256 balance = accounts [_from]; if (_value > balance) return false; balance = safeSub (balance, _value); if (_fee > balance) return false; balance = safeSub (balance, _fee); nonces [_from] = _nonce + 1; accounts [_from] = balance; accounts [_to] = safeAdd (accounts [_to], _value); accounts [msg.sender] = safeAdd (accounts [msg.sender], _fee); emit Transfer (_from, _to, _value); emit Transfer (_from, msg.sender, _fee); return true; } } /** * Create tokens. * * @param _value number of tokens to be created. */ function createTokens (uint256 _value) public returns (bool) { require (msg.sender == owner); if (_value > 0) { if (_value <= safeSub (MAX_TOKENS_COUNT, tokensCount)) { accounts [msg.sender] = safeAdd (accounts [msg.sender], _value); tokensCount = safeAdd (tokensCount, _value); emit Transfer (address (0), msg.sender, _value); return true; } else return false; } else return true; } /** * Burn tokens. * * @param _value number of tokens to burn */ function burnTokens (uint256 _value) public returns (bool) { require (msg.sender == owner); if (_value > 0) { if (_value <= accounts [msg.sender]) { accounts [msg.sender] = safeSub (accounts [msg.sender], _value); tokensCount = safeSub (tokensCount, _value); emit Transfer (msg.sender, address (0), _value); return true; } else return false; } else return true; } /** * Freeze token transfers. */ function freezeTransfers () public { require (msg.sender == owner); if (!frozen) { frozen = true; emit Freeze (); } } /** * Unfreeze token transfers. */ function unfreezeTransfers () public { require (msg.sender == owner); if (frozen) { frozen = false; emit Unfreeze (); } } /** * Set smart contract owner. * * @param _newOwner address of the new owner */ function setOwner (address _newOwner) public { require (msg.sender == owner); owner = _newOwner; } /** * Get current nonce for token holder with given address, i.e. nonce this * token holder should use for next delegated transfer. * * @param _owner address of the token holder to get nonce for * @return current nonce for token holder with give address */ function nonce (address _owner) public view returns (uint256) { return nonces [_owner]; } /** * Get address of this smart contract. * * @return address of this smart contract */ function thisAddress () internal view returns (address) { return this; } /** * Get address of message sender. * * @return address of this smart contract */ function messageSenderAddress () internal view returns (address) { return msg.sender; } /** * Owner of the smart contract. */ address internal owner; /** * Number of tokens in circulation. */ uint256 internal tokensCount; /** * Whether token transfers are currently frozen. */ bool internal frozen; /** * Mapping from sender's address to the next delegated transfer nonce. */ mapping (address => uint256) internal nonces; /** * Logged when token transfers were frozen. */ event Freeze (); /** * Logged when token transfers were unfrozen. */ event Unfreeze (); }
/** * SCT Token Smart Contract: EIP-20 compatible token smart contract that manages * SCT tokens. */
NatSpecMultiLine
transferFrom
function transferFrom (address _from, address _to, uint256 _value) public returns (bool) { if (frozen) return false; else { if (_value <= allowances [_from][msg.sender] && _value <= accounts [_from]) { require (AbstractToken.transferFrom (_from, _to, _value)); return true; } else return false; } }
/** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise */
NatSpecMultiLine
v0.4.26+commit.4563c3fc
MIT
bzzr://973479d5005c09b517f485895207c838a621123b5fa0024729e4c5583ad46f81
{ "func_code_index": [ 2585, 2950 ] }
9,995
SCTToken
SCTToken.sol
0x496d00092e63608bae5ba52d08bab580d8509615
Solidity
SCTToken
contract SCTToken is AbstractToken { uint256 constant internal MAX_TOKENS_COUNT = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - 1; /** * Create SCT Token smart contract with message sender as an owner. * */ constructor () public { owner = msg.sender; } /** * Delegate unrecognized functions. */ function () public payable { revert (); // Revert if not delegated } /** * Get name of the token. * * @return name of the token */ function name () public pure returns (string) { return "STASIS token"; } /** * Get symbol of the token. * * @return symbol of the token */ function symbol () public pure returns (string) { return "STSS"; } /** * Get number of decimals for the token. * * @return number of decimals for the token */ function decimals () public pure returns (uint8) { return 18; } /** * Get total number of tokens in circulation. * * @return total number of tokens in circulation */ function totalSupply () public view returns (uint256) { return tokensCount; } /** * Get number of tokens currently belonging to given owner. * * @param _owner address to get number of tokens currently belonging to the * owner of * @return number of tokens currently belonging to the owner of given address */ function balanceOf (address _owner) public view returns (uint256 balance) { return AbstractToken.balanceOf (_owner); } /** * Transfer given number of tokens from message sender to given recipient. * * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise */ function transfer (address _to, uint256 _value) public returns (bool) { if (frozen) return false; else { if (_value <= accounts [msg.sender]) { require (AbstractToken.transfer (_to, _value)); return true; } else return false; } } /** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise */ function transferFrom (address _from, address _to, uint256 _value) public returns (bool) { if (frozen) return false; else { if (_value <= allowances [_from][msg.sender] && _value <= accounts [_from]) { require (AbstractToken.transferFrom (_from, _to, _value)); return true; } else return false; } } /** * Allow given spender to transfer given number of tokens from message sender. * * @param _spender address to allow the owner of to transfer tokens from * message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */ function approve (address _spender, uint256 _value) public returns (bool success) { return AbstractToken.approve (_spender, _value); } /** * Tell how many tokens given spender is currently allowed to transfer from * given owner. * * @param _owner address to get number of tokens allowed to be transferred * from the owner of * @param _spender address to get number of tokens allowed to be transferred * by the owner of * @return number of tokens given spender is currently allowed to transfer * from given owner */ function allowance (address _owner, address _spender) public view returns (uint256 remaining) { return AbstractToken.allowance (_owner, _spender); } /** * Transfer given number of token from the signed defined by digital signature * to given recipient. * * @param _to address to transfer token to the owner of * @param _value number of tokens to transfer * @param _fee number of tokens to give to message sender * @param _nonce nonce of the transfer * @param _v parameter V of digital signature * @param _r parameter R of digital signature * @param _s parameter S of digital signature */ function delegatedTransfer ( address _to, uint256 _value, uint256 _fee, uint256 _nonce, uint8 _v, bytes32 _r, bytes32 _s) public returns (bool) { if (frozen) return false; else { address _from = ecrecover ( keccak256 ( thisAddress (), messageSenderAddress (), _to, _value, _fee, _nonce), _v, _r, _s); if (_nonce != nonces [_from]) return false; uint256 balance = accounts [_from]; if (_value > balance) return false; balance = safeSub (balance, _value); if (_fee > balance) return false; balance = safeSub (balance, _fee); nonces [_from] = _nonce + 1; accounts [_from] = balance; accounts [_to] = safeAdd (accounts [_to], _value); accounts [msg.sender] = safeAdd (accounts [msg.sender], _fee); emit Transfer (_from, _to, _value); emit Transfer (_from, msg.sender, _fee); return true; } } /** * Create tokens. * * @param _value number of tokens to be created. */ function createTokens (uint256 _value) public returns (bool) { require (msg.sender == owner); if (_value > 0) { if (_value <= safeSub (MAX_TOKENS_COUNT, tokensCount)) { accounts [msg.sender] = safeAdd (accounts [msg.sender], _value); tokensCount = safeAdd (tokensCount, _value); emit Transfer (address (0), msg.sender, _value); return true; } else return false; } else return true; } /** * Burn tokens. * * @param _value number of tokens to burn */ function burnTokens (uint256 _value) public returns (bool) { require (msg.sender == owner); if (_value > 0) { if (_value <= accounts [msg.sender]) { accounts [msg.sender] = safeSub (accounts [msg.sender], _value); tokensCount = safeSub (tokensCount, _value); emit Transfer (msg.sender, address (0), _value); return true; } else return false; } else return true; } /** * Freeze token transfers. */ function freezeTransfers () public { require (msg.sender == owner); if (!frozen) { frozen = true; emit Freeze (); } } /** * Unfreeze token transfers. */ function unfreezeTransfers () public { require (msg.sender == owner); if (frozen) { frozen = false; emit Unfreeze (); } } /** * Set smart contract owner. * * @param _newOwner address of the new owner */ function setOwner (address _newOwner) public { require (msg.sender == owner); owner = _newOwner; } /** * Get current nonce for token holder with given address, i.e. nonce this * token holder should use for next delegated transfer. * * @param _owner address of the token holder to get nonce for * @return current nonce for token holder with give address */ function nonce (address _owner) public view returns (uint256) { return nonces [_owner]; } /** * Get address of this smart contract. * * @return address of this smart contract */ function thisAddress () internal view returns (address) { return this; } /** * Get address of message sender. * * @return address of this smart contract */ function messageSenderAddress () internal view returns (address) { return msg.sender; } /** * Owner of the smart contract. */ address internal owner; /** * Number of tokens in circulation. */ uint256 internal tokensCount; /** * Whether token transfers are currently frozen. */ bool internal frozen; /** * Mapping from sender's address to the next delegated transfer nonce. */ mapping (address => uint256) internal nonces; /** * Logged when token transfers were frozen. */ event Freeze (); /** * Logged when token transfers were unfrozen. */ event Unfreeze (); }
/** * SCT Token Smart Contract: EIP-20 compatible token smart contract that manages * SCT tokens. */
NatSpecMultiLine
approve
function approve (address _spender, uint256 _value) public returns (bool success) { return AbstractToken.approve (_spender, _value); }
/** * Allow given spender to transfer given number of tokens from message sender. * * @param _spender address to allow the owner of to transfer tokens from * message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */
NatSpecMultiLine
v0.4.26+commit.4563c3fc
MIT
bzzr://973479d5005c09b517f485895207c838a621123b5fa0024729e4c5583ad46f81
{ "func_code_index": [ 3297, 3445 ] }
9,996
SCTToken
SCTToken.sol
0x496d00092e63608bae5ba52d08bab580d8509615
Solidity
SCTToken
contract SCTToken is AbstractToken { uint256 constant internal MAX_TOKENS_COUNT = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - 1; /** * Create SCT Token smart contract with message sender as an owner. * */ constructor () public { owner = msg.sender; } /** * Delegate unrecognized functions. */ function () public payable { revert (); // Revert if not delegated } /** * Get name of the token. * * @return name of the token */ function name () public pure returns (string) { return "STASIS token"; } /** * Get symbol of the token. * * @return symbol of the token */ function symbol () public pure returns (string) { return "STSS"; } /** * Get number of decimals for the token. * * @return number of decimals for the token */ function decimals () public pure returns (uint8) { return 18; } /** * Get total number of tokens in circulation. * * @return total number of tokens in circulation */ function totalSupply () public view returns (uint256) { return tokensCount; } /** * Get number of tokens currently belonging to given owner. * * @param _owner address to get number of tokens currently belonging to the * owner of * @return number of tokens currently belonging to the owner of given address */ function balanceOf (address _owner) public view returns (uint256 balance) { return AbstractToken.balanceOf (_owner); } /** * Transfer given number of tokens from message sender to given recipient. * * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise */ function transfer (address _to, uint256 _value) public returns (bool) { if (frozen) return false; else { if (_value <= accounts [msg.sender]) { require (AbstractToken.transfer (_to, _value)); return true; } else return false; } } /** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise */ function transferFrom (address _from, address _to, uint256 _value) public returns (bool) { if (frozen) return false; else { if (_value <= allowances [_from][msg.sender] && _value <= accounts [_from]) { require (AbstractToken.transferFrom (_from, _to, _value)); return true; } else return false; } } /** * Allow given spender to transfer given number of tokens from message sender. * * @param _spender address to allow the owner of to transfer tokens from * message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */ function approve (address _spender, uint256 _value) public returns (bool success) { return AbstractToken.approve (_spender, _value); } /** * Tell how many tokens given spender is currently allowed to transfer from * given owner. * * @param _owner address to get number of tokens allowed to be transferred * from the owner of * @param _spender address to get number of tokens allowed to be transferred * by the owner of * @return number of tokens given spender is currently allowed to transfer * from given owner */ function allowance (address _owner, address _spender) public view returns (uint256 remaining) { return AbstractToken.allowance (_owner, _spender); } /** * Transfer given number of token from the signed defined by digital signature * to given recipient. * * @param _to address to transfer token to the owner of * @param _value number of tokens to transfer * @param _fee number of tokens to give to message sender * @param _nonce nonce of the transfer * @param _v parameter V of digital signature * @param _r parameter R of digital signature * @param _s parameter S of digital signature */ function delegatedTransfer ( address _to, uint256 _value, uint256 _fee, uint256 _nonce, uint8 _v, bytes32 _r, bytes32 _s) public returns (bool) { if (frozen) return false; else { address _from = ecrecover ( keccak256 ( thisAddress (), messageSenderAddress (), _to, _value, _fee, _nonce), _v, _r, _s); if (_nonce != nonces [_from]) return false; uint256 balance = accounts [_from]; if (_value > balance) return false; balance = safeSub (balance, _value); if (_fee > balance) return false; balance = safeSub (balance, _fee); nonces [_from] = _nonce + 1; accounts [_from] = balance; accounts [_to] = safeAdd (accounts [_to], _value); accounts [msg.sender] = safeAdd (accounts [msg.sender], _fee); emit Transfer (_from, _to, _value); emit Transfer (_from, msg.sender, _fee); return true; } } /** * Create tokens. * * @param _value number of tokens to be created. */ function createTokens (uint256 _value) public returns (bool) { require (msg.sender == owner); if (_value > 0) { if (_value <= safeSub (MAX_TOKENS_COUNT, tokensCount)) { accounts [msg.sender] = safeAdd (accounts [msg.sender], _value); tokensCount = safeAdd (tokensCount, _value); emit Transfer (address (0), msg.sender, _value); return true; } else return false; } else return true; } /** * Burn tokens. * * @param _value number of tokens to burn */ function burnTokens (uint256 _value) public returns (bool) { require (msg.sender == owner); if (_value > 0) { if (_value <= accounts [msg.sender]) { accounts [msg.sender] = safeSub (accounts [msg.sender], _value); tokensCount = safeSub (tokensCount, _value); emit Transfer (msg.sender, address (0), _value); return true; } else return false; } else return true; } /** * Freeze token transfers. */ function freezeTransfers () public { require (msg.sender == owner); if (!frozen) { frozen = true; emit Freeze (); } } /** * Unfreeze token transfers. */ function unfreezeTransfers () public { require (msg.sender == owner); if (frozen) { frozen = false; emit Unfreeze (); } } /** * Set smart contract owner. * * @param _newOwner address of the new owner */ function setOwner (address _newOwner) public { require (msg.sender == owner); owner = _newOwner; } /** * Get current nonce for token holder with given address, i.e. nonce this * token holder should use for next delegated transfer. * * @param _owner address of the token holder to get nonce for * @return current nonce for token holder with give address */ function nonce (address _owner) public view returns (uint256) { return nonces [_owner]; } /** * Get address of this smart contract. * * @return address of this smart contract */ function thisAddress () internal view returns (address) { return this; } /** * Get address of message sender. * * @return address of this smart contract */ function messageSenderAddress () internal view returns (address) { return msg.sender; } /** * Owner of the smart contract. */ address internal owner; /** * Number of tokens in circulation. */ uint256 internal tokensCount; /** * Whether token transfers are currently frozen. */ bool internal frozen; /** * Mapping from sender's address to the next delegated transfer nonce. */ mapping (address => uint256) internal nonces; /** * Logged when token transfers were frozen. */ event Freeze (); /** * Logged when token transfers were unfrozen. */ event Unfreeze (); }
/** * SCT Token Smart Contract: EIP-20 compatible token smart contract that manages * SCT tokens. */
NatSpecMultiLine
allowance
function allowance (address _owner, address _spender) public view returns (uint256 remaining) { return AbstractToken.allowance (_owner, _spender); }
/** * Tell how many tokens given spender is currently allowed to transfer from * given owner. * * @param _owner address to get number of tokens allowed to be transferred * from the owner of * @param _spender address to get number of tokens allowed to be transferred * by the owner of * @return number of tokens given spender is currently allowed to transfer * from given owner */
NatSpecMultiLine
v0.4.26+commit.4563c3fc
MIT
bzzr://973479d5005c09b517f485895207c838a621123b5fa0024729e4c5583ad46f81
{ "func_code_index": [ 3893, 4055 ] }
9,997
SCTToken
SCTToken.sol
0x496d00092e63608bae5ba52d08bab580d8509615
Solidity
SCTToken
contract SCTToken is AbstractToken { uint256 constant internal MAX_TOKENS_COUNT = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - 1; /** * Create SCT Token smart contract with message sender as an owner. * */ constructor () public { owner = msg.sender; } /** * Delegate unrecognized functions. */ function () public payable { revert (); // Revert if not delegated } /** * Get name of the token. * * @return name of the token */ function name () public pure returns (string) { return "STASIS token"; } /** * Get symbol of the token. * * @return symbol of the token */ function symbol () public pure returns (string) { return "STSS"; } /** * Get number of decimals for the token. * * @return number of decimals for the token */ function decimals () public pure returns (uint8) { return 18; } /** * Get total number of tokens in circulation. * * @return total number of tokens in circulation */ function totalSupply () public view returns (uint256) { return tokensCount; } /** * Get number of tokens currently belonging to given owner. * * @param _owner address to get number of tokens currently belonging to the * owner of * @return number of tokens currently belonging to the owner of given address */ function balanceOf (address _owner) public view returns (uint256 balance) { return AbstractToken.balanceOf (_owner); } /** * Transfer given number of tokens from message sender to given recipient. * * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise */ function transfer (address _to, uint256 _value) public returns (bool) { if (frozen) return false; else { if (_value <= accounts [msg.sender]) { require (AbstractToken.transfer (_to, _value)); return true; } else return false; } } /** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise */ function transferFrom (address _from, address _to, uint256 _value) public returns (bool) { if (frozen) return false; else { if (_value <= allowances [_from][msg.sender] && _value <= accounts [_from]) { require (AbstractToken.transferFrom (_from, _to, _value)); return true; } else return false; } } /** * Allow given spender to transfer given number of tokens from message sender. * * @param _spender address to allow the owner of to transfer tokens from * message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */ function approve (address _spender, uint256 _value) public returns (bool success) { return AbstractToken.approve (_spender, _value); } /** * Tell how many tokens given spender is currently allowed to transfer from * given owner. * * @param _owner address to get number of tokens allowed to be transferred * from the owner of * @param _spender address to get number of tokens allowed to be transferred * by the owner of * @return number of tokens given spender is currently allowed to transfer * from given owner */ function allowance (address _owner, address _spender) public view returns (uint256 remaining) { return AbstractToken.allowance (_owner, _spender); } /** * Transfer given number of token from the signed defined by digital signature * to given recipient. * * @param _to address to transfer token to the owner of * @param _value number of tokens to transfer * @param _fee number of tokens to give to message sender * @param _nonce nonce of the transfer * @param _v parameter V of digital signature * @param _r parameter R of digital signature * @param _s parameter S of digital signature */ function delegatedTransfer ( address _to, uint256 _value, uint256 _fee, uint256 _nonce, uint8 _v, bytes32 _r, bytes32 _s) public returns (bool) { if (frozen) return false; else { address _from = ecrecover ( keccak256 ( thisAddress (), messageSenderAddress (), _to, _value, _fee, _nonce), _v, _r, _s); if (_nonce != nonces [_from]) return false; uint256 balance = accounts [_from]; if (_value > balance) return false; balance = safeSub (balance, _value); if (_fee > balance) return false; balance = safeSub (balance, _fee); nonces [_from] = _nonce + 1; accounts [_from] = balance; accounts [_to] = safeAdd (accounts [_to], _value); accounts [msg.sender] = safeAdd (accounts [msg.sender], _fee); emit Transfer (_from, _to, _value); emit Transfer (_from, msg.sender, _fee); return true; } } /** * Create tokens. * * @param _value number of tokens to be created. */ function createTokens (uint256 _value) public returns (bool) { require (msg.sender == owner); if (_value > 0) { if (_value <= safeSub (MAX_TOKENS_COUNT, tokensCount)) { accounts [msg.sender] = safeAdd (accounts [msg.sender], _value); tokensCount = safeAdd (tokensCount, _value); emit Transfer (address (0), msg.sender, _value); return true; } else return false; } else return true; } /** * Burn tokens. * * @param _value number of tokens to burn */ function burnTokens (uint256 _value) public returns (bool) { require (msg.sender == owner); if (_value > 0) { if (_value <= accounts [msg.sender]) { accounts [msg.sender] = safeSub (accounts [msg.sender], _value); tokensCount = safeSub (tokensCount, _value); emit Transfer (msg.sender, address (0), _value); return true; } else return false; } else return true; } /** * Freeze token transfers. */ function freezeTransfers () public { require (msg.sender == owner); if (!frozen) { frozen = true; emit Freeze (); } } /** * Unfreeze token transfers. */ function unfreezeTransfers () public { require (msg.sender == owner); if (frozen) { frozen = false; emit Unfreeze (); } } /** * Set smart contract owner. * * @param _newOwner address of the new owner */ function setOwner (address _newOwner) public { require (msg.sender == owner); owner = _newOwner; } /** * Get current nonce for token holder with given address, i.e. nonce this * token holder should use for next delegated transfer. * * @param _owner address of the token holder to get nonce for * @return current nonce for token holder with give address */ function nonce (address _owner) public view returns (uint256) { return nonces [_owner]; } /** * Get address of this smart contract. * * @return address of this smart contract */ function thisAddress () internal view returns (address) { return this; } /** * Get address of message sender. * * @return address of this smart contract */ function messageSenderAddress () internal view returns (address) { return msg.sender; } /** * Owner of the smart contract. */ address internal owner; /** * Number of tokens in circulation. */ uint256 internal tokensCount; /** * Whether token transfers are currently frozen. */ bool internal frozen; /** * Mapping from sender's address to the next delegated transfer nonce. */ mapping (address => uint256) internal nonces; /** * Logged when token transfers were frozen. */ event Freeze (); /** * Logged when token transfers were unfrozen. */ event Unfreeze (); }
/** * SCT Token Smart Contract: EIP-20 compatible token smart contract that manages * SCT tokens. */
NatSpecMultiLine
delegatedTransfer
function delegatedTransfer ( address _to, uint256 _value, uint256 _fee, uint256 _nonce, uint8 _v, bytes32 _r, bytes32 _s) public returns (bool) { if (frozen) return false; else { address _from = ecrecover ( keccak256 ( thisAddress (), messageSenderAddress (), _to, _value, _fee, _nonce), _v, _r, _s); if (_nonce != nonces [_from]) return false; uint256 balance = accounts [_from]; if (_value > balance) return false; balance = safeSub (balance, _value); if (_fee > balance) return false; balance = safeSub (balance, _fee); nonces [_from] = _nonce + 1; accounts [_from] = balance; accounts [_to] = safeAdd (accounts [_to], _value); accounts [msg.sender] = safeAdd (accounts [msg.sender], _fee); emit Transfer (_from, _to, _value); emit Transfer (_from, msg.sender, _fee); return true; } }
/** * Transfer given number of token from the signed defined by digital signature * to given recipient. * * @param _to address to transfer token to the owner of * @param _value number of tokens to transfer * @param _fee number of tokens to give to message sender * @param _nonce nonce of the transfer * @param _v parameter V of digital signature * @param _r parameter R of digital signature * @param _s parameter S of digital signature */
NatSpecMultiLine
v0.4.26+commit.4563c3fc
MIT
bzzr://973479d5005c09b517f485895207c838a621123b5fa0024729e4c5583ad46f81
{ "func_code_index": [ 4544, 5510 ] }
9,998
SCTToken
SCTToken.sol
0x496d00092e63608bae5ba52d08bab580d8509615
Solidity
SCTToken
contract SCTToken is AbstractToken { uint256 constant internal MAX_TOKENS_COUNT = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - 1; /** * Create SCT Token smart contract with message sender as an owner. * */ constructor () public { owner = msg.sender; } /** * Delegate unrecognized functions. */ function () public payable { revert (); // Revert if not delegated } /** * Get name of the token. * * @return name of the token */ function name () public pure returns (string) { return "STASIS token"; } /** * Get symbol of the token. * * @return symbol of the token */ function symbol () public pure returns (string) { return "STSS"; } /** * Get number of decimals for the token. * * @return number of decimals for the token */ function decimals () public pure returns (uint8) { return 18; } /** * Get total number of tokens in circulation. * * @return total number of tokens in circulation */ function totalSupply () public view returns (uint256) { return tokensCount; } /** * Get number of tokens currently belonging to given owner. * * @param _owner address to get number of tokens currently belonging to the * owner of * @return number of tokens currently belonging to the owner of given address */ function balanceOf (address _owner) public view returns (uint256 balance) { return AbstractToken.balanceOf (_owner); } /** * Transfer given number of tokens from message sender to given recipient. * * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise */ function transfer (address _to, uint256 _value) public returns (bool) { if (frozen) return false; else { if (_value <= accounts [msg.sender]) { require (AbstractToken.transfer (_to, _value)); return true; } else return false; } } /** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise */ function transferFrom (address _from, address _to, uint256 _value) public returns (bool) { if (frozen) return false; else { if (_value <= allowances [_from][msg.sender] && _value <= accounts [_from]) { require (AbstractToken.transferFrom (_from, _to, _value)); return true; } else return false; } } /** * Allow given spender to transfer given number of tokens from message sender. * * @param _spender address to allow the owner of to transfer tokens from * message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */ function approve (address _spender, uint256 _value) public returns (bool success) { return AbstractToken.approve (_spender, _value); } /** * Tell how many tokens given spender is currently allowed to transfer from * given owner. * * @param _owner address to get number of tokens allowed to be transferred * from the owner of * @param _spender address to get number of tokens allowed to be transferred * by the owner of * @return number of tokens given spender is currently allowed to transfer * from given owner */ function allowance (address _owner, address _spender) public view returns (uint256 remaining) { return AbstractToken.allowance (_owner, _spender); } /** * Transfer given number of token from the signed defined by digital signature * to given recipient. * * @param _to address to transfer token to the owner of * @param _value number of tokens to transfer * @param _fee number of tokens to give to message sender * @param _nonce nonce of the transfer * @param _v parameter V of digital signature * @param _r parameter R of digital signature * @param _s parameter S of digital signature */ function delegatedTransfer ( address _to, uint256 _value, uint256 _fee, uint256 _nonce, uint8 _v, bytes32 _r, bytes32 _s) public returns (bool) { if (frozen) return false; else { address _from = ecrecover ( keccak256 ( thisAddress (), messageSenderAddress (), _to, _value, _fee, _nonce), _v, _r, _s); if (_nonce != nonces [_from]) return false; uint256 balance = accounts [_from]; if (_value > balance) return false; balance = safeSub (balance, _value); if (_fee > balance) return false; balance = safeSub (balance, _fee); nonces [_from] = _nonce + 1; accounts [_from] = balance; accounts [_to] = safeAdd (accounts [_to], _value); accounts [msg.sender] = safeAdd (accounts [msg.sender], _fee); emit Transfer (_from, _to, _value); emit Transfer (_from, msg.sender, _fee); return true; } } /** * Create tokens. * * @param _value number of tokens to be created. */ function createTokens (uint256 _value) public returns (bool) { require (msg.sender == owner); if (_value > 0) { if (_value <= safeSub (MAX_TOKENS_COUNT, tokensCount)) { accounts [msg.sender] = safeAdd (accounts [msg.sender], _value); tokensCount = safeAdd (tokensCount, _value); emit Transfer (address (0), msg.sender, _value); return true; } else return false; } else return true; } /** * Burn tokens. * * @param _value number of tokens to burn */ function burnTokens (uint256 _value) public returns (bool) { require (msg.sender == owner); if (_value > 0) { if (_value <= accounts [msg.sender]) { accounts [msg.sender] = safeSub (accounts [msg.sender], _value); tokensCount = safeSub (tokensCount, _value); emit Transfer (msg.sender, address (0), _value); return true; } else return false; } else return true; } /** * Freeze token transfers. */ function freezeTransfers () public { require (msg.sender == owner); if (!frozen) { frozen = true; emit Freeze (); } } /** * Unfreeze token transfers. */ function unfreezeTransfers () public { require (msg.sender == owner); if (frozen) { frozen = false; emit Unfreeze (); } } /** * Set smart contract owner. * * @param _newOwner address of the new owner */ function setOwner (address _newOwner) public { require (msg.sender == owner); owner = _newOwner; } /** * Get current nonce for token holder with given address, i.e. nonce this * token holder should use for next delegated transfer. * * @param _owner address of the token holder to get nonce for * @return current nonce for token holder with give address */ function nonce (address _owner) public view returns (uint256) { return nonces [_owner]; } /** * Get address of this smart contract. * * @return address of this smart contract */ function thisAddress () internal view returns (address) { return this; } /** * Get address of message sender. * * @return address of this smart contract */ function messageSenderAddress () internal view returns (address) { return msg.sender; } /** * Owner of the smart contract. */ address internal owner; /** * Number of tokens in circulation. */ uint256 internal tokensCount; /** * Whether token transfers are currently frozen. */ bool internal frozen; /** * Mapping from sender's address to the next delegated transfer nonce. */ mapping (address => uint256) internal nonces; /** * Logged when token transfers were frozen. */ event Freeze (); /** * Logged when token transfers were unfrozen. */ event Unfreeze (); }
/** * SCT Token Smart Contract: EIP-20 compatible token smart contract that manages * SCT tokens. */
NatSpecMultiLine
createTokens
function createTokens (uint256 _value) public returns (bool) { require (msg.sender == owner); if (_value > 0) { if (_value <= safeSub (MAX_TOKENS_COUNT, tokensCount)) { accounts [msg.sender] = safeAdd (accounts [msg.sender], _value); tokensCount = safeAdd (tokensCount, _value); emit Transfer (address (0), msg.sender, _value); return true; } else return false; } else return true; }
/** * Create tokens. * * @param _value number of tokens to be created. */
NatSpecMultiLine
v0.4.26+commit.4563c3fc
MIT
bzzr://973479d5005c09b517f485895207c838a621123b5fa0024729e4c5583ad46f81
{ "func_code_index": [ 5606, 6069 ] }
9,999