github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/examples/gno.land/r/sys/names/names.gno (about) 1 // The realm r/sys/names is used to manage namespaces on gno.land. 2 package names 3 4 import ( 5 "std" 6 7 "gno.land/p/demo/avl" 8 ) 9 10 // "AddPkg" will check if r/sys/names exists. If yes, it will 11 // inspect the realm's state and use the following variable to 12 // determine if an address can publish a package or not. 13 var namespaces avl.Tree // name(string) -> Space 14 15 type Space struct { 16 Admins []std.Address 17 Editors []std.Address 18 InPause bool 19 } 20 21 func Register(namespace string) { 22 // TODO: input sanitization: 23 // - already exists / reserved. 24 // - min/max length, format. 25 // - fees (dynamic, based on length). 26 panic("not implemented") 27 } 28 29 func AddAdmin(namespace string, newAdmin std.Address) { 30 // TODO: assertIsAdmin() 31 panic("not implemented") 32 } 33 34 func RemoveAdmin(namespace string, newAdmin std.Address) { 35 // TODO: assertIsAdmin() 36 // TODO: check if self. 37 panic("not implemented") 38 } 39 40 func AddEditor(namespace string, newAdmin std.Address) { 41 // TODO: assertIsAdmin() 42 panic("not implemented") 43 } 44 45 func RemoveEditor(namespace string, newAdmin std.Address) { 46 // TODO: assertIsAdmin() 47 // TODO: check if self. 48 panic("not implemented") 49 } 50 51 func SetInPause(namespace string, state bool) { 52 // TODO: assertIsAdmin() 53 panic("not implemented") 54 } 55 56 func Render(path string) string { 57 // TODO: by namespace. 58 // TODO: by address. 59 return "not implemented" 60 }