rq rename
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
contract interface Rubicon =
|
||||
entrypoint lookup: () => list(string * int * string * string * address * bytes)
|
||||
|
||||
contract Names =
|
||||
type rbx_tuple = string * int * string * string * address * bytes
|
||||
type state = map(string, Rubicon)
|
||||
|
||||
entrypoint init(): state =
|
||||
{}
|
||||
|
||||
stateful entrypoint register(name: string, addr: Rubicon): unit =
|
||||
put(state{[name] = addr})
|
||||
|
||||
stateful entrypoint lookup(name: string): option(list(rbx_tuple)) =
|
||||
switch(Map.lookup(name, state))
|
||||
Some(addr) =>
|
||||
Some(addr.lookup())
|
||||
None =>
|
||||
None
|
||||
@@ -0,0 +1,24 @@
|
||||
contract Rubicon =
|
||||
// record rbx =
|
||||
// {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)
|
||||
|
||||
// (ip, port, protocol, noise, pubkey, prologue)
|
||||
type rbx_tuple = string * int * string * string * address * bytes
|
||||
type state = list(rbx_tuple)
|
||||
|
||||
entrypoint init(tuples: list(rbx_tuple)): state =
|
||||
tuples
|
||||
|
||||
stateful entrypoint set(tuples: list(rbx_tuple)): unit =
|
||||
// this would be nice
|
||||
// but unfortunately nobody knows how to do this
|
||||
// require(Call.caller == Contract.creator, "Not allowed")
|
||||
put(tuples)
|
||||
|
||||
entrypoint lookup(): list(rbx_tuple) =
|
||||
state
|
||||
Reference in New Issue
Block a user