Skip to content Search Apps Documentation Source Content File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

fee_collector.gno

0.66 Kb · 41 lines
 1package admin
 2
 3import (
 4	"chain"
 5
 6	"gno.land/p/akkadia/beta/accesscontrol"
 7)
 8
 9const (
10	SetFeeCollectorEvent = "SetFeeCollector"
11)
12
13var (
14	feeCollectorAddr address
15)
16
17func init() {
18	feeCollectorAddr = chain.PackageAddress("gno.land/r/akkadia/beta/admin")
19}
20
21func GetFeeCollector() address {
22	return feeCollectorAddr
23}
24
25func SetFeeCollector(cur realm, addr address) {
26	accesscontrol.AssertIsAdmin(0, cur, IsAdmin)
27
28	assertValidAddress(addr)
29	oldAddr := feeCollectorAddr
30	feeCollectorAddr = addr
31
32	chain.Emit(
33		SetFeeCollectorEvent,
34		"oldAddr", oldAddr.String(),
35		"newAddr", addr.String(),
36	)
37}
38
39func IsFeeCollector(address address) bool {
40	return address == feeCollectorAddr
41}