-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.gno
39 lines (33 loc) · 1.17 KB
/
main.gno
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package shiken
import (
"std"
avl "gno.land/p/demo/avl"
)
var (
Problems avl.Tree // Id -> Problem
leaderboardsKeyToScore avl.Tree // Id -> Btree{Key -> ScoreData}
leaderboardsAddressToKey avl.Tree // Id -> Avl.Tree{Address -> Score}
scoreCounter int // Contabilize the number of score attempts
TreeAddressToData avl.Tree // Address -> Data
owner std.Address // Creator of realm
ProblemId int // Counter for problems so can be registered in an avl.Tree
DAO avl.Tree // List of addresses that conform those that can edit everything here
DAOsize int // This value must be set in the beginning of the ream
)
const (
ErrNoProblemId = "No problem with given Id"
ErrNotDAOMember = "This address is not from a DAO member"
ErrNotDAOSize = "This list doesn't have enough members for the new DAO"
LeaderboardFactor = 10_000_000_000
)
func init() {
creator := std.GetOrigCaller()
owner = creator
DAOsize = 1
ProblemId = 1
DAO = avl.Tree{}
DAO.Set(creator.String(), true)
}
func Render(path string) string {
return "Shiken"
}