admin.gno
0.80 Kb ยท 53 lines
1package valopers
2
3import (
4 "std"
5
6 "gno.land/p/moul/authz"
7)
8
9var auth *authz.Authorizer
10
11func Auth() *authz.Authorizer {
12 return auth
13}
14
15func updateInstructions(newInstructions string) {
16 err := auth.Do("update-instructions", func() error {
17 instructions = newInstructions
18 return nil
19 })
20
21 if err != nil {
22 panic(err)
23 }
24}
25
26func updateMinFee(newMinFee int64) {
27 err := auth.Do("update-min-fee", func() error {
28 minFee = std.NewCoin("ugnot", newMinFee)
29 return nil
30 })
31
32 if err != nil {
33 panic(err)
34 }
35}
36
37func NewInstructionsProposalCallback(newInstructions string) func() error {
38 cb := func() error {
39 updateInstructions(newInstructions)
40 return nil
41 }
42
43 return cb
44}
45
46func NewMinFeeProposalCallback(newMinFee int64) func() error {
47 cb := func() error {
48 updateMinFee(newMinFee)
49 return nil
50 }
51
52 return cb
53}