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, ...)
- func (h AmmHooks) AfterPoolCreated(ctx sdk.Context, sender sdk.AccAddress, pool ammtypes.Pool)
- 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)
- 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, ...)
- func (k Keeper) AfterPoolCreated(ctx sdk.Context, sender sdk.AccAddress, ammPool ammtypes.Pool)
- 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)
- 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) CheckIfWhitelisted(ctx sdk.Context, address string) 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
- 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) CloseLong(ctx sdk.Context, msg *types.MsgClose) (*types.Position, sdk.Int, error)
- func (k Keeper) DestroyPosition(ctx sdk.Context, positionAddress string, id uint64) error
- func (k Keeper) DewhitelistAddress(ctx sdk.Context, address string)
- func (k Keeper) EstimateSwapGivenOut(ctx sdk.Context, tokenOutAmount sdk.Coin, tokenInDenom string, ...) (sdk.Int, error)
- func (k Keeper) ForceCloseLong(ctx sdk.Context, position types.Position, pool types.Pool, lpAmount sdk.Int) (sdk.Int, error)
- 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) []string
- func (k Keeper) GetAmmPool(ctx sdk.Context, poolId uint64) (ammtypes.Pool, error)
- func (k Keeper) GetEnabledPools(ctx sdk.Context) []uint64
- func (k Keeper) GetEpochLength(ctx sdk.Context) int64
- func (k Keeper) GetEpochPosition(ctx sdk.Context, epochLength int64) int64
- func (k Keeper) GetLpTokenPrice(ctx sdk.Context, ammPool *ammtypes.Pool) (sdk.Dec, error)
- func (k Keeper) GetMaxLeverageParam(ctx sdk.Context) sdk.Dec
- func (k Keeper) GetMaxOpenPositions(ctx sdk.Context) uint64
- 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 string, id uint64) (types.Position, error)
- func (k Keeper) GetPositionCount(ctx sdk.Context) uint64
- func (k Keeper) GetPositionHealth(ctx sdk.Context, position types.Position, ammPool ammtypes.Pool) (sdk.Dec, error)
- func (k Keeper) GetPositionIterator(ctx sdk.Context) sdk.Iterator
- func (k Keeper) GetPositions(ctx sdk.Context, pagination *query.PageRequest) ([]*types.Position, *query.PageResponse, error)
- func (k Keeper) GetPositionsForAddress(ctx sdk.Context, positionAddress sdk.Address, 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) ([]string, *query.PageResponse, error)
- func (k Keeper) Hooks() Hooks
- func (k Keeper) IsPoolClosed(ctx sdk.Context, poolId uint64) bool
- func (k Keeper) IsPoolEnabled(ctx sdk.Context, poolId uint64) bool
- func (k Keeper) IsWhitelisted(goCtx context.Context, req *types.IsWhitelistedRequest) (*types.IsWhitelistedResponse, error)
- func (k Keeper) IsWhitelistingEnabled(ctx sdk.Context) bool
- func (k Keeper) LiquidatePositionIfUnhealthy(ctx sdk.Context, position *types.Position, pool types.Pool, ...)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- 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) 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) ProcessOpenLong(ctx sdk.Context, position *types.Position, leverage sdk.Dec, ...) (*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) SetEnabledPools(ctx sdk.Context, pools []uint64)
- func (k *Keeper) SetHooks(gh types.LeveragelpHooks) *Keeper
- 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) TakeFundPayment(ctx sdk.Context, returnAmount sdk.Int, returnAsset string, ...) (sdk.Int, error)
- func (k Keeper) UpdatePoolHealth(ctx sdk.Context, pool *types.Pool)
- func (k Keeper) WhitelistAddress(ctx sdk.Context, address string)
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 sdk.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 sdk.Int)
AfterJoinPool is called after JoinPool, JoinSwapExternAmountIn, and JoinSwapShareAmountOut
func (AmmHooks) AfterPoolCreated ¶
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, ) *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 sdk.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 sdk.Int)
AfterJoinPool is called after JoinPool, JoinSwapExternAmountIn, and JoinSwapShareAmountOut
func (Keeper) AfterPoolCreated ¶
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) CheckIfWhitelisted ¶
func (Keeper) CheckPoolHealth ¶
func (Keeper) CheckSamePosition ¶
func (Keeper) CheckUserAuthorization ¶
func (Keeper) DestroyPosition ¶
func (Keeper) DewhitelistAddress ¶
func (Keeper) EstimateSwapGivenOut ¶
func (k Keeper) EstimateSwapGivenOut(ctx sdk.Context, tokenOutAmount sdk.Coin, tokenInDenom string, ammPool ammtypes.Pool) (sdk.Int, error)
Swap estimation using amm CalcInAmtGivenOut function
func (Keeper) ForceCloseLong ¶
func (Keeper) GetAllPools ¶
GetAllPool returns all pool
func (Keeper) GetAllWhitelistedAddress ¶
func (Keeper) GetAmmPool ¶
func (Keeper) GetEpochPosition ¶
get position of current block in epoch
func (Keeper) GetLpTokenPrice ¶ added in v0.14.0
func (Keeper) GetPosition ¶
func (Keeper) GetPositionHealth ¶
func (Keeper) GetPositionIterator ¶
func (Keeper) GetPositions ¶
func (k Keeper) GetPositions(ctx sdk.Context, pagination *query.PageRequest) ([]*types.Position, *query.PageResponse, error)
func (Keeper) GetPositionsForAddress ¶
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) ([]string, *query.PageResponse, error)
func (Keeper) IsWhitelisted ¶
func (k Keeper) IsWhitelisted(goCtx context.Context, req *types.IsWhitelistedRequest) (*types.IsWhitelistedResponse, error)
func (Keeper) LiquidatePositionIfUnhealthy ¶
func (Keeper) OpenConsolidate ¶
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) 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) SetHooks ¶
func (k *Keeper) SetHooks(gh types.LeveragelpHooks) *Keeper
Set the leveragelp hooks.
func (Keeper) SetOpenPositionCount ¶
Set Open Position count
func (Keeper) SetPositionCount ¶
Set Position count
func (Keeper) TakeFundPayment ¶
func (Keeper) UpdatePoolHealth ¶
Source Files ¶
- begin_blocker.go
- epoch.go
- hooks_amm.go
- hooks_epoch.go
- keeper.go
- msg_server.go
- msg_server_close.go
- msg_server_dewhitelist.go
- msg_server_open.go
- msg_server_update_params.go
- msg_server_update_pools.go
- msg_server_whitelist.go
- params.go
- pool.go
- position.go
- position_close.go
- position_open.go
- query.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
- utils.go