z3zB7GMkA9sGzDMm5ghbntnH44zuN/contract/contract.lua
npub1smartg7jdu7q7vew86qjggq90ncwdnue03d7r32gqe4qn335mtlqpqs7zu 01fcbbf3fc
genesis
2024-07-10 22:21:29 +02:00

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