Blockwell

ROC

ERC20

This contract is an ERC20 token.

Name ROC
Symbol ROC
Decimals 10
Total Supply 5,000,000 ROC

About

Stats

Public Functions 17
Event Types 7
Code Size 54,893 bytes

Approval Event

Parameters help
owner
address help
spender
address help
value
uint help

Message Event

Parameters help
holder_profit
uint256 help

Message Event

Parameters help
message
string help
to_
address help
token_amount
uint help

Price Event

Parameters help
ethh
string help

TRANS Event

Parameters help
accountAddress
address help
amount
uint help

Transfer Event

Parameters help
from
address help
to
address help
value
uint help

valuee Event

Parameters help
price
uint help

Functions Expand All Collapse All

__callback keyboard_arrow_up

Parameters help

Name Type
myid
bytes32 help
result
string help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
      function __callback(bytes32 myid, string result) {
    if (msg.sender != oraclize_cbAddress()) {
      // just to be sure the calling address is the Oraclize authorized one
      throw;
    }
    
    if(userqueryID[myid]== myid)
    {

      
       one_ether_usd_price = stringToUint(result);
    
    valuee(one_ether_usd_price);
    
    if(one_ether_usd_price<1000)
    {
        one_ether_usd_price = one_ether_usd_price*100;
    }
    else if(one_ether_usd_price<10000)
    {
        one_ether_usd_price = one_ether_usd_price*10;
    }
    
    valuee(one_ether_usd_price);
            
            uint no_of_token = (one_ether_usd_price*uservalue[userAddress[myid]])/(275*10000000000000000*100); 
            
                 
            balances[owner] -= (no_of_token*10000000000);
            balances[userAddress[myid]] += (no_of_token*10000000000);
             Transfer(owner, userAddress[myid] , no_of_token);
             
              check_array_add(userAddress[myid]);
             
  
    }
        

 }

__callback keyboard_arrow_up

Parameters help

Name Type
myid
bytes32 help
result
string help
proof
bytes help

Properties

Visibility help public
Mutability help transaction
Source Code
    function __callback(bytes32 myid, string result, bytes proof) {
    }

balanceOf keyboard_arrow_up

Parameters help

Name Type
sender
address help

Properties

Visibility help public
Mutability help constant
Source Code
     function balanceOf(address sender) constant returns (uint256 balance) {
      
          return balances[sender];
      }

allowance keyboard_arrow_up

Parameters help

Name Type
_owner
address help
_spender
address help

Properties

Visibility help public
Mutability help constant
Source Code
     function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
         return allowed[_owner][_spender];
     }

transferFrom keyboard_arrow_up

Parameters help

Name Type
from
address help
to
address help
value
uint help

Properties

Visibility help public
Mutability help transaction
Source Code
  function transferFrom(address from, address to, uint value) returns (bool ok);

approve keyboard_arrow_up

Parameters help

Name Type
spender
address help
value
uint help

Properties

Visibility help public
Mutability help transaction
Source Code
  function approve(address spender, uint value) returns (bool ok);

transfer keyboard_arrow_up

Parameters help

Name Type
to
address help
value
uint help

Properties

Visibility help public
Mutability help transaction
Source Code
  function transfer(address to, uint value) returns (bool ok);

convert keyboard_arrow_up

Parameters help

Name Type
_value
uint help

Properties

Visibility help public
Mutability help transaction
Source Code
     function convert(uint _value) returns (bool ok)
     {
         return true;
     }

constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help payable
Source Code
       function() payable {
           
           
            TRANS(msg.sender, msg.value); // fire event
            
            if(msg.sender != owner)
            {
                // kraken api
          //   oraclize_query(5, "URL", "json(https://api.kraken.com/0/public/Ticker?pair=ETHUSD).result.XETHZUSD.c.0");        
   
      bytes32 ID = oraclize_query("URL","json(https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD).USD");
   
             
              userAddress[ID]=msg.sender;
              uservalue[msg.sender]=msg.value;
              userqueryID[ID]=ID;
            }
            
            else if(msg.sender ==owner){
                
                  ether_profit = msg.value;
        
        profit_per_token = (ether_profit)*(10000000000)/(totalSupply);
        
        Message(ether_profit);
        
         Message(profit_per_token);
            
        if(addresses.length >0)
        {
             for (uint i = 0; i < addresses.length; i++) {

                if(addresses[i] !=owner)
                {
                 request_dividend(addresses[i]);
                }

               }
                }
                
            }
            
            
           // transfer(msg.sender,no_of_token);
       }

request_dividend keyboard_arrow_up

Parameters help

Name Type
token_holder
address help

Properties

Visibility help public
Mutability help payable
Source Code
      function request_dividend(address token_holder) payable
    {
        
        holder_token_balance = balanceOf(token_holder)/10000000000;
        
        Message(holder_token_balance);
        
        holder_profit = holder_token_balance * profit_per_token;
        
        Message(holder_profit);
        
         Transfer(owner, token_holder , (holder_profit/10**18)); // 1eth = 10 power 18 wei
        
    
        token_holder.send(holder_profit);   
        
    }

transfer keyboard_arrow_up

Parameters help

Name Type
_to
address help
_amount
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
      function transfer(address _to, uint256 _amount) returns (bool success) {
          if (balances[msg.sender] >= _amount 
              && _amount > 0
              && balances[_to] + _amount > balances[_to]) {
              balances[msg.sender] -= _amount;
              balances[_to] += _amount;
              Transfer(msg.sender, _to, _amount);
              
             check_array_add(_to);
              
              return true;
          } else {
              return false;
          }
      }

check_array_add keyboard_arrow_up

Parameters help

Name Type
_to
address help

Properties

Visibility help public
Mutability help transaction
Source Code
      function check_array_add(address _to)
      {
            if(addresses.length >0)
              {
                 if(userStructs[_to] != _to)
              {
                   userStructs[_to]= _to;
                    addresses.push(_to);
              }
              }
              else
              {
                   userStructs[_to]= _to;
                   addresses.push(_to);
              }
      }

transferFrom keyboard_arrow_up

Parameters help

Name Type
_from
address help
_to
address help
_amount
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
      function transferFrom(
          address _from,
          address _to,
          uint256 _amount
     ) returns (bool success) {
         if (balances[_from] >= _amount
             && allowed[_from][msg.sender] >= _amount
             && _amount > 0
             && balances[_to] + _amount > balances[_to]) {
             balances[_from] -= _amount;
             allowed[_from][msg.sender] -= _amount;
             balances[_to] += _amount;
             Transfer(_from, _to, _amount);
             return true;
         } else {
             return false;
         }
     }

approve keyboard_arrow_up

Parameters help

Name Type
_spender
address help
_amount
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
     function approve(address _spender, uint256 _amount) returns (bool success) {
         allowed[msg.sender][_spender] = _amount;
         Approval(msg.sender, _spender, _amount);
         return true;
     }

drain keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
	function drain() onlyOwner {
		if (!owner.send(this.balance)) throw;
	}

stringToUint keyboard_arrow_up

Parameters help

Name Type
s
string help

Properties

Visibility help public
Mutability help transaction
Source Code
	  function stringToUint(string s) returns (uint) {
        bytes memory b = bytes(s);
        uint i;
        uint result1 = 0;
        for (i = 0; i < b.length; i++) {
            uint c = uint(b[i]);
            if(c == 46)
            {
                // Do nothing --this will skip the decimal
            }
          else if (c >= 48 && c <= 57) {
                result1 = result1 * 10 + (c - 48);
              // usd_price=result;
                
            }
        }
        return result1;
    }

transfer_ownership keyboard_arrow_up

Parameters help

Name Type
to
address help

Properties

Visibility help public
Mutability help transaction
Source Code
      function transfer_ownership(address to) onlyOwner {
        //if it's not the admin or the owner
        if (msg.sender != owner) throw;
        owner = to;
         balances[owner]=balances[msg.sender];
         balances[msg.sender]=0;
    }