keeper

package
v1.15.2 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const AddressHasAccessKey = "address_has_access"

Variables

This section is empty.

Functions

func AllInvariants

func AllInvariants(k Keeper, bk bankkeeper.Keeper) sdk.Invariant

AllInvariants runs all invariants of the marker module.

func ContainsWildCard added in v1.15.0

func ContainsWildCard(attr string) bool

ContainsWildCard checks if attribute starts with wildcard

func EnsureAllRequiredAttributesExist added in v1.15.0

func EnsureAllRequiredAttributesExist(requiredAttributes []string, attributes []attrTypes.Attribute) bool

EnsureAllRequiredAttributesExist checks that all requiredAttributes are in attributes list

func HandleChangeStatusProposal added in v0.3.0

func HandleChangeStatusProposal(ctx sdk.Context, k Keeper, c *types.ChangeStatusProposal) error

HandleChangeStatusProposal handles a ChangeStatus governance proposal request

func HandleRemoveAdministratorProposal added in v0.3.0

func HandleRemoveAdministratorProposal(ctx sdk.Context, k Keeper, c *types.RemoveAdministratorProposal) error

HandleRemoveAdministratorProposal handles a RemoveAdministrator governance proposal request

func HandleSetAdministratorProposal added in v0.3.0

func HandleSetAdministratorProposal(ctx sdk.Context, k Keeper, c *types.SetAdministratorProposal) error

HandleSetAdministratorProposal handles a SetAdministrator governance proposal request

func HandleSetDenomMetadataProposal added in v1.7.0

func HandleSetDenomMetadataProposal(ctx sdk.Context, k Keeper, c *types.SetDenomMetadataProposal) error

HandleSetDenomMetadataProposal handles a Set Denom Metadata governance proposal request

func HandleSupplyDecreaseProposal added in v0.3.0

func HandleSupplyDecreaseProposal(ctx sdk.Context, k Keeper, c *types.SupplyDecreaseProposal) error

HandleSupplyDecreaseProposal handles a SupplyDecrease governance proposal request

func HandleSupplyIncreaseProposal added in v0.3.0

func HandleSupplyIncreaseProposal(ctx sdk.Context, k Keeper, c *types.SupplyIncreaseProposal) error

HandleSupplyIncreaseProposal handles a SupplyIncrease governance proposal request

func HandleWithdrawEscrowProposal added in v0.3.0

func HandleWithdrawEscrowProposal(ctx sdk.Context, k Keeper, c *types.WithdrawEscrowProposal) error

HandleWithdrawEscrowProposal handles a Withdraw escrowed coins governance proposal request

func HasMarkerSendRestrictionBypass added in v1.15.0

func HasMarkerSendRestrictionBypass(ctx sdk.Context) bool

HasMarkerSendRestrictionBypass returns the bool value of address has access defaults to false if not set

func MatchAttribute added in v1.15.0

func MatchAttribute(reqAttr string, attr string) bool

MatchAttribute compares required attribute against attribute string

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the marker MsgServer interface for the provided Keeper.

func NewQuerier

func NewQuerier(keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier

NewQuerier is the module level router for state queries (using the Legacy Amino Codec)

func RegisterInvariants

func RegisterInvariants(ir sdk.InvariantRegistry, mk Keeper, bk bankkeeper.Keeper)

RegisterInvariants registers module invariants

func WithMarkerSendRestrictionBypass added in v1.15.0

func WithMarkerSendRestrictionBypass(ctx sdk.Context, hasAccess bool) sdk.Context

WithMarkerSendRestrictionBypass returns the context with the address has access set used for allowing address to send restricted markers

Types

type Handler

type Handler func(record types.MarkerAccountI) error

Handler is a handler function for use with IterateRecords.

type Keeper

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

Keeper defines the name module Keeper

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	key storetypes.StoreKey,
	paramSpace paramtypes.Subspace,
	authKeeper authkeeper.AccountKeeper,
	bankKeeper bankkeeper.Keeper,
	authzKeeper authzkeeper.Keeper,
	feegrantKeeper feegrantkeeper.Keeper,
	ibcKeeper ibckeeper.Keeper,
	attrKeeper attrkeeper.Keeper,
	nameKeeper namekeeper.Keeper,
) Keeper

NewKeeper returns a marker keeper. It handles: - managing MarkerAccounts - enforcing permissions for marker creation/deletion/management

CONTRACT: the parameter Subspace must have the param key table already initialized

func (Keeper) Access

Access query for access records on an account

func (Keeper) ActivateMarker

func (k Keeper) ActivateMarker(ctx sdk.Context, caller sdk.Address, denom string) error

ActivateMarker transitions a marker into the active status, enforcing permissions, supply constraints, and minting any supply as required.

func (Keeper) AddAccess

func (k Keeper) AddAccess(
	ctx sdk.Context, caller sdk.AccAddress, denom string, grant types.AccessGrantI,
) error

AddAccess adds the provided AccessGrant to the marker of the caller is allowed to make changes

func (Keeper) AddFinalizeAndActivateMarker added in v1.14.0

func (k Keeper) AddFinalizeAndActivateMarker(ctx sdk.Context, marker types.MarkerAccountI) error

AddFinalizeAndActivateMarker adds marker, finalizes, and then activates it

func (Keeper) AddMarkerAccount

func (k Keeper) AddMarkerAccount(ctx sdk.Context, marker types.MarkerAccountI) error

AddMarkerAccount persists marker to the account keeper store.

func (Keeper) AdjustCirculation

func (k Keeper) AdjustCirculation(ctx sdk.Context, marker types.MarkerAccountI, desiredSupply sdk.Coin) error

AdjustCirculation will mint/burn coin if required to ensure desired supply matches amount in circulation

func (Keeper) AllMarkers

AllMarkers returns a list of all markers on the blockchain

func (Keeper) AllowMarkerSend added in v1.15.0

func (k Keeper) AllowMarkerSend(ctx sdk.Context, from, to, denom string) error

func (Keeper) BurnCoin

func (k Keeper) BurnCoin(ctx sdk.Context, caller sdk.AccAddress, coin sdk.Coin) error

BurnCoin removes supply from the marker by burning coins held within the marker acccount.

func (Keeper) CancelMarker

func (k Keeper) CancelMarker(ctx sdk.Context, caller sdk.AccAddress, denom string) error

CancelMarker prepares transition to deleted state.

func (Keeper) ContainsRequiredAttributes added in v1.15.0

func (k Keeper) ContainsRequiredAttributes(ctx sdk.Context, requiredAttributes []string, address string) (bool, error)

ContainsRequiredAttributes retrieves the attributes from address and checks that all required attributes are present

func (Keeper) CurrentCirculation added in v1.7.0

func (k Keeper) CurrentCirculation(ctx sdk.Context, marker types.MarkerAccountI) sdkmath.Int

Returns the current supply in network according to the bank module for the given marker

func (Keeper) CurrentEscrow added in v1.7.0

func (k Keeper) CurrentEscrow(ctx sdk.Context, marker types.MarkerAccountI) sdk.Coins

Retures the current escrow balance for the marker base account

func (Keeper) DecreaseSupply

func (k Keeper) DecreaseSupply(ctx sdk.Context, marker types.MarkerAccountI, coin sdk.Coin) error

DecreaseSupply will move a given amount of coin from the marker to the markermodule coin pool account then burn it.

func (Keeper) DeleteMarker

func (k Keeper) DeleteMarker(ctx sdk.Context, caller sdk.AccAddress, denom string) error

DeleteMarker burns the entire coin supply, ensure no assets are pooled, and marks the current instance of the marker as destroyed.

func (Keeper) DenomMetadata

DenomMetadata query for metadata on denom

func (Keeper) Escrow

Escrow query for coins on a marker account

func (Keeper) ExportGenesis

func (k Keeper) ExportGenesis(ctx sdk.Context) (data *types.GenesisState)

ExportGenesis exports the current keeper state of the marker module.ExportGenesis We do not export anything because our marker accounts will be exported/imported by the Account Module.

func (Keeper) FinalizeMarker

func (k Keeper) FinalizeMarker(ctx sdk.Context, caller sdk.Address, denom string) error

FinalizeMarker sets the state of the marker to finalized, mints the associated supply, assigns the minted coin to the marker accounts, and if successful emits an EventMarkerFinalize event to transition the state to active

func (Keeper) GetAllMarkerHolders

func (k Keeper) GetAllMarkerHolders(ctx sdk.Context, denom string) []types.Balance

GetAllMarkerHolders returns an array of all account addresses holding the given denom (and the amount)

func (Keeper) GetAuthority added in v1.14.0

func (k Keeper) GetAuthority() string

GetAuthority is signer of the proposal

func (Keeper) GetEnableGovernance added in v1.0.0

func (k Keeper) GetEnableGovernance(ctx sdk.Context) (enabled bool)

GetEnableGovernance returns the current parameter value for enabling governance control (or default if unset)

func (Keeper) GetEscrow

func (k Keeper) GetEscrow(ctx sdk.Context, marker types.MarkerAccountI) sdk.Coins

GetEscrow returns the balances of all coins held in escrow in the marker

func (Keeper) GetMarker

func (k Keeper) GetMarker(ctx sdk.Context, address sdk.AccAddress) (types.MarkerAccountI, error)

GetMarker looks up a marker by a given address

func (Keeper) GetMarkerByDenom

func (k Keeper) GetMarkerByDenom(ctx sdk.Context, denom string) (types.MarkerAccountI, error)

GetMarkerByDenom looks up marker with the given denom

func (Keeper) GetMaxTotalSupply added in v1.0.0

func (k Keeper) GetMaxTotalSupply(ctx sdk.Context) (max uint64)

GetMaxTotalSupply return the current parameter value for the max allowed total supply (or default if unset)

func (Keeper) GetParams

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

GetParams returns the total set of distribution parameters.

func (Keeper) GetUnrestrictedDenomRegex added in v1.0.0

func (k Keeper) GetUnrestrictedDenomRegex(ctx sdk.Context) (regex string)

GetUnrestrictedDenomRegex returns the current parameter value for enabling governance control (or default if unset)

func (Keeper) Holding

Holding query for all accounts holding the given marker coins

func (Keeper) IbcTransferCoin added in v1.13.0

func (k Keeper) IbcTransferCoin(
	ctx sdk.Context,
	sourcePort, sourceChannel string,
	token sdk.Coin,
	sender, admin sdk.AccAddress,
	receiver string,
	timeoutHeight clienttypes.Height,
	timeoutTimestamp uint64,
	memo string,
	checkRestrictionsHandler ibckeeper.CheckRestrictionsHandler) error

IbcTransferCoin transfers restricted coins between to chains when the administrator account holds the transfer access right and the marker type is restricted_coin

func (Keeper) IncreaseSupply

func (k Keeper) IncreaseSupply(ctx sdk.Context, marker types.MarkerAccountI, coin sdk.Coin) error

IncreaseSupply will mint coins to the marker module coin pool account, then send these to the marker account

func (Keeper) InitGenesis

func (k Keeper) InitGenesis(ctx sdk.Context, data *types.GenesisState)

InitGenesis creates the initial genesis state for the marker module. Typically these accounts would be listed with the rest of the accounts and not created here.

func (Keeper) IterateMarkers

func (k Keeper) IterateMarkers(ctx sdk.Context, cb func(marker types.MarkerAccountI) (stop bool))

IterateMarkers iterates all markers with the given handler function.

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) Marker

Marker query for a single marker by denom or address

func (Keeper) MintCoin

func (k Keeper) MintCoin(ctx sdk.Context, caller sdk.AccAddress, coin sdk.Coin) error

MintCoin increases the Supply of a coin by interacting with the supply keeper for the adjustment, updating the marker's record of expected total supply, and transferring the created coin to the MarkerAccount for holding pending further action.

func (Keeper) NewMarker

func (k Keeper) NewMarker(ctx sdk.Context, marker types.MarkerAccountI) types.MarkerAccountI

NewMarker returns a new marker instance with the address and baseaccount assigned. Does not save to auth store

func (Keeper) NormalizeRequiredAttributes added in v1.15.0

func (k Keeper) NormalizeRequiredAttributes(ctx sdk.Context, requiredAttributes []string) ([]string, error)

NormalizeRequiredAttributes normalizes the required attribute names using name module's Normalize method

func (Keeper) Params

Params queries params of distribution module

func (Keeper) RemoveAccess

func (k Keeper) RemoveAccess(ctx sdk.Context, caller sdk.AccAddress, denom string, remove sdk.AccAddress) error

RemoveAccess delete the AccessGrant for the specified user from the marker if the caller is allowed to make changes

func (Keeper) RemoveIsSendEnabledEntries added in v1.15.0

func (k Keeper) RemoveIsSendEnabledEntries(ctx sdk.Context)

RemoveIsSendEnabledEntries removes all entries in the bankkeepers send enabled table TODO: remove after v1.15.0 upgrade handler is removed

func (Keeper) RemoveMarker

func (k Keeper) RemoveMarker(ctx sdk.Context, marker types.MarkerAccountI)

RemoveMarker removes a marker from the auth account store. Note: if the account holds coins this will likely cause an invariant constraint violation for the coin supply

func (Keeper) SetMarker

func (k Keeper) SetMarker(ctx sdk.Context, marker types.MarkerAccountI)

SetMarker sets a marker in the auth account store will panic if the marker account is not valid or if the auth module account keeper fails to marshall the account.

func (Keeper) SetMarkerDenomMetadata added in v1.0.0

func (k Keeper) SetMarkerDenomMetadata(ctx sdk.Context, metadata banktypes.Metadata, caller sdk.AccAddress) error

SetMarkerDenomMetadata updates the denom metadata records for the current marker.

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params types.Params)

SetParams sets the distribution parameters to the param space.

func (Keeper) Supply

Supply query for supply of coin on a marker account

func (Keeper) TransferCoin

func (k Keeper) TransferCoin(ctx sdk.Context, from, to, admin sdk.AccAddress, amount sdk.Coin) error

TransferCoin transfers restricted coins between to accounts when the administrator account holds the transfer access right and the marker type is restricted_coin

func (Keeper) ValidateDenomMetadata added in v1.2.0

func (k Keeper) ValidateDenomMetadata(ctx sdk.Context, proposed banktypes.Metadata, existing *banktypes.Metadata, markerStatus types.MarkerStatus) error

ValidateDenomMetadata performs extended validation of the denom metadata fields. It checks that:

  • The proposed metadata passes ValidateDenomMetadataBasic.
  • The marker status is one that allows the denom metadata to be manipulated.
  • All DenomUnit Denom and Aliases strings pass the unrestricted denom regex. If there is an existing record:
  • The Base doesn't change. If marker status is active or finalized:
  • No DenomUnit entries are removed.
  • DenomUnit Denom fields aren't changed.
  • No aliases are removed from a DenomUnit.

func (Keeper) ValidateUnrestictedDenom added in v1.2.0

func (k Keeper) ValidateUnrestictedDenom(ctx sdk.Context, denom string) error

ValidateUnrestictedDenom checks if the supplied denom is valid based on the module params

func (Keeper) WithdrawCoins

func (k Keeper) WithdrawCoins(
	ctx sdk.Context, caller sdk.AccAddress, recipient sdk.AccAddress, denom string, coins sdk.Coins,
) error

WithdrawCoins removes the specified coins from the MarkerAccount (both marker denominated coins and coins as assets are supported here)

type MarkerKeeperI

type MarkerKeeperI interface {
	// Returns a new marker instance with the address and baseaccount assigned.  Does not save to auth store
	NewMarker(sdk.Context, types.MarkerAccountI) types.MarkerAccountI

	// GetMarker looks up a marker by a given address
	GetMarker(sdk.Context, sdk.AccAddress) (types.MarkerAccountI, error)
	// Set a marker in the auth account store
	SetMarker(sdk.Context, types.MarkerAccountI)
	// Remove a marker from the auth account store
	RemoveMarker(sdk.Context, types.MarkerAccountI)

	GetEscrow(sdk.Context, types.MarkerAccountI) sdk.Coins

	// IterateMarker processes all markers with the given handler function.
	IterateMarkers(sdk.Context, func(types.MarkerAccountI) bool)

	// GetAuthority returns the signing authority
	GetAuthority() string
}

MarkerKeeperI provides a read/write iterate interface to marker acccounts in the auth account keeper store

type Migrator added in v1.7.0

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

Migrator is a struct for handling in-place store migrations.

func NewMigrator added in v1.7.0

func NewMigrator(keeper Keeper) Migrator

NewMigrator returns a new Migrator.

Jump to

Keyboard shortcuts

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