-
Notifications
You must be signed in to change notification settings - Fork 373
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add placeholders for r/system/names (#375)
* feat: add r/system/names Signed-off-by: Manfred Touron <[email protected]> * chore: add placeholder comment for namespace support Signed-off-by: Manfred Touron <[email protected]> * fixup Signed-off-by: Manfred Touron <[email protected]> Signed-off-by: Manfred Touron <[email protected]>
- Loading branch information
Showing
3 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package names | ||
|
||
import "std" | ||
|
||
func init() { | ||
// Please, do not edit this file to reserve your username, use a transaction instead. | ||
var ( | ||
jaekwon = std.Address("g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj") | ||
manfred = std.Address("g1u7y667z64x2h7vc6fmpcprgey4ck233jaww9zq") | ||
test1 = std.Address("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5") | ||
reservedAdmin = std.Address("g100000000000000000000000000000000000000") // FIXME: create a multisig. | ||
reservedNames = []string{ | ||
// FIXME: complete this list. | ||
"gno", "gnolang", "tendermint", "cosmos", "hub", "admin", | ||
"ethereum", "bitcoin", | ||
// FIXME: reserve brands? then, require KYC to unlock? | ||
} | ||
) | ||
namespaces.Set("demo", &Space{Admins: []std.Address{jaekwon, manfred}}) | ||
namespaces.Set("gnoland", &Space{Admins: []std.Address{jaekwon, manfred}}) | ||
namespaces.Set("system", &Space{Admins: []std.Address{jaekwon, manfred}}) | ||
namespaces.Set("jaekwon", &Space{Admins: []std.Address{jaekwon}}) | ||
namespaces.Set("manfred", &Space{Admins: []std.Address{manfred}}) | ||
namespaces.Set("test1", &Space{Admins: []std.Address{test1}}) | ||
|
||
for _, keyword := range reservedNames { | ||
namespaces.Set(keyword, &Space{Admins: []std.Address{reservedAdmin}}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// The realm r/system/names is used to manage namespaces on gno.land. | ||
package names | ||
|
||
import ( | ||
"std" | ||
|
||
"gno.land/p/demo/avl" | ||
) | ||
|
||
// "AddPkg" will check if r/system/names exists. If yes, it will | ||
// inspect the realm's state and use the following variable to | ||
// determine if an address can publish a package or not. | ||
var namespaces avl.MutTree // name(string) -> Space | ||
|
||
type Space struct { | ||
Admins []std.Address | ||
Editors []std.Address | ||
InPause bool | ||
} | ||
|
||
func Register(namespace string) { | ||
// TODO: input sanitization: | ||
// - already exists / reserved. | ||
// - min/max length, format. | ||
// - fees (dynamic, based on length). | ||
panic("not implemented") | ||
} | ||
|
||
func AddAdmin(namespace string, newAdmin std.Address) { | ||
// TODO: assertIsAdmin() | ||
panic("not implemented") | ||
} | ||
|
||
func RemoveAdmin(namespace string, newAdmin std.Address) { | ||
// TODO: assertIsAdmin() | ||
// TODO: check if self. | ||
panic("not implemented") | ||
} | ||
|
||
func AddEditor(namespace string, newAdmin std.Address) { | ||
// TODO: assertIsAdmin() | ||
panic("not implemented") | ||
} | ||
|
||
func RemoveEditor(namespace string, newAdmin std.Address) { | ||
// TODO: assertIsAdmin() | ||
// TODO: check if self. | ||
panic("not implemented") | ||
} | ||
|
||
func SetInPause(namespace string, state bool) { | ||
// TODO: assertIsAdmin() | ||
panic("not implemented") | ||
} | ||
|
||
func Render(path string) string { | ||
// TODO: by namespace. | ||
// TODO: by address. | ||
return "not implemented" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters