Documentation ¶
Index ¶
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- type AmmHooks
- func (h AmmHooks) AfterExitPool(ctx sdk.Context, sender sdk.AccAddress, pool ammtypes.Pool, ...) error
- func (h AmmHooks) AfterJoinPool(ctx sdk.Context, sender sdk.AccAddress, pool ammtypes.Pool, ...) error
- func (h AmmHooks) AfterPoolCreated(ctx sdk.Context, sender sdk.AccAddress, pool ammtypes.Pool) error
- func (h AmmHooks) AfterSwap(ctx sdk.Context, sender sdk.AccAddress, pool ammtypes.Pool, input sdk.Coins, ...) error
- type Hooks
- type Keeper
- func (k Keeper) AfterEpochEnd(ctx sdk.Context, epochIdentifier string, _ int64) error
- func (k Keeper) AfterExitPool(ctx sdk.Context, sender sdk.AccAddress, ammPool ammtypes.Pool, ...) error
- func (k Keeper) AfterJoinPool(ctx sdk.Context, sender sdk.AccAddress, ammPool ammtypes.Pool, ...) error
- func (k Keeper) AfterPoolCreated(ctx sdk.Context, sender sdk.AccAddress, ammPool ammtypes.Pool) error
- func (k Keeper) AfterSwap(ctx sdk.Context, sender sdk.AccAddress, ammPool ammtypes.Pool, input sdk.Coins, ...) error
- func (k Keeper) AmmHooks() AmmHooks
- func (k Keeper) BeforeEpochStart(ctx sdk.Context, epochIdentifier string, epochNumber int64) error
- func (k Keeper) BeginBlocker(ctx sdk.Context)
- func (k Keeper) CalculatePoolHealth(ctx sdk.Context, pool *types.Pool) sdk.Dec
- func (k Keeper) CheckAmmPoolUsdcBalance(ctx sdk.Context, ammPool ammtypes.Pool) error
- func (k Keeper) CheckAndCloseAtStopLoss(ctx sdk.Context, position *types.Position, pool types.Pool, ...) (underStopLossPrice, closeAttempted bool, err error)
- func (k Keeper) CheckAndLiquidateUnhealthyPosition(ctx sdk.Context, position *types.Position, pool types.Pool, ...) (isHealthy, closeAttempted bool, health math.LegacyDec, err error)
- func (k Keeper) CheckIfWhitelisted(ctx sdk.Context, address sdk.AccAddress) bool
- func (k Keeper) CheckMaxOpenPositions(ctx sdk.Context) error
- func (k Keeper) CheckPoolHealth(ctx sdk.Context, poolId uint64) error
- func (k Keeper) CheckSamePosition(ctx sdk.Context, msg *types.MsgOpen) (*types.Position, error)
- func (k Keeper) CheckUserAuthorization(ctx sdk.Context, msg *types.MsgOpen) error
- func (k Keeper) Close(ctx sdk.Context, msg *types.MsgClose) (*types.MsgCloseResponse, error)
- func (k Keeper) CloseEst(goCtx context.Context, req *types.QueryCloseEstRequest) (*types.QueryCloseEstResponse, error)
- func (k Keeper) CloseLong(ctx sdk.Context, msg *types.MsgClose) (*types.Position, math.Int, error)
- func (k Keeper) CommittedTokensLocked(goCtx context.Context, req *types.QueryCommittedTokensLockedRequest) (*types.QueryCommittedTokensLockedResponse, error)
- func (k Keeper) DeleteLegacyPosition(ctx sdk.Context, positionAddress string, id uint64) error
- func (k Keeper) DeleteOffset(ctx sdk.Context)
- func (k Keeper) DeletePool(ctx sdk.Context, poolId uint64)
- func (k Keeper) DestroyPosition(ctx sdk.Context, positionAddress sdk.AccAddress, id uint64) error
- func (k Keeper) DewhitelistAddress(ctx sdk.Context, address sdk.AccAddress)
- func (k Keeper) EstimateSwapGivenOut(ctx sdk.Context, tokenOutAmount sdk.Coin, tokenInDenom string, ...) (math.Int, error)
- func (k Keeper) ForceCloseLong(ctx sdk.Context, position types.Position, pool types.Pool, lpAmount math.Int) (math.Int, error)
- func (k Keeper) GetAllLegacyPositions(ctx sdk.Context) []types.LegacyPosition
- func (k Keeper) GetAllPools(ctx sdk.Context) (list []types.Pool)
- func (k Keeper) GetAllPositions(ctx sdk.Context) []types.Position
- func (k Keeper) GetAllWhitelistedAddress(ctx sdk.Context) []sdk.AccAddress
- func (k Keeper) GetAmmPool(ctx sdk.Context, poolId uint64) (ammtypes.Pool, error)
- func (k Keeper) GetEpochLength(ctx sdk.Context) int64
- func (k Keeper) GetEpochPosition(ctx sdk.Context, epochLength int64) int64
- func (k Keeper) GetInterestRateUsd(ctx sdk.Context, positions []*types.QueryPosition) ([]*types.PositionAndInterest, error)
- func (k Keeper) GetLegacyParams(ctx sdk.Context) (params types.LegacyParams)
- func (k Keeper) GetLeverageLpUpdatedLeverage(ctx sdk.Context, positions []*types.Position) ([]*types.QueryPosition, error)
- func (k Keeper) GetMaxLeverageParam(ctx sdk.Context) sdk.Dec
- func (k Keeper) GetMaxOpenPositions(ctx sdk.Context) uint64
- func (k Keeper) GetOffset(ctx sdk.Context) (uint64, bool)
- func (k Keeper) GetOpenPositionCount(ctx sdk.Context) uint64
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetPool(ctx sdk.Context, poolId uint64) (val types.Pool, found bool)
- func (k Keeper) GetPoolOpenThreshold(ctx sdk.Context) sdk.Dec
- func (k Keeper) GetPosition(ctx sdk.Context, positionAddress sdk.AccAddress, id uint64) (types.Position, error)
- func (k Keeper) GetPositionCount(ctx sdk.Context) uint64
- func (k Keeper) GetPositionHealth(ctx sdk.Context, position types.Position) (sdk.Dec, error)
- func (k Keeper) GetPositionIterator(ctx sdk.Context) sdk.Iterator
- func (k Keeper) GetPositionWithId(ctx sdk.Context, positionAddress sdk.AccAddress, Id uint64) (*types.Position, bool)
- func (k Keeper) GetPositions(ctx sdk.Context, pagination *query.PageRequest) ([]*types.Position, *query.PageResponse, error)
- func (k Keeper) GetPositionsForAddress(ctx sdk.Context, positionAddress sdk.AccAddress, pagination *query.PageRequest) ([]*types.Position, *query.PageResponse, error)
- func (k Keeper) GetPositionsForPool(ctx sdk.Context, ammPoolId uint64, pagination *query.PageRequest) ([]*types.Position, *query.PageResponse, error)
- func (k Keeper) GetSafetyFactor(ctx sdk.Context) sdk.Dec
- func (k Keeper) GetStatus(goCtx context.Context, req *types.StatusRequest) (*types.StatusResponse, error)
- func (k Keeper) GetWhitelist(goCtx context.Context, req *types.WhitelistRequest) (*types.WhitelistResponse, error)
- func (k Keeper) GetWhitelistAddressIterator(ctx sdk.Context) sdk.Iterator
- func (k Keeper) GetWhitelistedAddress(ctx sdk.Context, pagination *query.PageRequest) ([]sdk.AccAddress, *query.PageResponse, error)
- func (k Keeper) Hooks() Hooks
- func (k Keeper) IsWhitelisted(goCtx context.Context, req *types.IsWhitelistedRequest) (*types.IsWhitelistedResponse, error)
- func (k Keeper) IsWhitelistingEnabled(ctx sdk.Context) bool
- func (k Keeper) LiquidationPrice(goCtx context.Context, req *types.QueryLiquidationPriceRequest) (*types.QueryLiquidationPriceResponse, error)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MigrateData(ctx sdk.Context)
- func (k Keeper) MigratePositionHealth(ctx sdk.Context)
- func (k Keeper) Open(ctx sdk.Context, msg *types.MsgOpen) (*types.MsgOpenResponse, error)
- func (k Keeper) OpenConsolidate(ctx sdk.Context, position *types.Position, msg *types.MsgOpen) (*types.MsgOpenResponse, error)
- func (k Keeper) OpenEst(goCtx context.Context, req *types.QueryOpenEstRequest) (*types.QueryOpenEstResponse, error)
- func (k Keeper) OpenLong(ctx sdk.Context, msg *types.MsgOpen) (*types.Position, error)
- func (k Keeper) Params(goCtx context.Context, req *types.ParamsRequest) (*types.ParamsResponse, error)
- func (k Keeper) Pool(goCtx context.Context, req *types.QueryGetPoolRequest) (*types.QueryGetPoolResponse, error)
- func (k Keeper) Pools(goCtx context.Context, req *types.QueryAllPoolRequest) (*types.QueryAllPoolResponse, error)
- func (k Keeper) Position(goCtx context.Context, req *types.PositionRequest) (*types.PositionResponse, error)
- func (k Keeper) ProcessAddCollateral(ctx sdk.Context, address string, id uint64, collateral sdk.Int) error
- func (k Keeper) ProcessOpenLong(ctx sdk.Context, position *types.Position, poolId uint64, msg *types.MsgOpen) (*types.Position, error)
- func (k Keeper) QueryPositions(goCtx context.Context, req *types.PositionsRequest) (*types.PositionsResponse, error)
- func (k Keeper) QueryPositionsByPool(goCtx context.Context, req *types.PositionsByPoolRequest) (*types.PositionsByPoolResponse, error)
- func (k Keeper) QueryPositionsForAddress(goCtx context.Context, req *types.PositionsForAddressRequest) (*types.PositionsForAddressResponse, error)
- func (k Keeper) RemovePool(ctx sdk.Context, index uint64)
- func (k Keeper) Rewards(goCtx context.Context, req *types.QueryRewardsRequest) (*types.QueryRewardsResponse, error)
- func (k *Keeper) SetHooks(lh types.LeverageLpHooks) *Keeper
- func (k Keeper) SetOffset(ctx sdk.Context, offset uint64)
- func (k Keeper) SetOpenPositionCount(ctx sdk.Context, count uint64)
- func (k Keeper) SetParams(ctx sdk.Context, params *types.Params) error
- func (k Keeper) SetPool(ctx sdk.Context, pool types.Pool)
- func (k Keeper) SetPosition(ctx sdk.Context, position *types.Position)
- func (k Keeper) SetPositionCount(ctx sdk.Context, count uint64)
- func (k Keeper) UpdatePoolHealth(ctx sdk.Context, pool *types.Pool)
- func (k Keeper) WhitelistAddress(ctx sdk.Context, address sdk.AccAddress)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMsgServerImpl ¶
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
type Hooks ¶
type Hooks struct {
// contains filtered or unexported fields
}
Hooks wrapper struct for incentive keeper
func (Hooks) AfterEpochEnd ¶
AfterEpochEnd 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 ¶
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) BeforeEpochStart ¶
BeforeEpochStart performs a no-op
func (Keeper) BeginBlocker ¶
func (Keeper) CalculatePoolHealth ¶
func (Keeper) CheckAmmPoolUsdcBalance ¶ added in v0.15.0
func (Keeper) CheckAndCloseAtStopLoss ¶ added in v0.44.0
func (Keeper) CheckAndLiquidateUnhealthyPosition ¶ added in v0.44.0
func (Keeper) CheckIfWhitelisted ¶
func (Keeper) CheckPoolHealth ¶
func (Keeper) CheckSamePosition ¶
func (Keeper) CheckUserAuthorization ¶
func (Keeper) CloseEst ¶ added in v0.33.0
func (k Keeper) CloseEst(goCtx context.Context, req *types.QueryCloseEstRequest) (*types.QueryCloseEstResponse, error)
func (Keeper) CommittedTokensLocked ¶ added in v0.40.0
func (k Keeper) CommittedTokensLocked(goCtx context.Context, req *types.QueryCommittedTokensLockedRequest) (*types.QueryCommittedTokensLockedResponse, error)
func (Keeper) DeleteLegacyPosition ¶ added in v0.42.0
func (Keeper) DeleteOffset ¶ added in v0.42.0
func (Keeper) DeletePool ¶ added in v0.40.0
func (Keeper) DestroyPosition ¶
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 (Keeper) GetAllLegacyPositions ¶ added in v0.43.0
func (k Keeper) GetAllLegacyPositions(ctx sdk.Context) []types.LegacyPosition
func (Keeper) GetAllPools ¶
GetAllPool returns all pool
func (Keeper) GetAllWhitelistedAddress ¶
func (k Keeper) GetAllWhitelistedAddress(ctx sdk.Context) []sdk.AccAddress
func (Keeper) GetAmmPool ¶
func (Keeper) GetEpochPosition ¶
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 (Keeper) GetPosition ¶
func (Keeper) GetPositionHealth ¶
GetPositionHealth Should not be used in queries as UpdateInterestAndGetDebt updates KVStore as well
func (Keeper) GetPositionIterator ¶
func (Keeper) GetPositionWithId ¶ added in v0.33.0
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 (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 (Keeper) GetWhitelistedAddress ¶
func (k Keeper) GetWhitelistedAddress(ctx sdk.Context, pagination *query.PageRequest) ([]sdk.AccAddress, *query.PageResponse, error)
func (Keeper) IsWhitelisted ¶
func (k Keeper) IsWhitelisted(goCtx context.Context, req *types.IsWhitelistedRequest) (*types.IsWhitelistedResponse, error)
func (Keeper) LiquidationPrice ¶ added in v0.35.0
func (k Keeper) LiquidationPrice(goCtx context.Context, req *types.QueryLiquidationPriceRequest) (*types.QueryLiquidationPriceResponse, error)
func (Keeper) MigrateData ¶ added in v0.44.0
func (Keeper) MigratePositionHealth ¶ added in v0.45.0
migrating eixsting position and setting position health to max dec when liablities is zero
func (Keeper) OpenConsolidate ¶
func (Keeper) OpenEst ¶ added in v0.33.0
func (k Keeper) OpenEst(goCtx context.Context, req *types.QueryOpenEstRequest) (*types.QueryOpenEstResponse, error)
func (Keeper) Params ¶
func (k Keeper) Params(goCtx context.Context, req *types.ParamsRequest) (*types.ParamsResponse, error)
func (Keeper) Pool ¶
func (k Keeper) Pool(goCtx context.Context, req *types.QueryGetPoolRequest) (*types.QueryGetPoolResponse, error)
func (Keeper) Pools ¶
func (k Keeper) Pools(goCtx context.Context, req *types.QueryAllPoolRequest) (*types.QueryAllPoolResponse, error)
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 (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 ¶
RemovePool removes a pool from the store
func (Keeper) Rewards ¶ added in v0.33.0
func (k Keeper) Rewards(goCtx context.Context, req *types.QueryRewardsRequest) (*types.QueryRewardsResponse, error)
func (*Keeper) SetHooks ¶
func (k *Keeper) SetHooks(lh types.LeverageLpHooks) *Keeper
SetHooks set the leveragelp hooks
func (Keeper) SetOpenPositionCount ¶
Set Open Position count
func (Keeper) SetPositionCount ¶
Set Position count
func (Keeper) UpdatePoolHealth ¶
func (Keeper) WhitelistAddress ¶
func (k Keeper) WhitelistAddress(ctx sdk.Context, address sdk.AccAddress)
Source Files ¶
- add_collateral.go
- begin_blocker.go
- epoch.go
- hooks_amm.go
- hooks_epoch.go
- keeper.go
- msg_server.go
- msg_server_add_pool.go
- msg_server_claim_rewards.go
- msg_server_close.go
- msg_server_close_positions.go
- msg_server_dewhitelist.go
- msg_server_open.go
- msg_server_remove_pool.go
- msg_server_update_params.go
- msg_server_update_pool.go
- msg_server_update_stop_loss.go
- msg_server_whitelist.go
- params.go
- pool.go
- position.go
- position_close.go
- position_open.go
- query.go
- query_committed_tokens_locked.go
- query_estimation.go
- query_get_positions.go
- query_get_positions_by_pool.go
- query_get_positions_for_address.go
- query_get_status.go
- query_get_whitelist.go
- query_is_whitelisted.go
- query_params.go
- query_pool.go
- query_position.go
- query_rewards.go
- utils.go