keeper

package
v7.3.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllInvariants added in v7.1.0

func AllInvariants(keeper Keeper) sdk.Invariant

AllInvariants runs all invariants of the gamm module

func NewMsgServerImpl

func NewMsgServerImpl(keeper *Keeper) types.MsgServer

NewMsgServerImpl returns an instance of MsgServer

func RegisterInvariants added in v7.1.0

func RegisterInvariants(ir sdk.InvariantRegistry, keeper Keeper)

RegisterInvariants registers all governance invariants

func TotalSuperfluidDelegationInvariant added in v7.1.0

func TotalSuperfluidDelegationInvariant(keeper Keeper) sdk.Invariant

TotalSuperfluidDelegationInvariant checks the sum of intermediary account delegation is same as sum of individual lockup delegation

func ValidatorAddressFromSyntheticDenom

func ValidatorAddressFromSyntheticDenom(syntheticDenom string) (string, error)

quick fix for getting the validator addresss from a synthetic denom

Types

type Hooks

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

Hooks wrapper struct for incentives keeper

func (Hooks) AfterAddTokensToLock

func (h Hooks) AfterAddTokensToLock(ctx sdk.Context, address sdk.AccAddress, lockID uint64, amount sdk.Coins)

lockup hooks if you add tokens to a lock that is superfluid unbonding, nothing happens superfluid side. This lock does as an edge case take on the slashing risk as well for historical slashes. This is deemed as fine, governance can re-pay if it occurs on mainnet.

func (Hooks) AfterDelegationModified

func (h Hooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)

func (Hooks) AfterEpochEnd

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

func (Hooks) AfterValidatorBeginUnbonding

func (h Hooks) AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)

func (Hooks) AfterValidatorBonded

func (h Hooks) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)

func (Hooks) AfterValidatorCreated

func (h Hooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress)

staking hooks

func (Hooks) AfterValidatorRemoved

func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)

func (Hooks) AfterValidatorSlashed added in v7.1.0

func (h Hooks) AfterValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, infractionHeight int64, slashFactor sdk.Dec, effectiveSlashFactor sdk.Dec)

func (Hooks) BeforeDelegationCreated

func (h Hooks) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)

func (Hooks) BeforeDelegationRemoved

func (h Hooks) BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)

func (Hooks) BeforeDelegationSharesModified

func (h Hooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)

func (Hooks) BeforeEpochStart

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

epochs hooks Don't do anything pre epoch start

func (Hooks) BeforeValidatorModified

func (h Hooks) BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress)

func (Hooks) BeforeValidatorSlashed

func (h Hooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, infractionHeight int64, slashFactor sdk.Dec, effectiveSlashFactor sdk.Dec)

func (Hooks) OnStartUnlock

func (h Hooks) OnStartUnlock(ctx sdk.Context, address sdk.AccAddress, lockID uint64, amount sdk.Coins, lockDuration time.Duration, unlockTime time.Time)

func (Hooks) OnTokenLocked

func (h Hooks) OnTokenLocked(ctx sdk.Context, address sdk.AccAddress, lockID uint64, amount sdk.Coins, lockDuration time.Duration, unlockTime time.Time)

func (Hooks) OnTokenSlashed

func (h Hooks) OnTokenSlashed(ctx sdk.Context, lockID uint64, amount sdk.Coins)

func (Hooks) OnTokenUnlocked

func (h Hooks) OnTokenUnlocked(ctx sdk.Context, address sdk.AccAddress, lockID uint64, amount sdk.Coins, lockDuration time.Duration, unlockTime time.Time)

type Keeper

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

Keeper provides a way to manage module storage

func NewKeeper

NewKeeper returns an instance of Keeper

func (Keeper) AddNewSuperfluidAsset

func (k Keeper) AddNewSuperfluidAsset(ctx sdk.Context, asset types.SuperfluidAsset)

func (Keeper) AfterEpochEnd

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

func (Keeper) AfterEpochStartBeginBlock

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

func (Keeper) AllAssets

AllAssets Returns all superfluid assets info

func (Keeper) AllIntermediaryAccounts

AllIntermediaryAccounts returns all superfluid intermediary accounts

func (Keeper) AssetMultiplier

AssetMultiplier returns superfluid asset multiplier

func (Keeper) AssetType

AssetType Returns superfluid asset type

func (Keeper) BeginUnwindSuperfluidAsset

func (k Keeper) BeginUnwindSuperfluidAsset(ctx sdk.Context, epochNum int64, asset types.SuperfluidAsset)

BeginUnwindSuperfluidAsset starts the deletion process for a superfluid asset. This current method is a stub, but is called when: * Governance removes a superfluid asset * A severe error in gamm occurs

It should eventually begin unwinding all of the synthetic lockups for that asset and queue them for deletion. See https://github.com/osmosis-labs/osmosis/issues/864

func (Keeper) ConnectedIntermediaryAccount

ConnectedIntermediaryAccount returns intermediary account connected to a superfluid staked lock by id

func (Keeper) DeleteIntermediaryAccount

func (k Keeper) DeleteIntermediaryAccount(ctx sdk.Context, address sdk.AccAddress)

func (Keeper) DeleteLockIdIntermediaryAccountConnection

func (k Keeper) DeleteLockIdIntermediaryAccountConnection(ctx sdk.Context, lockId uint64)

func (Keeper) DeleteOsmoEquivalentMultiplier

func (k Keeper) DeleteOsmoEquivalentMultiplier(ctx sdk.Context, denom string)

func (Keeper) DeleteSuperfluidAsset

func (k Keeper) DeleteSuperfluidAsset(ctx sdk.Context, denom string)

func (Keeper) EstimateSuperfluidDelegatedAmountByValidatorDenom

EstimateSuperfluidDelegatedAmountByValidatorDenom returns the amount of a specific denom delegated to a specific validator This is labeled an estimate, because the way it calculates the amount can lead rounding errors from the true delegated amount

func (Keeper) GetAllIntermediaryAccounts

func (k Keeper) GetAllIntermediaryAccounts(ctx sdk.Context) []types.SuperfluidIntermediaryAccount

func (Keeper) GetAllLockIdIntermediaryAccountConnections added in v7.1.0

func (k Keeper) GetAllLockIdIntermediaryAccountConnections(ctx sdk.Context) []types.LockIdIntermediaryAccountConnection

func (Keeper) GetAllOsmoEquivalentMultipliers

func (k Keeper) GetAllOsmoEquivalentMultipliers(ctx sdk.Context) []types.OsmoEquivalentMultiplierRecord

func (Keeper) GetAllSuperfluidAssets

func (k Keeper) GetAllSuperfluidAssets(ctx sdk.Context) []types.SuperfluidAsset

func (Keeper) GetEpochIdentifier

func (k Keeper) GetEpochIdentifier(ctx sdk.Context) (epochIdentifier string)

GetParams returns the total set params

func (Keeper) GetExpectedDelegationAmount

func (k Keeper) GetExpectedDelegationAmount(ctx sdk.Context, acc types.SuperfluidIntermediaryAccount) sdk.Int

func (Keeper) GetIntermediaryAccount

func (k Keeper) GetIntermediaryAccount(ctx sdk.Context, address sdk.AccAddress) types.SuperfluidIntermediaryAccount

func (Keeper) GetIntermediaryAccountFromLockId

func (k Keeper) GetIntermediaryAccountFromLockId(ctx sdk.Context, lockId uint64) (types.SuperfluidIntermediaryAccount, bool)

Returns Superfluid Intermediate Account and a bool if found / not found

func (Keeper) GetIntermediaryAccountsForVal

func (k Keeper) GetIntermediaryAccountsForVal(ctx sdk.Context, valAddr sdk.ValAddress) []types.SuperfluidIntermediaryAccount

func (Keeper) GetLockIdIntermediaryAccountConnection

func (k Keeper) GetLockIdIntermediaryAccountConnection(ctx sdk.Context, lockId uint64) sdk.AccAddress

func (Keeper) GetOrCreateIntermediaryAccount

func (k Keeper) GetOrCreateIntermediaryAccount(ctx sdk.Context, denom, valAddr string) (types.SuperfluidIntermediaryAccount, error)

func (Keeper) GetOsmoEquivalentMultiplier

func (k Keeper) GetOsmoEquivalentMultiplier(ctx sdk.Context, denom string) sdk.Dec

func (Keeper) GetParams

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

GetParams returns the total set params

func (Keeper) GetRiskAdjustedOsmoValue

func (k Keeper) GetRiskAdjustedOsmoValue(ctx sdk.Context, asset types.SuperfluidAsset, amount sdk.Int) sdk.Int

Returns amount * (1 - k.RiskFactor(asset)) Fow now, the risk factor is a global constant. It will move towards per pool functions.

func (Keeper) GetSuperfluidAsset

func (k Keeper) GetSuperfluidAsset(ctx sdk.Context, denom string) types.SuperfluidAsset

func (Keeper) GetSuperfluidOSMOTokens

func (k Keeper) GetSuperfluidOSMOTokens(ctx sdk.Context, denom string, amount sdk.Int) sdk.Int

func (Keeper) GetTotalSyntheticAssetsLocked

func (k Keeper) GetTotalSyntheticAssetsLocked(ctx sdk.Context, denom string) sdk.Int

func (Keeper) Hooks

func (k Keeper) Hooks() Hooks

Return the wrapper struct

func (Keeper) IncreaseSuperfluidDelegation

func (k Keeper) IncreaseSuperfluidDelegation(ctx sdk.Context, lockID uint64, amount sdk.Coins) error

func (Keeper) Logger

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

Logger returns a logger instance

func (Keeper) MoveSuperfluidDelegationRewardToGauges

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

func (Keeper) Params

Params returns the superfluid module params

func (Keeper) RefreshIntermediaryDelegationAmounts

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

func (Keeper) SetIntermediaryAccount

func (k Keeper) SetIntermediaryAccount(ctx sdk.Context, acc types.SuperfluidIntermediaryAccount)

func (Keeper) SetLockIdIntermediaryAccountConnection

func (k Keeper) SetLockIdIntermediaryAccountConnection(ctx sdk.Context, lockId uint64, acc types.SuperfluidIntermediaryAccount)

func (Keeper) SetOsmoEquivalentMultiplier

func (k Keeper) SetOsmoEquivalentMultiplier(ctx sdk.Context, epoch int64, denom string, multiplier sdk.Dec)

func (Keeper) SetParams

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

SetParams sets the total set of params

func (Keeper) SetSuperfluidAsset

func (k Keeper) SetSuperfluidAsset(ctx sdk.Context, asset types.SuperfluidAsset)

func (Keeper) SlashLockupsForValidatorSlash

func (k Keeper) SlashLockupsForValidatorSlash(ctx sdk.Context, valAddr sdk.ValAddress, infractionHeight int64, slashFactor sdk.Dec)

SlashLockupsForValidatorSlash should be called before the validator at valAddr is slashed. This function is responsible for inspecting every intermediate account to valAddr. For each intermediate account IA, it slashes every constituent delegation behind IA. Furthermore, if the infraction height is sufficiently old, slashes unbondings Note: Based on sdk.staking.Slash function review, slashed tokens are burnt not sent to community pool we ignore that, and send the underliyng tokens to the community pool anyway.

func (Keeper) SuperfluidDelegate

func (k Keeper) SuperfluidDelegate(ctx sdk.Context, sender string, lockID uint64, valAddr string) error

TODO: Merge a lot of logic with IncreaseSuperfluidDelegation

func (Keeper) SuperfluidDelegationAmount

SuperfluidDelegationAmount returns the coins superfluid delegated for a delegator, validator, denom triplet

func (Keeper) SuperfluidDelegationsByDelegator

SuperfluidDelegationsByDelegator returns all the superfluid poistions for a specific delegator

func (Keeper) SuperfluidDelegationsByValidatorDenom

SuperfluidDelegationsByValidatorDenom returns all the superfluid positions of a specific denom delegated to one validator

func (Keeper) SuperfluidUnbondLock

func (k Keeper) SuperfluidUnbondLock(ctx sdk.Context, underlyingLockId uint64, sender string) error

func (Keeper) SuperfluidUndelegate

func (k Keeper) SuperfluidUndelegate(ctx sdk.Context, sender string, lockID uint64) error

func (Keeper) SuperfluidUndelegationsByDelegator

SuperfluidUndelegationsByDelegator returns total amount undelegating by delegator

func (Keeper) TotalSuperfluidDelegations

TotalSuperfluidDelegations returns total amount of osmo delegated via superfluid staking

func (Keeper) UnriskAdjustOsmoValue

func (k Keeper) UnriskAdjustOsmoValue(ctx sdk.Context, amount sdk.Dec) sdk.Dec

func (Keeper) UpdateOsmoEquivalentMultipliers

func (k Keeper) UpdateOsmoEquivalentMultipliers(ctx sdk.Context, asset types.SuperfluidAsset, newEpochNumber int64) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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