-
Notifications
You must be signed in to change notification settings - Fork 0
/
contract.js
12 lines (12 loc) · 14.3 KB
/
contract.js
1
2
3
4
5
6
7
8
9
10
11
12
contracts = {};
contracts["ForecastWeatherAtLocation"] = {
"interface" : [{"inputs": [{"type": "bytes32", "name": "locationSpecifier"}], "constant": false, "type": "function", "name": "user_topUpLocation", "outputs": [{"type": "uint256", "name": "newLocationBalance_OrZeroIfSentTooLittle"}]}, {"inputs": [], "constant": true, "type": "function", "name": "timestamp_in3daysAndAHalf", "outputs": [{"type": "uint256", "name": "epoch_timestamp"}]}, {"inputs": [], "constant": true, "type": "function", "name": "owner_infos_internal", "outputs": [{"type": "uint256", "name": "numLocations"}, {"type": "uint256", "name": "numNonemptyLocations"}, {"type": "uint256", "name": "locationsBalSum"}, {"type": "uint256", "name": "ownerBal"}]}, {"inputs": [], "constant": true, "type": "function", "name": "user_getTopUpMinimumValue", "outputs": [{"type": "uint256", "name": "priceMinimum"}]}, {"inputs": [{"type": "bytes32", "name": "locationSpecifier"}, {"type": "uint256", "name": "timestamp"}], "constant": true, "type": "function", "name": "user_getForecast", "outputs": [{"type": "bytes32", "name": "message"}, {"type": "uint256", "name": "timestamp_forecast"}, {"type": "uint32", "name": "temp_millikelvin"}, {"type": "uint32", "name": "pressure_pascal"}, {"type": "uint8", "name": "humidity_percent"}, {"type": "uint8", "name": "clouds_percent"}, {"type": "uint32", "name": "wind_centimeterpersecond"}, {"type": "uint32", "name": "rain3h_micrometer"}]}, {"inputs": [{"type": "address", "name": "newOwner"}], "constant": false, "type": "function", "name": "owner_changeOwnerTo", "outputs": []}, {"inputs": [{"type": "uint256", "name": "addhours"}], "constant": true, "type": "function", "name": "timestamp_now_plus_hours", "outputs": [{"type": "uint256", "name": "epoch_timestamp"}]}, {"inputs": [{"type": "bytes32", "name": "locationName"}, {"type": "bytes32", "name": "message"}], "constant": false, "type": "function", "name": "debug_emit_Event_WeatherForecastNotAdded", "outputs": []}, {"inputs": [], "constant": true, "type": "function", "name": "timestamp_now", "outputs": [{"type": "uint256", "name": "epoch_timestamp"}]}, {"inputs": [], "constant": false, "type": "function", "name": "oracle_cleanupLocations_TODO", "outputs": []}, {"inputs": [], "constant": false, "type": "function", "name": "owner_killContract", "outputs": []}, {"inputs": [{"type": "bytes32", "name": "locationSpecifier"}], "constant": true, "type": "function", "name": "user_getLocationLastUpdateTime", "outputs": [{"type": "uint256", "name": "timestamp_lastUpdate"}]}, {"inputs": [{"type": "uint256", "name": "_price"}, {"type": "uint8", "name": "_ownerRewardPercentage"}], "constant": false, "type": "function", "name": "owner_setPriceAndOracleReward", "outputs": [{"type": "bool", "name": "success"}]}, {"inputs": [], "constant": true, "type": "function", "name": "user_getContractVersion", "outputs": [{"type": "bytes32", "name": "version"}]}, {"inputs": [{"type": "bytes32", "name": "locationName"}], "constant": false, "type": "function", "name": "debug_emit_Event_WeatherForecastAdded", "outputs": []}, {"inputs": [], "constant": false, "type": "function", "name": "owner_withdrawEarnings", "outputs": [{"type": "bool", "name": "success"}]}, {"inputs": [], "constant": true, "type": "function", "name": "timestamp_in2days", "outputs": [{"type": "uint256", "name": "epoch_timestamp"}]}, {"inputs": [], "constant": true, "type": "function", "name": "timestamp_tomorrow", "outputs": [{"type": "uint256", "name": "epoch_timestamp"}]}, {"inputs": [], "constant": true, "type": "function", "name": "user_getLocationNamesWithPositiveBalance", "outputs": [{"type": "bytes32[]", "name": "names"}]}, {"inputs": [], "constant": true, "type": "function", "name": "timestamp_in1day", "outputs": [{"type": "uint256", "name": "epoch_timestamp"}]}, {"inputs": [{"type": "bytes32", "name": "locationName"}], "constant": false, "type": "function", "name": "debug_emit_Event_LocationToppedUp", "outputs": []}, {"inputs": [{"type": "bytes32", "name": "location"}, {"type": "uint8", "name": "position"}, {"type": "uint256", "name": "_timestamp_forecast"}, {"type": "uint32", "name": "_temp_millikelvin"}, {"type": "uint32", "name": "_pressure_pascal"}, {"type": "uint8", "name": "_humidity_percent"}, {"type": "uint8", "name": "_clouds_percent"}, {"type": "uint32", "name": "_wind_centimeterpersecond"}, {"type": "uint32", "name": "_rain3h_micrometer"}], "constant": false, "type": "function", "name": "oracle_addForecast", "outputs": [{"type": "bool", "name": "rewarded"}]}, {"inputs": [{"type": "address", "name": "oracleAddress"}], "constant": false, "type": "function", "name": "owner_removeOracle", "outputs": [{"type": "bool", "name": "wasAnOracle"}]}, {"inputs": [{"type": "address", "name": "oracleAddress"}], "constant": false, "type": "function", "name": "owner_addOracle", "outputs": [{"type": "bool", "name": "wasNew"}]}, {"inputs": [{"type": "bytes32", "name": "_name"}], "constant": true, "type": "function", "name": "user_getLocationBalance", "outputs": [{"type": "uint256", "name": "balance"}]}, {"inputs": [], "constant": true, "type": "function", "name": "timestamp_in3days", "outputs": [{"type": "uint256", "name": "epoch_timestamp"}]}, {"inputs": [{"type": "address", "name": "testAddress"}], "constant": true, "type": "function", "name": "owner_isAddressOracle", "outputs": [{"type": "bool", "name": "isOracle"}]}, {"inputs": [{"type": "bytes32", "name": "location"}, {"type": "bytes32", "name": "message"}], "constant": false, "type": "function", "name": "oracle_noForecast_setMessage", "outputs": [{"type": "bool", "name": "rewarded"}]}, {"inputs": [], "type": "constructor"}, {"inputs": [{"indexed": false, "type": "bytes32", "name": "locationName"}, {"indexed": false, "type": "uint256", "name": "timestamp_forecast"}, {"indexed": false, "type": "bool", "name": "rewarded"}, {"indexed": false, "type": "uint256", "name": "newBalance"}], "type": "event", "name": "Event_WeatherForecastAdded", "anonymous": false}, {"inputs": [{"indexed": false, "type": "bytes32", "name": "locationName"}, {"indexed": false, "type": "bytes32", "name": "message"}, {"indexed": false, "type": "bool", "name": "rewarded"}, {"indexed": false, "type": "uint256", "name": "newBalance"}], "type": "event", "name": "Event_WeatherForecastNotAdded", "anonymous": false}, {"inputs": [{"indexed": false, "type": "bytes32", "name": "locationName"}, {"indexed": false, "type": "address", "name": "sender"}, {"indexed": false, "type": "uint256", "name": "value"}, {"indexed": false, "type": "uint256", "name": "newBalance"}], "type": "event", "name": "Event_LocationToppedUp", "anonymous": false}],
"address": "0x0c5c4bc449808eee712b1d0858e2b12e71410c8e"
};
contracts["ForecastWeatherAtLocation"]["contractClass"] = web3.eth.contract(contracts["ForecastWeatherAtLocation"]["interface"]);
contracts["ForecastWeatherAtLocation"]["contract"] = contracts["ForecastWeatherAtLocation"].contractClass.at(contracts["ForecastWeatherAtLocation"]["address"]);
contracts["ForecastWeatherAtLocation"]["info"] = {"timestamp_in3days": {"inputs": [], "constant": true, "type": "function", "name": "timestamp_in3days", "outputs": [{"type": "uint256", "name": "epoch_timestamp"}]}, "timestamp_now": {"inputs": [], "constant": true, "type": "function", "name": "timestamp_now", "outputs": [{"type": "uint256", "name": "epoch_timestamp"}]}, "timestamp_in2days": {"inputs": [], "constant": true, "type": "function", "name": "timestamp_in2days", "outputs": [{"type": "uint256", "name": "epoch_timestamp"}]}, "owner_infos_internal": {"inputs": [], "constant": true, "type": "function", "name": "owner_infos_internal", "outputs": [{"type": "uint256", "name": "numLocations"}, {"type": "uint256", "name": "numNonemptyLocations"}, {"type": "uint256", "name": "locationsBalSum"}, {"type": "uint256", "name": "ownerBal"}]}, "oracle_cleanupLocations_TODO": {"inputs": [], "constant": false, "type": "function", "name": "oracle_cleanupLocations_TODO", "outputs": []}, "user_getLocationLastUpdateTime": {"inputs": [{"type": "bytes32", "name": "locationSpecifier"}], "constant": true, "type": "function", "name": "user_getLocationLastUpdateTime", "outputs": [{"type": "uint256", "name": "timestamp_lastUpdate"}]}, "owner_removeOracle": {"inputs": [{"type": "address", "name": "oracleAddress"}], "constant": false, "type": "function", "name": "owner_removeOracle", "outputs": [{"type": "bool", "name": "wasAnOracle"}]}, "timestamp_in1day": {"inputs": [], "constant": true, "type": "function", "name": "timestamp_in1day", "outputs": [{"type": "uint256", "name": "epoch_timestamp"}]}, "Event_WeatherForecastNotAdded": {"inputs": [{"indexed": false, "type": "bytes32", "name": "locationName"}, {"indexed": false, "type": "bytes32", "name": "message"}, {"indexed": false, "type": "bool", "name": "rewarded"}, {"indexed": false, "type": "uint256", "name": "newBalance"}], "type": "event", "name": "Event_WeatherForecastNotAdded", "anonymous": false}, "owner_isAddressOracle": {"inputs": [{"type": "address", "name": "testAddress"}], "constant": true, "type": "function", "name": "owner_isAddressOracle", "outputs": [{"type": "bool", "name": "isOracle"}]}, "debug_emit_Event_WeatherForecastNotAdded": {"inputs": [{"type": "bytes32", "name": "locationName"}, {"type": "bytes32", "name": "message"}], "constant": false, "type": "function", "name": "debug_emit_Event_WeatherForecastNotAdded", "outputs": []}, "user_getForecast": {"inputs": [{"type": "bytes32", "name": "locationSpecifier"}, {"type": "uint256", "name": "timestamp"}], "constant": true, "type": "function", "name": "user_getForecast", "outputs": [{"type": "bytes32", "name": "message"}, {"type": "uint256", "name": "timestamp_forecast"}, {"type": "uint32", "name": "temp_millikelvin"}, {"type": "uint32", "name": "pressure_pascal"}, {"type": "uint8", "name": "humidity_percent"}, {"type": "uint8", "name": "clouds_percent"}, {"type": "uint32", "name": "wind_centimeterpersecond"}, {"type": "uint32", "name": "rain3h_micrometer"}]}, "timestamp_tomorrow": {"inputs": [], "constant": true, "type": "function", "name": "timestamp_tomorrow", "outputs": [{"type": "uint256", "name": "epoch_timestamp"}]}, "owner_killContract": {"inputs": [], "constant": false, "type": "function", "name": "owner_killContract", "outputs": []}, "user_getLocationNamesWithPositiveBalance": {"inputs": [], "constant": true, "type": "function", "name": "user_getLocationNamesWithPositiveBalance", "outputs": [{"type": "bytes32[]", "name": "names"}]}, "Event_WeatherForecastAdded": {"inputs": [{"indexed": false, "type": "bytes32", "name": "locationName"}, {"indexed": false, "type": "uint256", "name": "timestamp_forecast"}, {"indexed": false, "type": "bool", "name": "rewarded"}, {"indexed": false, "type": "uint256", "name": "newBalance"}], "type": "event", "name": "Event_WeatherForecastAdded", "anonymous": false}, "Event_LocationToppedUp": {"inputs": [{"indexed": false, "type": "bytes32", "name": "locationName"}, {"indexed": false, "type": "address", "name": "sender"}, {"indexed": false, "type": "uint256", "name": "value"}, {"indexed": false, "type": "uint256", "name": "newBalance"}], "type": "event", "name": "Event_LocationToppedUp", "anonymous": false}, "user_topUpLocation": {"inputs": [{"type": "bytes32", "name": "locationSpecifier"}], "constant": false, "type": "function", "name": "user_topUpLocation", "outputs": [{"type": "uint256", "name": "newLocationBalance_OrZeroIfSentTooLittle"}]}, "oracle_addForecast": {"inputs": [{"type": "bytes32", "name": "location"}, {"type": "uint8", "name": "position"}, {"type": "uint256", "name": "_timestamp_forecast"}, {"type": "uint32", "name": "_temp_millikelvin"}, {"type": "uint32", "name": "_pressure_pascal"}, {"type": "uint8", "name": "_humidity_percent"}, {"type": "uint8", "name": "_clouds_percent"}, {"type": "uint32", "name": "_wind_centimeterpersecond"}, {"type": "uint32", "name": "_rain3h_micrometer"}], "constant": false, "type": "function", "name": "oracle_addForecast", "outputs": [{"type": "bool", "name": "rewarded"}]}, "user_getLocationBalance": {"inputs": [{"type": "bytes32", "name": "_name"}], "constant": true, "type": "function", "name": "user_getLocationBalance", "outputs": [{"type": "uint256", "name": "balance"}]}, "debug_emit_Event_WeatherForecastAdded": {"inputs": [{"type": "bytes32", "name": "locationName"}], "constant": false, "type": "function", "name": "debug_emit_Event_WeatherForecastAdded", "outputs": []}, "owner_addOracle": {"inputs": [{"type": "address", "name": "oracleAddress"}], "constant": false, "type": "function", "name": "owner_addOracle", "outputs": [{"type": "bool", "name": "wasNew"}]}, "owner_withdrawEarnings": {"inputs": [], "constant": false, "type": "function", "name": "owner_withdrawEarnings", "outputs": [{"type": "bool", "name": "success"}]}, "debug_emit_Event_LocationToppedUp": {"inputs": [{"type": "bytes32", "name": "locationName"}], "constant": false, "type": "function", "name": "debug_emit_Event_LocationToppedUp", "outputs": []}, "owner_setPriceAndOracleReward": {"inputs": [{"type": "uint256", "name": "_price"}, {"type": "uint8", "name": "_ownerRewardPercentage"}], "constant": false, "type": "function", "name": "owner_setPriceAndOracleReward", "outputs": [{"type": "bool", "name": "success"}]}, "timestamp_now_plus_hours": {"inputs": [{"type": "uint256", "name": "addhours"}], "constant": true, "type": "function", "name": "timestamp_now_plus_hours", "outputs": [{"type": "uint256", "name": "epoch_timestamp"}]}, "oracle_noForecast_setMessage": {"inputs": [{"type": "bytes32", "name": "location"}, {"type": "bytes32", "name": "message"}], "constant": false, "type": "function", "name": "oracle_noForecast_setMessage", "outputs": [{"type": "bool", "name": "rewarded"}]}, "user_getTopUpMinimumValue": {"inputs": [], "constant": true, "type": "function", "name": "user_getTopUpMinimumValue", "outputs": [{"type": "uint256", "name": "priceMinimum"}]}, "owner_changeOwnerTo": {"inputs": [{"type": "address", "name": "newOwner"}], "constant": false, "type": "function", "name": "owner_changeOwnerTo", "outputs": []}, "timestamp_in3daysAndAHalf": {"inputs": [], "constant": true, "type": "function", "name": "timestamp_in3daysAndAHalf", "outputs": [{"type": "uint256", "name": "epoch_timestamp"}]}, "user_getContractVersion": {"inputs": [], "constant": true, "type": "function", "name": "user_getContractVersion", "outputs": [{"type": "bytes32", "name": "version"}]}};
WEATHER = contracts["ForecastWeatherAtLocation"]["contract"];
WEATHERinfo = contracts["ForecastWeatherAtLocation"]["info"];
WEATHER["info"] = "WEATHERinfo";
console.log("Contract ABI, and address loaded. Type WEATHER and press enter");