keeper

package
v13.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ICACallbackID_InstantiateOracle = "instantiate_oracle"
	ICACallbackID_UpdateOracle      = "update_oracle"
)

Variables

View Source
var (
	InstantiateOracleTimeout = time.Hour * 24 // 1 day
	MetricUpdateTimeout      = time.Hour * 24 // 1 day
)

Functions

func EmitUpdateOracleAckEvent

func EmitUpdateOracleAckEvent(ctx sdk.Context, metric *types.Metric, ackStatus string)

Emits an event for an oracle update

func EmitUpdateOracleEvent

func EmitUpdateOracleEvent(ctx sdk.Context, metric types.Metric)

Emits an event for an oracle update

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

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

Types

type Keeper

type Keeper struct {
	ICS4Wrapper         types.ICS4Wrapper
	ClientKeeper        types.ClientKeeper
	ConnectionKeeper    types.ConnectionKeeper
	ChannelKeeper       types.ChannelKeeper
	ICAControllerKeeper icacontrollerkeeper.Keeper
	ICACallbacksKeeper  types.ICACallbacksKeeper
	// contains filtered or unexported fields
}

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	key storetypes.StoreKey,
	paramstore paramtypes.Subspace,
	authority string,

	ics4Wrapper types.ICS4Wrapper,
	clientKeeper types.ClientKeeper,
	connectionKeeper types.ConnectionKeeper,
	channelKeeper types.ChannelKeeper,
	icaControllerKeeper icacontrollerkeeper.Keeper,
	icaCallbacksKeeper types.ICACallbacksKeeper,
) *Keeper

func (Keeper) ActiveOracles

Query all oracles with a filter on whether they are currently active

func (Keeper) AllOracles

Query all oracles with s

func (Keeper) Callbacks

func (Keeper) EndBlocker

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

EndBlocker of icaoracle module

func (Keeper) ExportGenesis

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

ExportGenesis returns the capability module's exported genesis.

func (Keeper) GetAllMetrics

func (k Keeper) GetAllMetrics(ctx sdk.Context) (metrics []types.Metric)

Returns all metrics from the store

func (Keeper) GetAllOracles

func (k Keeper) GetAllOracles(ctx sdk.Context) []types.Oracle

Returns all oracles

func (Keeper) GetAllQueuedMetrics

func (k Keeper) GetAllQueuedMetrics(ctx sdk.Context) (metrics []types.Metric)

Returns all metrics from the index queue

func (Keeper) GetAuthority

func (k Keeper) GetAuthority() string

GetAuthority returns the x/staking module's authority.

func (Keeper) GetMetric

func (k Keeper) GetMetric(ctx sdk.Context, metricId string) (metric types.Metric, found bool)

Gets a specifc metric from the store

func (Keeper) GetOracle

func (k Keeper) GetOracle(ctx sdk.Context, chainId string) (oracle types.Oracle, found bool)

Grabs and returns an oracle object from the store using the chain-id

func (Keeper) GetOracleFromConnectionId

func (k Keeper) GetOracleFromConnectionId(ctx sdk.Context, connectionId string) (oracle types.Oracle, found bool)

Grab's an oracle from it's connectionId

func (Keeper) InitGenesis

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

InitGenesis initializes the capability module's state from a provided genesis state.

func (Keeper) InstantiateOracleCallback

func (k Keeper) InstantiateOracleCallback(ctx sdk.Context, packet channeltypes.Packet, ackResponse *icacallbackstypes.AcknowledgementResponse, args []byte) error

Callback after an instantiating an oracle's CW contract

If successful: Stores the cosmwasm contract address on the oracle object
If timeout/failure: Does nothing

func (Keeper) IsOracleICAChannelOpen

func (k Keeper) IsOracleICAChannelOpen(ctx sdk.Context, oracle types.Oracle) bool

Checks if the oracle ICA channel is open

func (Keeper) Logger

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

func (Keeper) Metrics

Query metrics with optional filters

func (Keeper) OnChanOpenAck

func (k Keeper) OnChanOpenAck(ctx sdk.Context, portID, channelID string) error

func (Keeper) Oracle

Query a specific oracle

func (Keeper) PostAllQueuedMetrics

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

For each queued metric, submit an ICA to each oracle, and then flag the metric as IN_PROGRESS

func (Keeper) QueueMetricUpdate

func (k Keeper) QueueMetricUpdate(ctx sdk.Context, key, value, metricType, attributes string)

Queues an metric update across each active oracle One metric record is created for each oracle, in status QUEUED

func (Keeper) RemoveMetric

func (k Keeper) RemoveMetric(ctx sdk.Context, metricId string)

Removes a metric from the store

func (Keeper) RemoveOracle

func (k Keeper) RemoveOracle(ctx sdk.Context, chainId string)

Removes an oracle from the store

func (Keeper) SetMetric

func (k Keeper) SetMetric(ctx sdk.Context, metric types.Metric)

Stores a metric in the main metric store and then either adds the metric to the queue or removes it from the queue depending on the status of the metric

func (Keeper) SetOracle

func (k Keeper) SetOracle(ctx sdk.Context, oracle types.Oracle)

Stores/updates an oracle object in the store

func (Keeper) SubmitICATx

func (k Keeper) SubmitICATx(ctx sdk.Context, tx types.ICATx) error

func (Keeper) SubmitMetricUpdate

func (k Keeper) SubmitMetricUpdate(ctx sdk.Context, oracle types.Oracle, metric types.Metric) error

Submits an ICA to update the metric in the CW contract

func (Keeper) ToggleOracle

func (k Keeper) ToggleOracle(ctx sdk.Context, chainId string, active bool) error

Toggle whether an oracle is active

func (Keeper) UpdateMetricStatus

func (k Keeper) UpdateMetricStatus(ctx sdk.Context, metric types.Metric, status types.MetricStatus)

Updates the status of a metric which will consequently move it either in or out of the queue

func (Keeper) UpdateOracleCallback

func (k Keeper) UpdateOracleCallback(ctx sdk.Context, packet channeltypes.Packet, ackResponse *icacallbackstypes.AcknowledgementResponse, args []byte) error

Callback after an update oracle ICA

If successful/failure: the metric is removed from the pending store
If timeout: metric is left in pending store so it can be re-submitted

Jump to

Keyboard shortcuts

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