Realm
gno.land/r/gnoswap/referral/v1
Overview
Realm Path
gno.land/r/gnoswap/referral/v1
Exported Functions
8
State Entries
14
Source Files
8
Total Package Entries
28
Exported Functions
8 exported functions
State
14 state entries
Source Code
FILES
assert.gno
go
1package referral
2
3import (
4 prabc "gno.land/p/gnoswap/rbac/v1"
5
6 "gno.land/r/gnoswap/access/v1"
7 _ "gno.land/r/gnoswap/rbac/v1"
8)
9
10// MUST BE IMMUTABLE, DO NOT MODIFY.
11// validCallerRoles is a list of roles that are authorized to modify referral data.
12// This includes governance, governance staker, router, position, staker, and launchpad contracts.
13var validCallerRoles = []string{
14 prabc.ROLE_GOVERNANCE.String(),
15 prabc.ROLE_GOV_STAKER.String(),
16 prabc.ROLE_ROUTER.String(),
17 prabc.ROLE_POSITION.String(),
18 prabc.ROLE_STAKER.String(),
19 prabc.ROLE_LAUNCHPAD.String(),
20}
21
22// assertValidCaller checks if the caller address has permission to modify referral data.
23// Only addresses with specific roles defined in validCallerRoles are authorized.
24//
25// Errors:
26// - ErrUnauthorized: the caller is not authorized to modify referral data
27func assertValidCaller(caller address) {
28 for _, role := range validCallerRoles {
29 if access.IsAuthorized(role, caller) {
30 return
31 }
32 }
33
34 panic(makeErrorWithDetails(ErrUnauthorized, caller.String()))
35}
36Raw Package Data
Raw JSON data