simple rubicon ct
This commit is contained in:
+36
-9
@@ -1,17 +1,44 @@
|
|||||||
/**
|
/**
|
||||||
* Rubicon contracts
|
* Rubicon contract
|
||||||
*
|
|
||||||
* Copyright (C) 2026, QPQ AG
|
|
||||||
*
|
*
|
||||||
* Author: Peter Harpending <peterharpending@qpq.swiss>
|
* Author: Peter Harpending <peterharpending@qpq.swiss>
|
||||||
* Date: 2026-08-12
|
* Date: 2026-08-12
|
||||||
*/
|
*/
|
||||||
|
|
||||||
payable contract NameService =
|
contract Rubicon =
|
||||||
record state =
|
// this could/should be a record, but records aren't really
|
||||||
{names : map(string, address)}
|
// portable across contracts/languages/APIs
|
||||||
|
//
|
||||||
|
// I think records are returned to caller as a FATE tuple with
|
||||||
|
// fields in this order. I don't really know though and that's
|
||||||
|
// kind of a hack and not something that we should build around i
|
||||||
|
// feel like
|
||||||
|
//
|
||||||
|
// record rbx =
|
||||||
|
// {ip : string,
|
||||||
|
// port : int,
|
||||||
|
// protocol : string, // "tcp", "udp", "sctp", etc
|
||||||
|
// noise : string, // Noise_Foo_Bar_Baz_Quux
|
||||||
|
// pubkey : bytes, // service's pubkey
|
||||||
|
// salt : bytes} // ???
|
||||||
|
|
||||||
payable entrypoint
|
// (ip, port, protocol, noise, pubkey)
|
||||||
init : () => state
|
type rbx_tuple = string * int * string * string * bytes
|
||||||
init() =
|
type state = list(rbx_tuple)
|
||||||
|
|
||||||
|
entrypoint
|
||||||
|
init : list(rbx_tuple) => state
|
||||||
|
init(services) =
|
||||||
|
services
|
||||||
|
|
||||||
|
stateful entrypoint
|
||||||
|
set_services : list(rbx_tuple) => ()
|
||||||
|
set_services(_) | Call.caller != Contract.creator =
|
||||||
|
abort("Not allowed")
|
||||||
|
set_services(svs) =
|
||||||
|
put(svs)
|
||||||
|
|
||||||
|
entrypoint
|
||||||
|
get_services : () => list(rbx_tuple)
|
||||||
|
get_services() =
|
||||||
|
state
|
||||||
|
|||||||
Reference in New Issue
Block a user