keeper

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 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 added in v0.21.7

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 added in v1.2.0

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 added in v0.21.7

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

func NewMsgServer added in v0.21.7

func NewMsgServer(keeper Keeper) *MsgServer

func (MsgServer) ChangeRoot added in v0.21.7

func (MsgServer) EditSudoers added in v0.21.7

EditSudoers adds or removes sudo contracts from state.

type Querier added in v0.21.7

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

func (Querier) QuerySudoers added in v0.21.7

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