Last active
May 29, 2016 10:16
-
-
Save tinybike/a4f38d10052bd36b2bf4f8dbbae83fd3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| from ethereum import tester | |
| s = tester.state() | |
| c = s.abi_contract("sha3-example.se") | |
| print hex(c.makeMarketID()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def makeMarketID(): | |
| description = text("Will the average temperature on Earth in 2016 be Higher, Lower, or Unchanged from the average temperature on Earth in 2014?") | |
| marketInfo = string(8*32 + len(description)) | |
| marketInfo[0] = 0x1708aec800 | |
| marketInfo[1] = 0x51eb851eb851eb8 | |
| marketInfo[2] = 0x574aad9e | |
| marketInfo[3] = 0x7765617468657200000000000000000000000000000000000000000000000000 | |
| marketInfo[4] = 0x74656d7065726174757265000000000000000000000000000000000000000000 | |
| marketInfo[5] = 0x636c696d617465206368616e6765000000000000000000000000000000000000 | |
| marketInfo[6] = 0x159823db800 | |
| marketInfo[7] = len(description) | |
| mcopy(marketInfo + 8*32, description, chars=len(description)) | |
| marketID = sha3(marketInfo, chars=len(marketInfo)) | |
| return marketID |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment