See original Reddit post for the origin story.
This contract allows participants to guess when they believe the price of ether (ETH) will next reach 1000 USD. Under the assumption that u/Jimmyn3wbert will follow through with his promise and use this particular contract as the means of fulfilling it, the person whose guess is closest to when ETH hits the mark wins.
-
Participants include both a UNIX timestamp and the address that they want to receive the ETH in when making a guess. Only one guess per address is possible.
-
Once the
checkPrice
function is called, which can only be called by the contract owner, and assuming the price is greater than 1000 USD based on Kraken's last trade between the ETHUSD pairing on their API,priceConfirmedOver1000
is set to true and thepayout
function can be called. -
payout
iterates through all the various participants and finds the one whose timestamp guess is closest to the winning timestamp, whether their guess falls before or after the winning timestamp. Note, there is nothing stopping the owner from putting a false timestamp in when he callspayout
. Assuming good faith, he should callcheckPrice
, wait for Oraclize to return theresult
from the API call, then provide the timestamp returned in the event log (from when Oraclize was queried) in thepayout
function.
This is an open source project. Contributions are welcomed & encouraged! 😄
- Audit and code review