Documentation ¶
Index ¶
- func FundsHolderBalanceInvariant(keeper Keeper) sdk.Invariant
- func RegisterInvariants(ir sdk.InvariantRegistry, keeper Keeper)
- type Keeper
- func (k Keeper) Accept(goCtx context.Context, msg *quarantine.MsgAccept) (*quarantine.MsgAcceptResponse, error)
- func (k Keeper) AcceptQuarantinedFunds(ctx sdk.Context, toAddr sdk.AccAddress, fromAddrs ...sdk.AccAddress) (sdk.Coins, error)
- func (k Keeper) AddQuarantinedCoins(ctx sdk.Context, coins sdk.Coins, toAddr sdk.AccAddress, ...) error
- func (k Keeper) AutoResponses(goCtx context.Context, req *quarantine.QueryAutoResponsesRequest) (*quarantine.QueryAutoResponsesResponse, error)
- func (k Keeper) Decline(goCtx context.Context, msg *quarantine.MsgDecline) (*quarantine.MsgDeclineResponse, error)
- func (k Keeper) DeclineQuarantinedFunds(ctx sdk.Context, toAddr sdk.AccAddress, fromAddrs ...sdk.AccAddress)
- func (k Keeper) ExportGenesis(ctx sdk.Context) *quarantine.GenesisState
- func (k Keeper) GetAllAutoResponseEntries(ctx sdk.Context) []*quarantine.AutoResponseEntry
- func (k Keeper) GetAllQuarantinedAccounts(ctx sdk.Context) []string
- func (k Keeper) GetAllQuarantinedFunds(ctx sdk.Context) []*quarantine.QuarantinedFunds
- func (k Keeper) GetAutoResponse(ctx sdk.Context, toAddr, fromAddr sdk.AccAddress) quarantine.AutoResponse
- func (k Keeper) GetFundsHolder() sdk.AccAddress
- func (k Keeper) GetQuarantineRecord(ctx sdk.Context, toAddr sdk.AccAddress, fromAddrs ...sdk.AccAddress) *quarantine.QuarantineRecord
- func (k Keeper) GetQuarantineRecords(ctx sdk.Context, toAddr sdk.AccAddress, fromAddrs ...sdk.AccAddress) []*quarantine.QuarantineRecord
- func (k Keeper) InitGenesis(ctx sdk.Context, genesisState *quarantine.GenesisState)
- func (k Keeper) IsAutoAccept(ctx sdk.Context, toAddr sdk.AccAddress, fromAddrs ...sdk.AccAddress) bool
- func (k Keeper) IsAutoDecline(ctx sdk.Context, toAddr sdk.AccAddress, fromAddrs ...sdk.AccAddress) bool
- func (k Keeper) IsQuarantined(goCtx context.Context, req *quarantine.QueryIsQuarantinedRequest) (*quarantine.QueryIsQuarantinedResponse, error)
- func (k Keeper) IsQuarantinedAddr(ctx sdk.Context, toAddr sdk.AccAddress) bool
- func (k Keeper) IterateAutoResponses(ctx sdk.Context, toAddr sdk.AccAddress, ...)
- func (k Keeper) IterateQuarantineRecords(ctx sdk.Context, toAddr sdk.AccAddress, ...)
- func (k Keeper) IterateQuarantinedAccounts(ctx sdk.Context, cb func(toAddr sdk.AccAddress) (stop bool))
- func (k Keeper) OptIn(goCtx context.Context, msg *quarantine.MsgOptIn) (*quarantine.MsgOptInResponse, error)
- func (k Keeper) OptOut(goCtx context.Context, msg *quarantine.MsgOptOut) (*quarantine.MsgOptOutResponse, error)
- func (k Keeper) QuarantinedFunds(goCtx context.Context, req *quarantine.QueryQuarantinedFundsRequest) (*quarantine.QueryQuarantinedFundsResponse, error)
- func (k Keeper) SendRestrictionFn(ctx sdk.Context, fromAddr, toAddr sdk.AccAddress, amt sdk.Coins) (sdk.AccAddress, error)
- func (k Keeper) SetAutoResponse(ctx sdk.Context, toAddr, fromAddr sdk.AccAddress, ...)
- func (k Keeper) SetOptIn(ctx sdk.Context, toAddr sdk.AccAddress) error
- func (k Keeper) SetOptOut(ctx sdk.Context, toAddr sdk.AccAddress) error
- func (k Keeper) SetQuarantineRecord(ctx sdk.Context, toAddr sdk.AccAddress, record *quarantine.QuarantineRecord)
- func (k Keeper) UpdateAutoResponses(goCtx context.Context, msg *quarantine.MsgUpdateAutoResponses) (*quarantine.MsgUpdateAutoResponsesResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FundsHolderBalanceInvariant ¶
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 (k Keeper) Accept(goCtx context.Context, msg *quarantine.MsgAccept) (*quarantine.MsgAcceptResponse, error)
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) AutoResponses ¶
func (k Keeper) AutoResponses(goCtx context.Context, req *quarantine.QueryAutoResponsesRequest) (*quarantine.QueryAutoResponsesResponse, error)
func (Keeper) Decline ¶
func (k Keeper) Decline(goCtx context.Context, msg *quarantine.MsgDecline) (*quarantine.MsgDeclineResponse, error)
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 ¶
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) IsQuarantined ¶
func (k Keeper) IsQuarantined(goCtx context.Context, req *quarantine.QueryIsQuarantinedRequest) (*quarantine.QueryIsQuarantinedResponse, error)
func (Keeper) IsQuarantinedAddr ¶
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 (k Keeper) OptIn(goCtx context.Context, msg *quarantine.MsgOptIn) (*quarantine.MsgOptInResponse, error)
func (Keeper) OptOut ¶
func (k Keeper) OptOut(goCtx context.Context, msg *quarantine.MsgOptOut) (*quarantine.MsgOptOutResponse, error)
func (Keeper) QuarantinedFunds ¶
func (k Keeper) QuarantinedFunds(goCtx context.Context, req *quarantine.QueryQuarantinedFundsRequest) (*quarantine.QueryQuarantinedFundsResponse, error)
func (Keeper) SendRestrictionFn ¶
func (k Keeper) SendRestrictionFn(ctx sdk.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) 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.
func (Keeper) UpdateAutoResponses ¶
func (k Keeper) UpdateAutoResponses(goCtx context.Context, msg *quarantine.MsgUpdateAutoResponses) (*quarantine.MsgUpdateAutoResponsesResponse, error)