Skip to content
Verified contractPartial

Oraclize

Address0x73efa7dd98b095fd43f835e6fb04576a45e712d3
Balance

0 ETH

 

Transactions

8

 

Compiler

solc 0.1.6

 

Same code

Only this contract

 

Details

Compiler
solc 0.1.6+commit.d41f8b7c
Language
solidity
Optimization
Yes, 200 runs
License
Not stated
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
469,357
Creation transaction
0xcc47fc2ac3…41f8883d94

Oraclize.sol

// Recovered by EthereumHistory (ethereumhistory.com) -sw
contract Oraclize {
    function addDSource(string dsname, uint multiplier) {
        if ((msg.sender != owner)&&(msg.sender != cb_address)) throw;
        bytes32 dsname_hash = sha3(dsname);
        dsources[dsources.length++] = dsname_hash;
        price_multiplier[dsname_hash] = multiplier;
    }

    uint reqc = 0;

    address public cb_address = 0x26588a9301b0428d95e6fc3a5024fce8bec12d51;

    event Log1(bytes32 cid, uint timestamp, string datasource, string arg);
    event Log2(bytes32 cid, uint timestamp, string datasource, string arg1, string arg2);

    address owner;

    function(){
        msg.sender.send(msg.value);
    }

    function Oraclize() {
        owner = msg.sender;
    }

    modifier costs(string datasource) {
        uint price = getPrice(datasource, msg.sender);
        if (price == 0) addr_already[msg.sender] = true;
        if (msg.value >= price){
            address(0xf65b3b60010d57d0bb8478aa6ced15fe720621b4).send(price);
            uint diff = msg.value - price;
            if (diff > 0) msg.sender.send(diff);
            _
        } else throw;
    }
    mapping (address => bool) addr_already;
    uint baseprice;
    mapping (bytes32 => uint) price;
    mapping (bytes32 => uint) price_multiplier;
    bytes32[] dsources;

    function getPrice(string _datasource) public returns (uint _dsprice) {
        return getPrice(_datasource, msg.sender);
    }

    function getPrice(string _datasource, uint _gaslimit) public returns (uint _dsprice) {
        return getPrice(_datasource, _gaslimit, msg.sender);
    }

    function getPrice(string _datasource, address _addr) private returns (uint _dsprice) {
        return getPrice(_datasource, 200000, _addr);
    }

    uint gasprice = 500000000000;

    function setGasPrice(uint newgasprice){
        if ((msg.sender != owner)&&(msg.sender != cb_address)) throw;
        gasprice = newgasprice;
    }

    function getPrice(string _datasource, uint _gaslimit, address _addr) private returns (uint _dsprice) {
        if (addr_already[_addr] == false) return 0;
        _dsprice = price[sha3(_datasource)];
        _dsprice += _gaslimit*gasprice;
        return _dsprice;
    }

    function setBasePrice(uint new_baseprice){
        if ((msg.sender != owner)&&(msg.sender != cb_address)) throw;
        baseprice = new_baseprice;
        for (uint i=0; i<dsources.length; i++) price[dsources[i]] = new_baseprice*price_multiplier[dsources[i]];
    }

    function query(uint _timestamp, string _datasource, string _arg) returns (bytes32 _id){
        return query1(_timestamp, _datasource, _arg);
    }

    function query1(uint _timestamp, string _datasource, string _arg) costs(_datasource) returns (bytes32 _id){
        _id = sha3(now+reqc);
        reqc++;
        Log1(_id, _timestamp, _datasource, _arg);
        return _id;
    }

    function query2(uint _timestamp, string _datasource, string _arg1, string _arg2) costs(_datasource) returns (bytes32 _id){
        _id = sha3(now+reqc);
        reqc++;
        Log2(_id, _timestamp, _datasource, _arg1, _arg2);
        return _id;
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": true
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.