keeper

package
v3.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllInvariants

func AllInvariants(k Keeper) sdk.Invariant

AllInvariants runs all invariants of the x/streamer module.

func LastStreamIdInvariant

func LastStreamIdInvariant(k Keeper) sdk.Invariant

func RegisterInvariants

func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)

RegisterInvariants registers the bank module invariants

func StreamerBalanceInvariant

func StreamerBalanceInvariant(k Keeper) sdk.Invariant

func StreamsCountInvariant

func StreamsCountInvariant(k Keeper) sdk.Invariant

func StreamsInvariant

func StreamsInvariant(k Keeper) sdk.Invariant

Types

type Hooks

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

Hooks is the wrapper struct for the streamer keeper.

func (Hooks) AfterEpochEnd

func (h Hooks) AfterEpochEnd(ctx sdk.Context, epochIdentifier string, epochNumber int64) error

AfterEpochEnd is the epoch end hook.

func (Hooks) AfterExitPool

func (h Hooks) AfterExitPool(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, shareInAmount sdk.Int, exitCoins sdk.Coins)

AfterExitPool hook is a noop.

func (Hooks) AfterJoinPool

func (h Hooks) AfterJoinPool(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, enterCoins sdk.Coins, shareOutAmount sdk.Int)

AfterJoinPool hook is a noop.

func (Hooks) AfterPoolCreated

func (h Hooks) AfterPoolCreated(ctx sdk.Context, sender sdk.AccAddress, poolId uint64)

AfterPoolCreated creates a gauge for each pool’s lockable duration.

func (Hooks) AfterSwap

func (h Hooks) AfterSwap(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, input sdk.Coins, output sdk.Coins)

AfterSwap hook is a noop.

func (Hooks) BeforeEpochStart

func (h Hooks) BeforeEpochStart(ctx sdk.Context, epochIdentifier string, epochNumber int64) error

BeforeEpochStart is the epoch start hook.

type Keeper

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

Keeper provides a way to manage streamer module storage.

func NewKeeper

NewKeeper returns a new instance of the incentive module keeper struct.

func (Keeper) ActiveStreamsIterator

func (k Keeper) ActiveStreamsIterator(ctx sdk.Context) sdk.Iterator

ActiveStreamsIterator returns the iterator for all active streams.

func (Keeper) AfterEpochEnd

func (k Keeper) AfterEpochEnd(ctx sdk.Context, epochIdentifier string, epochNumber int64) error

AfterEpochEnd is the epoch end hook.

func (Keeper) BeforeEpochStart

func (k Keeper) BeforeEpochStart(ctx sdk.Context, epochIdentifier string, epochNumber int64) error

BeforeEpochStart is the epoch start hook.

func (Keeper) CreatePoolGauge

func (k Keeper) CreatePoolGauge(ctx sdk.Context, poolId uint64) error

func (Keeper) CreateStream

func (k Keeper) CreateStream(ctx sdk.Context, coins sdk.Coins, records []types.DistrRecord, startTime time.Time, epochIdentifier string, numEpochsPaidOver uint64) (uint64, error)

CreateStream creates a stream and sends coins to the stream.

func (Keeper) CreateStreamRefKeys

func (k Keeper) CreateStreamRefKeys(ctx sdk.Context, stream *types.Stream, combinedKeys []byte) error

CreateStreamRefKeys takes combinedKey (the keyPrefix for upcoming, active, or finished streams combined with stream start time) and adds a reference to the respective stream ID. If stream is active or upcoming, creates reference between the denom and stream ID. Used to consolidate codepaths for InitGenesis and CreateStream.

func (Keeper) Distribute

func (k Keeper) Distribute(ctx sdk.Context, streams []types.Stream) (sdk.Coins, error)

Distribute distributes coins from an array of streams to all eligible locks.

func (Keeper) DistributeByWeights

func (k Keeper) DistributeByWeights(ctx sdk.Context, coins sdk.Coins, distrInfo *types.DistrInfo) (sdk.Coins, error)

DistributeByWeights allocates and distributes coin according a gauge’s proportional weight that is recorded in the record.

func (Keeper) ExportGenesis

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

ExportGenesis returns the x/streamer module's exported genesis.

func (Keeper) FinishedStreamsIterator

func (k Keeper) FinishedStreamsIterator(ctx sdk.Context) sdk.Iterator

FinishedStreamsIterator returns the iterator for all finished streams.

func (Keeper) GetActiveStreams

func (k Keeper) GetActiveStreams(ctx sdk.Context) []types.Stream

GetActiveStreams returns active streams.

func (Keeper) GetFinishedStreams

func (k Keeper) GetFinishedStreams(ctx sdk.Context) []types.Stream

GetFinishedStreams returns finished streams.

func (Keeper) GetLastStreamID

func (k Keeper) GetLastStreamID(ctx sdk.Context) uint64

GetLastStreamID returns the last used stream ID.

func (Keeper) GetModuleDistributedCoins

func (k Keeper) GetModuleDistributedCoins(ctx sdk.Context) sdk.Coins

GetModuleDistributedCoins returns sum of coins that have been distributed so far for all of the module.

func (Keeper) GetModuleToDistributeCoins

func (k Keeper) GetModuleToDistributeCoins(ctx sdk.Context) sdk.Coins

GetModuleToDistributeCoins returns sum of coins yet to be distributed for all of the module.

func (Keeper) GetNotFinishedStreams

func (k Keeper) GetNotFinishedStreams(ctx sdk.Context) []types.Stream

GetNotFinishedStreams returns both upcoming and active streams.

func (Keeper) GetParams

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

GetParams returns all of the parameters in the incentive module.

func (Keeper) GetStreamByID

func (k Keeper) GetStreamByID(ctx sdk.Context, streamID uint64) (*types.Stream, error)

GetStreamByID returns stream from stream ID.

func (Keeper) GetStreamFromIDs

func (k Keeper) GetStreamFromIDs(ctx sdk.Context, streamIDs []uint64) ([]types.Stream, error)

GetStreamFromIDs returns multiple streams from a streamIDs array.

func (Keeper) GetStreams

func (k Keeper) GetStreams(ctx sdk.Context) []types.Stream

GetStreams returns upcoming, active, and finished streams.

func (Keeper) GetUpcomingStreams

func (k Keeper) GetUpcomingStreams(ctx sdk.Context) []types.Stream

GetUpcomingStreams returns upcoming streams.

func (Keeper) Hooks

func (k Keeper) Hooks() Hooks

Hooks returns the hook wrapper struct.

func (Keeper) InitGenesis

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

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

func (Keeper) Logger

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

Logger returns a logger instance for the streamer module.

func (Keeper) NewDistrInfo

func (k Keeper) NewDistrInfo(ctx sdk.Context, records []types.DistrRecord) (*types.DistrInfo, error)

func (Keeper) ReplaceDistrRecords

func (k Keeper) ReplaceDistrRecords(ctx sdk.Context, streamId uint64, records []types.DistrRecord) error

This is checked for no err when a proposal is made, and executed when a proposal passes.

func (Keeper) SetLastStreamID

func (k Keeper) SetLastStreamID(ctx sdk.Context, ID uint64)

SetLastStreamID sets the last used stream ID to the provided ID.

func (Keeper) SetParams

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

SetParams sets all of the parameters in the incentive module.

func (Keeper) SetStreamWithRefKey

func (k Keeper) SetStreamWithRefKey(ctx sdk.Context, stream *types.Stream) error

SetStreamWithRefKey takes a single stream and assigns a key. Takes combinedKey (the keyPrefix for upcoming, active, or finished streams combined with stream start time) and adds a reference to the respective stream ID.

func (Keeper) StreamsIterator

func (k Keeper) StreamsIterator(ctx sdk.Context) sdk.Iterator

StreamsIterator returns the iterator for all streams.

func (Keeper) TerminateStream

func (k Keeper) TerminateStream(ctx sdk.Context, streamID uint64) error

TerminateStream cancels a stream.

func (Keeper) UpcomingStreamsIterator

func (k Keeper) UpcomingStreamsIterator(ctx sdk.Context) sdk.Iterator

UpcomingStreamsIterator returns the iterator for all upcoming streams.

func (Keeper) UpdateDistrRecords

func (k Keeper) UpdateDistrRecords(ctx sdk.Context, streamId uint64, records []types.DistrRecord) error

UpdateDistrRecords is checked for no err when a proposal is made, and executed when a proposal passes.

type Querier

type Querier struct {
	Keeper
}

Querier defines a wrapper around the streamer module keeper providing gRPC method handlers.

func NewQuerier

func NewQuerier(k Keeper) Querier

NewQuerier creates a new Querier struct.

func (Querier) ActiveStreams

ActiveStreams returns all active streams.

func (Querier) ModuleToDistributeCoins

ModuleToDistributeCoins returns coins that are going to be distributed.

func (Querier) StreamByID

StreamByID takes a streamID and returns its respective stream.

func (Querier) Streams

Streams returns all upcoming and active streams.

func (Querier) UpcomingStreams

UpcomingStreams returns all upcoming streams.

Jump to

Keyboard shortcuts

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