package block import ( "chain" "chain/runtime" "gno.land/p/nt/ufmt" ) const ( SetCreatorBPSEvent = "SetCreatorBPS" SetListLimitEvent = "SetListLimit" ) var ( // creatorBPS is the basis points (1/10000) that goes to block creator on mint // Default: 4000 = 40% creatorBPS int = 4000 listLimit int = 1000 // Max items per list query ) // SetCreatorBPS sets the creator revenue share in basis points (admin only) // BPS must be between 0 and 10000 (0% to 100%) func SetCreatorBPS(cur realm, bps int) { caller := runtime.PreviousRealm().Address() assertIsAdmin(caller) if bps < 0 || bps > 10000 { panic("creator bps must be between 0 and 10000") } oldBPS := creatorBPS creatorBPS = bps chain.Emit( SetCreatorBPSEvent, "admin", caller.String(), "oldBPS", ufmt.Sprintf("%d", oldBPS), "newBPS", ufmt.Sprintf("%d", bps), ) } // GetCreatorBPS returns the current creator revenue share in basis points func GetCreatorBPS() int { return creatorBPS } // 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 }