sbn contract
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
contract Sbn =
|
||||
record sp =
|
||||
{ip : string,
|
||||
port : int,
|
||||
protocol : string, // "tcp", "udp", "sctp", etc
|
||||
noise : string, // Noise_Foo_Bar_Baz_Quux
|
||||
pubkey : address, // responder static pubkey (noise: rs field)
|
||||
prologue : bytes} // noise prologue (empty = no prologue)
|
||||
|
||||
|
||||
type state = map(string, list(sp))
|
||||
|
||||
entrypoint
|
||||
init : () => state
|
||||
init() = {}
|
||||
|
||||
stateful entrypoint
|
||||
register : (string, list(sp)) => bool
|
||||
register(name, roster) =
|
||||
put(state{[name] = roster})
|
||||
true
|
||||
|
||||
stateful entrypoint
|
||||
lookup : (string) => option(list(rp))
|
||||
lookup(name) =
|
||||
Map.lookup(name, state)
|
||||
|
||||
stateful entrypoint
|
||||
get_state : state
|
||||
get_state() =
|
||||
state
|
||||
Reference in New Issue
Block a user