Search Apps Documentation Source Content File Folder Download Copy Actions Download

config.gno

0.88 Kb · 47 lines
 1package blueprint
 2
 3import (
 4	"chain"
 5	"strconv"
 6
 7	"gno.land/p/akkadia/v0/accesscontrol"
 8	"gno.land/r/akkadia/v0/admin"
 9)
10
11const SetCreationCostEvent = "SetCreationCost"
12
13var (
14	creationCost int64 = 0
15	listLimit    int   = 100
16	batchLimit   int   = 1000
17)
18
19func SetCreationCost(cur realm, nextCreationCost int64) {
20	assertNotFrozen()
21	accesscontrol.AssertIsAdmin(0, cur, admin.IsAdmin)
22	assertCreationCost(nextCreationCost)
23
24	oldCreationCost := creationCost
25	creationCost = nextCreationCost
26
27	chain.Emit(
28		SetCreationCostEvent,
29		"oldCreationCost", strconv.FormatInt(oldCreationCost, 10),
30		"newCreationCost", strconv.FormatInt(creationCost, 10),
31	)
32}
33
34func GetCreationCost() int64 {
35	assertMigrationStateAvailable()
36	return creationCost
37}
38
39func GetListLimit() int {
40	assertMigrationStateAvailable()
41	return listLimit
42}
43
44func GetBatchLimit() int {
45	assertMigrationStateAvailable()
46	return batchLimit
47}