daily pastebin goal
9%
SHARE
TWEET

Untitled

a guest Mar 25th, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. pragma solidity ^0.4.9;
  2.  
  3. contract SafeMath {
  4.     function safeAdd(uint a, uint b) public pure returns (uint c) {
  5.         c = a + b;
  6.         require(c >= a);
  7.     }
  8.     function safeSub(uint a, uint b) public pure returns (uint c) {
  9.         require(b <= a);
  10.         c = a - b;
  11.     }
  12.     function safeMul(uint a, uint b) public pure returns (uint c) {
  13.         c = a * b;
  14.         require(a == 0 || c / a == b);
  15.     }
  16.     function safeDiv(uint a, uint b) public pure returns (uint c) {
  17.         require(b > 0);
  18.         c = a / b;
  19.     }
  20. }
  21.  
  22. contract ERC223ReceivingContract {
  23. /**
  24.  * @dev Standard ERC223 function that will handle incoming token transfers.
  25.  *
  26.  * @param _from  Token sender address.
  27.  * @param _value Amount of tokens.
  28.  * @param _data  Transaction metadata.
  29.  */
  30.     function tokenFallback(address _from, uint _value, bytes _data) public returns(bool);
  31. }
  32.  
  33. contract Owned {
  34.     address public owner;
  35.     address public newOwner;
  36.  
  37.     event OwnershipTransferred(address indexed _from, address indexed _to);
  38.  
  39.     constructor() public {
  40.         owner = msg.sender;
  41.     }
  42.  
  43.     modifier onlyOwner {
  44.         require(msg.sender == owner);
  45.         _;
  46.     }
  47.  
  48.     function transferOwnership(address _newOwner) public onlyOwner {
  49.         newOwner = _newOwner;
  50.     }
  51.     function acceptOwnership() public {
  52.         require(msg.sender == newOwner);
  53.         emit OwnershipTransferred(owner, newOwner);
  54.         owner = newOwner;
  55.         newOwner = address(0);
  56.     }
  57. }
  58.  
  59. contract ERC223Token is SafeMath, Owned {
  60.    
  61.   event Transfer(address indexed _from, address indexed _to, uint256 _value, bytes _data);
  62.  
  63.   mapping(address => uint) balances;
  64.   mapping(address => bool) public verified;
  65.  
  66.   string public name    = "Storh";
  67.   string public symbol  = "STORH";
  68.   uint8 public decimals = 14;
  69.   uint public totalSupply;
  70.   uint public startTime;
  71.   uint public totalVerifiedAccounts;
  72.  
  73.   mapping (address => uint)  public tokens;
  74.   address[] public verifiedAccounts;
  75.  
  76.   modifier isVerified(address reciever) {
  77.         require(verified[msg.sender]);
  78.         require(verified[reciever]);
  79.         _;
  80.     }
  81.    
  82.   modifier hasMinBalance(uint value) {
  83.       if(now < (startTime + 365 days) && msg.sender == owner){
  84.         require(balances[owner] >= ((totalSupply*5)/100) + value);
  85.       }
  86.       _;
  87.   }
  88.  
  89.   constructor () public
  90.   {
  91.       balances[msg.sender] = 12000000000000000000000;
  92.       totalSupply = balances[msg.sender];
  93.       verified[msg.sender] = true;
  94.       startTime = now;
  95.   }
  96.  
  97.   function verifyAccount(address account,uint amount) public onlyOwner {
  98.       verified[account] = true;
  99.       tokens[account] = amount;
  100.       totalVerifiedAccounts = totalVerifiedAccounts +1;
  101.       verifiedAccounts.push(account);
  102.   }
  103.  
  104.   function updateUserTokens(address account,uint amount) public onlyOwner{
  105.       tokens[account] = amount;
  106.   }
  107.  
  108.   function setStartTime(uint _startTime) public {
  109.     startTime = _startTime;
  110.   }
  111.  
  112.   function multiERC20Transfer() public onlyOwner {
  113.      
  114.         for (uint i = 0; i < verifiedAccounts.length; i++) {
  115.             if(tokens[verifiedAccounts[i]]>0){
  116.                 transfer(verifiedAccounts[i],tokens[verifiedAccounts[i]]);
  117.                 tokens[verifiedAccounts[i]]=0;
  118.             }
  119.            
  120.         }
  121.        
  122.     }
  123.    
  124.     uint public test1;
  125.    
  126.    
  127.   function transfer(address _to, uint _value, bytes _data) public isVerified(_to) hasMinBalance(_value){
  128.         // Standard function transfer similar to ERC20 transfer with no _data .
  129.         // Added due to backwards compatibility reasons .
  130.         uint codeLength;
  131.  
  132.         assembly {
  133.             // Retrieve the size of the code on target address, this needs assembly .
  134.             codeLength := extcodesize(_to)
  135.         }
  136.        
  137.         test1 = codeLength;
  138.  
  139.         balances[msg.sender] = safeSub(balances[msg.sender],_value);
  140.         balances[_to] = safeAdd(balances[_to],_value);
  141.         if(codeLength>0) {
  142.             ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
  143.             if(!receiver.tokenFallback(msg.sender, _value, _data)) revert();
  144.         }
  145.         emit Transfer(msg.sender, _to, _value, _data);
  146.     }
  147.    
  148.    
  149.     uint public test;
  150.  
  151.    
  152.     function transfer(address _to, uint _value) public isVerified(_to) hasMinBalance(_value){
  153.         uint codeLength;
  154.         bytes memory empty;
  155.  
  156.         assembly {
  157.             // Retrieve the size of the code on target address, this needs assembly .
  158.             codeLength := extcodesize(_to)
  159.         }
  160.        
  161.         test = codeLength;
  162.  
  163.         balances[msg.sender] = safeSub(balances[msg.sender],_value);
  164.         balances[_to] = safeAdd(balances[_to],_value);
  165.         if(codeLength>0) {
  166.             ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
  167.             if(!receiver.tokenFallback(msg.sender, _value, empty)) revert();
  168.         }
  169.         emit Transfer(msg.sender, _to, _value, empty);
  170.     }
  171.  
  172.  
  173.  
  174.  
  175.   function balanceOf(address _owner) constant public returns (uint balance) {
  176.     return balances[_owner];
  177.   }
  178.  
  179.   function close() public onlyOwner { //onlyOwner is custom modifier
  180.   selfdestruct(owner);  // `owner` is the owners address
  181. }
  182. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top