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

manager source pure

Constants 3

const EventTypeRoleLabel, EventTypeRoleGranted, EventTypeRoleRevoked, EventTypeRoleAdminChanged, EventTypeRoleGrantDelayChanged, EventTypeTargetClosed, EventTypeTargetFunctionRoleUpdated

1const (
2	EventTypeRoleLabel                 = "RoleLabel"
3	EventTypeRoleGranted               = "RoleGranted"
4	EventTypeRoleRevoked               = "RoleRevoked"
5	EventTypeRoleAdminChanged          = "RoleAdminChanged"
6	EventTypeRoleGrantDelayChanged     = "RoleGrantDelayChanged"
7	EventTypeTargetClosed              = "TargetClosed"
8	EventTypeTargetFunctionRoleUpdated = "TargetFunctionRoleUpdated"
9)
source

const AttributeKeyTarget, AttributeKeyRoleID, AttributeKeyLabel, AttributeKeyAccount, AttributeKeyDelay, AttributeKeySince, AttributeKeyNewMember, AttributeKeyAdmin, AttributeKeyClosed, AttributeKeySelector

 1const (
 2	AttributeKeyTarget    = "target"
 3	AttributeKeyRoleID    = "role_id"
 4	AttributeKeyLabel     = "label"
 5	AttributeKeyAccount   = "account"
 6	AttributeKeyDelay     = "delay"
 7	AttributeKeySince     = "since"
 8	AttributeKeyNewMember = "new_member"
 9	AttributeKeyAdmin     = "admin"
10	AttributeKeyClosed    = "closed"
11	AttributeKeySelector  = "selector"
12)
source

Functions 13

Types 10

type Access

struct
1type Access struct {
2	Since TimePoint
3}
source

type Delay

ident
1type Delay uint32
source

Methods on Delay

func String

method on Delay
1func (d Delay) String() string
source

func Uint32

method on Delay
1func (d Delay) Uint32() uint32
source

type RoleConfig

struct
1type RoleConfig struct {
2	Members    map[address]Access
3	Admin      RoleId
4	GrantDelay Delay
5}
source

type RoleId

ident
1type RoleId uint64
source

Methods on RoleId

func String

method on RoleId
1func (r RoleId) String() string
source

func Uint64

method on RoleId
1func (r RoleId) Uint64() uint64
source

type State

struct
1type State struct {
2	Roles   map[RoleId]*RoleConfig
3	Targets map[string]*TargetConfig
4}
source

Methods on State

func CanCall

method on State
1func (state *State) CanCall(caller address, target string, selector Selector) CanCallResult
source

CanCall reports whether caller can call target selector immediately. This Gno port returns only immediate authorization because scheduled execution and execution delay are intentionally not ported. OpenZeppelin reference: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/5fd1781b1454fd1ef8e722282f86f9293cacf256/contracts/access/manager/AccessManager.sol#L140-L156

func CanManageTarget

method on State
1func (state *State) CanManageTarget(caller address) CanCallResult
source

func GrantRole

method on State
1func (state *State) GrantRole(role RoleId, account address) bool
source

func RevokeRole

method on State
1func (state *State) RevokeRole(role RoleId, account address) bool
source

func SetGrantDelay

method on State
1func (state *State) SetGrantDelay(role RoleId, delay Delay)
source

func SetRoleAdmin

method on State
1func (state *State) SetRoleAdmin(role RoleId, admin RoleId)
source

func SetTargetClosed

method on State
1func (state *State) SetTargetClosed(target string, closed bool)
source

type TargetConfig

struct
1type TargetConfig struct {
2	FunctionRoles map[Selector]RoleId
3	Closed        bool
4}
source

type TimePoint

ident
1type TimePoint int64
source

Methods on TimePoint

func After

method on TimePoint
1func (t TimePoint) After(other TimePoint) bool
source

func Before

method on TimePoint
1func (t TimePoint) Before(other TimePoint) bool
source

func Equal

method on TimePoint
1func (t TimePoint) Equal(other TimePoint) bool
source

func Int64

method on TimePoint
1func (t TimePoint) Int64() int64
source

func IsZero

method on TimePoint
1func (t TimePoint) IsZero() bool
source

func String

method on TimePoint
1func (t TimePoint) String() string
source

Imports 5

Source Files 11