keeper

package
v6.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMsgServerImpl

func NewMsgServerImpl(kb Builder) uibc.MsgServer

NewMsgServerImpl returns an implementation of uibc.MsgServer

Types

type Builder

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

Builder constructs Keeper by perparing all related dependencies (notably the store).

func NewKeeperBuilder

func NewKeeperBuilder(
	cdc codec.BinaryCodec, key storetypes.StoreKey,
	leverage uibc.Leverage, oracle uibc.Oracle, ugov ugov.EmergencyGroupBuilder,
) Builder

func (Builder) ExportGenesis

func (kb Builder) ExportGenesis(ctx sdk.Context) *uibc.GenesisState

ExportGenesis returns the x/uibc module's exported genesis state.

func (Builder) InitGenesis

func (kb Builder) InitGenesis(ctx sdk.Context, genState uibc.GenesisState)

InitGenesis initializes the x/uibc module's state from a provided genesis state.

func (Builder) Keeper

func (kb Builder) Keeper(ctx *sdk.Context) Keeper

type Keeper

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

func (Keeper) CheckAndUpdateQuota

func (k Keeper) CheckAndUpdateQuota(denom string, newOutflow sdkmath.Int) error

CheckAndUpdateQuota checks if adding a newOutflow doesn't exceed the max quota and updates the current quota metrics.

func (Keeper) GetAllInflows added in v6.2.0

func (k Keeper) GetAllInflows() (sdk.DecCoins, error)

GetAllInflows returns inflows of all registered tokens in USD value.

func (Keeper) GetAllOutflows

func (k Keeper) GetAllOutflows() (sdk.DecCoins, error)

GetAllOutflows returns sum of outflows of all tokens in USD value.

func (Keeper) GetExpire

func (k Keeper) GetExpire() (*time.Time, error)

GetExpire returns ibc-transfer quota expires time.

func (Keeper) GetInflowSum added in v6.2.0

func (k Keeper) GetInflowSum() sdk.Dec

GetInflowSum returns the total inflow of ibc-transfer amount.

func (Keeper) GetOutflowSum added in v6.2.0

func (k Keeper) GetOutflowSum() sdk.Dec

GetOutflowSum returns the total outflow of ibc-transfer amount.

func (Keeper) GetParams

func (k Keeper) GetParams() (params uibc.Params)

GetParams gets the x/uibc module's parameters.

func (Keeper) GetTokenInflow added in v6.2.0

func (k Keeper) GetTokenInflow(denom string) sdk.DecCoin

GetTokenInflow returns the inflow of denom from store.

func (Keeper) GetTokenOutflows

func (k Keeper) GetTokenOutflows(denom string) sdk.DecCoin

GetTokenOutflows returns sum of denom outflows in USD value in the DecCoin structure.

func (Keeper) MigrateOutflowSum added in v6.2.0

func (k Keeper) MigrateOutflowSum()

MigrateOutflowSum migrate the old total outflow type to new one Note: only use for v6.2 migration from v6.1.0

func (Keeper) PrefixStore

func (k Keeper) PrefixStore(prefix []byte) store.KVStore

PrefixStore creates an new prefix store. It will automatically remove provided prefix from keys when using with the iterator.

func (Keeper) RecordIBCInflow added in v6.2.0

func (k Keeper) RecordIBCInflow(ctx sdk.Context,
	packet channeltypes.Packet, dataDenom, dataAmount string, isSourceChain bool,
) exported.Acknowledgement

RecordIBCInflow will save the inflow amount if token is registered otherwise it will skip

func (Keeper) ResetAllQuotas

func (k Keeper) ResetAllQuotas() error

ResetAllQuotas will zero the ibc-transfer quotas

func (Keeper) SetExpire

func (k Keeper) SetExpire(expires time.Time) error

SetExpire save the quota expire time of ibc denom into.

func (Keeper) SetIBCStatus

func (k Keeper) SetIBCStatus(ibcStatus uibc.IBCTransferStatus) error

SetIBCStatus update the ibc-transfer status in module params.

func (Keeper) SetInflowSum added in v6.2.0

func (k Keeper) SetInflowSum(amount sdk.Dec)

SetInflowSum save the total inflow of ibc-transfer amount.

func (Keeper) SetOutflowSum added in v6.2.0

func (k Keeper) SetOutflowSum(amount sdk.Dec)

SetOutflowSum save the total outflow of ibc-transfer amount.

func (Keeper) SetParams

func (k Keeper) SetParams(params uibc.Params) error

SetParams sets the x/uibc module's parameters.

func (Keeper) SetTokenInflow added in v6.2.0

func (k Keeper) SetTokenInflow(inflow sdk.DecCoin)

SetTokenInflow save the inflow of denom into store.

func (Keeper) SetTokenInflows added in v6.2.0

func (k Keeper) SetTokenInflows(inflows sdk.DecCoins)

SetTokenInflows saves provided updated IBC inflows as a pair: USD value, denom name in the DecCoin structure.

func (Keeper) SetTokenOutflow

func (k Keeper) SetTokenOutflow(outflow sdk.DecCoin)

SetTokenOutflow save the outflows of denom into store.

func (Keeper) SetTokenOutflows

func (k Keeper) SetTokenOutflows(outflows sdk.DecCoins)

SetTokenOutflows saves provided updated IBC outflows as a pair: USD value, denom name in the DecCoin structure.

func (Keeper) UndoUpdateQuota

func (k Keeper) UndoUpdateQuota(denom string, amount sdkmath.Int) error

UndoUpdateQuota subtracts `amount` from quota metric of the ibc denom.

func (Keeper) UpdateQuotaParams

func (k Keeper) UpdateQuotaParams(totalQuota, quotaPerDenom sdk.Dec, quotaDuration time.Duration,
	byEmergencyGroup bool,
) error

UpdateQuotaParams update the ibc-transfer quota params for ibc denoms

type Querier

type Querier struct {
	Builder
}

Querier implements a QueryServer for the x/uibc module.

func NewQuerier

func NewQuerier(kb Builder) Querier

func (Querier) AllOutflows

AllOutflows queries outflows for all denom in the current period.

func (Querier) Outflows

func (q Querier) Outflows(goCtx context.Context, req *uibc.QueryOutflows) (
	*uibc.QueryOutflowsResponse, error,
)

Outflows queries denom outflows in the current period. If req.Denom is not set, then we return total outflows.

func (Querier) Params

func (q Querier) Params(goCtx context.Context, _ *uibc.QueryParams) (
	*uibc.QueryParamsResponse, error,
)

Params returns params of the x/uibc module.

Jump to

Keyboard shortcuts

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