package acr import ( "chain" "chain/runtime" "gno.land/p/nt/ufmt" ) const ( SetListLimitEvent = "SetListLimit" ) var ( listLimit int = 100 // Max items per list query ) // SetListLimit sets the max items per list query (admin only) func SetListLimit(cur realm, limit int) { caller := runtime.PreviousRealm().Address() assertIsAdmin(caller) if limit < 1 { panic("limit must be at least 1") } oldLimit := listLimit listLimit = limit chain.Emit( SetListLimitEvent, "admin", caller.String(), "oldLimit", ufmt.Sprintf("%d", oldLimit), "newLimit", ufmt.Sprintf("%d", limit), ) } // GetListLimit returns the max items per list query func GetListLimit() int { return listLimit }