Skip to content

Weather station oracle#34

Open
Andy92Pac wants to merge 3 commits intoiExecBlockchainComputing:masterfrom
Andy92Pac:weather-station-oracle
Open

Weather station oracle#34
Andy92Pac wants to merge 3 commits intoiExecBlockchainComputing:masterfrom
Andy92Pac:weather-station-oracle

Conversation

@Andy92Pac
Copy link
Contributor

Doracle address : 0xdffFa5f74Ba05A21C8A10E76d41f50F8A0858A5F
Docker container : https://hub.docker.com/r/andy92pac/weather-station
Smart contract address : 0x3980652C5b1dc731A97af99c91b23A017a170f4c

The Doracle is using DarkSky api to get description of the weather at a specific location.
Using this api, it is possible to get access to historical data as well as upcoming forecast. Past and future timestamps are therefore valid.
The description of the weather can get the following values : clear-day, clear-night, rain, snow, sleet, wind, fog, cloudy, partly-cloudy-day and partly-cloudy-night

Copy link
Contributor

@Amxx Amxx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minors improvements would be nice (see comments). Otherwise good work

struct Location
{
string location;
mapping(uint256 => WeatherReport) reports;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be nice to have reports as an array of WeatherReport (each WeatherReport containing the associated time).
That way we can traverse the history / get the latest value easily.

Another solution is to only store the latest report and rely on offchain services (such as TheGraph) to index past events

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it could be nice to use an array as well. But as we allow users to pass a specific timestamp, the reports being fetched will not necessarily be in a correct time order, that's why I used a mapping instead. Don't you think it is better in this case ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants