keeper

package
v1.19.0-rc4 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2024 License: Apache-2.0 Imports: 29 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 MatchAttribute added in v1.15.0

func MatchAttribute(reqAttr string, attr string) bool

MatchAttribute returns true if the provided attr satisfies the reqAttr.

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

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

func RegisterInvariants

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

RegisterInvariants registers module invariants

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,
	authKeeper types.AccountKeeper,
	bankKeeper types.BankKeeper,
	authzKeeper types.AuthzKeeper,
	feegrantKeeper types.FeeGrantKeeper,
	attrKeeper types.AttrKeeper,
	nameKeeper types.NameKeeper,
	ibcTransferServer types.IbcTransferMsgServer,
	reqAttrBypassAddrs []sdk.AccAddress,
	checker types.GroupChecker,
) 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) AccountData added in v1.16.0

AccountData query for account data associated with a denom

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) AddSendDeny added in v1.17.0

func (k Keeper) AddSendDeny(ctx sdk.Context, markerAddr, senderAddr sdk.AccAddress)

AddSendDeny set sender address to denied for marker

func (Keeper) AddSetNetAssetValues added in v1.17.0

func (k Keeper) AddSetNetAssetValues(ctx sdk.Context, marker types.MarkerAccountI, netAssetValues []types.NetAssetValue, source string) error

AddSetNetAssetValues adds a set of net asset values to a marker

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) 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) ClearSendDeny added in v1.18.0

func (k Keeper) ClearSendDeny(ctx sdk.Context, markerAddr sdk.AccAddress)

ClearSendDeny removes all entries of a marker from a send deny list

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) 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 whether governance control is enabled.

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) GetMaxSupply added in v1.17.0

func (k Keeper) GetMaxSupply(ctx sdk.Context) (max sdkmath.Int)

GetMaxSupply returns the current parameter value for the max allowed supply.

func (Keeper) GetNetAssetValue added in v1.18.0

func (k Keeper) GetNetAssetValue(ctx sdk.Context, markerDenom, priceDenom string) (*types.NetAssetValue, error)

GetNetAssetValue gets the NetAssetValue for a marker denom with a specific price denom.

func (Keeper) GetParams

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

GetParams returns the total set of marker parameters.

func (Keeper) GetReqAttrBypassAddrs added in v1.17.0

func (k Keeper) GetReqAttrBypassAddrs() []sdk.AccAddress

GetReqAttrBypassAddrs returns a deep copy of the addresses that bypass the required attributes checking.

func (Keeper) GetSendDenyList added in v1.18.0

func (k Keeper) GetSendDenyList(ctx sdk.Context, markerAddr sdk.AccAddress) []sdk.AccAddress

GetSendDenyList gets the list of sender addresses from the marker's deny list

func (Keeper) GetUnrestrictedDenomRegex added in v1.0.0

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

GetUnrestrictedDenomRegex returns the regex for unrestricted denom validation.

func (Keeper) HandleChangeStatusProposal added in v1.19.0

func (k Keeper) HandleChangeStatusProposal(ctx sdk.Context, denom string, status types.MarkerStatus) error

HandleChangeStatusProposal handles a ChangeStatus governance proposal request

func (Keeper) HandleRemoveAdministratorProposal added in v1.19.0

func (k Keeper) HandleRemoveAdministratorProposal(ctx sdk.Context, denom string, removedAddress []string) error

HandleRemoveAdministratorProposal handles a RemoveAdministrator governance proposal request

func (Keeper) HandleSetAdministratorProposal added in v1.19.0

func (k Keeper) HandleSetAdministratorProposal(ctx sdk.Context, denom string, accessGrants []types.AccessGrant) error

HandleSetAdministratorProposal handles a SetAdministrator governance proposal request

func (Keeper) HandleSetDenomMetadataProposal added in v1.19.0

func (k Keeper) HandleSetDenomMetadataProposal(ctx sdk.Context, metadata banktypes.Metadata) error

HandleSetDenomMetadataProposal handles a Set Denom Metadata governance proposal request

func (Keeper) HandleSupplyDecreaseProposal added in v1.19.0

func (k Keeper) HandleSupplyDecreaseProposal(ctx sdk.Context, amount sdk.Coin) error

HandleSupplyDecreaseProposal handles a SupplyDecrease governance proposal request

func (Keeper) HandleSupplyIncreaseProposal added in v1.19.0

func (k Keeper) HandleSupplyIncreaseProposal(ctx sdk.Context, amount sdk.Coin, targetAddress string) error

HandleSupplyIncreaseProposal handles a SupplyIncrease governance proposal request

func (Keeper) HandleWithdrawEscrowProposal added in v1.19.0

func (k Keeper) HandleWithdrawEscrowProposal(ctx sdk.Context, denom, targetAddress string, amount sdk.Coins) error

HandleWithdrawEscrowProposal handles a Withdraw escrowed coins governance proposal request

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,
) error

IbcTransferCoin transfers restricted coins between two 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) IsAuthority added in v1.19.0

func (k Keeper) IsAuthority(addr string) bool

IsAuthority returns true if the provided address bech32 string is the authority address.

func (Keeper) IsReqAttrBypassAddr added in v1.17.0

func (k Keeper) IsReqAttrBypassAddr(addr sdk.AccAddress) bool

IsReqAttrBypassAddr returns true if the provided addr can bypass the required attributes checking.

func (Keeper) IsSendDeny added in v1.17.0

func (k Keeper) IsSendDeny(ctx sdk.Context, markerAddr, senderAddr sdk.AccAddress) bool

IsSendDeny returns true if sender address is denied for marker

func (Keeper) IterateAllNetAssetValues added in v1.18.0

func (k Keeper) IterateAllNetAssetValues(ctx sdk.Context, handler func(sdk.AccAddress, types.NetAssetValue) (stop bool)) error

IterateAllNetAssetValues iterates all net asset values

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) IterateNetAssetValues added in v1.17.0

func (k Keeper) IterateNetAssetValues(ctx sdk.Context, markerAddr sdk.AccAddress, handler func(state types.NetAssetValue) (stop bool)) error

IterateNetAssetValues iterates net asset values for marker

func (Keeper) IterateSendDeny added in v1.17.0

func (k Keeper) IterateSendDeny(ctx sdk.Context, handler func(key []byte) (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) NetAssetValues added in v1.17.0

NetAssetValues query for returning net asset values for a marker

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) 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) RemoveNetAssetValues added in v1.17.0

func (k Keeper) RemoveNetAssetValues(ctx sdk.Context, markerAddr sdk.AccAddress)

RemoveNetAssetValues removes all net asset values for a marker

func (Keeper) RemoveSendDeny added in v1.17.0

func (k Keeper) RemoveSendDeny(ctx sdk.Context, markerAddr, senderAddr sdk.AccAddress)

RemoveSendDeny removes sender address from marker deny list

func (Keeper) SendRestrictionFn added in v1.16.0

func (k Keeper) SendRestrictionFn(goCtx context.Context, fromAddr, toAddr sdk.AccAddress, amt sdk.Coins) (sdk.AccAddress, error)

func (Keeper) SetDenomMetaData added in v1.17.0

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

SetDenomMetaData sets denom metadata to keeper and emits event

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) SetNetAssetValue added in v1.17.0

func (k Keeper) SetNetAssetValue(ctx sdk.Context, marker types.MarkerAccountI, netAssetValue types.NetAssetValue, source string) error

SetNetAssetValue adds/updates a net asset value to marker

func (Keeper) SetNetAssetValueWithBlockHeight added in v1.18.0

func (k Keeper) SetNetAssetValueWithBlockHeight(ctx sdk.Context, marker types.MarkerAccountI, netAssetValue types.NetAssetValue, source string, blockHeight uint64) error

SetNetAssetValueWithBlockHeight adds/updates a net asset value to marker with a specific block height

func (Keeper) SetParams

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

SetParams sets the marker parameters to the store.

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) ValidateAuthority added in v1.19.0

func (k Keeper) ValidateAuthority(addr string) error

ValidateAuthority returns an error if the provided address is not the authority.

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