3 ;; Price base (wei), doubled for each definition up to DEFS-COUNT
5 ;; Add to the index to get the price base exponent
6 (def 'PRICE-FACTOR-ADD 10)
7 ;; Number of definitions
9 ;; Range of values for definitions
11 (def 'DEF-MAX 0x0F0F0F0F)
15 (def 'defs-base 0x100)
16 (def 'theorists-base 0x200)
19 ;; Contract owner/payee
26 [action] (calldataload 0)
27 (when (= @action "set")
29 [index] (calldataload 32)
30 [definition] (calldataload 64)
31 [price] (exp PRICE-BASE (+ @index 1 PRICE-FACTOR-ADD))
32 ;; If the index is in range and the caller paid enough to set it
33 (when (&& (>= @definition DEF-MIN)
34 (<= @definition DEF-MAX)
36 (= (callvalue) @price))
39 [[(+ defs-base @index)]] @definition
40 [[(+ theorists-base @index)]] (caller)
41 (- (gas) 100) @@artist @price 0 0 0 0