admin.gno

0.84 Kb ยท 51 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.DoByCurrent("update-instructions", func() error {
17		instructions = newInstructions
18		return nil
19	})
20	if err != nil {
21		panic(err)
22	}
23}
24
25func updateMinFee(newMinFee int64) {
26	err := auth.DoByCurrent("update-min-fee", func() error {
27		minFee = std.NewCoin("ugnot", newMinFee)
28		return nil
29	})
30	if err != nil {
31		panic(err)
32	}
33}
34
35func NewInstructionsProposalCallback(newInstructions string) func(realm) error {
36	cb := func(cur realm) error {
37		updateInstructions(newInstructions)
38		return nil
39	}
40
41	return cb
42}
43
44func NewMinFeeProposalCallback(newMinFee int64) func(realm) error {
45	cb := func(cur realm) error {
46		updateMinFee(newMinFee)
47		return nil
48	}
49
50	return cb
51}