keeper

package
v0.45.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

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

Types

type AmmHooks

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

Hooks wrapper struct for tvl keeper

func (AmmHooks) AfterExitPool

func (h AmmHooks) AfterExitPool(ctx sdk.Context, sender sdk.AccAddress, pool ammtypes.Pool, shareInAmount math.Int, exitCoins sdk.Coins) error

AfterExitPool is called after ExitPool, ExitSwapShareAmountIn, and ExitSwapExternAmountOut

func (AmmHooks) AfterJoinPool

func (h AmmHooks) AfterJoinPool(ctx sdk.Context, sender sdk.AccAddress, pool ammtypes.Pool, enterCoins sdk.Coins, shareOutAmount math.Int) error

AfterJoinPool is called after JoinPool, JoinSwapExternAmountIn, and JoinSwapShareAmountOut

func (AmmHooks) AfterPoolCreated

func (h AmmHooks) AfterPoolCreated(ctx sdk.Context, sender sdk.AccAddress, pool ammtypes.Pool) error

AfterPoolCreated is called after CreatePool

func (AmmHooks) AfterSwap

func (h AmmHooks) AfterSwap(ctx sdk.Context, sender sdk.AccAddress, pool ammtypes.Pool, input sdk.Coins, output sdk.Coins) error

AfterSwap is called after SwapExactAmountIn and SwapExactAmountOut

type Hooks

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

Hooks wrapper struct for incentive keeper

func (Hooks) AfterEpochEnd

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

AfterEpochEnd implements EpochHooks

func (Hooks) BeforeEpochStart

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

BeforeEpochStart implements EpochHooks

type Keeper

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

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeKey,
	memKey storetypes.StoreKey,
	authority string,
	amm types.AmmKeeper,
	bk types.BankKeeper,
	oracleKeeper ammtypes.OracleKeeper,
	stableKeeper types.StableStakeKeeper,
	commitmentKeeper types.CommitmentKeeper,
	assetProfileKeeper types.AssetProfileKeeper,
	masterchefKeeper types.MasterchefKeeper,
) *Keeper

func (Keeper) AfterEpochEnd

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

AfterEpochEnd distributes vested tokens at the end of each epoch

func (Keeper) AfterExitPool

func (k Keeper) AfterExitPool(ctx sdk.Context, sender sdk.AccAddress, ammPool ammtypes.Pool, shareInAmount math.Int, exitCoins sdk.Coins) error

AfterExitPool is called after ExitPool, ExitSwapShareAmountIn, and ExitSwapExternAmountOut

func (Keeper) AfterJoinPool

func (k Keeper) AfterJoinPool(ctx sdk.Context, sender sdk.AccAddress, ammPool ammtypes.Pool, enterCoins sdk.Coins, shareOutAmount math.Int) error

AfterJoinPool is called after JoinPool, JoinSwapExternAmountIn, and JoinSwapShareAmountOut

func (Keeper) AfterPoolCreated

func (k Keeper) AfterPoolCreated(ctx sdk.Context, sender sdk.AccAddress, ammPool ammtypes.Pool) error

AfterPoolCreated is called after CreatePool

func (Keeper) AfterSwap

func (k Keeper) AfterSwap(ctx sdk.Context, sender sdk.AccAddress, ammPool ammtypes.Pool, input sdk.Coins, output sdk.Coins) error

AfterSwap is called after SwapExactAmountIn and SwapExactAmountOut

func (Keeper) AmmHooks

func (k Keeper) AmmHooks() AmmHooks

Return the wrapper struct

func (Keeper) BeforeEpochStart

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

BeforeEpochStart performs a no-op

func (Keeper) BeginBlocker

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

func (Keeper) CalculatePoolHealth

func (k Keeper) CalculatePoolHealth(ctx sdk.Context, pool *types.Pool) sdk.Dec

func (Keeper) CheckAmmPoolUsdcBalance added in v0.15.0

func (k Keeper) CheckAmmPoolUsdcBalance(ctx sdk.Context, ammPool ammtypes.Pool) error

func (Keeper) CheckAndCloseAtStopLoss added in v0.44.0

func (k Keeper) CheckAndCloseAtStopLoss(ctx sdk.Context, position *types.Position, pool types.Pool, ammPool ammtypes.Pool) (underStopLossPrice, closeAttempted bool, err error)

func (Keeper) CheckAndLiquidateUnhealthyPosition added in v0.44.0

func (k Keeper) CheckAndLiquidateUnhealthyPosition(ctx sdk.Context, position *types.Position, pool types.Pool, ammPool ammtypes.Pool) (isHealthy, closeAttempted bool, health math.LegacyDec, err error)

func (Keeper) CheckIfWhitelisted

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

func (Keeper) CheckMaxOpenPositions

func (k Keeper) CheckMaxOpenPositions(ctx sdk.Context) error

func (Keeper) CheckPoolHealth

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

func (Keeper) CheckSamePosition

func (k Keeper) CheckSamePosition(ctx sdk.Context, msg *types.MsgOpen) (*types.Position, error)

func (Keeper) CheckUserAuthorization

func (k Keeper) CheckUserAuthorization(ctx sdk.Context, msg *types.MsgOpen) error

func (Keeper) Close

func (k Keeper) Close(ctx sdk.Context, msg *types.MsgClose) (*types.MsgCloseResponse, error)

func (Keeper) CloseEst added in v0.33.0

func (Keeper) CloseLong

func (k Keeper) CloseLong(ctx sdk.Context, msg *types.MsgClose) (*types.Position, math.Int, error)

func (Keeper) CommittedTokensLocked added in v0.40.0

func (Keeper) DeleteLegacyPosition added in v0.42.0

func (k Keeper) DeleteLegacyPosition(ctx sdk.Context, positionAddress string, id uint64) error

func (Keeper) DeleteOffset added in v0.42.0

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

func (Keeper) DeletePool added in v0.40.0

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

func (Keeper) DestroyPosition

func (k Keeper) DestroyPosition(ctx sdk.Context, positionAddress sdk.AccAddress, id uint64) error

func (Keeper) DewhitelistAddress

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

func (Keeper) EstimateSwapGivenOut

func (k Keeper) EstimateSwapGivenOut(ctx sdk.Context, tokenOutAmount sdk.Coin, tokenInDenom string, ammPool ammtypes.Pool) (math.Int, error)

Swap estimation using amm CalcInAmtGivenOut function

func (Keeper) ForceCloseLong

func (k Keeper) ForceCloseLong(ctx sdk.Context, position types.Position, pool types.Pool, lpAmount math.Int) (math.Int, error)

func (Keeper) GetAllLegacyPositions added in v0.43.0

func (k Keeper) GetAllLegacyPositions(ctx sdk.Context) []types.LegacyPosition

func (Keeper) GetAllPools

func (k Keeper) GetAllPools(ctx sdk.Context) (list []types.Pool)

GetAllPool returns all pool

func (Keeper) GetAllPositions

func (k Keeper) GetAllPositions(ctx sdk.Context) []types.Position

func (Keeper) GetAllWhitelistedAddress

func (k Keeper) GetAllWhitelistedAddress(ctx sdk.Context) []sdk.AccAddress

func (Keeper) GetAmmPool

func (k Keeper) GetAmmPool(ctx sdk.Context, poolId uint64) (ammtypes.Pool, error)

func (Keeper) GetEpochLength

func (k Keeper) GetEpochLength(ctx sdk.Context) int64

func (Keeper) GetEpochPosition

func (k Keeper) GetEpochPosition(ctx sdk.Context, epochLength int64) int64

get position of current block in epoch

func (Keeper) GetInterestRateUsd added in v0.44.0

func (k Keeper) GetInterestRateUsd(ctx sdk.Context, positions []*types.QueryPosition) ([]*types.PositionAndInterest, error)

func (Keeper) GetLegacyParams added in v0.42.0

func (k Keeper) GetLegacyParams(ctx sdk.Context) (params types.LegacyParams)

GetParams get all parameters as types.Params

func (Keeper) GetLeverageLpUpdatedLeverage added in v0.43.0

func (k Keeper) GetLeverageLpUpdatedLeverage(ctx sdk.Context, positions []*types.Position) ([]*types.QueryPosition, error)

func (Keeper) GetMaxLeverageParam

func (k Keeper) GetMaxLeverageParam(ctx sdk.Context) sdk.Dec

func (Keeper) GetMaxOpenPositions

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

func (Keeper) GetOffset added in v0.42.0

func (k Keeper) GetOffset(ctx sdk.Context) (uint64, bool)

func (Keeper) GetOpenPositionCount

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

func (Keeper) GetParams

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

GetParams get all parameters as types.Params

func (Keeper) GetPool

func (k Keeper) GetPool(ctx sdk.Context, poolId uint64) (val types.Pool, found bool)

GetPool returns a pool from its index

func (Keeper) GetPoolOpenThreshold

func (k Keeper) GetPoolOpenThreshold(ctx sdk.Context) sdk.Dec

func (Keeper) GetPosition

func (k Keeper) GetPosition(ctx sdk.Context, positionAddress sdk.AccAddress, id uint64) (types.Position, error)

func (Keeper) GetPositionCount

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

func (Keeper) GetPositionHealth

func (k Keeper) GetPositionHealth(ctx sdk.Context, position types.Position) (sdk.Dec, error)

GetPositionHealth Should not be used in queries as UpdateInterestAndGetDebt updates KVStore as well

func (Keeper) GetPositionIterator

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

func (Keeper) GetPositionWithId added in v0.33.0

func (k Keeper) GetPositionWithId(ctx sdk.Context, positionAddress sdk.AccAddress, Id uint64) (*types.Position, bool)

func (Keeper) GetPositions

func (k Keeper) GetPositions(ctx sdk.Context, pagination *query.PageRequest) ([]*types.Position, *query.PageResponse, error)

func (Keeper) GetPositionsForAddress

func (k Keeper) GetPositionsForAddress(ctx sdk.Context, positionAddress sdk.AccAddress, pagination *query.PageRequest) ([]*types.Position, *query.PageResponse, error)

func (Keeper) GetPositionsForPool

func (k Keeper) GetPositionsForPool(ctx sdk.Context, ammPoolId uint64, pagination *query.PageRequest) ([]*types.Position, *query.PageResponse, error)

func (Keeper) GetSafetyFactor

func (k Keeper) GetSafetyFactor(ctx sdk.Context) sdk.Dec

func (Keeper) GetStatus

func (k Keeper) GetStatus(goCtx context.Context, req *types.StatusRequest) (*types.StatusResponse, error)

func (Keeper) GetWhitelist

func (k Keeper) GetWhitelist(goCtx context.Context, req *types.WhitelistRequest) (*types.WhitelistResponse, error)

func (Keeper) GetWhitelistAddressIterator

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

func (Keeper) GetWhitelistedAddress

func (k Keeper) GetWhitelistedAddress(ctx sdk.Context, pagination *query.PageRequest) ([]sdk.AccAddress, *query.PageResponse, error)

func (Keeper) Hooks

func (k Keeper) Hooks() Hooks

Return the wrapper struct

func (Keeper) IsWhitelisted

func (Keeper) IsWhitelistingEnabled

func (k Keeper) IsWhitelistingEnabled(ctx sdk.Context) bool

func (Keeper) LiquidationPrice added in v0.35.0

func (Keeper) Logger

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

func (Keeper) MigrateData added in v0.44.0

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

func (Keeper) MigratePositionHealth added in v0.45.0

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

migrating eixsting position and setting position health to max dec when liablities is zero

func (Keeper) Open

func (k Keeper) Open(ctx sdk.Context, msg *types.MsgOpen) (*types.MsgOpenResponse, error)

func (Keeper) OpenConsolidate

func (k Keeper) OpenConsolidate(ctx sdk.Context, position *types.Position, msg *types.MsgOpen) (*types.MsgOpenResponse, error)

func (Keeper) OpenEst added in v0.33.0

func (Keeper) OpenLong

func (k Keeper) OpenLong(ctx sdk.Context, msg *types.MsgOpen) (*types.Position, error)

func (Keeper) Params

func (k Keeper) Params(goCtx context.Context, req *types.ParamsRequest) (*types.ParamsResponse, error)

func (Keeper) Pool

func (Keeper) Pools

func (Keeper) Position

func (k Keeper) Position(goCtx context.Context, req *types.PositionRequest) (*types.PositionResponse, error)

func (Keeper) ProcessAddCollateral added in v0.37.0

func (k Keeper) ProcessAddCollateral(ctx sdk.Context, address string, id uint64, collateral sdk.Int) error

Increase collateral, repay with additional collateral, update debt, liability and health

func (Keeper) ProcessOpenLong

func (k Keeper) ProcessOpenLong(ctx sdk.Context, position *types.Position, poolId uint64, msg *types.MsgOpen) (*types.Position, error)

func (Keeper) QueryPositions

func (k Keeper) QueryPositions(goCtx context.Context, req *types.PositionsRequest) (*types.PositionsResponse, error)

func (Keeper) QueryPositionsByPool

func (k Keeper) QueryPositionsByPool(goCtx context.Context, req *types.PositionsByPoolRequest) (*types.PositionsByPoolResponse, error)

func (Keeper) QueryPositionsForAddress

func (k Keeper) QueryPositionsForAddress(goCtx context.Context, req *types.PositionsForAddressRequest) (*types.PositionsForAddressResponse, error)

func (Keeper) RemovePool

func (k Keeper) RemovePool(ctx sdk.Context, index uint64)

RemovePool removes a pool from the store

func (Keeper) Rewards added in v0.33.0

func (*Keeper) SetHooks

func (k *Keeper) SetHooks(lh types.LeverageLpHooks) *Keeper

SetHooks set the leveragelp hooks

func (Keeper) SetOffset added in v0.42.0

func (k Keeper) SetOffset(ctx sdk.Context, offset uint64)

func (Keeper) SetOpenPositionCount

func (k Keeper) SetOpenPositionCount(ctx sdk.Context, count uint64)

Set Open Position count

func (Keeper) SetParams

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

SetParams set the params

func (Keeper) SetPool

func (k Keeper) SetPool(ctx sdk.Context, pool types.Pool)

SetPool set a specific pool in the store from its index

func (Keeper) SetPosition

func (k Keeper) SetPosition(ctx sdk.Context, position *types.Position)

func (Keeper) SetPositionCount

func (k Keeper) SetPositionCount(ctx sdk.Context, count uint64)

Set Position count

func (Keeper) UpdatePoolHealth

func (k Keeper) UpdatePoolHealth(ctx sdk.Context, pool *types.Pool)

func (Keeper) WhitelistAddress

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

Jump to

Keyboard shortcuts

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