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('86fa35a3d26f3c0f332e3e812420057cf0e6cf997c5be1c548066a09c634dafe', call.msatoshi)
|
|
end
|