contract SamToken is Pausable {
  using SafeMath for uint;
 
    uint256 _lockedTokens;
    bool isLocked = true ;
    bool releasedForOwner ;
    uint256 public ownerPercent = 10;
    uint256 public ownerSupply;
    uint256 public adminPercent = 90;
    uint256 public adminSupply ;
    
     //The name of the  token
    string public constant name = "SAM Token";
    //The token symbol
    string public constant symbol = "SAM";
    //The precision used in the balance calculations in contract
    uint public constant decimals = 0;

  event Burn(address indexed burner, uint256 value);
  event CompanyTokenReleased( address indexed _company, uint256 indexed _tokens );

  constructor(
        address _owner, 
        address _admin,        
        uint256 _totalsupply
        ) public {
    owner = _owner;
    admin = _admin;

    _totalsupply = _totalsupply ;
    totalSupply_ = totalSupply_.add(_totalsupply);
       
    adminSupply = 900000000 ;  
    ownerSupply = 100000000 ;

    _lockedTokens = _lockedTokens.add(ownerSupply);
    balances[admin] = balances[admin].add(adminSupply);
     isLocked = true;
    emit Transfer(address(0), admin, adminSupply );
    
  }

  modifier onlyPayloadSize(uint numWords) {
    assert(msg.data.length >= numWords * 32 + 4);
    _;
  }

 /**
  * @dev Locked number of tokens in existence
  */
    function lockedTokens() public view returns (uint256) {
      return _lockedTokens;
    }

 /**
  * @dev function to check whether passed address is a contract address
  */
    function isContract(address _address) private view returns (bool is_contract) {
      uint256 length;
      assembly {
      //retrieve the size of the code on target address, this needs assembly
        length := extcodesize(_address)
      }
      return (length > 0);
    }

/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint _value) public returns (bool success) {
    require(balances[msg.sender] >= _value);
    balances[msg.sender] = balances[msg.sender].sub(_value);
    totalSupply_ = totalSupply_.sub(_value);
    emit Burn(msg.sender, _value);
    return true;
}

/**
* @dev Burns a specific amount of tokens from the target address and decrements allowance
* @param from address The address which you want to send tokens from
* @param _value uint256 The amount of token to be burned
*/
function burnFrom(address from, uint _value) public returns (bool success) {
    require(balances[from] >= _value);
    require(_value <= allowed[from][msg.sender]);
    balances[from] = balances[from].sub(_value);
    allowed[from][msg.sender] = allowed[from][msg.sender].sub(_value);
    totalSupply_ = totalSupply_.sub(_value);
    emit Burn(from, _value);
    return true;
}

function () public payable {
    revert();
}

/**
* @dev Function to transfer any ERC20 token  to owner address which gets accidentally transferred to this contract
* @param tokenAddress The address of the ERC20 contract
* @param tokens The amount of tokens to transfer.
* @return A boolean that indicates if the operation was successful.
*/
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
    require(tokenAddress != address(0));
    require(isContract(tokenAddress));
    return ERC20(tokenAddress).transfer(owner, tokens);
}

// Transfer token to team 
function companyTokensRelease(address _company) external onlyAdmin returns(bool) {
   require(_company != address(0), "Address is not valid");
   require(!releasedForOwner, "Team release has already done");
    if (now > contractDeployed.add(365 days) && releasedForOwner == false ) {          
          balances[_company] = balances[_company].add(_lockedTokens);
          isLocked = false;
          releasedForOwner = true;
          emit CompanyTokenReleased(_company, _lockedTokens);
          return true;
        }
    }

}
function isContract(address _address) private view returns (bool is_contract) {
  uint256 length;
  assembly {
  //retrieve the size of the code on target address, this needs assembly
    length := extcodesize(_address)
  }
  return (length > 0);
}

/**
 * @dev function to check whether passed address is a contract address
 */