The contract pulls the last n=10 check_point ETH price from Empiric oracle and uses that for a super smart algorithm to predict price for the next epoch
The number historical price points pulled by contract be changed in contracts/libraries/helpers/constants.cairo. The higher this number, the more accurate the prediction would be
The algorithm contract used is in predict_next_price function which can be tuned further for more accuracy
The contract was deployed on StarkNet Goerli testnet at 0x6acea7a35c3226898b8143cc1ec76a7b079bb023fd660852b6b9ad7a17e1ebb
How it's Made
Contracts are written in Cairo
Empiric oracle contract address on StarkNet Goerli: 0x0446812bac98c08190dee8967180f4e3cdcd1db9373ca269904acb17f67f7093
Nile framework has been used for compiling and deployment
The project showed that it's easy to query historical data onchain, and potentially more with other consuming data & computational feeds, more sophisticated algorithms for prediction can be done onchain as well