Conversation
Amxx
left a comment
There was a problem hiding this comment.
Minors improvements would be nice (see comments). Otherwise good work
| struct Location | ||
| { | ||
| string location; | ||
| mapping(uint256 => WeatherReport) reports; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 ?
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.