Skip to content

anemometer#33

Open
Andy92Pac wants to merge 1 commit intoiExecBlockchainComputing:masterfrom
Andy92Pac:anemometer
Open

anemometer#33
Andy92Pac wants to merge 1 commit intoiExecBlockchainComputing:masterfrom
Andy92Pac:anemometer

Conversation

@Andy92Pac
Copy link
Contributor

Doracle address : 0xA4f68821bdA8d6117eA8b88afbe0A91c3c2dE119
Docker container : https://hub.docker.com/r/andy92pac/wind-feed
Smart contract address : 0x65464777c27D8242A2d32bA48aE688b563BC4e4d

The Doracle is using DarkSky api to get general summary (string) and wind speed (uint256).
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 wind speed is fetched using SI units and then multiplied by 1000 by the Doracle to prevent a loss of precision.

@Andy92Pac Andy92Pac changed the title anomometer anemometer Oct 20, 2019
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