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 AdminRole, PublicRole, MinSetback

1const (
2	AdminRole  RoleId = 0
3	PublicRole RoleId = 1<<64 - 1 // uint64 max
4
5	// MinSetback is the minimum setback for a grant delay change (5 days).
6	// OpenZeppelin: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/5fd1781b1454fd1ef8e722282f86f9293cacf256/contracts/access/manager/AccessManager.sol#L164-L166
7	// Union: https://github.com/unionlabs/union/blob/8cff0ff34f6baa4cdb1e4650a08985dd05de0c5a/cosmwasm/access-manager/src/contract.rs#L1076-L1080
8	MinSetback uint32 = 5 * 24 * 60 * 60
9)
source

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

struct
1type Delay struct {
2	effectDate  TimePoint
3	valueBefore uint32
4	valueAfter  uint32
5}
source

Methods on Delay

func WithUpdate

method on Delay
1func (d Delay) WithUpdate(timestamp TimePoint, newDelay uint32, minSetback uint32) (Delay, TimePoint)
source

WithUpdate schedules newDelay to take effect at timestamp plus a setback: at least minSetback, or longer when newDelay decreases the active value by more than minSetback. Returns the updated Delay and the effect timePoint. OpenZeppelin: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/5fd1781b1454fd1ef8e722282f86f9293cacf256/contracts/utils/types/Time.sol#L103-L112 Union: https://github.com/unionlabs/union/blob/8cff0ff34f6baa4cdb1e4650a08985dd05de0c5a/lib/access-manager-types/src/time.rs#L119-L131

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 GetRoleGrantDelay

method on State
1func (state *State) GetRoleGrantDelay(role RoleId) uint32
source

func GetRoleGrantDelayEffect

method on State
1func (state *State) GetRoleGrantDelayEffect(role RoleId) TimePoint
source

GetRoleGrantDelayEffect returns when role's scheduled grant delay change takes effect. No OZ/Union equivalent; added to avoid direct field access.

func GetRoleMemberSince

method on State
1func (state *State) GetRoleMemberSince(role RoleId, account address) TimePoint
source

GetRoleMemberSince returns when account's role membership became active, or zero if it is not a member. It corresponds to OZ/Union's since field; execution-delay fields are not ported here.

OpenZeppelin: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/5fd1781b1454fd1ef8e722282f86f9293cacf256/contracts/access/manager/AccessManager.sol#L205 Union: https://github.com/unionlabs/union/blob/8cff0ff34f6baa4cdb1e4650a08985dd05de0c5a/cosmwasm/access-manager/src/contract.rs#L1165

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, newDelay uint32)
source

SetGrantDelay schedules newDelay behind a setback; it never overwrites the active delay on the spot. Callers read GetRoleGrantDelay for the current value or GetRoleGrantDelayEffect for the effect timePoint. AdminRole is not locked here (unlike SetRoleAdmin) — OZ/Union only reject PublicRole. OpenZeppelin: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/5fd1781b1454fd1ef8e722282f86f9293cacf256/contracts/access/manager/AccessManager.sol#L262-L264,L362-L371 Union: https://github.com/unionlabs/union/blob/8cff0ff34f6baa4cdb1e4650a08985dd05de0c5a/cosmwasm/access-manager/src/contract.rs#L139-L148,L314-L345

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 12