Custom and numbered work examples updated to work without byte arrays. Revisit this...
[robmyers:artworld-ethereum.git] / serpent / numbered_works.se
1 init:
2     ARTWORK.NUMBER.INDEX = 1001 
3     contract.storage[ARTWORK.NUMBER.INDEX] = 1
4
5 code:
6     ARTWORK = "Work #"
7     ARTWORK.NUMBER.INDEX = 1001
8     
9     // Make sure we have enough gas to run the contact
10     if tx.value < tx.basefee * 400:
11         // If not, stop
12         stop
13
14     // Get the number of the work to produce
15     number = contract.storage[ARTWORK.NUMBER.INDEX]
16     // Store the number to use for the next work
17     contract.storage[ARTWORK.NUMBER.INDEX] = contract.storage[ARTWORK.NUMBER.INDEX] + 1
18     // Return the work
19     return([ARTWORK, number], 2)