Files
rbx/rq/ct/rubicon.aes

32 lines
1.0 KiB
Plaintext

/**
* Rubicon contract
*
* Author: Peter Harpending <peterharpending@qpq.swiss>
* Date: 2026-09-04
*/
contract Rubicon =
// this could/should be a record, but records aren't really
// portable across contracts/languages/APIs
//
// 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 : option(bytes)} // noise prologue (empty = no prologue)
// (ip, port, protocol, noise, pubkey, prologue)
type rbx_tuple = string * int * string * string * address * option(bytes)
type state = list(rbx_tuple)
entrypoint init(tuples: list(rbx_tuple)): state =
tuples
stateful entrypoint set(tuples: list(rbx_tuple)): unit =
require(Call.caller == Contract.creator, "Not allowed")
put(tuples)
entrypoint lookup(): list(rbx_tuple) =
state