21 lines
477 B
Lua
21 lines
477 B
Lua
function __init__ ()
|
|
return {hue=0}
|
|
end
|
|
|
|
function sethue ()
|
|
if call.msatoshi < 1000000 then
|
|
error('pay at least 1000 sats!')
|
|
end
|
|
|
|
if type(call.payload.hue) ~= 'number' then
|
|
error('hue is not a number!')
|
|
end
|
|
|
|
if call.payload.hue < 0 or call.payload.hue > 360 then
|
|
error('hue is out of the 0~360 range!')
|
|
end
|
|
|
|
contract.state.hue = call.payload.hue
|
|
contract.send('86fa35962e3c40d400f983422284ce5470fb7c3900deb0606d1e2be8ba0f5d9a', call.msatoshi)
|
|
end
|