keeper

package
v1.20.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FundsHolderBalanceInvariant

func FundsHolderBalanceInvariant(keeper Keeper) sdk.Invariant

FundsHolderBalanceInvariant checks that the funds-holder account has enough funds to cover all quarantined funds.

func RegisterInvariants

func RegisterInvariants(ir sdk.InvariantRegistry, keeper Keeper)

RegisterInvariants registers all quarantine invariants.

Types

type Keeper

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

func NewKeeper

func NewKeeper(cdc codec.BinaryCodec, storeKey storetypes.StoreKey, bankKeeper quarantine.BankKeeper, fundsHolder sdk.AccAddress) Keeper

func (Keeper) Accept

func (Keeper) AcceptQuarantinedFunds

func (k Keeper) AcceptQuarantinedFunds(ctx sdk.Context, toAddr sdk.AccAddress, fromAddrs ...sdk.AccAddress) (sdk.Coins, error)

AcceptQuarantinedFunds looks up all quarantined funds to toAddr from any of the fromAddrs. It marks and saves each as accepted and, if fully accepted, releases (sends) the funds to toAddr. Returns total funds released and possibly an error.

func (Keeper) AddQuarantinedCoins

func (k Keeper) AddQuarantinedCoins(ctx sdk.Context, coins sdk.Coins, toAddr sdk.AccAddress, fromAddrs ...sdk.AccAddress) error

AddQuarantinedCoins records that some new funds have been quarantined.

func (Keeper) Decline

func (Keeper) DeclineQuarantinedFunds

func (k Keeper) DeclineQuarantinedFunds(ctx sdk.Context, toAddr sdk.AccAddress, fromAddrs ...sdk.AccAddress)

DeclineQuarantinedFunds marks as declined, all quarantined funds to toAddr where any fromAddr is a sender.

func (Keeper) ExportGenesis

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

ExportGenesis reads this keeper's entire state and returns it as a GenesisState.

func (Keeper) GetAllAutoResponseEntries

func (k Keeper) GetAllAutoResponseEntries(ctx sdk.Context) []*quarantine.AutoResponseEntry

GetAllAutoResponseEntries gets an AutoResponseEntry entry for every quarantine auto-response that has been set. This is designed for use with ExportGenesis. See also IterateAutoResponses.

func (Keeper) GetAllQuarantinedAccounts

func (k Keeper) GetAllQuarantinedAccounts(ctx sdk.Context) []string

GetAllQuarantinedAccounts gets the bech32 string of every account that have opted into quarantine. This is designed for use with ExportGenesis. See also IterateQuarantinedAccounts.

func (Keeper) GetAllQuarantinedFunds

func (k Keeper) GetAllQuarantinedFunds(ctx sdk.Context) []*quarantine.QuarantinedFunds

GetAllQuarantinedFunds gets a QuarantinedFunds entry for each QuarantineRecord. This is designed for use with ExportGenesis. See also IterateQuarantineRecords.

func (Keeper) GetAutoResponse

func (k Keeper) GetAutoResponse(ctx sdk.Context, toAddr, fromAddr sdk.AccAddress) quarantine.AutoResponse

GetAutoResponse returns the quarantine auto-response for the given to/from addresses.

func (Keeper) GetFundsHolder

func (k Keeper) GetFundsHolder() sdk.AccAddress

GetFundsHolder returns the account address that holds quarantined funds.

func (Keeper) GetQuarantineRecord

func (k Keeper) GetQuarantineRecord(ctx sdk.Context, toAddr sdk.AccAddress, fromAddrs ...sdk.AccAddress) *quarantine.QuarantineRecord

GetQuarantineRecord gets the single quarantine record to toAddr from all the fromAddrs. If the record doesn't exist, nil is returned.

If you want all records from any of the fromAddrs, use GetQuarantineRecords.

func (Keeper) GetQuarantineRecords

func (k Keeper) GetQuarantineRecords(ctx sdk.Context, toAddr sdk.AccAddress, fromAddrs ...sdk.AccAddress) []*quarantine.QuarantineRecord

GetQuarantineRecords gets all the quarantine records to toAddr that involved any of the fromAddrs.

If you want a single record from all the fromAddrs, use GetQuarantineRecord.

func (Keeper) InitGenesis

func (k Keeper) InitGenesis(ctx sdk.Context, genesisState *quarantine.GenesisState)

InitGenesis updates this keeper's store using the provided GenesisState.

func (Keeper) IsAutoAccept

func (k Keeper) IsAutoAccept(ctx sdk.Context, toAddr sdk.AccAddress, fromAddrs ...sdk.AccAddress) bool

IsAutoAccept returns true if the to address has enabled auto-accept for ALL the from address.

func (Keeper) IsAutoDecline

func (k Keeper) IsAutoDecline(ctx sdk.Context, toAddr sdk.AccAddress, fromAddrs ...sdk.AccAddress) bool

IsAutoDecline returns true if the to address has enabled auto-decline for ANY of the from address.

func (Keeper) IsQuarantinedAddr

func (k Keeper) IsQuarantinedAddr(ctx sdk.Context, toAddr sdk.AccAddress) bool

IsQuarantinedAddr returns true if the given address has opted into quarantine.

func (Keeper) IterateAutoResponses

func (k Keeper) IterateAutoResponses(ctx sdk.Context, toAddr sdk.AccAddress, cb func(toAddr, fromAddr sdk.AccAddress, response quarantine.AutoResponse) (stop bool))

IterateAutoResponses iterates over the auto-responses for a given recipient address, or if no address is provided, iterates over all auto-response entries. The callback function should accept a to address, from address, and auto-response setting (in that order). It should return whether to stop iteration early. I.e. false will allow iteration to continue, true will stop iteration.

func (Keeper) IterateQuarantineRecords

func (k Keeper) IterateQuarantineRecords(ctx sdk.Context, toAddr sdk.AccAddress, cb func(toAddr, recordSuffix sdk.AccAddress, record *quarantine.QuarantineRecord) (stop bool))

IterateQuarantineRecords iterates over the quarantine records for a given recipient address, or if no address is provided, iterates over all quarantine records. The callback function should accept a to address, record suffix, and QuarantineRecord (in that order). It should return whether to stop iteration early. I.e. false will allow iteration to continue, true will stop iteration.

func (Keeper) IterateQuarantinedAccounts

func (k Keeper) IterateQuarantinedAccounts(ctx sdk.Context, cb func(toAddr sdk.AccAddress) (stop bool))

IterateQuarantinedAccounts iterates over all quarantine account addresses. The callback function should accept the to address (that has quarantine enabled). It should return whether to stop iteration early. I.e. false will allow iteration to continue, true will stop iteration.

func (Keeper) OptIn

func (Keeper) OptOut

func (Keeper) SendRestrictionFn

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

func (Keeper) SetAutoResponse

func (k Keeper) SetAutoResponse(ctx sdk.Context, toAddr, fromAddr sdk.AccAddress, response quarantine.AutoResponse)

SetAutoResponse sets the auto response of sends to toAddr from fromAddr. If the response is AUTO_RESPONSE_UNSPECIFIED, the auto-response record is deleted, otherwise it is created/updated with the given setting.

func (Keeper) SetOptIn

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

SetOptIn records that an address has opted into quarantine.

func (Keeper) SetOptOut

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

SetOptOut removes an address' quarantine opt-in record.

func (Keeper) SetQuarantineRecord

func (k Keeper) SetQuarantineRecord(ctx sdk.Context, toAddr sdk.AccAddress, record *quarantine.QuarantineRecord)

SetQuarantineRecord sets a quarantine record. Panics if the record is nil. If the record is fully accepted, it is deleted. Otherwise, it is saved.

Jump to

Keyboard shortcuts

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