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) 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) ClosePositionIfUnderStopLossPrice(ctx sdk.Context, position *types.Position, pool types.Pool, ...) (underStopLossPrice, earlyReturn bool)
- func (k Keeper) CommittedTokensLocked(goCtx context.Context, req *types.QueryCommittedTokensLockedRequest) (*types.QueryCommittedTokensLockedResponse, error)
- func (k Keeper) DeletePool(ctx sdk.Context, poolId uint64)
- func (k Keeper) DeletePoolPosIdsLiquidationSorted(ctx sdk.Context, poolId uint64)
- func (k Keeper) DeletePoolPosIdsStopLossSorted(ctx sdk.Context, poolId uint64)
- func (k Keeper) DestroyPosition(ctx sdk.Context, positionAddress string, id uint64, oldDebt sdk.Int) error
- func (k Keeper) DewhitelistAddress(ctx sdk.Context, address string)
- 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) 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) 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) (sdk.Dec, error)
- func (k Keeper) GetPositionIterator(ctx sdk.Context) sdk.Iterator
- func (k Keeper) GetPositionWithId(ctx sdk.Context, positionAddress sdk.Address, 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.Address, pagination *query.PageRequest) ([]*types.PositionAndInterest, *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) IteratePoolPosIdsLiquidationSorted(ctx sdk.Context, poolId uint64, fn func(posId types.AddressId) bool)
- func (k Keeper) IteratePoolPosIdsStopLossSorted(ctx sdk.Context, poolId uint64, fn func(posId types.AddressId) bool)
- func (k Keeper) LiquidatePositionIfUnhealthy(ctx sdk.Context, position *types.Position, pool types.Pool, ...) (isHealthy, earlyReturn 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) 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, 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) Rewards(goCtx context.Context, req *types.QueryRewardsRequest) (*types.QueryRewardsResponse, error)
- func (k Keeper) SetEnabledPools(ctx sdk.Context, pools []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, oldDebt sdk.Int)
- func (k Keeper) SetPositionCount(ctx sdk.Context, count uint64)
- func (k Keeper) SetSortedLiquidation(ctx sdk.Context, address string, old sdk.Int, new sdk.Int)
- func (k Keeper) SetSortedLiquidationAndStopLoss(ctx sdk.Context, position types.Position)
- func (k Keeper) TakeFundPayment(ctx sdk.Context, returnAmount math.Int, returnAsset string, ...) (math.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 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)
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, 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)
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) CloseEst ¶ added in v0.33.0
func (k Keeper) CloseEst(goCtx context.Context, req *types.QueryCloseEstRequest) (*types.QueryCloseEstResponse, error)
func (Keeper) ClosePositionIfUnderStopLossPrice ¶ added in v0.33.0
func (Keeper) CommittedTokensLocked ¶ added in v0.40.0
func (k Keeper) CommittedTokensLocked(goCtx context.Context, req *types.QueryCommittedTokensLockedRequest) (*types.QueryCommittedTokensLockedResponse, error)
func (Keeper) DeletePool ¶ added in v0.40.0
func (Keeper) DeletePoolPosIdsLiquidationSorted ¶ added in v0.38.0
func (Keeper) DeletePoolPosIdsStopLossSorted ¶ added in v0.38.0
func (Keeper) DestroyPosition ¶
func (Keeper) DewhitelistAddress ¶
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) GetAllPools ¶
GetAllPool returns all pool
func (Keeper) GetAllWhitelistedAddress ¶
func (Keeper) GetAmmPool ¶
func (Keeper) GetEpochPosition ¶
get position of current block in epoch
func (Keeper) GetPosition ¶
func (Keeper) GetPositionHealth ¶
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.Address, pagination *query.PageRequest) ([]*types.PositionAndInterest, *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) ([]string, *query.PageResponse, error)
func (Keeper) IsWhitelisted ¶
func (k Keeper) IsWhitelisted(goCtx context.Context, req *types.IsWhitelistedRequest) (*types.IsWhitelistedResponse, error)
func (Keeper) IteratePoolPosIdsLiquidationSorted ¶ added in v0.33.0
func (Keeper) IteratePoolPosIdsStopLossSorted ¶ added in v0.33.0
func (Keeper) LiquidatePositionIfUnhealthy ¶
func (Keeper) LiquidationPrice ¶ added in v0.35.0
func (k Keeper) LiquidationPrice(goCtx context.Context, req *types.QueryLiquidationPriceRequest) (*types.QueryLiquidationPriceResponse, error)
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) SetOpenPositionCount ¶
Set Open Position count
func (Keeper) SetPosition ¶
func (Keeper) SetPositionCount ¶
Set Position count
func (Keeper) SetSortedLiquidation ¶ added in v0.38.0
Set sorted liquidation
func (Keeper) SetSortedLiquidationAndStopLoss ¶ added in v0.38.0
Change DS for migration
func (Keeper) TakeFundPayment ¶
func (Keeper) UpdatePoolHealth ¶
Source Files ¶
- add_collateral.go
- begin_blocker.go
- epoch.go
- hooks_amm.go
- hooks_epoch.go
- keeper.go
- msg_server.go
- msg_server_add_collateral.go
- msg_server_add_pool.go
- msg_server_claim_rewards.go
- msg_server_close.go
- msg_server_dewhitelist.go
- msg_server_open.go
- msg_server_remove_pool.go
- msg_server_update_params.go
- msg_server_update_pools.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