keeper

package
v2.0.0-rc.14 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

Types

type DevGasIndexes

type DevGasIndexes struct {
	// Deployer MultiIndex:
	//  - indexing key (IK): deployer address
	//  - primary key (PK): contract address
	//  - value (V): Dev gas struct
	Deployer collections.MultiIndex[string, string, devgastypes.FeeShare]

	// Withdrawer MultiIndex:
	//  - indexing key (IK): withdrawer address
	//  - primary key (PK): contract address
	//  - value (V): Dev gas struct
	Withdrawer collections.MultiIndex[string, string, devgastypes.FeeShare]
}

func (DevGasIndexes) IndexerList

type Keeper

type Keeper struct {

	// DevGasStore: IndexedMap
	//  - primary key (PK): Contract address. The contract is the primary key
	//  because there's exactly one deployer and withdrawer.
	//  - value (V): FeeShare value saved into state.
	//  - indexers (I):  Indexed by deployer and withdrawer
	DevGasStore collections.IndexedMap[string, devgastypes.FeeShare, DevGasIndexes]

	ModuleParams collections.Item[devgastypes.ModuleParams]
	// contains filtered or unexported fields
}

Keeper of this module maintains collections of feeshares for contracts registered to receive Nibiru Chain gas fees.

func NewKeeper

func NewKeeper(
	storeKey storetypes.StoreKey,
	cdc codec.BinaryCodec,
	bk devgastypes.BankKeeper,
	wk wasmkeeper.Keeper,
	ak devgastypes.AccountKeeper,
	feeCollector string,
	authority string,
) Keeper

NewKeeper creates new instances of the fees Keeper

func (Keeper) CancelFeeShare

func (k Keeper) CancelFeeShare(
	goCtx context.Context,
	msg *types.MsgCancelFeeShare,
) (*types.MsgCancelFeeShareResponse, error)

CancelFeeShare deletes the FeeShare for a given contract

func (Keeper) GetAuthority

func (k Keeper) GetAuthority() string

GetAuthority returns the x/feeshare module's authority.

func (Keeper) GetContractAdminOrCreatorAddress

func (k Keeper) GetContractAdminOrCreatorAddress(
	ctx sdk.Context, contract sdk.AccAddress, deployer string,
) (sdk.AccAddress, error)

GetContractAdminOrCreatorAddress ensures the deployer is the contract's admin OR creator if no admin is set for all msg_server feeshare functions.

func (Keeper) GetFeeShare

func (k Keeper) GetFeeShare(
	ctx sdk.Context,
	contract sdk.Address,
) (devGas types.FeeShare, isFound bool)

GetFeeShare returns the FeeShare for a registered contract

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) (params types.ModuleParams)

GetParams returns the total set of fees parameters.

func (Keeper) IsFeeShareRegistered

func (k Keeper) IsFeeShareRegistered(
	ctx sdk.Context,
	contract sdk.Address,
) (isRegistered bool)

IsFeeShareRegistered checks if a contract was registered for receiving transaction fees

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns a module-specific logger.

func (Keeper) RegisterFeeShare

func (k Keeper) RegisterFeeShare(
	goCtx context.Context,
	msg *types.MsgRegisterFeeShare,
) (*types.MsgRegisterFeeShareResponse, error)

RegisterFeeShare registers a contract to receive transaction fees

func (Keeper) SetFeeShare

func (k Keeper) SetFeeShare(ctx sdk.Context, feeshare types.FeeShare)

SetFeeShare stores the FeeShare for a registered contract, then iterates over every registered Indexer and instructs them to create the relationship between the primary key PK and the object v.

func (Keeper) UpdateFeeShare

func (k Keeper) UpdateFeeShare(
	goCtx context.Context,
	msg *types.MsgUpdateFeeShare,
) (*types.MsgUpdateFeeShareResponse, error)

UpdateFeeShare updates the withdraw address of a given FeeShare. If the given withdraw address is empty or the same as the deployer address, the withdraw address is removed.

func (Keeper) UpdateParams

func (k Keeper) UpdateParams(
	goCtx context.Context, req *types.MsgUpdateParams,
) (resp *types.MsgUpdateParamsResponse, err error)

type Querier

type Querier struct {
	Keeper
}

Querier defines a wrapper around the x/FeeShare keeper providing gRPC method handlers.

func NewQuerier

func NewQuerier(k Keeper) Querier

func (Querier) FeeShare

FeeShare returns the FeeShare that has been registered for fee distribution for a given contract

func (Querier) FeeShares

TODO FeeSharesAll returns all FeeShares that have been registered for fee distribution

func (Querier) FeeSharesByWithdrawer

FeeSharesByWithdrawer returns all fees for a given withdraw address

func (Querier) Params

Params returns the fees module params

Jump to

Keyboard shortcuts

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