Skip to content
Verified contractPartial

Weather

Address0xbffcd3a8e2afa3e71c7205ecc36b858acb42be44
Balance

0 ETH

 

Transactions

2

 

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
499,120
Creation transaction
0xe9a21186ab…99cc3b12ff

Weather.sol

// Recovered by EthereumHistory (ethereumhistory.com) -sw
contract OraclizeI {
    address public cbAddress;
    function query(uint _timestamp, string _datasource, string _arg) returns (bytes32 _id);
    function getPrice(string _datasource) returns (uint _dsprice);
    function useCoupon(string _coupon);
}

contract OraclizeAddrResolverI {
    function getAddress() returns (address _addr);
}

contract usingOraclize {
    OraclizeI oraclize;

    modifier oraclizeAPI {
        OraclizeAddrResolverI OAR = OraclizeAddrResolverI(0x1d11e5eae3112dbd44f99266872ff1d07c77dce8);
        oraclize = OraclizeI(OAR.getAddress());
        _
    }

    modifier coupon(string code) {
        _
    }

    function oraclize_query(uint timestamp, string datasource, string arg) oraclizeAPI internal returns (bytes32 id) {
        return oraclize.query.value(oraclize.getPrice(datasource))(timestamp, datasource, arg);
    }

    function oraclize_cbAddress() oraclizeAPI internal returns (address) {
        return oraclize.cbAddress();
    }

    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;
    	}	
    }
}

contract IoTDAO {
    function close();
}

contract Weather is usingOraclize {
    address iot = 0x87bb217883541a312fac2977c2a744219963586f;

    function Weather() {
        checkWeather();
    }

    function __callback(bytes32 myid, string result) {
        if (msg.sender != oraclize_cbAddress()) throw;
        if (indexOf(result, "cloud") > -1) IoTDAO(iot).close();
        else checkWeather();
    }

    function checkWeather() coupon("IoTDAO") {
        oraclize_query(60, "WolframAlpha", "weather conditions in London");
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": true
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.