keeper

package
v2.0.0-rc.13 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewQuerier

func NewQuerier(k Keeper) types.QueryServer

Types

type Keeper

type Keeper struct {
	Sudoers collections.Item[sudotypes.Sudoers]
}

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeKey types.StoreKey,
) Keeper

func (Keeper) AddContracts

func (k Keeper) AddContracts(
	goCtx context.Context, msg *sudotypes.MsgEditSudoers,
) (msgResp *sudotypes.MsgEditSudoersResponse, err error)

AddContracts executes a MsgEditSudoers message with action type "add_contracts". This adds contract addresses to the sudoer set.

func (Keeper) CheckPermissions

func (k Keeper) CheckPermissions(
	contract sdk.AccAddress, ctx sdk.Context,
) error

CheckPermissions Checks if a contract is contained within the set of sudo contracts defined in the x/sudo module. These smart contracts are able to execute certain permissioned functions.

func (Keeper) GetRootAddr

func (k Keeper) GetRootAddr(ctx sdk.Context) (sdk.AccAddress, error)

Returns the root address of the sudo module.

func (Keeper) RemoveContracts

func (k Keeper) RemoveContracts(
	goCtx context.Context, msg *sudotypes.MsgEditSudoers,
) (msgResp *sudotypes.MsgEditSudoersResponse, err error)

type MsgServer

type MsgServer struct {
	// contains filtered or unexported fields
}

func NewMsgServer

func NewMsgServer(keeper Keeper) *MsgServer

func (MsgServer) ChangeRoot

func (MsgServer) EditSudoers

EditSudoers adds or removes sudo contracts from state.

type Querier

type Querier struct {
	// contains filtered or unexported fields
}

func (Querier) QuerySudoers

func (q Querier) QuerySudoers(
	goCtx context.Context,
	req *types.QuerySudoersRequest,
) (resp *types.QuerySudoersResponse, err error)

type Sudoers

type Sudoers struct {
	Root      string          `json:"root"`
	Contracts set.Set[string] `json:"contracts"`
}

func SudoersFromPb

func SudoersFromPb(pbSudoers sudotypes.Sudoers) Sudoers

func (*Sudoers) AddContracts

func (sudo *Sudoers) AddContracts(
	contracts []string,
) (out set.Set[string], err error)

AddContracts adds contract addresses to the sudoer set.

func (*Sudoers) RemoveContracts

func (sudo *Sudoers) RemoveContracts(contracts []string)

func (Sudoers) String

func (sudo Sudoers) String() string

func (Sudoers) ToPb

func (sudo Sudoers) ToPb() sudotypes.Sudoers

Jump to

Keyboard shortcuts

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