Registry code working well enough to demo (various checks not performed in either...
[robmyers:artworld-ethereum.git] / contract / transferrable_stored_work.se
1 init:
2     ARTIST = 0x8802b7f0bfa5e9f5825f2fc708e1ad00d2c2b5d6
3     OWNER = 1001
4     // Initialize the owner to be the artist
5     contract.storage[OWNER] = ARTIST
6
7 code:
8     OWNER = 1001
9     ARTWORK = "The art happens here."
10     // Make sure we have enough gas to run the contact
11     //if tx.value < tx.basefee * 200:
12         // If not, stop
13     //    stop
14
15     // If the message is from the current owner
16     // and there are enough arguments
17     // and the command to transfer is being given
18     if msg.sender == contract.storage[OWNER] and msg.datasize == 2 and msg.data[0] == "transfer":
19         // Transfer it to a new owner
20         contract.storage[OWNER] = msg.data[1]
21         return(1)
22     // If there are enough arguments
23     // and the command to show the work is being given
24     elif msg.datasize == 1:
25         // Just return the artwork
26         return(ARTWORK)
27     else:
28         return(0)