roles

package
v0.0.0-...-9705ef6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Roles interface example

This package shows how to use a smart-contract interface with go interfaces. For demonstration we define a simple RBAC interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SenderHasRole

func SenderHasRole(roleName string, ctr WithRoles) (bool, errstack.E)

SenderHasRole checks if contract sender has specified role

func SenderIsOwnerOrHasRole

func SenderIsOwnerOrHasRole(who common.Address, roleName string, ctr WithRoles) (bool, errstack.E)

SenderIsOwnerOrHasRole checks if `who` is owner or sender has role

Types

type WithRoles

type WithRoles interface {
	Owner(opts *bind.CallOpts) (common.Address, error)
	HasRole(opts *bind.CallOpts, roleName string) (bool, error)
	SenderHasRole(opts *bind.CallOpts, roleName string) (bool, error)
}

WithRoles provides interface for contracts which implement Roles contract.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL