Convert to ace and to current Serpent. Some errors with return() will be fixed soon...
[robmyers:artworld-ethereum.git] / contract / 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)